query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through.
|
def gmap_params
params.require(:bank).permit(:latitude, :longitude, :address)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Provides operations to manage the defaultManagedAppProtections property of the microsoft.graph.deviceAppManagement entity.
|
def default_managed_app_protections()
return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def android_managed_app_protections=(value)\n @android_managed_app_protections = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections\n return @android_managed_app_protections\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def work_profile_default_app_permission_policy=(value)\n @work_profile_default_app_permission_policy = value\n end",
"def work_profile_default_app_permission_policy\n return @work_profile_default_app_permission_policy\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.targetedManagedAppProtection\"\n end",
"def managed_apps\n return @managed_apps\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_field_deserializers()\n return super.merge({\n \"androidManagedAppProtections\" => lambda {|n| @android_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AndroidManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"defaultManagedAppProtections\" => lambda {|n| @default_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DefaultManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"iosManagedAppProtections\" => lambda {|n| @ios_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IosManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"isEnabledForMicrosoftStoreForBusiness\" => lambda {|n| @is_enabled_for_microsoft_store_for_business = n.get_boolean_value() },\n \"managedAppPolicies\" => lambda {|n| @managed_app_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"managedAppRegistrations\" => lambda {|n| @managed_app_registrations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppRegistration.create_from_discriminator_value(pn) }) },\n \"managedAppStatuses\" => lambda {|n| @managed_app_statuses = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppStatus.create_from_discriminator_value(pn) }) },\n \"managedEBooks\" => lambda {|n| @managed_e_books = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedEBook.create_from_discriminator_value(pn) }) },\n \"mdmWindowsInformationProtectionPolicies\" => lambda {|n| @mdm_windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MdmWindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n \"microsoftStoreForBusinessLanguage\" => lambda {|n| @microsoft_store_for_business_language = n.get_string_value() },\n \"microsoftStoreForBusinessLastCompletedApplicationSyncTime\" => lambda {|n| @microsoft_store_for_business_last_completed_application_sync_time = n.get_date_time_value() },\n \"microsoftStoreForBusinessLastSuccessfulSyncDateTime\" => lambda {|n| @microsoft_store_for_business_last_successful_sync_date_time = n.get_date_time_value() },\n \"mobileAppCategories\" => lambda {|n| @mobile_app_categories = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppCategory.create_from_discriminator_value(pn) }) },\n \"mobileAppConfigurations\" => lambda {|n| @mobile_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDeviceMobileAppConfiguration.create_from_discriminator_value(pn) }) },\n \"mobileApps\" => lambda {|n| @mobile_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileApp.create_from_discriminator_value(pn) }) },\n \"targetedManagedAppConfigurations\" => lambda {|n| @targeted_managed_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppConfiguration.create_from_discriminator_value(pn) }) },\n \"vppTokens\" => lambda {|n| @vpp_tokens = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::VppToken.create_from_discriminator_value(pn) }) },\n \"windowsInformationProtectionPolicies\" => lambda {|n| @windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n })\n end",
"def apply_admin_policy_defaults\n resp = connection.post do |req|\n req.url \"#{object_path}/apply_admin_policy_defaults\"\n end\n\n raise_exception_based_on_response!(resp) unless resp.success?\n\n true\n end",
"def protected_apps=(value)\n @protected_apps = value\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def user_set_to_default_app_type\n return if @current_user.app_type_valid?\n\n current_user.app_type_id = all_user_app_type_ids.first\n current_user.save\n end",
"def documents_block_managed_documents_in_unmanaged_apps=(value)\n @documents_block_managed_documents_in_unmanaged_apps = value\n end",
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.androidManagedAppProtection\"\n end",
"def default_permission\n\t\treturn self.app_id.downcase.gsub(/\\W+/, '_' ).to_sym\n\tend",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def allowed_domain_guids_for_sync_app=(value)\n @allowed_domain_guids_for_sync_app = value\n end",
"def apply_apo_defaults\n @object.reapplyAdminPolicyObjectDefaults\n render status: 200, plain: 'Defaults applied.'\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def set_automatic_managed\n converge_by(\"Set pagefile to Automatic Managed\") do\n logger.trace(\"Running Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$true} -PassThru\")\n powershell_exec! <<~EOH\n $sys = Get-CimInstance Win32_ComputerSystem -Property *\n Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$true} -PassThru\n EOH\n end\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def documents_block_unmanaged_documents_in_managed_apps\n return @documents_block_unmanaged_documents_in_managed_apps\n end",
"def windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def unset_automatic_managed\n if automatic_managed?\n converge_by(\"Turn off Automatically Managed on pagefiles\") do\n logger.trace(\"Running Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru\")\n powershell_exec! <<~EOH\n $sys = Get-CimInstance Win32_ComputerSystem -Property *\n Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru\n EOH\n end\n end\n end",
"def managed_models\n @managed_models\n end",
"def enable_managed_login\n if RightScale::LoginManager.instance.supported_by_platform?\n ssh_host_keys = RightScale::LoginManager.instance.get_ssh_host_keys\n payload = {:agent_identity => @agent_identity,\n :ssh_host_keys=>ssh_host_keys}\n req = RightScale::RetryableRequest.new('/booter/get_login_policy', payload)\n\n req.callback do |policy|\n audit = RightScale::AuditProxy.new(policy.audit_id)\n begin\n RightScale::LoginManager.instance.update_policy(policy, @agent_identity) do |audit_content|\n if audit_content\n audit.create_new_section('Managed login enabled')\n audit.append_info(audit_content)\n end\n end\n rescue Exception => e\n audit.create_new_section('Failed to enable managed login')\n audit.append_error(\"Error applying login policy: #{e}\", :category => RightScale::EventCategories::CATEGORY_ERROR)\n RightScale::Log.error('Failed to enable managed login', e, :trace)\n end\n\n setup_volumes\n end\n\n req.errback do |res|\n RightScale::Log.error('Could not get login policy', res)\n boot\n end\n\n req.run\n else\n setup_volumes\n end\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def documents_block_managed_documents_in_unmanaged_apps\n return @documents_block_managed_documents_in_unmanaged_apps\n end",
"def provision_group_default\n @attributes[:provision_group_default]\n end",
"def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end",
"def prefer_managed(managed)\n pointer.prefer_managed managed\n end",
"def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end",
"def is_unmanaged_sync_app_for_tenant_restricted=(value)\n @is_unmanaged_sync_app_for_tenant_restricted = value\n end",
"def provision_for_default_devices(alert)\n case alert.type\n when 'airbourne_alert'\n Models::Device.where(device_type: 'gas_valve').each do |device|\n device.alert = alert\n device.save!\n end\n end\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def managed_devices\n return @managed_devices\n end",
"def default(app)\n @default_app = app\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def set_app_groups\n @sys_app_groups = bc_sys_app_groups\n @usr_app_groups = bc_usr_app_groups\n @dev_app_groups = bc_dev_app_groups\n @apps_menu_group = bc_custom_apps_group\n end",
"def set_defaultsettings\n AppSettings.item.to_hash.each do |setting, value|\n s = RailsSettings::Settings.new \n s.var = setting.to_s\n s.value = value[:default]\n s.thing_id = self.id\n s.thing_type = \"Group\" \n s.save\n end\n end",
"def protected_apps\n return @protected_apps\n end",
"def set_default_promotion_attributes\n promotion_type_attributes unless persisted?\n end",
"def migrate_default_policies\n policies_dir = \"#{@migration_root}/elb-default-policies\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n\n default_policies = ELB::default_policies\n default_policies.map do |policy_name, policy|\n puts \"Processing #{policy_name}\"\n\n cumulus_name = \"Cumulus-#{policy_name}\"\n json = JSON.pretty_generate(policy.to_cumulus_hash)\n\n File.open(\"#{policies_dir}/#{cumulus_name}.json\", \"w\") { |f| f.write(json) }\n end\n end",
"def default_groups\n @default_groups ||= begin\n if ENV['AUTHORIZED_NETWORK_GROUPS'].is_a?(String)\n group_list_from_env(ENV['AUTHORIZED_NETWORK_GROUPS'])\n else\n [:default]\n end\n end\n end",
"def set_defaultsettings\r\n AppSettings.item.to_hash.each do |setting, value|\r\n s = RailsSettings::Settings.new \r\n s.var = setting.to_s\r\n s.value = value[:default]\r\n s.thing_id = self.id\r\n s.thing_type = \"Item\" \r\n s.save\r\n end\r\n end",
"def default\n out_buffer = FFI::MemoryPointer.new(:pointer)\n status = Sec.SecKeychainCopyDefault(out_buffer);\n Sec.check_osstatus(status)\n\n Keychain.new(out_buffer.read_pointer).release_on_gc\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def apps_single_app_mode_list=(value)\n @apps_single_app_mode_list = value\n end",
"def set_system_managed(pagefile)\n converge_by(\"set #{pagefile} to System Managed\") do\n logger.trace(\"Running \")\n powershell_exec! <<~EOM\n $page_file = \"#{pagefile}\"\n $driveLetter = $page_file.split(':')[0]\n Get-CimInstance -ClassName Win32_PageFileSetting -Filter \"SettingID='pagefile.sys @ $($driveLetter):'\" -ErrorAction Stop | Set-CimInstance -Property @{\n InitialSize = 0\n MaximumSize = 0}\n EOM\n end\n end",
"def protected_app_locker_files=(value)\n @protected_app_locker_files = value\n end",
"def app_locker_application_control=(value)\n @app_locker_application_control = value\n end",
"def provision_site_admin_groups\n @attributes[:provision_site_admin_groups]\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignments\" => lambda {|n| @assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppPolicyAssignment.create_from_discriminator_value(pn) }) },\n \"azureRightsManagementServicesAllowed\" => lambda {|n| @azure_rights_management_services_allowed = n.get_boolean_value() },\n \"dataRecoveryCertificate\" => lambda {|n| @data_recovery_certificate = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionDataRecoveryCertificate.create_from_discriminator_value(pn) }) },\n \"enforcementLevel\" => lambda {|n| @enforcement_level = n.get_enum_value(MicrosoftGraph::Models::WindowsInformationProtectionEnforcementLevel) },\n \"enterpriseDomain\" => lambda {|n| @enterprise_domain = n.get_string_value() },\n \"enterpriseIPRanges\" => lambda {|n| @enterprise_i_p_ranges = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionIPRangeCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseIPRangesAreAuthoritative\" => lambda {|n| @enterprise_i_p_ranges_are_authoritative = n.get_boolean_value() },\n \"enterpriseInternalProxyServers\" => lambda {|n| @enterprise_internal_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseNetworkDomainNames\" => lambda {|n| @enterprise_network_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProtectedDomainNames\" => lambda {|n| @enterprise_protected_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxiedDomains\" => lambda {|n| @enterprise_proxied_domains = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionProxiedDomainCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServers\" => lambda {|n| @enterprise_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServersAreAuthoritative\" => lambda {|n| @enterprise_proxy_servers_are_authoritative = n.get_boolean_value() },\n \"exemptAppLockerFiles\" => lambda {|n| @exempt_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"exemptApps\" => lambda {|n| @exempt_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"iconsVisible\" => lambda {|n| @icons_visible = n.get_boolean_value() },\n \"indexingEncryptedStoresOrItemsBlocked\" => lambda {|n| @indexing_encrypted_stores_or_items_blocked = n.get_boolean_value() },\n \"isAssigned\" => lambda {|n| @is_assigned = n.get_boolean_value() },\n \"neutralDomainResources\" => lambda {|n| @neutral_domain_resources = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"protectedAppLockerFiles\" => lambda {|n| @protected_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"protectedApps\" => lambda {|n| @protected_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"protectionUnderLockConfigRequired\" => lambda {|n| @protection_under_lock_config_required = n.get_boolean_value() },\n \"revokeOnUnenrollDisabled\" => lambda {|n| @revoke_on_unenroll_disabled = n.get_boolean_value() },\n \"rightsManagementServicesTemplateId\" => lambda {|n| @rights_management_services_template_id = n.get_guid_value() },\n \"smbAutoEncryptedFileExtensions\" => lambda {|n| @smb_auto_encrypted_file_extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n })\n end",
"def device_sharing_allowed=(value)\n @device_sharing_allowed = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsInformationProtection\"\n end",
"def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end",
"def exempt_apps=(value)\n @exempt_apps = value\n end",
"def apps_install_allow_list=(value)\n @apps_install_allow_list = value\n end",
"def is_unmanaged_sync_app_for_tenant_restricted\n return @is_unmanaged_sync_app_for_tenant_restricted\n end",
"def is_mac_sync_app_enabled=(value)\n @is_mac_sync_app_enabled = value\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def apps_install_allow_list\n return @apps_install_allow_list\n end",
"def add_default_attributes\n self.id_number ||= (self.class.where(['school_id = ?', school_id]).maximum('id_number') || 0) + 1\n (authorization || build_authorization).add_default_attributes(self)\n end",
"def application_controller(perms)\n return unless ApplicationController.respond_to?(:permission_definition)\n return if ApplicationController.permission_definition.nil? || ApplicationController.permission_definition == {}\n perms << PermissionsGenerator.new(ApplicationController)\nend",
"def set_vbmanage_machinefolder_default()\n system(\"vboxmanage setproperty machinefolder default\")\n _track_ai_event(__method__, {\n 'vm_name': vm_name\n })\n end",
"def enable_termination_protection\n data[:enable_termination_protection]\n end",
"def content_security_policy_overrides\n {}\n end",
"def kiosk_mode_apps=(value)\n @kiosk_mode_apps = value\n end",
"def add_default_products_to_user\r\n Product.default_include.each do |product|\r\n #ProductSupport.change_support product.id, self.id, -1\r\n ps = ProductSupport.new\r\n ps.change_support product.id, self.id, -1\r\n end\r\n end",
"def defender_guarded_folders_allowed_app_paths=(value)\n @defender_guarded_folders_allowed_app_paths = value\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end"
] |
[
"0.77753145",
"0.72597766",
"0.6829432",
"0.6721182",
"0.64629275",
"0.6291577",
"0.6066823",
"0.6062792",
"0.5831713",
"0.5815131",
"0.57798344",
"0.5612159",
"0.55968827",
"0.5468354",
"0.545257",
"0.541068",
"0.5343736",
"0.5313879",
"0.53048956",
"0.52950567",
"0.52796584",
"0.52119404",
"0.5194703",
"0.5181724",
"0.51203805",
"0.5114608",
"0.5080868",
"0.50752294",
"0.50707614",
"0.5065687",
"0.49992582",
"0.499235",
"0.49920323",
"0.49720895",
"0.49660704",
"0.49451435",
"0.48835176",
"0.4879739",
"0.4867429",
"0.48548216",
"0.4846509",
"0.48094812",
"0.47310492",
"0.47201392",
"0.47157016",
"0.47145",
"0.47002307",
"0.46979833",
"0.4683475",
"0.46407515",
"0.46314722",
"0.46288583",
"0.4619743",
"0.46151933",
"0.46095756",
"0.46058267",
"0.4594335",
"0.45858374",
"0.458151",
"0.4545703",
"0.45395637",
"0.45314926",
"0.44840083",
"0.4478506",
"0.447557",
"0.44651082",
"0.44428167",
"0.4437519",
"0.44106248",
"0.4372032",
"0.4362834",
"0.43537048",
"0.43478927",
"0.4343824",
"0.43436918",
"0.43376553",
"0.4319901",
"0.43174085",
"0.43151808",
"0.43149096",
"0.43106857",
"0.43032545",
"0.42875755",
"0.42869017",
"0.42866564",
"0.42846596",
"0.42836252",
"0.42815334",
"0.4273346",
"0.42592728",
"0.42472592",
"0.42424822",
"0.42422414",
"0.42408064",
"0.42379776",
"0.42144105",
"0.4213215",
"0.4208856",
"0.42039633",
"0.42025375"
] |
0.8005835
|
0
|
Provides operations to manage the iosManagedAppProtections property of the microsoft.graph.deviceAppManagement entity.
|
def ios_managed_app_protections()
return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections=(value)\n @android_managed_app_protections = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections\n return @android_managed_app_protections\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def managed_apps\n return @managed_apps\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.targetedManagedAppProtection\"\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def protected_apps=(value)\n @protected_apps = value\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.androidManagedAppProtection\"\n end",
"def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end",
"def managed_devices\n return @managed_devices\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"def documents_block_managed_documents_in_unmanaged_apps=(value)\n @documents_block_managed_documents_in_unmanaged_apps = value\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_field_deserializers()\n return super.merge({\n \"androidManagedAppProtections\" => lambda {|n| @android_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AndroidManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"defaultManagedAppProtections\" => lambda {|n| @default_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DefaultManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"iosManagedAppProtections\" => lambda {|n| @ios_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IosManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"isEnabledForMicrosoftStoreForBusiness\" => lambda {|n| @is_enabled_for_microsoft_store_for_business = n.get_boolean_value() },\n \"managedAppPolicies\" => lambda {|n| @managed_app_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"managedAppRegistrations\" => lambda {|n| @managed_app_registrations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppRegistration.create_from_discriminator_value(pn) }) },\n \"managedAppStatuses\" => lambda {|n| @managed_app_statuses = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppStatus.create_from_discriminator_value(pn) }) },\n \"managedEBooks\" => lambda {|n| @managed_e_books = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedEBook.create_from_discriminator_value(pn) }) },\n \"mdmWindowsInformationProtectionPolicies\" => lambda {|n| @mdm_windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MdmWindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n \"microsoftStoreForBusinessLanguage\" => lambda {|n| @microsoft_store_for_business_language = n.get_string_value() },\n \"microsoftStoreForBusinessLastCompletedApplicationSyncTime\" => lambda {|n| @microsoft_store_for_business_last_completed_application_sync_time = n.get_date_time_value() },\n \"microsoftStoreForBusinessLastSuccessfulSyncDateTime\" => lambda {|n| @microsoft_store_for_business_last_successful_sync_date_time = n.get_date_time_value() },\n \"mobileAppCategories\" => lambda {|n| @mobile_app_categories = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppCategory.create_from_discriminator_value(pn) }) },\n \"mobileAppConfigurations\" => lambda {|n| @mobile_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDeviceMobileAppConfiguration.create_from_discriminator_value(pn) }) },\n \"mobileApps\" => lambda {|n| @mobile_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileApp.create_from_discriminator_value(pn) }) },\n \"targetedManagedAppConfigurations\" => lambda {|n| @targeted_managed_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppConfiguration.create_from_discriminator_value(pn) }) },\n \"vppTokens\" => lambda {|n| @vpp_tokens = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::VppToken.create_from_discriminator_value(pn) }) },\n \"windowsInformationProtectionPolicies\" => lambda {|n| @windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n })\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def allowed_domain_guids_for_sync_app=(value)\n @allowed_domain_guids_for_sync_app = value\n end",
"def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def set_provisioning_profile(app)\n app.development do\n puts 'Provisioning for development'\n if ENV['IOS_APP_DEVELOPMENT_PROFILE_ID']\n app.provisioning_profile = get_provisioning_profile_for(ENV.require('IOS_APP_DEVELOPMENT_PROFILE_ID'))\n end\n app.entitlements['aps-environment'] = 'development'\n app.entitlements['get-task-allow'] = true\n end\n\n app.release do\n puts 'Provisioning for distribution'\n app.provisioning_profile = get_provisioning_profile_for(ENV.require('IOS_APP_PRODUCTION_PROFILE_ID'))\n app.entitlements['aps-environment'] = 'production'\n app.entitlements['get-task-allow'] = false\n end\nend",
"def managed_models\n @managed_models\n end",
"def appman_params\n params.require(:appman).permit(:name, :stackmetadata, :stackid, :details, :cloud_ids)\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def is_unmanaged_sync_app_for_tenant_restricted=(value)\n @is_unmanaged_sync_app_for_tenant_restricted = value\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def windows_information_protection_policies\n return @windows_information_protection_policies\n end",
"def entitlement_management\n return @entitlement_management\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def mac_os_enrollment_assignments\n return @mac_os_enrollment_assignments\n end",
"def mac_os_enrollment_assignments=(value)\n @mac_os_enrollment_assignments = value\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def application_controller(perms)\n return unless ApplicationController.respond_to?(:permission_definition)\n return if ApplicationController.permission_definition.nil? || ApplicationController.permission_definition == {}\n perms << PermissionsGenerator.new(ApplicationController)\nend",
"def protected_apps\n return @protected_apps\n end",
"def is_mac_sync_app_enabled=(value)\n @is_mac_sync_app_enabled = value\n end",
"def documents_block_managed_documents_in_unmanaged_apps\n return @documents_block_managed_documents_in_unmanaged_apps\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def documents_block_unmanaged_documents_in_managed_apps\n return @documents_block_unmanaged_documents_in_managed_apps\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"androidManagedAppProtections\", @android_managed_app_protections)\n writer.write_collection_of_object_values(\"defaultManagedAppProtections\", @default_managed_app_protections)\n writer.write_collection_of_object_values(\"iosManagedAppProtections\", @ios_managed_app_protections)\n writer.write_boolean_value(\"isEnabledForMicrosoftStoreForBusiness\", @is_enabled_for_microsoft_store_for_business)\n writer.write_collection_of_object_values(\"managedAppPolicies\", @managed_app_policies)\n writer.write_collection_of_object_values(\"managedAppRegistrations\", @managed_app_registrations)\n writer.write_collection_of_object_values(\"managedAppStatuses\", @managed_app_statuses)\n writer.write_collection_of_object_values(\"managedEBooks\", @managed_e_books)\n writer.write_collection_of_object_values(\"mdmWindowsInformationProtectionPolicies\", @mdm_windows_information_protection_policies)\n writer.write_string_value(\"microsoftStoreForBusinessLanguage\", @microsoft_store_for_business_language)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastCompletedApplicationSyncTime\", @microsoft_store_for_business_last_completed_application_sync_time)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastSuccessfulSyncDateTime\", @microsoft_store_for_business_last_successful_sync_date_time)\n writer.write_collection_of_object_values(\"mobileAppCategories\", @mobile_app_categories)\n writer.write_collection_of_object_values(\"mobileAppConfigurations\", @mobile_app_configurations)\n writer.write_collection_of_object_values(\"mobileApps\", @mobile_apps)\n writer.write_collection_of_object_values(\"targetedManagedAppConfigurations\", @targeted_managed_app_configurations)\n writer.write_collection_of_object_values(\"vppTokens\", @vpp_tokens)\n writer.write_collection_of_object_values(\"windowsInformationProtectionPolicies\", @windows_information_protection_policies)\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def managed_collection_ids\n Hyrax::Collections::PermissionsService.source_ids_for_manage(ability: @ability)\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def set_payment_app\n @payment_app = PaymentApp.find(params[:id])\n end",
"def exempt_apps=(value)\n @exempt_apps = value\n end",
"def is_unmanaged_sync_app_for_tenant_restricted\n return @is_unmanaged_sync_app_for_tenant_restricted\n end",
"def app_params\n params.require(:app).permit(:key, :identifier, :environment, :password, :certificate, :sandbox)\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def set_appman\n @appman = Appman.find(params[:id])\n end",
"def device_sharing_allowed=(value)\n @device_sharing_allowed = value\n end",
"def fix_app_permissions(apps)\n apps.map { |path|\n fix_facl(path, app_acl_template(path))\n }.select { |report| report.updated || report.error }\n end",
"def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def index\n @app_instances = parent_organization.app_instances.active.where(\"updated_at.gt\" => Time.at(timestamp)).select do |i|\n # force owner assignment to avoid a refetch in ability can?(:access,i)\n i.owner = parent_organization\n can?(:access,i)\n end\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def security_require_verify_apps=(value)\n @security_require_verify_apps = value\n end"
] |
[
"0.7477903",
"0.69932246",
"0.6872003",
"0.6630619",
"0.64953953",
"0.6470286",
"0.6329817",
"0.6088134",
"0.6011512",
"0.5970006",
"0.5940825",
"0.57495624",
"0.5685943",
"0.5636086",
"0.56063616",
"0.5560754",
"0.5548923",
"0.55247676",
"0.55194473",
"0.5437535",
"0.5385764",
"0.53514",
"0.5298767",
"0.5298175",
"0.5280074",
"0.5234409",
"0.5183604",
"0.5169128",
"0.5117927",
"0.51107734",
"0.5110129",
"0.5109666",
"0.50856507",
"0.50433236",
"0.5042218",
"0.4995005",
"0.4989136",
"0.49865538",
"0.49789017",
"0.4872629",
"0.48537982",
"0.48463088",
"0.4814952",
"0.47834817",
"0.47617692",
"0.47003794",
"0.46914247",
"0.4690809",
"0.4677103",
"0.46624506",
"0.46143764",
"0.45899013",
"0.4589679",
"0.45738965",
"0.4567373",
"0.45335817",
"0.4531671",
"0.4524585",
"0.44953212",
"0.44927648",
"0.44807327",
"0.44786236",
"0.4457221",
"0.4457221",
"0.44534355",
"0.44533938",
"0.44533247",
"0.4453094",
"0.4452837",
"0.4452335",
"0.44513363",
"0.44483447",
"0.44431663",
"0.44406426",
"0.44378552",
"0.44312304",
"0.4429139",
"0.4429139",
"0.44090298",
"0.44039828",
"0.44039828",
"0.43988743",
"0.43757033",
"0.43740952",
"0.4363975",
"0.43622684",
"0.43589085",
"0.435336",
"0.43343034",
"0.4333176",
"0.4315718",
"0.43144014",
"0.4309157",
"0.42923045",
"0.42816094",
"0.4274431",
"0.4274431",
"0.42736086",
"0.42728284",
"0.4270527"
] |
0.78540516
|
0
|
Provides operations to manage the managedAppPolicies property of the microsoft.graph.deviceAppManagement entity.
|
def managed_app_policies()
return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def managed_apps\n return @managed_apps\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def have_policy_for?(app_name)\n @policies ||= Vault.sys.policies\n @policies.include?(app_name)\n end",
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_models\n @managed_models\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def group_policies\r\n GroupPoliciesController.instance\r\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def manage\n @managed_orgs = managed_orgs(current_user)\n if (@managed_orgs.present?)\n @managed_jobs = Job.where(:organization_id => @managed_orgs.ids)\n @interviewing_postings = JobPosting.where(:job_id => @managed_jobs.ids, :status => \"interviewing\").order(\"deadline\").paginate(:page => params[:page], :per_page => 10)\n @applications = JobApplication.where(:job_posting_id => @interviewing_postings.ids, :status =>\"interview_scheduled\")\n @interviews = Interview.where(:job_application_id => @applications.ids).order(end_time: :asc)\n end\n end",
"def azure_rights_management_services_allowed\n return @azure_rights_management_services_allowed\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def android_managed_app_protections=(value)\n @android_managed_app_protections = value\n end",
"def appctrl_admin_destroy( model )\n return appctrl_not_permitted() unless ( @current_user.admin? )\n appctrl_destroy( model )\n end",
"def windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections\n return @android_managed_app_protections\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def account_manager_policy=(value)\n @account_manager_policy = value\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update\n @application = policy_scope(Application).find(params[:id])\n\n @application.schedule_items.clear\n @application.experiences.clear\n @application.roles.clear\n\n policy_scope(Application).update(@application.id, application_params)\n authorize @application\n if params[:application][:decision] == 'update'\n if @application.save\n flash[:notice] = t('.successfully_updated')\n else\n flash[:alert] = t('.not_created')\n end\n elsif params[:decision] == 'accept'\n @application.accept!\n flash[:notice] = t('.accepted')\n elsif params[:decision] == 'reject'\n @application.reject!\n flash[:notice] = t('.rejected')\n else\n flash[:alert] = t('.cant_change_state')\n end\n redirect_to applications_path\n end",
"def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def apply_admin_policy_defaults\n resp = connection.post do |req|\n req.url \"#{object_path}/apply_admin_policy_defaults\"\n end\n\n raise_exception_based_on_response!(resp) unless resp.success?\n\n true\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def setPolicies\n=begin\n Util.modifyPolicy(ncaEnclave, '', '\nPolicy DamlBootPolicyNCAServletForRearPolicyAdmin = [\n A user in role RearPolicyAdministration can access a servlet named NCAServlets\n]\n')\n=end\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def manage?\n allowed_to?(:manage_assessments?, with: GraderPermissionPolicy)\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def managed?\n (options[:managed].present? && options[:managed] === true)\n end",
"def documents_block_managed_documents_in_unmanaged_apps=(value)\n @documents_block_managed_documents_in_unmanaged_apps = value\n end",
"def managed_devices\n return @managed_devices\n end",
"def update\n\n # Only allow update by SEA or LEA admin.\n unless is_app_authorizer?\n logger.warn 'User is not SEA or LEA admin and cannot update application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n\n # Top level edOrg to expand\n edorg = session[:edOrgId]\n # EdOrgs selected using Tree Control\n added = params[:application_authorization][:edorgsAdded] || ''\n added.strip!\n addedEdOrgs = added.split(/,/)\n\n removed = params[:application_authorization][:edorgsRemoved] || ''\n removed.strip!\n removedEdOrgs = removed.split(/,/)\n\n # ID of app\n appId = params[:application_authorization][:appId]\n\n updates = {\"appId\" => appId, \"authorized\" => true, :edorgs => addedEdOrgs}\n @application_authorization = ApplicationAuthorization.find(params[:id])\n success = @application_authorization.update_attributes(updates)\n\n updates = {\"appId\" => appId, \"authorized\" => false, :edorgs => removedEdOrgs}\n @application_authorization = ApplicationAuthorization.find(params[:id])\n success = @application_authorization.update_attributes(updates)\n\n # Redirect to response page\n ApplicationAuthorization.cur_edorg = edorg\n respond_to do |format|\n if success\n format.html { redirect_to application_authorizations_path, notice: 'Application was succesfully updated.'}\n #format.html {redirect_to :action => 'index', notice: 'Application authorization was succesfully updated.'}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application_authorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def apply_privileges(app_name=nil)\n return if credentials(app_name).nil?\n if is_postgresql()\n cmd_acl=\"GRANT CREATE ON SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL TABLES IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL FUNCTIONS IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL SEQUENCES IN SCHEMA PUBLIC TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO PUBLIC;\"\n# shell(cmd_acl,true)\n \n # reset the owner of the functions to the current user\n # when there is a 'privileged' app.\n app_name ||= @wrapped['director']['bound_app'] if @wrapped['director']\n if app_name\n cmd_select_fcts=\"SELECT pg_proc.proname FROM pg_catalog.pg_proc WHERE \\\n pg_proc.pronamespace=(SELECT pg_namespace.oid FROM pg_catalog.pg_namespace WHERE pg_namespace.nspname = 'public') \\\n AND pg_proc.proowner!=(SELECT oid FROM pg_roles WHERE rolname = 'postgres')\"\n current_owner=credentials()['username']\n unless current_owner\n STDERR.puts \"The application #{app_name} is not bound to the data-service #{name}; not applying the database privileges.\"\n return\n end\n fcts_name=shell(cmd_select_fcts,true,true)\n if fcts_name.empty?\n puts \"No need to re-assign the ownership of the functions in #{credentials()['name']}; the DB does not define its own functions.\" if VMC::Cli::Config.trace\n else\n fcts = fcts_name.split(\"\\n\").collect do |line|\n line.strip!\n \"'#{line}'\"\n end.join(',')\n cmd_change_fcts_owner=\"UPDATE pg_catalog.pg_proc \\\n SET proowner = (SELECT oid FROM pg_roles WHERE rolname = '#{current_owner}')\\\n WHERE pg_proc.proname IN (#{fcts})\"\n puts `sudo -u postgres psql --dbname #{credentials()['name']} -c \\\"#{cmd_change_fcts_owner}\\\" #{PSQL_RAW_RES_ARGS}`\n end\n end\n end\n end",
"def documents_block_managed_documents_in_unmanaged_apps\n return @documents_block_managed_documents_in_unmanaged_apps\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:extension_id, :version)))\n end",
"def apps=(value)\n @apps = value\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def is_unmanaged_sync_app_for_tenant_restricted\n return @is_unmanaged_sync_app_for_tenant_restricted\n end",
"def new\n @apps = params[:apps]\n @organizations = current_user.organizations.to_a\n @organization = @organizations.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n\n unless @organization\n @organization = @organizations.one? ? @organizations.first : nil\n end\n\n if @organization && cannot?(:manage_app_instances, @organization)\n msg = 'Unfortunately you do not have permission to purchase products for this organization'\n if @organizations.one?\n redirect_path = add_param_to_fragment(after_provision_path.to_s, 'flash', [{msg: msg, type: :error}.to_json])\n redirect_to redirect_path\n else\n @organization = nil\n flash.now.alert = msg\n end\n end\n\n # Redirect to dashboard if no applications\n unless @apps && @apps.any?\n redirect_to after_provision_path\n end\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def managed_collection_ids\n Hyrax::Collections::PermissionsService.source_ids_for_manage(ability: @ability)\n end",
"def documents_block_unmanaged_documents_in_managed_apps\n return @documents_block_unmanaged_documents_in_managed_apps\n end",
"def protected_apps=(value)\n @protected_apps = value\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:username, :extension_id, :version)))\n end",
"def policies\n @policies = Policy.all\n end",
"def apply_apo_defaults\n @object.reapplyAdminPolicyObjectDefaults\n render status: 200, plain: 'Defaults applied.'\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def populate_policies\n end",
"def is_unmanaged_sync_app_for_tenant_restricted=(value)\n @is_unmanaged_sync_app_for_tenant_restricted = value\n end",
"def apps=(selected_apps)\n filter = ( APPS && selected_apps )\n filter = filter.select{|item| !item.blank?}\n # mark (APPS && selected_apps) != (selected_apps && APPS)\n self.apps_mask = filter.map{|app| 2**APPS.index(app) }.sum\n end",
"def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end",
"def policy_class\n Hydra.config.permissions.policy_class || Hydra::AdminPolicy\n end",
"def managed_organizations\n if has_role?(:org_admin)\n org_ids = roles.where(name: Role::NAMES[:org_admin]).first.ref_ids\n Organization.in(id: org_ids)\n else\n []\n end\n end",
"def index\n skip_policy_scope\n @applications = current_user&.oauth_applications\n if @applications&.empty?\n skip_authorization\n else\n @applications&.each do |app|\n authorize app, policy_class: Oauth::ApplicationPolicy\n end\n end\n end",
"def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end",
"def work_profile_default_app_permission_policy\n return @work_profile_default_app_permission_policy\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def authorized_gae_applications\n settings[:authorized_gae_applications]\n end",
"def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end",
"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",
"def get_application_pools\n\t\ts = get_admin_section \"system.applicationHost/applicationPools\"\n\t\tIisObjectCollection.new s.Collection, :add, ApplicationPool\n end",
"def perform_scaling_for_appservers()\n APPS_LOCK.synchronize {\n @apps_loaded.each { |app_name|\n\n next if app_name == \"none\" \n initialize_scaling_info_for_app(app_name)\n\n # Always get scaling info, as that will send this info to the\n # AppDashboard for users to view.\n case get_scaling_info_for_app(app_name)\n when :scale_up\n Djinn.log_debug(\"Considering scaling up app #{app_name}.\")\n try_to_scale_up(app_name)\n when :scale_down\n Djinn.log_debug(\"Considering scaling down app #{app_name}.\")\n try_to_scale_down(app_name)\n else\n Djinn.log_debug(\"Not scaling app #{app_name} up or down right now.\")\n end\n }\n }\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def managed?\n @managed.nil? ? true : @managed\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end"
] |
[
"0.75470936",
"0.69188136",
"0.6849626",
"0.658735",
"0.63462585",
"0.5977279",
"0.5651906",
"0.5556686",
"0.5510073",
"0.54415226",
"0.5242824",
"0.52209496",
"0.51883256",
"0.51432425",
"0.51116073",
"0.50694996",
"0.50259125",
"0.5020367",
"0.4961551",
"0.49563906",
"0.49482736",
"0.48960188",
"0.48869962",
"0.48860842",
"0.4884122",
"0.48578358",
"0.4829898",
"0.48044303",
"0.47990158",
"0.47760102",
"0.47309247",
"0.472352",
"0.47095376",
"0.47044474",
"0.46790516",
"0.46742186",
"0.46553403",
"0.46462947",
"0.4603083",
"0.4599165",
"0.45979324",
"0.4582241",
"0.45335004",
"0.45313394",
"0.45239273",
"0.451714",
"0.45138875",
"0.45029676",
"0.4482339",
"0.446755",
"0.44607028",
"0.44466773",
"0.44323778",
"0.4422545",
"0.44188896",
"0.44131592",
"0.4397091",
"0.4396008",
"0.43946224",
"0.43897554",
"0.43893078",
"0.43864477",
"0.43847674",
"0.43816453",
"0.43795627",
"0.43750775",
"0.43692124",
"0.4358719",
"0.4340015",
"0.43267164",
"0.43203107",
"0.43203107",
"0.42994332",
"0.42966852",
"0.42912722",
"0.42889568",
"0.4288001",
"0.42834154",
"0.42790228",
"0.4271146",
"0.42698672",
"0.4268801",
"0.42684963",
"0.4259248",
"0.42460814",
"0.42421892",
"0.42368072",
"0.42364523",
"0.42313284",
"0.42230955",
"0.42143816",
"0.42134482",
"0.4210967",
"0.42000785",
"0.41999796",
"0.41885358",
"0.41859424",
"0.41859424",
"0.4183805",
"0.4183646"
] |
0.77995986
|
0
|
Provides operations to manage the managedAppRegistrations property of the microsoft.graph.deviceAppManagement entity.
|
def managed_app_registrations()
return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def managed_apps\n return @managed_apps\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def managed_devices\n return @managed_devices\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def registered_applications\n @registered_applications ||= current_user.registered_applications.all\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def register_app\n \tself.app_upload_field.registered_app\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def managed_models\n @managed_models\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def index\n @registered_apps = RegisteredApp.all\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def index\n @device_registrations = DeviceRegistration.all\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def allowed_domain_guids_for_sync_app=(value)\n @allowed_domain_guids_for_sync_app = value\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage(klass)\n @@resources.add(klass)\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def create\n @app = App.new(app_params)\n #added code for realizers list\n\t#@developers = Developer.where(:id => params[:realizers])\n #logger.debug \"DEVELOPER: #{@developers.inspect} \\n\"\n\t#@app.developers << @developers \n #logger.debug \"DEVELOPERS: #{@app.developers.inspect} \\n\"\n\t#end code\n\n respond_to do |format|\n if @app.save\n @app.developers << current_dev \n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_application_pools\n\t\ts = get_admin_section \"system.applicationHost/applicationPools\"\n\t\tIisObjectCollection.new s.Collection, :add, ApplicationPool\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n @mobile_app.build_notifications(:created)\n @mobile_app.published!\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully created.\" }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n if @mobile_app.mobile_app_versions.empty?\n @mobile_app.mobile_app_versions.build\n end\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def managed_organizations\n if has_role?(:org_admin)\n org_ids = roles.where(name: Role::NAMES[:org_admin]).first.ref_ids\n Organization.in(id: org_ids)\n else\n []\n end\n end",
"def appstore_apps_message(app_id)\n response = connection.post(get_appstore_apps_message_url(app_id)) do |request|\n request.headers[CONTENT_TYPE] = APPLICATION_JSON\n request.params[:adminDeviceSpaceId] = \"1\"\n request.body = JSON.dump({ installIncluded: true, updateIncluded: true, pushApp: true })\n end\n\n if response.success?\n AppStoreAppsMessageResponse.new(response.body)\n end\n end",
"def get_field_deserializers()\n return super.merge({\n \"apps\" => lambda {|n| @apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedMobileApp.create_from_discriminator_value(pn) }) },\n \"customBrowserDisplayName\" => lambda {|n| @custom_browser_display_name = n.get_string_value() },\n \"customBrowserPackageId\" => lambda {|n| @custom_browser_package_id = n.get_string_value() },\n \"deployedAppCount\" => lambda {|n| @deployed_app_count = n.get_number_value() },\n \"deploymentSummary\" => lambda {|n| @deployment_summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicyDeploymentSummary.create_from_discriminator_value(pn) }) },\n \"disableAppEncryptionIfDeviceEncryptionIsEnabled\" => lambda {|n| @disable_app_encryption_if_device_encryption_is_enabled = n.get_boolean_value() },\n \"encryptAppData\" => lambda {|n| @encrypt_app_data = n.get_boolean_value() },\n \"minimumRequiredPatchVersion\" => lambda {|n| @minimum_required_patch_version = n.get_string_value() },\n \"minimumWarningPatchVersion\" => lambda {|n| @minimum_warning_patch_version = n.get_string_value() },\n \"screenCaptureBlocked\" => lambda {|n| @screen_capture_blocked = n.get_boolean_value() },\n })\n end",
"def installed_apps=(value)\n @installed_apps = value\n end",
"def installed_apps=(value)\n @installed_apps = value\n end",
"def manage_resources(resources)\n resources.map {|r| manage_resource(r) }\n end",
"def update\n if params[:device_group][:property_ids]\n params[:device_group][:property_ids].each do |property_id|\n @property = Property.find(property_id)\n @device_group.properties << @property\n end\n end\n respond_to do |format|\n if @device_group.update(device_group_params)\n format.html { redirect_to @device_group, notice: 'Device group was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n end\n end\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def provision_site_admin_groups\n @attributes[:provision_site_admin_groups]\n end",
"def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def authorized_gae_applications\n settings[:authorized_gae_applications]\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def amend_muni_admin\n # we should have a current muni_admin. And we are going to the new authentication if\n # it is not there already.\n muni_admin = current_muni_admin\n if (muni_admin)\n auth = request.env[\"omniauth.auth\"]\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :muni_admin_id.ne => nil,\n :master_id => @master.id).order(\"created_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.muni_admin == muni_admin\n if oauth.nil?\n oauth = oa\n else\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :alert => \"This authentication belongs to different administrator.\"\n return\n end\n end\n if oauth\n # Already added\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n muni_admin.authentications << oauth\n muni_admin.save\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_muni_admin_sign_in_path(:master_id => params[:master_id]),\n :alert => \"Need to sign in first.\"\n end\n end",
"def index\n @admin_devices = AdminDevice.all\n end",
"def list_managed_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_managed_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"def app_members(owner:, platform:, app_id:)\n endpoint = \"/api/users/#{owner}/platforms/#{platform}/apps/#{app_id}/members\"\n res = api.get endpoint\n Response.new(res)\n end",
"def mobile_app_categories()\n return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def sync_device()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::SyncDevice::SyncDeviceRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def new\n @apps = params[:apps]\n @organizations = current_user.organizations.to_a\n @organization = @organizations.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n\n unless @organization\n @organization = @organizations.one? ? @organizations.first : nil\n end\n\n if @organization && cannot?(:manage_app_instances, @organization)\n msg = 'Unfortunately you do not have permission to purchase products for this organization'\n if @organizations.one?\n redirect_path = add_param_to_fragment(after_provision_path.to_s, 'flash', [{msg: msg, type: :error}.to_json])\n redirect_to redirect_path\n else\n @organization = nil\n flash.now.alert = msg\n end\n end\n\n # Redirect to dashboard if no applications\n unless @apps && @apps.any?\n redirect_to after_provision_path\n end\n end",
"def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end",
"def register_application(app_name, namespace, public_hostname)\n end",
"def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def get_field_deserializers()\n return super.merge({\n \"appIdentifier\" => lambda {|n| @app_identifier = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MobileAppIdentifier.create_from_discriminator_value(pn) }) },\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"appliedPolicies\" => lambda {|n| @applied_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"deviceTag\" => lambda {|n| @device_tag = n.get_string_value() },\n \"deviceType\" => lambda {|n| @device_type = n.get_string_value() },\n \"flaggedReasons\" => lambda {|n| @flagged_reasons = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppFlaggedReason.create_from_discriminator_value(pn) }) },\n \"intendedPolicies\" => lambda {|n| @intended_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"lastSyncDateTime\" => lambda {|n| @last_sync_date_time = n.get_date_time_value() },\n \"managementSdkVersion\" => lambda {|n| @management_sdk_version = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppOperation.create_from_discriminator_value(pn) }) },\n \"platformVersion\" => lambda {|n| @platform_version = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def set_app_groups\n @sys_app_groups = bc_sys_app_groups\n @usr_app_groups = bc_usr_app_groups\n @dev_app_groups = bc_dev_app_groups\n @apps_menu_group = bc_custom_apps_group\n end",
"def appstore_apps_labels(app_id, label_id, space_id)\n response = connection.put(get_appstore_apps_labels_url(app_id, label_id)) do |request|\n request.params[:adminDeviceSpaceId] = space_id\n end\n\n if response.success?\n AppStoreAppsLabelsResponse.new(response.body)\n end\n end",
"def create\n @app = App.new app_params\n @app.user = current_user\n \n if @app.valid?\n\n openid_client = Services::OpenIdConnectionService.new(@app).register\n\n\n if openid_client[\"client_id\"].present?\n @app.openid_client_id = openid_client[\"client_id\"]\n @app.openid_client_secret = openid_client[\"client_secret\"]\n @app.openid_client_access_token = openid_client[\"registration_access_token\"]\n @app.save\n end\n end\n\n respond_to do |format|\n if @app.persisted?\n format.html { redirect_to app_path(@app), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def register(devices)\n @devices.merge! devices\n end",
"def register(devices)\n @devices.merge! devices\n end",
"def apps=(value)\n @apps = value\n end",
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def set_management\n @admin = Admin.find(params[:id])\n @management = Admin.find(params[:id])\n end",
"def allow_registration method\n @register_semaphore.synchronize do\n @dynamic_capabilities.add method\n end\n end",
"def create\n @app = App::Gcm::App.find_by_name(params[:app_name])\n @app_user = @app.app_users.build(app_params)\n @app_user.app_id = @app.id\n @app_user.app_name = @app.name\n respond_to do |format|\n if @app_user.save\n format.html { redirect_to ({action:'show', id:@app_user.id}), notice: 'App user was successfully created.' }\n format.json { render json: @app_user, status: :created, location: {:action => 'show', id:@app_user.id} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72985137",
"0.67457193",
"0.6265421",
"0.6120318",
"0.5852492",
"0.5804979",
"0.57139933",
"0.55794626",
"0.5397568",
"0.5307091",
"0.5282389",
"0.5274645",
"0.5209892",
"0.5108425",
"0.50594586",
"0.50440323",
"0.49683988",
"0.49683988",
"0.49335074",
"0.4924272",
"0.48430544",
"0.4808795",
"0.48078755",
"0.47932136",
"0.47905055",
"0.47757077",
"0.4747196",
"0.4724375",
"0.4718906",
"0.47127828",
"0.4707688",
"0.46976745",
"0.46781942",
"0.4653473",
"0.4651763",
"0.46132812",
"0.46070713",
"0.46044996",
"0.4592198",
"0.45341596",
"0.4510414",
"0.45093784",
"0.4508316",
"0.44793037",
"0.44652295",
"0.44627818",
"0.44481158",
"0.4447265",
"0.4414902",
"0.44134122",
"0.44080815",
"0.44045788",
"0.44019362",
"0.4397007",
"0.43965423",
"0.43858272",
"0.43278396",
"0.43117118",
"0.43018663",
"0.42947164",
"0.42947164",
"0.42544818",
"0.4254444",
"0.4253475",
"0.42488462",
"0.4244096",
"0.42433235",
"0.42354006",
"0.42187375",
"0.4214767",
"0.42135742",
"0.4200607",
"0.41936493",
"0.41901377",
"0.41824034",
"0.417248",
"0.41669062",
"0.41611713",
"0.41588217",
"0.41586247",
"0.41577822",
"0.41521966",
"0.4149028",
"0.41478002",
"0.41355446",
"0.41328442",
"0.41324443",
"0.41253498",
"0.412504",
"0.41226152",
"0.41226152",
"0.41222215",
"0.41172498",
"0.41107744",
"0.41107744",
"0.41039535",
"0.4103293",
"0.4099382",
"0.40950793",
"0.40945905"
] |
0.7485382
|
0
|
Provides operations to manage the managedAppStatuses property of the microsoft.graph.deviceAppManagement entity.
|
def managed_app_statuses()
return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_apps\n return @managed_apps\n end",
"def status\n\t\tbody = {\n\t\t\t'developerId' => $developer_id,\n\t\t\t'status' => params[:status]\n\t\t}\n\n\t\turl = URI.parse($base_url + '/v2/apps/' + params[:appId] + '/status')\n\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\thttp.use_ssl = true\n\n\t\treq = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json', 'Authorization' => $auth})\n\t\treq.body = ActiveSupport::JSON.encode(body)\n\t\tres = Net::HTTP.start(url.host, url.port) { |https|\n\t\t\thttp.request(req)\n\t\t}\n\t\t\n\t\tres = ActiveSupport::JSON.decode(res.body)\n\n\t\t# If error is retrieved, display error message and return\n\t\tif res['code'] != nil\n\t\t\tsession[:toast_type] = 'error'\n\t\t\tsession[:toast_message] = res['errors'][0]['message']\n\t\t\tredirect_to '/app/list'\n\t\t\treturn\n\t\tend\n\n\t\t# Display success message\n\t\tsession[:toast_type] = 'status'\n\t\tsession[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n\tend",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def status_enum\n status_list\n end",
"def set_app_status\n @app_status = AppStatus.find(params[:id])\n end",
"def status(*app_names)\n each_app(*app_names) do |server_app|\n begin\n server_app.status\n rescue => e\n e.message\n end\n end\n end",
"def index\n @device_statuses = DeviceStatus.all\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def read_appliance_management_service_status(opts = {})\n data, _status_code, _headers = read_appliance_management_service_status_with_http_info(opts)\n return data\n end",
"def modify_status(site_creation, site_duplication, domain_management, bulk_operations)\n current_path = '/api/v1/status'\n payload = { 'site_creation' => site_creation,\n 'site_duplication' => site_duplication,\n 'domain_management' => domain_management,\n 'bulk_operations' => bulk_operations }.to_json\n @conn.put(current_path, payload)\n end",
"def statuses; end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def index\n @devices = current_user.devices.all\n\n # init device status\n if @devices.first.present? && @devices.first.status.blank?\n @devices.each do |d|\n d.get_status\n d.save\n end\n end\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def statuses\n lifecycle.statuses\n end",
"def set_admin_device_status\n @device_status = DeviceStatus.find(params[:id])\n end",
"def statuses\n aux = WorkOrderStatus.all\n render json: serialized_work_order_statuses(aux)\n end",
"def status\n STATUSES[self.status_id]\n end",
"def update\n respond_to do |format|\n if @app_status.update(app_status_params)\n format.html { redirect_to @app_status, notice: 'App status was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_status }\n else\n format.html { render :edit }\n format.json { render json: @app_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end",
"def status\n STATUSES[self.status_id || 0]\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def statuses\n api.get('status')\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def managed_models\n @managed_models\n end",
"def managed_devices\n return @managed_devices\n end",
"def apps_by_status(status)\n apps(:status => status)\n end",
"def index\n @entity_statuses = EntityStatus.all\n end",
"def create_starting_statuses\n new_status_attributes = { :public_title => \"New\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"new\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(new_status_attributes)\n in_progress_status_attributes = { :public_title => \"In Progress\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"in_progress\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(in_progress_status_attributes)\n submitted_status_attributes = { :public_title => \"Submitted\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"submitted\"),\n :disallow_user_edits => 1,\n :disallow_all_edits => 0,\n :allow_application_edits => 0 }\n statuses.create(submitted_status_attributes)\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end",
"def set_common_data\n @statuses = Status.all\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def index\n @mstatuses = Mstatus.all\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def manage\n @managed_orgs = managed_orgs(current_user)\n if (@managed_orgs.present?)\n @managed_jobs = Job.where(:organization_id => @managed_orgs.ids)\n @interviewing_postings = JobPosting.where(:job_id => @managed_jobs.ids, :status => \"interviewing\").order(\"deadline\").paginate(:page => params[:page], :per_page => 10)\n @applications = JobApplication.where(:job_posting_id => @interviewing_postings.ids, :status =>\"interview_scheduled\")\n @interviews = Interview.where(:job_application_id => @applications.ids).order(end_time: :asc)\n end\n end",
"def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end",
"def status_info\n {:active_objects => @active_list.size,\n :idle_objects => @idle_list.size,\n :idle_check_status => @idle_check_status}.merge(self.config.to_hash)\n end",
"def status_enum=(status)\n write_attribute(:status, status)\n end",
"def statuses=(statuses)\n assert_unloaded\n @statuses = Array(statuses)\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @deployment_statuses = DeploymentStatus.all\n end",
"def index\n @health_statuses = HealthStatus.all\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def status_enum\n [\n [STATUSES.active],\n [STATUSES.resolved],\n [STATUSES.cancelled],\n [STATUSES.deleted]\n ]\n end",
"def update\n respond_to do |format|\n if @device_status.update(admin_device_status_params)\n format.html { redirect_to admin_device_status_path(@device_status), notice: 'Device Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_status }\n else\n format.html { render :edit }\n format.json { render json: @device_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @appointment_statuses = AppointmentStatus.all\n end",
"def update_status() \n ContentProviderStatusItem.update(self)\n end",
"def index\n @application_statuses = ApplicationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_statuses }\n end\n end",
"def status_object\n @status\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def update_status(status)\n @metric_status = status if STATUSES[status] > STATUSES[@metric_status]\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end",
"def refresh_status_sm\n assert_privileges(\"storage_manager_refresh_status\")\n sm_button_operation('request_status_update', _('Refresh Status'))\n end",
"def update\n respond_to do |format|\n\t status_param = params.require(:collaboration_application).permit(:status)\n\t status = @application.status\n if @application.update(status_param)\n format.html { redirect_to @application, notice: \"Application was successfully #{@application.status}.\" }\n else\n\t @application.status = status\n format.html { render action: 'show' }\n end\n end\n end",
"def set_mstatus\n @mstatus = Mstatus.find(params[:id])\n end",
"def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update_mp_status\n update(\n mp_response: MP_STATUSES[payment_status.to_sym][payment_status_detail.to_sym]\n )\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend",
"def update_manager_validation_hashes_status\n @manager_validation_hash_obj.status = GlobalConstant::ManagerValidationHash.used_status\n @manager_validation_hash_obj.save!\n\n ManagerValidationHash.where(\n manager_id: @manager_id,\n kind: GlobalConstant::ManagerValidationHash.secure_data_access_kind,\n status: GlobalConstant::ManagerValidationHash.active_status\n ).find_in_batches(batch_size: 100) do |manager_validation_hashes|\n manager_validation_hashes_ids_to_deactivate = []\n manager_validation_hashes.each do |manager_validation_hash|\n manager_validation_hashes_ids_to_deactivate.push(manager_validation_hash.id)\n end\n ManagerValidationHash.where(id: manager_validation_hashes_ids_to_deactivate).update_all(status: GlobalConstant::ManagerValidationHash.inactive_status)\n end\n\n success\n end",
"def health_status\n data.health_status\n end",
"def status\n response = JSON.parse(@client.get(\"items/#{send(:id)}/status\").body)\n response['items']\n end",
"def status\n response = JSON.parse(@client.get(\"items/#{send(:id)}/status\").body)\n response['items']\n end",
"def status\n response = JSON.parse(@client.get(\"items/#{send(:id)}/status\").body)\n response['items']\n end",
"def statuses\n calculated = Array(read_attribute(:statuses))\n calculated.delete(Contact::OK)\n calculated.delete(Contact::LINKED)\n calculated << Contact::OK if calculated.empty?# && valid?\n calculated << Contact::LINKED if linked?\n\n calculated.uniq\n end",
"def destroy\n @app_status.destroy\n respond_to do |format|\n format.html { redirect_to app_statuses_url, notice: 'App status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def update_collaboration_status\n if collaboration.collaboration_items.count >= 30\n collaboration.status = 4\n elsif collaboration.collaboration_items.count >= 20\n collaboration.status = 3\n elsif collaboration.collaboration_items.count >= 10\n collaboration.status = 2\n elsif collaboration.collaboration_items.count >= 5\n collaboration.status = 1\n elsif collaboration.collaboration_items.count >= 0\n collaboration.status = 0\n end\n collaboration.save\n end",
"def getStatus\n @@statuses[@status]\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def possible_statuses\n\t\tcase self.status\n\t\twhen 'pending'\n\t\t\t['granted', 'denied']\n\t\twhen 'granted'\n\t\t\t['revoked']\n\t\twhen 'denied'\n\t\t\t['granted']\n\t\twhen 'revoked'\n\t\t\t['granted']\n\t\telse\n\t\t\t[]\n\t\tend\n\tend",
"def managed=(managed)\n pointer.managed = managed\n end",
"def status\n @app = ThirdpartyService.get_app(@url, AUTH, @http, @body)\n if @app['code'] != nil\n session[:toast_type] = 'error'\n session[:toast_message] = @app['errors'][0]['message']\n redirect_to app_list_path\n return\n end\n # Display success message\n session[:toast_type] = 'status'\n session[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n end",
"def read_appliance_management_service_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_appliance_management_service_status ...\"\n end\n # resource path\n local_var_path = \"/node/services/node-mgmt/status\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeServiceStatusProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_appliance_management_service_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def admin_device_status_params\n params.require(:device_status).permit(:name, :status, :activity_status_id)\n end",
"def get_app_status(app)\n instance = app.web_component_instance || app.component_instances.first\n gear = instance.gears.first\n idle, leave_stopped, _, _ = get_cart_status(gear, instance)\n return idle, leave_stopped\n end",
"def status\n ::HubEdos::Common::Reference::Descriptor.new(@data['status']) if @data['status']\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def manage_items\n @pending_items = Item.find_all_by_item_status_id(1)\n @for_sale_items = Item.find_all_by_item_status_id(2)\n @free_items = Item.find_all_by_item_status_id(3)\n @claimed_items = Item.find_all_by_item_status_id(4)\n @sold_items = Item.find_all_by_item_status_id(5)\n end",
"def get_status\n return @m_status\n end",
"def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end",
"def device_states_list\n get \"deviceStates\"\n end",
"def create\n @app_status = AppStatus.new(app_status_params)\n\n respond_to do |format|\n if @app_status.save\n format.html { redirect_to @app_status, notice: 'App status was successfully created.' }\n format.json { render :show, status: :created, location: @app_status }\n else\n format.html { render :new }\n format.json { render json: @app_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_compute_collection_statuses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiIdentityFirewallMonitoringApi.list_compute_collection_statuses ...'\n end\n # resource path\n local_var_path = '/idfw/compute-collections/status'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IdfwComputeCollectionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiIdentityFirewallMonitoringApi#list_compute_collection_statuses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.79606086",
"0.72728515",
"0.63220656",
"0.56817997",
"0.5501011",
"0.5481292",
"0.5354721",
"0.5318809",
"0.52537566",
"0.5229585",
"0.5186789",
"0.51442635",
"0.5122658",
"0.51043147",
"0.50992763",
"0.50816673",
"0.5009185",
"0.49941427",
"0.4993908",
"0.49923635",
"0.49887228",
"0.4985195",
"0.4958669",
"0.49561864",
"0.49401793",
"0.49129727",
"0.48978284",
"0.48932606",
"0.4877565",
"0.4868021",
"0.48606288",
"0.48483992",
"0.48481634",
"0.48469648",
"0.4839894",
"0.48246852",
"0.48209998",
"0.48200572",
"0.47905812",
"0.47495013",
"0.47465822",
"0.47447595",
"0.47344285",
"0.47304216",
"0.47171772",
"0.47152513",
"0.4697333",
"0.46818203",
"0.46816525",
"0.46815434",
"0.4648269",
"0.46364322",
"0.46207446",
"0.46123436",
"0.46035388",
"0.45857066",
"0.45839173",
"0.4572481",
"0.4559326",
"0.45511958",
"0.45486903",
"0.45475924",
"0.4540495",
"0.45306852",
"0.45292398",
"0.4527417",
"0.4527417",
"0.4527417",
"0.4527417",
"0.45210183",
"0.45137978",
"0.45122468",
"0.45015615",
"0.45009425",
"0.4497798",
"0.44967672",
"0.44953308",
"0.44953308",
"0.44953308",
"0.44929123",
"0.44762802",
"0.44714713",
"0.44714713",
"0.44627586",
"0.44552016",
"0.44526947",
"0.4444236",
"0.44413373",
"0.44397253",
"0.44393858",
"0.44384152",
"0.4432315",
"0.44274962",
"0.44273567",
"0.44272354",
"0.44239",
"0.44149777",
"0.44138637",
"0.44080478",
"0.4397044"
] |
0.7845098
|
1
|
Provides operations to manage the managedEBooks property of the microsoft.graph.deviceAppManagement entity.
|
def managed_e_books()
return MicrosoftGraph::DeviceAppManagement::ManagedEBooks::ManagedEBooksRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_e_books=(value)\n @managed_e_books = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def managed_e_books\n return @managed_e_books\n end",
"def managed_apps\n return @managed_apps\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_models\n @managed_models\n end",
"def manage_books\n\n end",
"def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end",
"def managed_devices\n return @managed_devices\n end",
"def documents_block_managed_documents_in_unmanaged_apps=(value)\n @documents_block_managed_documents_in_unmanaged_apps = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def documents_block_managed_documents_in_unmanaged_apps\n return @documents_block_managed_documents_in_unmanaged_apps\n end",
"def managed\n true\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def documents_block_unmanaged_documents_in_managed_apps\n return @documents_block_unmanaged_documents_in_managed_apps\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_disks\n @managed_disks ||= collect_inventory(:managed_disks) { @sds.list_all }\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def managed?\n @managed.nil? ? true : @managed\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def manage_items\n end",
"def manage\n @managed_orgs = managed_orgs(current_user)\n if (@managed_orgs.present?)\n @managed_jobs = Job.where(:organization_id => @managed_orgs.ids)\n @interviewing_postings = JobPosting.where(:job_id => @managed_jobs.ids, :status => \"interviewing\").order(\"deadline\").paginate(:page => params[:page], :per_page => 10)\n @applications = JobApplication.where(:job_posting_id => @interviewing_postings.ids, :status =>\"interview_scheduled\")\n @interviews = Interview.where(:job_application_id => @applications.ids).order(end_time: :asc)\n end\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def managed?\n (options[:managed].present? && options[:managed] === true)\n end",
"def manage\n\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def index\n @product_managements = ProductManagement.all\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def manage(app_name, instance_name, action)\n case action\n when :checkpoint\n dump_database app_name, instance_name\n when :rollback\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n load_database app_name, instance_name\n configure_rails app_name, instance_name\n migrate_database app_name, instance_name\n when :rekey\n admin_database app_name, instance_name, :rekey\n configure_rails app_name, instance_name\n when :db_reset\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n migrate_database app_name, instance_name\n end\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managedObjectModel\n unless @managedObjectModel\n model_url = NSBundle.mainBundle.URLForResource(\"Hubcap\", withExtension:\"momd\")\n @managedObjectModel = NSManagedObjectModel.alloc.initWithContentsOfURL(model_url)\n end\n\n @managedObjectModel\n end",
"def set_management\n @admin = Admin.find(params[:id])\n @management = Admin.find(params[:id])\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def set_goods_category_management\n @goods_category_management = GoodsCategoryManagement.find(params[:id])\n end",
"def is_managed_attaching_volume?(mapping)\n return 'attached' == mapping[:management_status] && 'attached' != mapping[:volume_status]\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def list_managed_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_managed_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"def add_physical_disks\n add_collection(physical_infra, :physical_disks) do |builder|\n builder.add_properties(\n :manager_ref => %i(physical_storage ems_ref),\n :manager_ref_allowed_nil => %i(ems_ref)\n )\n end\n end",
"def set_management\n @management = Management.friendly.find(params[:id])\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def use_managed_browser=(value)\n @use_managed_browser = value\n end",
"def entitlement_management\n return @entitlement_management\n end",
"def set_product_management\n @product_management = ProductManagement.find(params[:id])\n end",
"def index\n @managements = Management.all\n end",
"def manage\n render \"program/#{@_class.tableize}/manage\", :layout => 'admin'\n end",
"def management(jmx_clazz = org.neo4j.jmx.Primitives, this_db = self.started_db)\n this_db.management(jmx_clazz)\n end",
"def setManagedObjectContext(context)\n super_setManagedObjectContext(context)\n unless @@model_registered\n OSX::CoreData.define_wrapper(managedObjectModel)\n @@model_registered = true\n end\n end",
"def managedObjectModel\n unless @managedObjectModel\n model_url = NSBundle.mainBundle.URLForResource(\"Homebrew\", withExtension:\"momd\")\n @managedObjectModel = NSManagedObjectModel.alloc.initWithContentsOfURL(model_url)\n end\n \n @managedObjectModel\n end",
"def prefer_managed(managed)\n pointer.prefer_managed managed\n end",
"def set_automatic_managed\n converge_by(\"Set pagefile to Automatic Managed\") do\n logger.trace(\"Running Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$true} -PassThru\")\n powershell_exec! <<~EOH\n $sys = Get-CimInstance Win32_ComputerSystem -Property *\n Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$true} -PassThru\n EOH\n end\n end",
"def index\n @users_managements = Users::Management.all\n end",
"def manage_volume_device_assignment(mapping)\n\n # only managed volumes should be in an attached state ready for assignment.\n unless 'attached' == mapping[:management_status]\n raise VolumeManagement::UnexpectedState.new(\"The volume #{mapping[:volume_id]} was in an unexpected managed state: #{mapping.inspect}\")\n end\n\n # check for changes in disks.\n last_disks = InstanceState.planned_volume_state.disks\n last_volumes = InstanceState.planned_volume_state.volumes\n vm = RightScale::Platform.volume_manager\n current_disks = vm.disks\n current_volumes = vm.volumes\n\n # correctly managing device assignment requires expecting precise changes\n # to disks and volumes. any deviation from this requires a retry.\n succeeded = false\n if new_disk = find_distinct_item(current_disks, last_disks, :index)\n # if the new disk as no partitions, then we will format and assign device.\n if vm.partitions(new_disk[:index]).empty?\n # FIX: ignore multiple mount points for simplicity and only only create\n # a single primary partition for the first mount point.\n # if we had the UI for it, then the user would probably specify\n # partition sizes as a percentage of disk size and associate those with\n # mount points formatted optionally specifying file system, label, etc.\n @audit.append_info(\"Creating primary partition and formatting \\\"#{mapping[:mount_points].first}\\\".\")\n vm.format_disk(new_disk[:index], mapping[:mount_points].first)\n succeeded = true\n else\n # FIX: ignoring multiple existing partitiions on a disk (which should\n # result in multiple new volumes appearing when the disk comes online)\n # for simplicity until we have a UI supporting multiple mount points.\n @audit.append_info(\"Preparing \\\"#{mapping[:mount_points].first}\\\" for use.\")\n new_volume = find_distinct_item(current_volumes, last_volumes, :device)\n unless new_volume\n vm.online_disk(new_disk[:index])\n current_volumes = vm.volumes\n new_volume = find_distinct_item(current_volumes, last_volumes, :device)\n end\n if new_volume\n # prefer selection by existing device because it is more reliable in Windows 2003 case.\n unless new_volume[:device] && (0 == new_volume[:device].casecmp(mapping[:mount_points].first))\n device_or_index_to_select = new_volume[:device] || new_volume[:index]\n vm.assign_device(device_or_index_to_select, mapping[:mount_points].first)\n end\n succeeded = true\n end\n end\n end\n\n # retry only if still not assigned.\n if succeeded\n # volume is (finally!) assigned to correct device name.\n mapping[:management_status] = 'assigned'\n mapping[:attempts] = nil\n\n # reset cached volumes/disks for next attempt (to attach), if any.\n InstanceState.planned_volume_state.disks = nil\n InstanceState.planned_volume_state.volumes = nil\n\n # continue.\n yield if block_given?\n else\n mapping[:attempts] ||= 0\n mapping[:attempts] += 1\n if mapping[:attempts] >= VolumeManagement::MAX_VOLUME_ATTEMPTS\n strand(\"Exceeded maximum of #{VolumeManagement::MAX_VOLUME_ATTEMPTS} attempts waiting for volume #{mapping[:volume_id]} to be in a managable state.\")\n else\n yield if block_given?\n end\n end\n rescue Exception => e\n strand(e)\n end",
"def primitive_is_managed?(primitive)\n return unless primitive_exists? primitive\n is_managed = primitives.fetch(primitive).fetch('meta_attributes', {}).fetch('is-managed', {}).fetch('value', 'true')\n is_managed == 'true'\n end",
"def managedObjectModel\n if @managedObjectModel\n return @managedObjectModel\n end\n\n modelURL = OSX::NSBundle.mainBundle.URLForResource_withExtension_(\"NmapR\", \"momd\")\n @managedObjectModel = OSX::NSManagedObjectModel.alloc.initWithContentsOfURL_(modelURL)\n return @managedObjectModel\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def IsManaged\n Read()\n @new_service_id_name != \"network\"\n end",
"def sync_microsoft_store_for_business_apps()\n return MicrosoftGraph::DeviceAppManagement::SyncMicrosoftStoreForBusinessApps::SyncMicrosoftStoreForBusinessAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def appEM\n EmbracerApp.instance\nend",
"def managed_connections\n @@managed_connections\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def management(jmx_clazz = Java::OrgNeo4jJmx::Primitives, this_db = self.started_db)\n this_db.management(jmx_clazz)\n end",
"def manage(klass)\n @@resources.add(klass)\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scaffold_manage_link\n manage = \"manage#{@scaffold_suffix}\"\n \"<br />#{scaffold_link(\"Manage #{@scaffold_options[:plural_lc_human_name]}\", manage)}\" if scaffolded_method?(manage)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def controller_power\n EntitiesPower.new(application_context)\n end",
"def set_ebook\n @ebooks = Ebook.find(params[:id])\n end",
"def is_managed_attached_unassigned_volume?(mapping)\n return 'attached' == mapping[:volume_status] && 'attached' == mapping[:management_status]\n end",
"def set_medical_equipment\n @medical_equipment = MedicalEquipment.find(params[:id])\n end",
"def managed_checkbox?\n !programme_dropdown? &&\n Programme.site_managed_programme.present? &&\n Programme.can_create?\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def managed_collection_ids\n Hyrax::Collections::PermissionsService.source_ids_for_manage(ability: @ability)\n end",
"def managedObjectModel\n if @managedObjectModel\n return @managedObjectModel\n end\n \n @managedObjectModel = NSManagedObjectModel.mergedModelFromBundles(nil)\n return @managedObjectModel\n end",
"def management\n prepareBaseContext\n end",
"def managed_only?\n !programme_dropdown? &&\n Programme.site_managed_programme.present? &&\n !Programme.can_create?\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_hardware_types = Admin::HardwareType.all\n end",
"def set_manage_admin\n @manage_admin = Manage::Admin.find(params[:id])\n end"
] |
[
"0.6486972",
"0.6339535",
"0.6086713",
"0.59717584",
"0.57540375",
"0.5637973",
"0.5522624",
"0.54124457",
"0.53652656",
"0.5345044",
"0.5313149",
"0.5286193",
"0.526265",
"0.522382",
"0.51898265",
"0.5176836",
"0.51441675",
"0.5120621",
"0.5119191",
"0.51069444",
"0.5078245",
"0.5077232",
"0.50490975",
"0.50176394",
"0.499302",
"0.49890488",
"0.49144918",
"0.48911273",
"0.4890532",
"0.4889434",
"0.48832026",
"0.48801506",
"0.486857",
"0.48581225",
"0.4855355",
"0.48266488",
"0.48083186",
"0.4780253",
"0.47472507",
"0.47428358",
"0.46807548",
"0.46111423",
"0.45992708",
"0.45826936",
"0.45551407",
"0.4534371",
"0.45311055",
"0.44867182",
"0.44840723",
"0.4449109",
"0.44489098",
"0.4439651",
"0.44372046",
"0.44336185",
"0.4433501",
"0.44249526",
"0.44190285",
"0.43936568",
"0.4390257",
"0.4376514",
"0.43705422",
"0.4364835",
"0.43546495",
"0.4351564",
"0.43444273",
"0.43407112",
"0.43068138",
"0.43002343",
"0.42447928",
"0.42427734",
"0.42405245",
"0.4234341",
"0.4204673",
"0.4195626",
"0.41951284",
"0.4186177",
"0.4183943",
"0.41839164",
"0.41690606",
"0.41623625",
"0.41439313",
"0.41328093",
"0.41141397",
"0.4111002",
"0.41090542",
"0.41088834",
"0.41068807",
"0.41016993",
"0.40981007",
"0.4094742",
"0.40940967",
"0.40938896",
"0.4085953",
"0.40855616",
"0.40823072",
"0.40802255",
"0.40770167",
"0.40731126",
"0.4068879",
"0.40638337"
] |
0.69566834
|
0
|
Provides operations to manage the mdmWindowsInformationProtectionPolicies property of the microsoft.graph.deviceAppManagement entity.
|
def mdm_windows_information_protection_policies()
return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def windows_information_protection_policies\n return @windows_information_protection_policies\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def android_managed_app_protections=(value)\n @android_managed_app_protections = value\n end",
"def windows_protection_state()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::WindowsProtectionState::WindowsProtectionStateRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections\n return @android_managed_app_protections\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def information_protection()\n return MicrosoftGraph::InformationProtection::InformationProtectionRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsInformationProtection\"\n end",
"def med_network_policy\n info 'os10_lldp_interface::med_network_policy'\n begin\n lldp_interface_med = @lldp_intf[:'lldp-med-cfg'] || {}\n @lldp_med_nw_policy = lldp_interface_med[:'policy-id'] || []\n info \"lldp med policy #{@lldp_med_nw_policy}\"\n return [@lldp_med_nw_policy] if @lldp_med_nw_policy.class == String\n return @lldp_med_nw_policy\n rescue Exception => e\n err 'Exception in network policy'\n err e.message\n err e.backtrace[0]\n raise\n end\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def azure_rights_management_services_allowed\n return @azure_rights_management_services_allowed\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def windows_mobile_restriction\n return @windows_mobile_restriction\n end",
"def control_availability\n dpms_availability\n end",
"def upi_power_management=(upi_power_management)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(upi_power_management)\n fail ArgumentError, \"invalid value for \\\"upi_power_management\\\", must be one of #{validator.allowable_values}.\"\n end\n @upi_power_management = upi_power_management\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def account_manager_policy=(value)\n @account_manager_policy = value\n end",
"def entitlement_management\n return @entitlement_management\n end",
"def set_management\n @admin = Admin.find(params[:id])\n @management = Admin.find(params[:id])\n end",
"def managed_apps\n return @managed_apps\n end",
"def set_material_management\n @material_management = MaterialManagement.find(params[:id])\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.targetedManagedAppProtection\"\n end",
"def get_field_deserializers()\n return super.merge({\n \"androidManagedAppProtections\" => lambda {|n| @android_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AndroidManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"defaultManagedAppProtections\" => lambda {|n| @default_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DefaultManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"iosManagedAppProtections\" => lambda {|n| @ios_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IosManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"isEnabledForMicrosoftStoreForBusiness\" => lambda {|n| @is_enabled_for_microsoft_store_for_business = n.get_boolean_value() },\n \"managedAppPolicies\" => lambda {|n| @managed_app_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"managedAppRegistrations\" => lambda {|n| @managed_app_registrations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppRegistration.create_from_discriminator_value(pn) }) },\n \"managedAppStatuses\" => lambda {|n| @managed_app_statuses = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppStatus.create_from_discriminator_value(pn) }) },\n \"managedEBooks\" => lambda {|n| @managed_e_books = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedEBook.create_from_discriminator_value(pn) }) },\n \"mdmWindowsInformationProtectionPolicies\" => lambda {|n| @mdm_windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MdmWindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n \"microsoftStoreForBusinessLanguage\" => lambda {|n| @microsoft_store_for_business_language = n.get_string_value() },\n \"microsoftStoreForBusinessLastCompletedApplicationSyncTime\" => lambda {|n| @microsoft_store_for_business_last_completed_application_sync_time = n.get_date_time_value() },\n \"microsoftStoreForBusinessLastSuccessfulSyncDateTime\" => lambda {|n| @microsoft_store_for_business_last_successful_sync_date_time = n.get_date_time_value() },\n \"mobileAppCategories\" => lambda {|n| @mobile_app_categories = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppCategory.create_from_discriminator_value(pn) }) },\n \"mobileAppConfigurations\" => lambda {|n| @mobile_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDeviceMobileAppConfiguration.create_from_discriminator_value(pn) }) },\n \"mobileApps\" => lambda {|n| @mobile_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileApp.create_from_discriminator_value(pn) }) },\n \"targetedManagedAppConfigurations\" => lambda {|n| @targeted_managed_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppConfiguration.create_from_discriminator_value(pn) }) },\n \"vppTokens\" => lambda {|n| @vpp_tokens = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::VppToken.create_from_discriminator_value(pn) }) },\n \"windowsInformationProtectionPolicies\" => lambda {|n| @windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n })\n end",
"def windows_mobile_restriction=(value)\n @windows_mobile_restriction = value\n end",
"def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def group_policies\r\n GroupPoliciesController.instance\r\n end",
"def managed_devices\n return @managed_devices\n end",
"def set_management\n @management = Management.friendly.find(params[:id])\n end",
"def work_profile_default_app_permission_policy\n return @work_profile_default_app_permission_policy\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def supported_privilege_set\n nil\n end",
"def manage_content_profiles\n @page_controls = content_service.handle_content_profile_management(params.to_unsafe_h)\n flash[:notice] = @page_controls.message if @page_controls.message?\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def protect(base, length = nil, protection = nil)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_PROTECT)\n\n if (length == nil)\n length = 4096\n end\n\n # If no protection was supplied, default to the most flexible\n if (protection == nil)\n protection = PAGE_EXECUTE_READWRITE\n else\n protection = gen_prot_to_specific(protection)\n end\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_LENGTH, length)\n request.add_tlv(TLV_TYPE_PROTECTION, protection)\n\n # Send the request\n response = process.client.send_request(request)\n\n # Return the old protection to the caller\n return specific_prot_to_gen(response.get_tlv_value(TLV_TYPE_PROTECTION))\n end",
"def permissions_policy(&block); end",
"def deletion_protection\n data[:deletion_protection]\n end",
"def deletion_protection\n data[:deletion_protection]\n end",
"def protections\n @descriptive_detail.protections\n end",
"def supported_privilege_set\n nil\n end",
"def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end",
"def set_product_management\n @product_management = ProductManagement.find(params[:id])\n end",
"def assert_pm_scoped_privilege_expectations\n users_or_attributes = policy_machine.users | policy_machine.user_attributes\n objects_or_attributes = policy_machine.objects | policy_machine.object_attributes\n users_or_attributes.product(objects_or_attributes) do |u, o|\n expected_scoped_privileges = policy_machine.operations.reject(&:prohibition?).grep(->op{policy_machine.is_privilege?(u, op.unique_identifier, o)}) do |op|\n [u, op, o]\n end\n expect(policy_machine.scoped_privileges(u,o)).to match_array(expected_scoped_privileges)\n end\n\nend",
"def account_manager_policy\n return @account_manager_policy\n end",
"def windows_restriction\n return @windows_restriction\n end",
"def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end",
"def set_manifestation_custom_property\n @manifestation_custom_property = ManifestationCustomProperty.find(params[:id])\n authorize @manifestation_custom_property\n end",
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def migrate_permissions_for(object)\n # Find any access controls for this work. The must be sufia6F style in order to not show up on the Work.\n legacy_access_controls = access_controls_for object\n puts \"#{legacy_access_controls.count} AccessControls for #{object.class}: #{object.id}\"\n puts \"#{object.permissions}\"\n\n # Create equivalent access controls\n self.class.make_equivalent_permissions( object, legacy_access_controls )\n puts \"Created equivalent permissions.\"\n puts \"#{object.permissions}\"\n\n # Destroy legacy_access_controls\n if object.save\n puts \"Able to save #{object.class} with new permissions. Destroying old access controls.\"\n legacy_access_controls.each{ |ac| ac.destroy }\n else\n puts \"Unable to save #{object.class}.\"\n end\n end",
"def admin_update_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n perms_ids = params[:perm_ids].blank? ? [] : params[:perm_ids].map(&:to_i)\n perms = Perm.where( id: perms_ids)\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n if ! perms.include? perm\n @user.perms.delete(perm)\n if perm.id == Perm.use_api.id\n @user.remove_token!\n end\n end\n else\n if perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n end\n end\n end\n end\n\n if @user.save!\n redirect_to({controller: 'users', action: 'admin_index'}, {notice: _('Information was successfully updated.')}) # helpers.success key does not exist, replaced with a generic string\n else\n flash[:notice] = failed_update_error(@user, _('user'))\n end\n end",
"def update\n respond_to do |format|\n if @permission_policy.update(permission_policy_params)\n format.html { redirect_to @permission_policy, notice: 'Permission policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @permission_policy }\n else\n format.html { render :edit }\n format.json { render json: @permission_policy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_permission_policy\n @permission_policy = PermissionPolicy.find(params[:id])\n end",
"def implied_perms_for(permissions)\n implied_permissions = []\n permissions.each do |p|\n next if p.class_name.to_sym == :any\n next unless p.target_class_exists?\n p.target_class.sg_priv_to_implied_privs[p.privilege].each do |pi|\n\tp_new = p.dup\n\tp_new.privilege = pi\n\timplied_permissions << p_new\n\tend\n end\n implied_permissions \n end",
"def get_field_deserializers()\n return super.merge({\n \"assignments\" => lambda {|n| @assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppPolicyAssignment.create_from_discriminator_value(pn) }) },\n \"azureRightsManagementServicesAllowed\" => lambda {|n| @azure_rights_management_services_allowed = n.get_boolean_value() },\n \"dataRecoveryCertificate\" => lambda {|n| @data_recovery_certificate = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionDataRecoveryCertificate.create_from_discriminator_value(pn) }) },\n \"enforcementLevel\" => lambda {|n| @enforcement_level = n.get_enum_value(MicrosoftGraph::Models::WindowsInformationProtectionEnforcementLevel) },\n \"enterpriseDomain\" => lambda {|n| @enterprise_domain = n.get_string_value() },\n \"enterpriseIPRanges\" => lambda {|n| @enterprise_i_p_ranges = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionIPRangeCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseIPRangesAreAuthoritative\" => lambda {|n| @enterprise_i_p_ranges_are_authoritative = n.get_boolean_value() },\n \"enterpriseInternalProxyServers\" => lambda {|n| @enterprise_internal_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseNetworkDomainNames\" => lambda {|n| @enterprise_network_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProtectedDomainNames\" => lambda {|n| @enterprise_protected_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxiedDomains\" => lambda {|n| @enterprise_proxied_domains = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionProxiedDomainCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServers\" => lambda {|n| @enterprise_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServersAreAuthoritative\" => lambda {|n| @enterprise_proxy_servers_are_authoritative = n.get_boolean_value() },\n \"exemptAppLockerFiles\" => lambda {|n| @exempt_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"exemptApps\" => lambda {|n| @exempt_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"iconsVisible\" => lambda {|n| @icons_visible = n.get_boolean_value() },\n \"indexingEncryptedStoresOrItemsBlocked\" => lambda {|n| @indexing_encrypted_stores_or_items_blocked = n.get_boolean_value() },\n \"isAssigned\" => lambda {|n| @is_assigned = n.get_boolean_value() },\n \"neutralDomainResources\" => lambda {|n| @neutral_domain_resources = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"protectedAppLockerFiles\" => lambda {|n| @protected_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"protectedApps\" => lambda {|n| @protected_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"protectionUnderLockConfigRequired\" => lambda {|n| @protection_under_lock_config_required = n.get_boolean_value() },\n \"revokeOnUnenrollDisabled\" => lambda {|n| @revoke_on_unenroll_disabled = n.get_boolean_value() },\n \"rightsManagementServicesTemplateId\" => lambda {|n| @rights_management_services_template_id = n.get_guid_value() },\n \"smbAutoEncryptedFileExtensions\" => lambda {|n| @smb_auto_encrypted_file_extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n })\n end",
"def windows_restriction=(value)\n @windows_restriction = value\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def cpu_power_management=(cpu_power_management)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"custom\", \"disabled\", \"energy-efficient\", \"performance\"])\n unless validator.valid?(cpu_power_management)\n fail ArgumentError, \"invalid value for \\\"cpu_power_management\\\", must be one of #{validator.allowable_values}.\"\n end\n @cpu_power_management = cpu_power_management\n end",
"def enable_termination_protection\n data[:enable_termination_protection]\n end",
"def controller_power\n raise I18n.t(:error_param_scope) if params[:role_id].blank?\n \n Roles::PermissionsPower.new(application_context, params[:role_id])\n end",
"def work_profile_default_app_permission_policy=(value)\n @work_profile_default_app_permission_policy = value\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"androidManagedAppProtections\", @android_managed_app_protections)\n writer.write_collection_of_object_values(\"defaultManagedAppProtections\", @default_managed_app_protections)\n writer.write_collection_of_object_values(\"iosManagedAppProtections\", @ios_managed_app_protections)\n writer.write_boolean_value(\"isEnabledForMicrosoftStoreForBusiness\", @is_enabled_for_microsoft_store_for_business)\n writer.write_collection_of_object_values(\"managedAppPolicies\", @managed_app_policies)\n writer.write_collection_of_object_values(\"managedAppRegistrations\", @managed_app_registrations)\n writer.write_collection_of_object_values(\"managedAppStatuses\", @managed_app_statuses)\n writer.write_collection_of_object_values(\"managedEBooks\", @managed_e_books)\n writer.write_collection_of_object_values(\"mdmWindowsInformationProtectionPolicies\", @mdm_windows_information_protection_policies)\n writer.write_string_value(\"microsoftStoreForBusinessLanguage\", @microsoft_store_for_business_language)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastCompletedApplicationSyncTime\", @microsoft_store_for_business_last_completed_application_sync_time)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastSuccessfulSyncDateTime\", @microsoft_store_for_business_last_successful_sync_date_time)\n writer.write_collection_of_object_values(\"mobileAppCategories\", @mobile_app_categories)\n writer.write_collection_of_object_values(\"mobileAppConfigurations\", @mobile_app_configurations)\n writer.write_collection_of_object_values(\"mobileApps\", @mobile_apps)\n writer.write_collection_of_object_values(\"targetedManagedAppConfigurations\", @targeted_managed_app_configurations)\n writer.write_collection_of_object_values(\"vppTokens\", @vpp_tokens)\n writer.write_collection_of_object_values(\"windowsInformationProtectionPolicies\", @windows_information_protection_policies)\n end",
"def set_resource_management4\n @resource_management4 = ResourceManagement4.find(params[:id])\n end",
"def device_compliance_policy_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceCompliancePolicyStates::DeviceCompliancePolicyStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def management_interface_settings\r\n ManagementInterfaceSettingsController.instance\r\n end",
"def med_network_policy=(should_med_network_policy)\n info \"os10_lldp_interface::med_network_policy=#{should_med_network_policy}\"\n begin\n conf_lines = []\n if med_network_policy\n remove = med_network_policy - should_med_network_policy\n remove.each do |policy|\n conf_lines << \"interface #{@interface_name}\"\n conf_lines << \"lldp med network-policy remove #{policy}\"\n end\n end\n if should_med_network_policy\n should_med_network_policy.each do |policy|\n conf_lines << \"interface #{@interface_name}\"\n conf_lines << \"lldp med network-policy add #{policy}\"\n end\n end\n conf_lines.each { |value| info value }\n ecc conf_lines\n return\n rescue Exception => e\n err 'Exception in network policy='\n err e.message\n err e.backtrace[0]\n raise\n end\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:extension_id, :version)))\n end",
"def protected_apps=(value)\n @protected_apps = value\n end",
"def management_params\n params.require(:management).permit(:name, :last_name, :post, :Work_Experience, :image)\n end",
"def managed_models\n @managed_models\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def disable_power_policies\n return @disable_power_policies\n end"
] |
[
"0.7528585",
"0.71643025",
"0.71293247",
"0.6655285",
"0.62881017",
"0.61900556",
"0.6021546",
"0.59574395",
"0.5909645",
"0.5811215",
"0.5615959",
"0.5498525",
"0.5464466",
"0.5408088",
"0.5201753",
"0.51493996",
"0.5114892",
"0.49813446",
"0.4949016",
"0.4862762",
"0.4859275",
"0.4809843",
"0.4795448",
"0.47116938",
"0.4684616",
"0.46241945",
"0.46063015",
"0.45673138",
"0.45350012",
"0.45306242",
"0.4526214",
"0.45242202",
"0.44876614",
"0.44842553",
"0.44837847",
"0.44725326",
"0.4446892",
"0.4438957",
"0.44254845",
"0.44096476",
"0.44052267",
"0.43873438",
"0.4385543",
"0.43790188",
"0.4368437",
"0.4368123",
"0.43491182",
"0.43479866",
"0.4330513",
"0.43117297",
"0.43113363",
"0.42987534",
"0.4292009",
"0.42914757",
"0.42902216",
"0.42396098",
"0.42375204",
"0.42354307",
"0.42309082",
"0.42087355",
"0.41986817",
"0.41967326",
"0.4188391",
"0.4181865",
"0.4181865",
"0.4166777",
"0.41473833",
"0.41443753",
"0.41315758",
"0.41220245",
"0.4121629",
"0.41145822",
"0.4111777",
"0.41067898",
"0.41040397",
"0.40820006",
"0.40749308",
"0.40712926",
"0.40705976",
"0.4058506",
"0.40564495",
"0.40458494",
"0.4040814",
"0.4035724",
"0.40356666",
"0.40177673",
"0.40166456",
"0.40157822",
"0.40096742",
"0.40043312",
"0.40018082",
"0.39969647",
"0.3993938",
"0.39885998",
"0.39807817",
"0.39768407",
"0.39762667",
"0.39691803",
"0.39686817",
"0.3963566"
] |
0.7908284
|
0
|
Provides operations to manage the mobileAppCategories property of the microsoft.graph.deviceAppManagement entity.
|
def mobile_app_categories()
return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"def mobile_app_categories\n return @mobile_app_categories\n end",
"def mx_l7_application_categories\r\n MXL7ApplicationCategoriesController.instance\r\n end",
"def device_category()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceCategory::DeviceCategoryRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def categories_mobile\n click_mobile_menu\n get_mobile_menu_element('menu')\n end",
"def set_mcategory\n @mcategory = Mcategory.find(params[:id])\n end",
"def set_mcategory\n @mcategory = Mcategory.find(params[:id])\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mcategory(id)\n @mcategory = Mcategory.find(id)\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def index\n @mcategories = Mcategory.all\n end",
"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",
"def set_category\n end",
"def category\n conf['category'] || 'apps'\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update_magento_category\n self.stores.each do |store|\n response = API::SOAP::Catalog::Category.update(self, store)\n\n unless response.success?\n errors.add(:base, response.body[:faultstring])\n return false\n end\n end\n\n self.sync_needed = false\n return true\n end",
"def get_menu_category\n require \"rest_client\"\n require \"json\"\n\n self.categories.update_all(still_present: false)\n response = RestClient.get(\"https://api.omnivore.io/0.1/locations/#{self.omnivore_id}/menu/categories\", {:content_type => :json, :'Api-Key' => Setting.first.app_api_key})\n res = JSON.parse(response)\n res[\"_embedded\"][\"categories\"].each do |category|\n cat = self.categories.where(omnivore_id: category[\"id\"]).first_or_create\n cat.name = category[\"name\"]\n cat.still_present = true\n cat.save\n end\n\n self.categories.where(still_present: false).destroy_all\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_physical_category\n @physical_category = PhysicalCategory.find(params[:id])\n end",
"def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def update\n MediaCategory.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_medias_path\n end",
"def update_category_lists\n\t\tall_list = CategoryList.all_list\n\t\thome_list = CategoryList.home_list\n\t\tif is_predefined\n\t\t\tall_list.categories << self unless category_lists.include? all_list\n\t\t\tif home_page_column\n\t\t\t\thome_list.categories << self unless category_lists.include? home_list\n\t\t\telse\n\t\t\t\thome_list.categories.delete self if category_lists.include? home_list\n\t\t\tend\n\t\telse\n\t\t\tall_list.categories.delete self if category_lists.include? all_list\n\t\t\thome_list.categories.delete self if category_lists.include? home_list\n\t\tend\n\tend",
"def categories=(value)\n @categories = value\n end",
"def create\n MediaCategory.create\n\n redirect_to admin_medias_path\n end",
"def update_keyword_categories(data=nil,generate_objects=false)\n uri = URI.parse(@uri + \"/KeywordCategories\")\n results = put(uri,data,generate_objects)\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def assign_categories_for_admin\n categories = Category.all\n @categories = []\n categories.each { |category| @categories << [category.name, category.id] }\n end",
"def conceptual_categories\n @conceptual_categories ||= Fotolia::ConceptualCategories.new(self)\n end",
"def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end",
"def categories=(value)\n\t\t@categories = value\n\tend",
"def categories=(value)\n\t\t@categories = value\n\tend",
"def categories=(value)\n\t\t@categories = value\n\tend",
"def categories\n add_to_query restrict_kind: 'category'\n end",
"def set_goods_category_management\n @goods_category_management = GoodsCategoryManagement.find(params[:id])\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def categories=(value)\n @categories = value\n end",
"def categories=(value)\n @categories = value\n end",
"def categories=(value)\n @categories = value\n end",
"def create\n @mcategory = Mcategory.new(mcategory_params)\n @mcategory.user_id = current_user.id\n respond_to do |format|\n if @mcategory.save\n format.html { redirect_to root_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @mcategory }\n else\n format.html { render :new }\n format.json { render json: @mcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_categories(operation)\n category_names = operation.kind.split(\";\")\n\n category_names.each do |name| \n category = find_or_create_category(name)\n category.operations.push(operation)\n end\n end",
"def set_admin_category\n @category = Category.find(params[:id])\n end",
"def set_categories\n @categories = Category.all\n end",
"def set_category_system\n @category_system = CategorySystem.find(params[:id])\n end",
"def targeting_app_store_categories(options = {})\n get('/targeting_criteria/app_store_categories', options)\n end",
"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",
"def set_admin_category\n @admin_category = Admin::Category.friendly.find(params[:id])\n end",
"def categories\n expose Metadata.categories(@oauth_token)\n end",
"def create_magento_category\n response = API::SOAP::Catalog::Category.create(self, self.stores.first)\n\n if response.success?\n self.magento_id = response.body[:attribute_id]\n self.sync_needed = false\n\n self.stores.each_with_index do |store, index|\n next if index == 0\n response = API::SOAP::Catalog::Category.update(self, store)\n\n # If there was a problem updating on of the stores, then make sure the product will be synced on next save.\n # The product needs to be saved regardless, since a Magento product was created and the id must be set. So,\n # this will not return false.\n self.sync_needed = true unless response.success?\n end\n\n\n return true\n else\n errors.add(:base, response.body[:faultstring])\n return false\n end\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def set_category\n\t\tself.category_type=\"Main\"\n\t\tself.save\n\tend",
"def set_categories(ids)\n self.categories = Category.find(ids)\n self.save\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def index\n @physical_categories = PhysicalCategory.all\n \n @physical_category = PhysicalCategory.new\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def set_admin_category\n @admin_category = Admin::Category.find(params[:id])\n end",
"def cat_perms\n ident = :categories\n text = 'Forum permissions'\n desc = 'All permissions that have to do with the forums'\n id_based = false\n options = [:true, :false, :flow]\n def_option = :flow\n\n forum_global = write_permission_group(ident, text, desc, options, def_option)\n\n text = 'See this category'\n desc = 'Gives the user the ability to view this category'\n g = write_permission(text, desc, :see, options, def_option)\n g.add_to_group(forum_global)\n\n text = 'Mass Moderate'\n desc = 'Gives the user the ability to perform mass moderation actions in this category'\n g = write_permission(text, desc, :mass_moderate, options, def_option)\n g.add_to_group(forum_global)\n\n text = 'Create discussions this category'\n desc = 'Gives the user the ability to creat discussions in this category'\n g = write_permission(text, desc, :create, options, def_option)\n g.add_to_group(forum_global)\n\n states = [:normal, :archived, :locked, :stickied]\n\n # Actions\n ident = :actions\n parent_text = '{0} discussions in this category'\n parent_desc = 'Gives the user the ability to {0} to discussions in this category'\n options = [:all, :own, :false, :flow]\n def_option = :flow\n\n actions = write_permission_group(ident, 'Actions', 'Actions corresponding to the root discussion object', options, def_option)\n\n [:sticky, :tag, :lock, :archive].each do |action|\n text = translate_text(parent_text, action.to_s.gsub('_', ' ').capitalize)\n desc = translate_text(parent_desc, action.to_s.gsub('_', ' ').capitalize)\n g = write_permission(text, desc, action, options, def_option)\n g.add_to_group(actions)\n end\n\n actions.add_to_group(forum_global)\n\n # Edit\n ident = 'Discussion States - Edit'\n edit_parent_text = 'Edit {0} discussions in this category'\n edit_parent_desc = 'Gives the user the ability to edit {0} discussions in this category'\n edit = write_permission_group(:edit, ident, 'Permissions for each discussion state in regards to editing', options, def_option)\n # View\n ident = 'Discussion States - View'\n view_parent_text = '{0} {1} discussions in this category'\n view_parent_desc = 'Gives the user the ability to {0} {1} discussions in this category'\n view = write_permission_group(:view, ident, 'Permissions for each discussion state in regards to viewing', options, def_option)\n\n states.each do |action|\n edit_text = translate_text(edit_parent_text, 'Edit', action)\n edit_desc = translate_text(edit_parent_desc, 'Edit', action)\n view_text = translate_text(view_parent_text, 'View', action)\n view_desc = translate_text(view_parent_desc, 'View', action)\n g = write_permission(edit_text, edit_desc, action, options, def_option)\n g1 = write_permission(view_text, view_desc, action, options, def_option)\n g.add_to_group(edit)\n g1.add_to_group(view)\n end\n\n edit.add_to_group(forum_global)\n view.add_to_group(forum_global)\n\n # Reply To\n ident = 'Discussion States - Reply'\n parent_text = 'Reply to {0} discussions in this category'\n parent_desc = 'Gives the user the ability to reply to {0} discussions in this category'\n reply_to = write_permission_group(:reply_to, ident, 'Permissions dealing with replying to different discussion states', options, def_option)\n\n states.each do |action|\n text = translate_text(parent_text, action)\n desc = translate_text(parent_desc, action)\n g = write_permission(text, desc, action, options, def_option)\n g.add_to_group(reply_to)\n end\n\n reply_to.add_to_group(forum_global)\n\n # Replies\n ident = 'Replies'\n parent_text = '{0} {1} replies in this category'\n parent_desc = 'Gives the user the ability to {0} {1} replies in this category'\n replies = write_permission_group(:replies, ident, 'Permissions dealing with replies', options, def_option)\n\n # Edit\n edit = write_permission_group(:edit, 'Replies - Edit', 'Permissions dealing with editing replies', options, def_option)\n\n [:normal, :archived].each do |action|\n text = translate_text(parent_text, 'Edit', action)\n desc = translate_text(parent_desc, 'Edit', action)\n g = write_permission(text, desc, action, options, def_option)\n g.add_to_group(edit)\n end\n\n edit.add_to_group(replies)\n\n actions = write_permission_group(:actions, 'Replies - Actions', 'Permissions dealing with performing actions on replies', options, def_option)\n\n # Archive\n text = translate_text(parent_text, 'Archive', '')\n desc = translate_text(parent_text, 'Archive', '')\n g = write_permission(text, desc, :archive, options, def_option)\n g.add_to_group(actions)\n\n # Sanction\n text = translate_text(parent_text, 'Sanction', '')\n desc = translate_text(parent_text, 'Sanction', '')\n g = write_permission(text, desc, :sanction, options, def_option)\n g.add_to_group(actions)\n\n # Override Time\n text = 'Override post cooldown time'\n desc = 'Gives the user the ability to override the post cooldown time in this category'\n g = write_permission(text, desc, :override_time, [:true, :false, :flow], def_option)\n g.add_to_group(actions)\n\n actions.add_to_group(replies)\n\n # View\n view = write_permission_group(:view, 'Replies - View', 'Permissions dealing with viewing replies', options, def_option)\n\n # Archived\n text = 'View archived replies'\n desc = 'Gives the user the ability to view archived topics in this category'\n g = write_permission(text, desc, :archived, options, def_option)\n g.add_to_group(view)\n\n # Revisions\n text = \"View a post's revisions\"\n desc = 'Gives the user the ability to view revisions from posts in this category'\n g = write_permission(text, desc, :revisions, options, def_option)\n g.add_to_group(view)\n\n view.add_to_group(replies)\n\n replies.add_to_group(forum_global)\n\n global_options = {\n text: 'Forums',\n desc: 'All permissions that have to do with the forums',\n options: options,\n def_option: def_option\n }\n\n PermissionsGenerator.new('Forums', true, global_options, forum_global, [])\nend",
"def category\n ActiveModel::SerializableResource.new(object.category, each_serializer: CategoriesSerializer)\n end",
"def set_admin_category\n @admin_category = Category.find(params[:id])\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def graph_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphMobileLobApp::GraphMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_mobile_type_list\n @mobile_type_list = MobileTypeList.find(params[:id])\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"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",
"def set_item_category\n @item_category = current_company.item_categories.friendly.find(params[:id]) || []\n end",
"def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_category_mod\n @category_mod = CategoryMod.find(params[:id])\n end",
"def set_categories\n\t\t@categories = Category.all\t\n\tend",
"def categories=(categories)\n end",
"def check_validity_of_application_category\n unless application_category.nil? || application_type.nil?\n application_category.reload && application_type.reload\n self.application_category_id = nil unless application_category.offering_application_type_id == application_type_id\n end\n end",
"def categories_items\n all_items = self.all_active_items\n categories_given_items(all_items)\n end",
"def update_project_keyword_categories(data=nil,generate_objects=false)\n uri = URI.parse(@uri + \"/ProjectKeywordCategories\")\n results = put(uri,data,generate_objects)\n end",
"def set_backend_category\n @backend_category = Backend::Category.find(params[:id])\n end",
"def category(category)\n self.category = category\n self\n end",
"def category(category)\n self.category = category\n self\n end",
"def set_category\n @categories = Category.find(params[:id])\n end",
"def managed_apps\n return @managed_apps\n end",
"def set_category\n @categories = Category.friendly.find(params[:id])\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end"
] |
[
"0.7375698",
"0.6684424",
"0.58831906",
"0.5819288",
"0.5618737",
"0.5590688",
"0.5517008",
"0.5508222",
"0.53401375",
"0.53401375",
"0.53374296",
"0.51919377",
"0.5146399",
"0.5146399",
"0.5131816",
"0.5037006",
"0.50210446",
"0.5013232",
"0.49747172",
"0.49650228",
"0.49510092",
"0.4938671",
"0.4930315",
"0.48820502",
"0.48714742",
"0.48603532",
"0.48512703",
"0.48326516",
"0.4794056",
"0.4767524",
"0.4765017",
"0.47524974",
"0.4735534",
"0.47247764",
"0.47104543",
"0.47088513",
"0.4701351",
"0.46887338",
"0.4677493",
"0.46672228",
"0.46672228",
"0.46672228",
"0.46627244",
"0.46585742",
"0.4655278",
"0.46537936",
"0.46519238",
"0.4647713",
"0.46420974",
"0.46420974",
"0.46420974",
"0.46388355",
"0.46355706",
"0.4630256",
"0.4626506",
"0.46250677",
"0.46123075",
"0.46086156",
"0.45972586",
"0.45918438",
"0.45880166",
"0.45771652",
"0.45695925",
"0.4564183",
"0.4564183",
"0.4564183",
"0.4564183",
"0.4564183",
"0.4564183",
"0.45613292",
"0.45536318",
"0.45480964",
"0.4543427",
"0.4543314",
"0.45404753",
"0.4534709",
"0.45337513",
"0.4531762",
"0.4528823",
"0.45220098",
"0.45199504",
"0.45195824",
"0.45112935",
"0.45088243",
"0.4486127",
"0.447895",
"0.4476445",
"0.44609",
"0.44571424",
"0.4455947",
"0.44472146",
"0.4439019",
"0.4438201",
"0.4435169",
"0.44193673",
"0.44193673",
"0.4412187",
"0.44102573",
"0.44022727",
"0.4399236"
] |
0.74035686
|
0
|
Provides operations to manage the mobileAppConfigurations property of the microsoft.graph.deviceAppManagement entity.
|
def mobile_app_configurations()
return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def mobile_app_categories()\n return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"def managed_apps\n return @managed_apps\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_mapp\n @mapp = Mapp.find(params[:id])\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def mobile_app_categories\n return @mobile_app_categories\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_devices\n return @managed_devices\n end",
"def graph_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphMobileLobApp::GraphMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mobile_app_params\n params.require(:mobile_app).permit(:name, :description, :image_url, :store_link)\n end",
"def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully created.' }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apps=(value)\n @apps = value\n end",
"def get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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] || 'InlineResponse2003' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def mobile_app_params\n params.require(:mobile_app).permit( :name, :short_description, :long_description, :icon_url,\n :language, :agency_tokens, :user_tokens, :tag_tokens, :primary_contact_id, :secondary_contact_id, :primary_agency_id, :secondary_agency_id, :notes, mobile_app_versions_attributes: [:id, :store_url,:platform,\n :version_number,:publish_date,:description,:whats_new,:screenshot,:device,\n :language,:average_rating,:number_of_ratings, :_destroy])\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def client_applications=(value)\n @client_applications = value\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def appstore_apps_message(app_id)\n response = connection.post(get_appstore_apps_message_url(app_id)) do |request|\n request.headers[CONTENT_TYPE] = APPLICATION_JSON\n request.params[:adminDeviceSpaceId] = \"1\"\n request.body = JSON.dump({ installIncluded: true, updateIncluded: true, pushApp: true })\n end\n\n if response.success?\n AppStoreAppsMessageResponse.new(response.body)\n end\n end",
"def new\n @mobile_app = MobileApp.new\n @mobile_app.language = \"English\"\n if current_user.agency\n @mobile_app.primary_agency_id = current_user.agency.id\n end\n @mobile_app.primary_contact_id = current_user.id\n @mobile_app.mobile_app_versions.build\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def new\n @mobileapp = Mobileapp.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mobileapp }\n end\n end",
"def applications\n apps = {}\n Dir[File.join(@path, '*')].each do |store_dir|\n name = File.basename(store_dir)\n \n apps[name] = ApplicationConfiguration.new name, store_dir\n end\n \n apps\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n @mobile_app.build_notifications(:created)\n @mobile_app.published!\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully created.\" }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n if @mobile_app.mobile_app_versions.empty?\n @mobile_app.mobile_app_versions.build\n end\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_config\n @app_config = AppConfig.find(params[:id])\n end",
"def applications_list\n get \"applications\"\n end",
"def by_mobile_app_id(mobile_app_id)\n raise StandardError, 'mobile_app_id cannot be null' if mobile_app_id.nil?\n url_tpl_params = @path_parameters.clone\n url_tpl_params[\"mobileApp%2Did\"] = mobile_app_id\n return MicrosoftGraph::DeviceAppManagement::MobileApps::Item::MobileAppItemRequestBuilder.new(url_tpl_params, @request_adapter)\n end",
"def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def set_mobile_type_list\n @mobile_type_list = MobileTypeList.find(params[:id])\n end",
"def devices=(value)\n @devices = value\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def destroy\n ELASTIC_SEARCH_CLIENT.delete index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id\n @mobile_app.destroy!\n respond_to do |format|\n format.html { redirect_to admin_mobile_apps_url, notice: 'Mobile Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n authorize_action_for @app\n\n respond_to do |format|\n if app_params[:android_config].present? && app_params[:android_config][:bundle_id].present?\n if (@app.android_config['bundle_id'] != app_params[:android_config][:bundle_id]) && App.android_bundle_id?(app_params[:android_config][:bundle_id])\n @app.errors.add(:base, 'Android bundle id is invalid or already used')\n end\n end\n\n if app_params[:ios_config].present? && app_params[:ios_config][:bundle_id].present?\n if (@app.ios_config['bundle_id'] != app_params[:ios_config][:bundle_id]) && App.ios_bundle_id?(app_params[:ios_config][:bundle_id])\n @app.errors.add(:base, 'iOS bundle id is invalid or already used')\n end\n end\n\n if !@app.errors.full_messages.present? && @app.update(app_params)\n format.html { redirect_to request.referrer, notice: 'App was successfully updated.' }\n format.json { render json: @app, status: :ok, location: :edit }\n else\n format.html { render :settings }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_properties(properties)\n properties = properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def set_phone_app\n @phone_app = PhoneApp.find(params[:id])\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def checkin_network_sm_devices(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/devices/checkin'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: options['checkin_network_sm_devices'].to_json\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def set_medicaldevice\n @medicaldevice = Medicaldevice.find(params[:id])\n end",
"def set_app_properties(properties)\n properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def mobile_platform\n return @children['mobile-platform'][:value]\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::MobileAppCollectionResponse.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def destroy\n @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end",
"def get_network_sm_devices(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/devices'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'fields' => options['fields'],\r\n 'wifiMacs' => options['wifi_macs'],\r\n 'serials' => options['serials'],\r\n 'ids' => options['ids'],\r\n 'scope' => options['scope'],\r\n 'batchSize' => options['batch_size'],\r\n 'batchToken' => options['batch_token']\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def metric_devices=(value)\n @metric_devices = value\n end",
"def index\n @mapps = Mapp.all\n end",
"def managed_models\n @managed_models\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_applist\n @applist = Applist.find(params[:id])\n end",
"def set_jenkins_app_config\n @jenkins_app_config = JenkinsAppConfig.find(params[:id])\n end",
"def set_emulated_media(media:)\n {\n method: \"Emulation.setEmulatedMedia\",\n params: { media: media }.compact\n }\n end",
"def remove_mobile_platform(value)\n @children['mobile-platform'][:value].delete(value)\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend",
"def app_list\n host_os_family.app_list( self )\n end"
] |
[
"0.6725974",
"0.63592434",
"0.6272889",
"0.627158",
"0.6231614",
"0.62301904",
"0.613656",
"0.5974369",
"0.57873327",
"0.56845045",
"0.56845045",
"0.5633411",
"0.5614081",
"0.5583626",
"0.5522805",
"0.55174464",
"0.54779404",
"0.5474169",
"0.54059184",
"0.5382686",
"0.53547907",
"0.53512836",
"0.5335255",
"0.5301055",
"0.51865715",
"0.5149544",
"0.51391757",
"0.5134211",
"0.5107009",
"0.5064282",
"0.504525",
"0.50220555",
"0.49769092",
"0.49769092",
"0.495393",
"0.495224",
"0.49409455",
"0.49365565",
"0.4888026",
"0.48478386",
"0.48475087",
"0.48271316",
"0.48128676",
"0.47996062",
"0.4795048",
"0.47600985",
"0.47503242",
"0.47475368",
"0.47056884",
"0.46630868",
"0.46550393",
"0.45838255",
"0.45751503",
"0.45636874",
"0.456156",
"0.456156",
"0.45569515",
"0.45561516",
"0.45455155",
"0.45438516",
"0.45424777",
"0.45410547",
"0.4521592",
"0.45166197",
"0.451605",
"0.45157027",
"0.45120537",
"0.44933704",
"0.44877034",
"0.44747394",
"0.4463755",
"0.44619972",
"0.44554538",
"0.44533503",
"0.44366592",
"0.4416706",
"0.44083905",
"0.4396796",
"0.4393676",
"0.43840587",
"0.43711615",
"0.43663812",
"0.43632838",
"0.43395236",
"0.43352237",
"0.43298098",
"0.43270934",
"0.43194488",
"0.43166184",
"0.43095645",
"0.4299904",
"0.42956153",
"0.42744535",
"0.42736524",
"0.4271763",
"0.42646793",
"0.42636687",
"0.42519596",
"0.4246627",
"0.42464444"
] |
0.71362567
|
0
|
Provides operations to manage the mobileApps property of the microsoft.graph.deviceAppManagement entity.
|
def mobile_apps()
return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully created.' }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def mobile_app_categories()\n return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def graph_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphMobileLobApp::GraphMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_apps\n return @managed_apps\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def set_mapp\n @mapp = Mapp.find(params[:id])\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def apps=(value)\n @apps = value\n end",
"def applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def by_mobile_app_id(mobile_app_id)\n raise StandardError, 'mobile_app_id cannot be null' if mobile_app_id.nil?\n url_tpl_params = @path_parameters.clone\n url_tpl_params[\"mobileApp%2Did\"] = mobile_app_id\n return MicrosoftGraph::DeviceAppManagement::MobileApps::Item::MobileAppItemRequestBuilder.new(url_tpl_params, @request_adapter)\n end",
"def new\n @mobileapp = Mobileapp.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mobileapp }\n end\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_app_params\n params.require(:mobile_app).permit(:name, :description, :image_url, :store_link)\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"def show\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobileapp }\n end\n end",
"def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def destroy\n @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def new\n @mobile_app = MobileApp.new\n @mobile_app.language = \"English\"\n if current_user.agency\n @mobile_app.primary_agency_id = current_user.agency.id\n end\n @mobile_app.primary_contact_id = current_user.id\n @mobile_app.mobile_app_versions.build\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def appstore_apps_message(app_id)\n response = connection.post(get_appstore_apps_message_url(app_id)) do |request|\n request.headers[CONTENT_TYPE] = APPLICATION_JSON\n request.params[:adminDeviceSpaceId] = \"1\"\n request.body = JSON.dump({ installIncluded: true, updateIncluded: true, pushApp: true })\n end\n\n if response.success?\n AppStoreAppsMessageResponse.new(response.body)\n end\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def set_phone_app\n @phone_app = PhoneApp.find(params[:id])\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def applications_list\n get \"applications\"\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n @mobile_app.build_notifications(:created)\n @mobile_app.published!\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully created.\" }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n if @mobile_app.mobile_app_versions.empty?\n @mobile_app.mobile_app_versions.build\n end\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mobile_app_params\n params.require(:mobile_app).permit( :name, :short_description, :long_description, :icon_url,\n :language, :agency_tokens, :user_tokens, :tag_tokens, :primary_contact_id, :secondary_contact_id, :primary_agency_id, :secondary_agency_id, :notes, mobile_app_versions_attributes: [:id, :store_url,:platform,\n :version_number,:publish_date,:description,:whats_new,:screenshot,:device,\n :language,:average_rating,:number_of_ratings, :_destroy])\n end",
"def modern_apps=(value)\n @modern_apps = value\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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] || 'InlineResponse2003' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n ELASTIC_SEARCH_CLIENT.delete index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id\n @mobile_app.destroy!\n respond_to do |format|\n format.html { redirect_to admin_mobile_apps_url, notice: 'Mobile Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def installed_apps=(value)\n @installed_apps = value\n end",
"def installed_apps=(value)\n @installed_apps = value\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def index\n @mapps = Mapp.all\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def mobile_app_categories\n return @mobile_app_categories\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def set_mobile_type_list\n @mobile_type_list = MobileTypeList.find(params[:id])\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def is_mobile_device?\n self.class.supported_devices.any? do |os, version_range|\n mobile_device_info.operating_system == os &&\n version_range.member?(mobile_device_info.version)\n end\n end",
"def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @mobile_app.destroy\n respond_to do |format|\n format.html { redirect_to mobile_apps_url, notice: 'Mobile app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def set_app\n @app = App.find_by( token: params[:app_id])\n if !@app \n render json: { error: \"app not found\"}, status: :not_found\n end\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def show\n params[:page_size] = params[:page_size] || PAGE_SIZE\n\t\t@mobile_apps = MobileApp.where(id: params[:id]).page(params[:page] || DEFAULT_PAGE).per(params[:page_size] || PAGE_SIZE)\n\t\trespond_to do |format|\n\t\t\tformat.json { render \"show\" }\n\t\tend\t\t\n\tend",
"def client_applications=(value)\n @client_applications = value\n end",
"def apps_single_app_mode_list=(value)\n @apps_single_app_mode_list = value\n end",
"def update\n respond_to do |format|\n if @mapp.update(mapp_params)\n format.html { redirect_to @mapp, notice: 'Mapp was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapp }\n else\n format.html { render :edit }\n format.json { render json: @mapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mobile_app = create_app\n if @mobile_app.present? && @mobile_app['identifier'].present?\n @api_key = create_api_key @mobile_app['identifier']\n end\n redirect_to \"/\", flash: { error_message: @error_message }\n end",
"def index\n @phone_apps = PhoneApp.all\n end"
] |
[
"0.72200453",
"0.68944633",
"0.6520375",
"0.6520375",
"0.64326906",
"0.6157296",
"0.60891485",
"0.5919858",
"0.5884511",
"0.57775664",
"0.5759725",
"0.57033116",
"0.5698578",
"0.5651597",
"0.564872",
"0.5612222",
"0.55787176",
"0.5562505",
"0.5546961",
"0.552165",
"0.5484573",
"0.5483361",
"0.5451783",
"0.5433831",
"0.53987",
"0.5384989",
"0.5359908",
"0.5359908",
"0.5342688",
"0.53426284",
"0.5305033",
"0.52870166",
"0.52417564",
"0.5239746",
"0.5221001",
"0.5175824",
"0.5171739",
"0.51708806",
"0.51655936",
"0.51590073",
"0.51193917",
"0.5096194",
"0.5062433",
"0.5023506",
"0.50233966",
"0.50066",
"0.5006236",
"0.5001016",
"0.49942243",
"0.49936885",
"0.4967508",
"0.49665368",
"0.49615607",
"0.49492764",
"0.49475268",
"0.49327046",
"0.49009013",
"0.48931736",
"0.4884926",
"0.4884926",
"0.4872896",
"0.48600736",
"0.4857061",
"0.48484945",
"0.48445043",
"0.47968122",
"0.47944197",
"0.47892338",
"0.4768548",
"0.47662827",
"0.46918705",
"0.4690167",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46886486",
"0.46875566",
"0.4678494",
"0.46761313",
"0.46757564",
"0.4657088",
"0.46481714",
"0.46424913",
"0.463918",
"0.46263874",
"0.461237",
"0.46051592",
"0.46049842",
"0.46016514",
"0.46012056",
"0.45932072",
"0.45915362",
"0.4591098",
"0.4582793",
"0.4570657"
] |
0.7214287
|
1
|
Provides operations to call the syncMicrosoftStoreForBusinessApps method.
|
def sync_microsoft_store_for_business_apps()
return MicrosoftGraph::DeviceAppManagement::SyncMicrosoftStoreForBusinessApps::SyncMicrosoftStoreForBusinessAppsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def sync\n Logger.d(\"Sync invoked for ContactsSync\")\n find_all_contacts_with_email { |emails|\n Logger.d(\"Going to sync #{emails.length} contacts\")\n # Save the contacts on the server \n json = {\n :user => {\n :contacts => emails\n },\n :auth_token => @auth_token\n }.to_json\n\n on_api_call_failed = Proc.new { |json_obj|\n Logger.d(\"API CALL FAILED in ContactsSync.sync\", \">\")\n } \n\n # Save on network\n network_post(CONFIG.get(:sync_contacts), nil, json, on_api_call_failed) do |response_obj|\n Logger.d(\"Contacts sync done\", \":) \")\n end \n }\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def broadcast_check_for_apps!\n @account.self_and_all_descendant_customers.find_each do |customer|\n ServiceRunnerJob.perform_later(\n \"DeviceBroadcasts::Customer\",\n customer,\n { type: \"apps\", payload: {} }.to_json\n )\n end\n end",
"def sync_items\n oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, current_company.access_token, current_company.access_secret)\n\n item_service = Quickeebooks::Online::Service::Item.new\n item_service.access_token = oauth_client\n item_service.realm_id = current_company.realm_id\n\n #load all the customers created in QuickBookss\n @items = []\n 500.times do |i|\n temp_item = item_service.list(filters = [], page = i+1, per_page = 500, sort = nil, options = {}).entries\n @items += temp_item\n break if temp_item.empty?\n end \n\n\n @items.each do |item|\n if !current_company.items.exists?(:name => item.name)\n current_company.items.create(:quickbook_item_id => item.id, :name => item.name, :description => item.desc, :unit_price => item.unit_price.present? ? item.unit_price.amount : 0, :unit_cost => 0, :itemtype => \"Quickbook\", :qty => 1, :number => \"-\")\n else\n @item = current_company.items.find_by_name(item.name)\n @item.update_attributes(:quickbook_item_id => item.id, :name => item.name, :description => item.desc, :unit_price => item.unit_price.present? ? item.unit_price.amount : 0, :unit_cost => 0, :itemtype => \"Quickbook\", :qty => 1, :number => \"-\")\n end\n end\n rescue OAuth::Problem\n flash[:alert] = \"OAuth::Problem - token_rejected. Please Reconnect to QBO\"\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def sync\n logger.info \"Syncing EVERYTHING\"\n # Update info in background\n Thread.new do\n if Qbo.exists?\n Customer.sync\n Invoice.sync\n QboItem.sync\n Employee.sync\n Estimate.sync\n \n # Record the last sync time\n Qbo.update_time_stamp\n end\n ActiveRecord::Base.connection.close\n end\n\n redirect_to :home, :flash => { :notice => \"Successfully synced to Quickbooks\" }\n end",
"def sync_customer_data\n oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, current_company.access_token, current_company.access_secret)\n\n customer_service = Quickeebooks::Online::Service::Customer.new\n customer_service.access_token = oauth_client\n customer_service.realm_id = current_company.realm_id\n\n #load all the customers created in QuickBooks\n @customers = []\n 200.times do |i|\n temp_cust = customer_service.list(filters = [], page = i+1, per_page = 500, sort = nil, options = {}).entries\n @customers += temp_cust\n break if temp_cust.empty?\n end \n\n \n # find the list of customers that don't have either city, state or zipcode in quickbooks\n # and if found display error message for those customers\n @customers_without_address = []\n \n #check the condition for each customer either they exists in our application or not\n #if any of the customer doesnot exists in our application then create new customer\n #with QuickBooks customer values\n @customers.each do |customer|\n @customer_id = customer.try(:id)\n @customer_name = customer.try(:name)\n @city = customer.try(:addresses).try(:first).try(:city)\n @state = customer.try(:addresses).try(:first).try(:country_sub_division_code)\n @zipcode = customer.try(:addresses).try(:first).try(:postal_code)\n @address1 = customer.try(:addresses).try(:first).try(:line1)\n @address2 = customer.try(:addresses).try(:first).try(:line2)\n @phone = customer.try(:phones).try(:first).try(:free_form_number)\n @website = customer.try(:web_site).try(:uri)\n \n \n if @city.blank? || @state.blank? || @zipcode.blank?\n @customers_without_address << @customer_name\n end\n \n \n #sync terms client\n customer = customer_service.fetch_by_id(customer.id.to_i)\n if customer.sales_term_id.present?\n sales_term_id = customer.sales_term_id.value\n service = Quickeebooks::Online::Service::SalesTerm.new\n service.access_token = oauth_client\n service.realm_id = current_company.realm_id\n\n sales_term = service.fetch_by_id(sales_term_id)\n @terms_client = sales_term.try(:name)\n end\n \n \n # if customer donot exists in our database directly create them\n # if they already exists then, update them\n unless current_company.customers.exists?(:quickbook_customer_id => @customer_id.to_i)\n current_company.customers.create(:types => \"Customer\", :account => \" \", :company_name => @customer_name, :address1 => @address1, :address2 => @address2, :city => @city, :state => @state, :zip => @zipcode, :phone => @phone, :website => @website, :quickbook_customer_id => @customer_id, :terms_client => @terms_client )\n else\n current_company.customers.find_or_create_by_company_name(:company_name => @customer_name).update_attributes(:types => \"Customer\", :account => \" \", :company_name => @customer_name, :address1 => @address1, :address2 => @address2, :city => @city, :state => @state, :zip => @zipcode, :phone => @phone, :website => @website, :quickbook_customer_id => @customer_id, :terms_client => @terms_client )\n end\n end\n \n @customers_without_address\n\n # push non-existing customers to QBO from SMO\n qbo_customers = []\n smo_customers = []\n non_matching_customers = []\n\n qbo_customers = @customers.map{|c| [c.name]}\n smo_customers = current_company.customers.where(\"types!=?\", \"Prospect\").map{|c| [c.company_name]}\n \n \n non_matching_customers = smo_customers - qbo_customers # non matching in SMO, push these to QuickBooks\n non_matching_customers.each do |customer|\n smo_customers = current_company.customers.find_by_company_name(customer)\n push_to_quickbook(smo_customers)\n end\n rescue OAuth::Problem\n session[:alert] = \"OAuth::Problem - token_rejected. Please Reconnect to QBO\"\n rescue IntuitRequestException \n session[:alert] = \" Another $$customer$$ is already using this name. Please use a different name.\"\n \n session[:last_seen] = Time.now\n end",
"def managed_apps\n return @managed_apps\n end",
"def microsoft_store_for_business_language=(value)\n @microsoft_store_for_business_language = value\n end",
"def microsoft_store_for_business_last_completed_application_sync_time\n return @microsoft_store_for_business_last_completed_application_sync_time\n end",
"def sync\n # Update info in background\n Thread.new do\n if Qbo.exists?\n Customer.sync\n QboItem.sync\n QboEmployee.sync\n QboEstimate.sync\n QboInvoice.sync\n \n # Record the last sync time\n Qbo.update_time_stamp\n end\n ActiveRecord::Base.connection.close\n end\n\n redirect_to qbo_path(:redmine_qbo), :flash => { :notice => \"Successfully synced to Quickbooks\" }\n end",
"def app_store\n self.in(AppStore)\n end",
"def sync_app_builds(test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_syncAppBuilds])\n @payload = JSON.generate(test_suite_result_list)\n @params = nil\n ReportLog.info('Set up the RTC REST client and start syncing application builds...')\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n rtc_client.run_successfully ? ReportLog.info('Sync completed.') : (raise construct_api_failure_msg(rtc_client))\n ReportLog.exiting(@@class_name, __method__.to_s)\n end",
"def microsoft_store_for_business_last_completed_application_sync_time=(value)\n @microsoft_store_for_business_last_completed_application_sync_time = value\n end",
"def review\n\t\t@MerchantApps = MerchantApplication.all\n\tend",
"def microsoft_store_for_business_last_successful_sync_date_time\n return @microsoft_store_for_business_last_successful_sync_date_time\n end",
"def microsoft_store_for_business_language\n return @microsoft_store_for_business_language\n end",
"def after_save_actions\n Logger.d(\"Inside after_save_actions in User\")\n ContactsSync.new(@context, get(:auth_token)).sync if is_user_contacts_syncable? == true # non-blocking\n end",
"def sync_files\n User.sync_files!(@context)\n end",
"def sync *attributes\n self.class.define_method(:sync_attributes) do\n ActiveSync::Sync.sync_attributes(self, attributes)\n end\n define_method(:sync_record) do\n ActiveSync::Sync.sync_record(self, attributes)\n end\n define_method(:sync_associations) do\n ActiveSync::Sync.sync_associations(self, attributes)\n end\n end",
"def sync_all_data\n return if self.disabled?\n self.sync_availability\n self.sync_rate\n self.sync_stop_sell\n self.sync_min_stay\n\n if self.channel == GtaTravelChannel.first\n self.sync_gta_travel_cta\n self.sync_gta_travel_ctb\n else\n self.sync_cta if Constant::SUPPORT_CTA.include?(self.channel)\n self.sync_ctd if Constant::SUPPORT_CTD.include?(self.channel)\n end\n end",
"def broadcast_after_save\n # ObjectActivity.faye_broadcast(self, self) if verified_changed? | confirmed_at_changed?\n return true unless verified_changed? | confirmed_at_changed? | name_changed? | bio_changed? | job_title_id_changed? | avatar_changed? | gmc_changed?\n # users = User.joins(:user_locations).where(:user_locations => {:location_id => self.locations.collect{|a| a.id}}).all\n # users.each do |u|\n # UpdatesChannel.broadcast_to(u, {loadModels: [self.to_jsonapi]})\n # end\n BroadcastToLocationJob.perform_later(self.locations.all.to_a, {loadModels: [self.to_jsonapi]})\n true\n end",
"def sync_datas_process\n SyncDatas.sync(self)\n # user = self\n end",
"def sync_items!(sync_state = nil, sync_amount = 256, sync_all = false, opts = {})\n item_shape = opts.has_key?(:item_shape) ? opts.delete(:item_shape) : {:base_shape => :default}\n sync_state ||= @sync_state\n\n resp = ews.sync_folder_items item_shape: item_shape,\n sync_folder_id: self.folder_id, max_changes_returned: sync_amount, sync_state: sync_state\n rmsg = resp.response_messages[0]\n\n if rmsg.success?\n @synced = rmsg.includes_last_item_in_range?\n @sync_state = rmsg.sync_state\n rhash = {}\n rmsg.changes.each do |c|\n ctype = c.keys.first\n rhash[ctype] = [] unless rhash.has_key?(ctype)\n if ctype == :delete || ctype == :read_flag_change\n rhash[ctype] << c[ctype][:elems][0][:item_id][:attribs]\n else\n type = c[ctype][:elems][0].keys.first\n item = class_by_name(type).new(ews, c[ctype][:elems][0][type])\n rhash[ctype] << item\n end\n end\n rhash\n else\n raise EwsError, \"Could not synchronize: #{rmsg.code}: #{rmsg.message_text}\"\n end\n end",
"def sync_quickbooks!(skip:)\n if EffectiveOrders.qb_online?\n skip ? EffectiveQbOnline.skip_order!(self) : EffectiveQbOnline.sync_order!(self)\n end\n\n if EffectiveOrders.qb_sync?\n skip ? EffectiveQbSync.skip_order!(self) : true # Nothing to do\n end\n\n true\n end",
"def run_autosync\n begin\n self.status = _(\"Synchronizing organisations.\")\n self.update_organisation_cache\n \n self.status = _(\"Synchronizing worktime.\")\n self.update_worktime_cache\n \n self.status = _(\"Automatic synchronization done.\")\n rescue => e\n self.status = sprintf(_(\"Error while auto-syncing: %s\"), e.message)\n puts Knj::Errors.error_str(e)\n ensure\n @sync_thread = nil\n end\n end",
"def sync()\n #This is a stub, used for indexing\n end",
"def iosync\n @tc_bdb.sync\n end",
"def microsoft_store_for_business_last_successful_sync_date_time=(value)\n @microsoft_store_for_business_last_successful_sync_date_time = value\n end",
"def update_attributes_and_sync(attributes)\n if update_attributes(attributes)\n update_salesforce_attributes(attributes)\n end\n end",
"def set_business\n @business = Business.find(params[:id])\n @current_obj = @business\n end",
"def windows_update_for_business=(value)\n @windows_update_for_business = value\n end",
"def run_syncdb\n manage_py_execute('syncdb', '--noinput') if new_resource.syncdb\n end",
"def sync_device()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::SyncDevice::SyncDeviceRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def flush_and_load_applications\n\t\t\t@r.flushall # Only hardcode baby!!!\n\n\t\t\t# Restoring all default applications \n\t\t\t@config[\"defaults\"][\"applications\"].each do |k,app|\n\t\t\t\t@r.set(\"apps:#{app['key']}\", app.reject{|a,v| a.eql?('key') }.to_json )\n\t\t\tend\n\t\t\t# We need this! Yeah baby we need this\n\t\t\t@r.bgsave\n\n\t\t\t# Puting alert that database cleaned\n\t\t\tputs \"\"\n\t\t\tputs \"ACHTUNG!: Database cleaned and default applications id loaded\"\n\t\t\tputs \"\"\n\t\tend",
"def call\n return unless context.user.auto_sync?\n begin\n playlist = context.spotify_user.create_playlist!(context.backup_playlist_name)\n playlist.add_tracks!(context.discover_weekly_playlist.tracks)\n context.backup_spotify_playlist = playlist\n rescue\n context.fail!(message: \"Couldn't create the playlist on Spotify. Please try again later\")\n end\n end",
"def sync\n end",
"def sync\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def sync!\n events = @matrix.sync since: @since\n process_sync events\n rescue ApiError => err\n broadcast(:sync_error, err)\n end",
"def zoho_sync\n\n\t\t\tUser.zoho_sync\n\n\t\t\trender text: 'OK'\n\n\t\tend",
"def sync_configuration\n end",
"def save!\n client.update_app_version!(application.apple_id, is_live?, raw_data)\n end",
"def index\n @customer_apps = CustomerApp.for_account(active_account)\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def perform(name = nil, count = nil)\n active_organizations = Maestrano::Connector::Rails::Organization.where.not(oauth_provider: nil, encrypted_oauth_token: nil)\n gap_span = (60 / active_organizations.count).to_i\n time = 0\n active_organizations.each do |o|\n next unless [true, 1].include?(o.sync_enabled)\n Maestrano::Connector::Rails::SynchronizationJob.set(wait: time.minutes).perform_later(o.id, {})\n time += gap_span\n end\n end",
"def set_calendar_sync\n @calendar_sync = CalendarSync.find(params[:id])\n end",
"def set_business\n\t\t@business = Business.find(params[:id])\n\tend",
"def clouddata!\n\n # Collect all application ids, skipping any invalid ones\n ids = apps.collect do |app|\n app.id\n end.compact\n\n # Queries Apple's iTunes Store API for latest cloud data using undocumented bulk method\n response = Net::HTTP.get('itunes.apple.com', '/lookup?id=' + ids.join(','))\n results = JSON.parse(response)['results']\n results.each do |result|\n if app = get(result['trackId'] || -1)\n app.clouddata = result\n end\n end\n end",
"def icloud_sync\n raise \"not yet implemented\"\n end",
"def synchronize_with(store, query)\n\t#FIXME THis is Busted. Steve said it's OK to leave this!store.connect(@sub_folder)\n\t\tstore.connect\n\t\tObjectDatabase::Synchronizer.new(store, query, self).sync\n\t\tstore.disconnect\n\tend",
"def sync\n OPENERP_MAPPING_SEED.map do |openerp_model, rails_data|\n rails_model = rails_data.camelize.constantize\n \n print_syncing(openerp_model, rails_model)\n rails_model.sync(openerp_model) \n\n end\n end",
"def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def putBusiness( name, building_number, branch_name, address1, address2, address3, district, town, county, province, postcode, country, latitude, longitude, timezone, telephone_number, additional_telephone_number, email, website, category_id, category_type, do_not_display, referrer_url, referrer_name, destructive, delete_mode, master_entity_id)\n params = Hash.new\n params['name'] = name\n params['building_number'] = building_number\n params['branch_name'] = branch_name\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['timezone'] = timezone\n params['telephone_number'] = telephone_number\n params['additional_telephone_number'] = additional_telephone_number\n params['email'] = email\n params['website'] = website\n params['category_id'] = category_id\n params['category_type'] = category_type\n params['do_not_display'] = do_not_display\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n params['destructive'] = destructive\n params['delete_mode'] = delete_mode\n params['master_entity_id'] = master_entity_id\n return doCurl(\"put\",\"/business\",params)\n end",
"def sync_with_service_department\n if needs_sync?\n begin\n start_sync\n update(synced_on: Date.today)\n rescue\n logger.debug \"Something went wrong sending registration: #{self.inspect}\"\n end\n end\n end",
"def is_enabled_for_microsoft_store_for_business=(value)\n @is_enabled_for_microsoft_store_for_business = value\n end",
"def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_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",
"def fetch(facebook)\n setup facebook if facebook.present?\n\n # Make an Invocation per batch and enqueue each in Sidekiq.\n batchify.each do |batch|\n batch.to_invocation.save\n end\n end",
"def set_business_listing\n @business_listing = BusinessListing.find(params[:id])\n end",
"def apiCall\n\t\t# Build Request\n\t\treq = Net::HTTP::Get.new @O365_path.request_uri\n\t\thttp = Net::HTTP.new @O365_path.host, @O365_path.port\n\t\thttp.use_ssl = true\n\n\t\t# Make the request\n\t\tputs \"Making API call...\"\n\t\tres = http.request req\n\t\tif res.code == \"200\"\n\t\t\t@O365_Services = JSON.parse res.body\n\t\t\tputs \"Making API call...\"\n\t\telse\n\t\t\traise IOError, \"Invaild response from Office365 API: #{res.code} - #{res.body}\"\n\t\tend\n\n\tend",
"def windows_update_for_business\n return @windows_update_for_business\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def sync_data\n\t\tSYNC_TABLES.each do |sync|\n\t\t\tself.sync_table(sync)\n\t\tend\n\tend",
"def update_other_applications(paid)\n ServiceRunnerJob.perform_later(\"OtherApps::UpdateBillingStatus\", @account, paid)\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def perform(person_id, business_id, options={})\n @person = Person.find(person_id)\n @business = Business.find( business_id )\n @options = options\n Channel.transaction{ save_all_records! }\n end",
"def after_sync\n end",
"def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end",
"def database_sync_api\n snacks = Suggestion.all\n\n snacks.each do |snack|\n if !api_snack_checker?(snack.name)\n data_to_api(snack.name, snack.location, snack.optional)\n end\n end\n end",
"def perform\n track do\n reset!\n\n Restforce::DB::Registry.each do |mapping|\n run(\"CLEANING RECORDS\", Cleaner, mapping)\n run(\"ATTACHING RECORDS\", Attacher, mapping)\n run(\"PROPAGATING RECORDS\", Initializer, mapping)\n run(\"COLLECTING CHANGES\", Collector, mapping)\n end\n\n # NOTE: We can only perform the synchronization after all record\n # changes have been aggregated, so this second loop is necessary.\n Restforce::DB::Registry.each do |mapping|\n run(\"UPDATING ASSOCIATIONS\", Associator, mapping)\n run(\"APPLYING CHANGES\", Synchronizer, mapping)\n end\n end\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @title = 'Salesforce Sync Queries'\n @sync_queries = SyncQuery.all\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def synced(shop_id, routine)\n request :patch, \"shops/#{shop_id}/#{routine}_synced\"\n end",
"def sync\n begin\n @external_plans = Shoppe::ApiHandler.get_subscription_plans\n @external_plans.data.each do |external_plan|\n shoppe_plan = Shoppe::SubscriptionPlan.find_or_create_by(api_plan_id: external_plan.id)\n shoppe_plan.amount = Shoppe::ApiHandler.native_amount(external_plan.amount)\n shoppe_plan.currency = external_plan.currency\n shoppe_plan.interval = external_plan.interval\n shoppe_plan.interval_count = external_plan.interval_count\n shoppe_plan.name = external_plan.name\n shoppe_plan.trial_period_days = external_plan.trial_period_days || 0\n shoppe_plan.save\n end\n\n rescue ::Stripe::InvalidRequestError\n flash[:warning] = t('shoppe.subscription_plans.api_responses.plan_sync_failed')\n end\n redirect_to subscription_plans_url, notice: t('shoppe.subscription_plans.api_responses.sync_complete')\n end",
"def index\n ensure_salesforce_connector\n fetch_app_and_key\n fetch_certificate if @mobile_app.present?\n fetch_users if @certificate.present?\n\n flash[:error_message] ||= @error_message\n flash[:info] ||= @info\n end",
"def execute_work!\n save_receipts = event_store.with_transaction do\n pending_saves.map(&:call)\n end\n\n @pending_saves = []\n\n save_receipts.each do |reciept|\n message_bus.publish_events(reciept.id, reciept.klass, reciept.events,\n reciept.meta.merge(meta))\n end\n\n self\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def set_mybusiness\n @mybusiness = Mybusiness.find(params[:id])\n end",
"def sync_calendars(opts={})\n # why does the primary calendar feed change every time?\n feed_xml = get_user_calendar_xml\n xml_ts = Time.zone.parse(feed_xml.xpath('/ns:feed/ns:updated', 'ns'=>'http://www.w3.org/2005/Atom').text)\n self.body = feed_xml.to_s if xml_ts != synced_at\n\n feed_xml.css('entry').each { |entry|\n existing_cal = calendars.find :first, :conditions=>{ :uid=>entry.css('id').text}\n if existing_cal\n existing_cal.events.destroy_all if opts[:force] == true\n existing_cal.sync_with_xml(entry, opts) # , range - allows calendar to only sync specified range\n else\n cal = Calendar.new(:init=>entry)\n puts \"XXX not found. creating new calendar object for #{cal.title}\"\n calendars << cal\n cal.sync_events\n end\n }\n\n # find any local calendars that are new and push them up to google\n calendars.find(:all, :conditions=>{:synced_at=>nil}).each do |entry|\n end\n self.synced_at = xml_ts\n save\n end",
"def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1-merchant', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end",
"def save\n call_ok?(:slft_application, request_save) do |body|\n convert_back_office_hash(body)\n end\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def sync; end",
"def sync_notify\n # ERR_NONE = 0\n # ERR_NETWORK = 1\n # ERR_REMOTESERVER = 2\n # ERR_RUNTIME = 3\n # ERR_UNEXPECTEDSERVERRESPONSE = 4\n # ERR_DIFFDOMAINSINSYNCSRC = 5\n # ERR_NOSERVERRESPONSE = 6\n # ERR_CLIENTISNOTLOGGEDIN = 7\n # ERR_CUSTOMSYNCSERVER = 8\n # ERR_UNATHORIZED = 9\n # ERR_CANCELBYUSER = 10\n # ERR_SYNCVERSION = 11\n # ERR_GEOLOCATION = 12\n \n setup_sync_handlers\n \n \n sourcename = @params['source_name'] ? @params['source_name'] : \"\"\n \n status = @params['status'] ? @params['status'] : \"\"\n \n if status == \"complete\"\n update_last_synced_time\n \n puts \"%\"*80\n puts \"SYNC COMPLETE\"\n puts \"new opp sync pending: \" + Settings.new_opportunity_sync_pending.to_s\n if Settings.new_opportunity_sync_pending\n puts \"Sync complete, starting pending new_opportunity sync.\"\n SyncUtil.start_sync('new_opportunity')\n Settings.new_opportunity_sync_pending = false\n end\n \n # store device info\n DeviceInfo.check_device_information\n \n @on_sync_complete.call\n \n WebView.execute_js(\"stopSyncSpin();\") \n\n #if latest integrated lead createdon is greater than before sync, display popup alert\n # handle_new_integrated_leads\n elsif status == \"ok\"\n if sourcename == 'AppInfo'\n check_for_upgrade\n elsif model_limits_exceeded?(sourcename, @params['total_count'])\n # model limit exceeded, stop synchronization\n return\n end\n \n if sourcename == 'Opportunity'\n handle_new_integrated_leads\n end\n \n if @params['source_name'] && @params['cumulative_count'] && @params['cumulative_count'].to_i > 0\n klass = Object.const_get(@params['source_name'])\n klass.local_changed=true if klass && klass.respond_to?(:local_changed=)\n end\n \n @on_sync_ok.call\n elsif status == \"in_progress\"\n @on_sync_in_progress.call\n elsif status == \"error\"\n err_code = @params['error_code'].to_i\n rho_error = Rho::RhoError.new(err_code)\n \n is_bad_request_data = (err_code == Rho::RhoError::ERR_CUSTOMSYNCSERVER) && !@params['server_errors'].to_s[/406 Not Acceptable/].nil?\n \n if @params['server_errors'] && @params['server_errors']['create-error']\n log_error(\"Create error\", @params.inspect)\n unless is_bad_request_data \n SyncEngine.on_sync_create_error( @params['source_name'], @params['server_errors']['create-error'], :recreate)\n else\n #notify the user here?\n #the create data given to the proxy was bad and will not succeed if tried again; delete the create\n SyncEngine.on_sync_create_error( @params['source_name'], @params['server_errors']['create-error'], :delete)\n end\n end\n \n if @params['server_errors'] && @params['server_errors']['update-error']\n log_error(\"Update error\", @params.inspect)\n unless is_bad_request_data\n SyncEngine.on_sync_update_error( @params['source_name'], @params['server_errors']['update-error'], :retry)\n else\n #notify the user here?\n SyncEngine.on_sync_update_error( @params['source_name'], @params['server_errors']['update-error'], :rollback, @params['server_errors']['update-rollback'])\n end\n end\n\n @msg = rho_error.message unless @msg and @msg.length > 0\n \n # RhoSync 2.1.5 has fixes that will cause rho_error.unknown_client? to return true in the proper scenarios.\n is_unknown_client_error = rho_error.unknown_client?(@params['error_message']) \n \n # Legacy support for RhoSync versions before 2.1.5\n is_unknown_client_error ||= (err_code == Rho::RhoError::ERR_REMOTESERVER && @params['error_message'] == \"undefined method `user_id' for nil:NilClass\")\n \n # Rhosync is not aware of this client's ID. Reset and force the user to the login screen.\n if is_unknown_client_error\n log_error(\"Error: Unknown client\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\")\n \n SyncEngine.set_pollinterval(0)\n SyncEngine.stop_sync\n\n full_reset_logout\n \n goto_login(\"Unknown client, please log in again.\")\n elsif err_code == Rho::RhoError::ERR_NETWORK\n #leave ':send_to_exceptional => false' alone until infinite loop issue is fixed for clients without a network connection\n log_error(\"Network connectivity lost\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\", {:send_to_exceptional => false})\n \n #stop current sync, otherwise do nothing for connectivity lapse\n SyncEngine.stop_sync\n \n #send them back to login because initial sync did not complete\n @on_sync_error.call({:error_source => 'connection'})\n elsif [Rho::RhoError::ERR_CLIENTISNOTLOGGEDIN,Rho::RhoError::ERR_UNATHORIZED].include?(err_code) \n log_error(\"RhoSync error: client is not logged in / unauthorized\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\")\n SyncEngine.set_pollinterval(0)\n SyncEngine.stop_sync\n background_login\n elsif err_code == Rho::RhoError::ERR_CUSTOMSYNCSERVER && !@params['server_errors'].to_s[/401 Unauthorized/].nil?\n #proxy returned a 401, need to re-login\n log_error(\"Error: 401 Unauthorized from proxy\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\")\n SyncEngine.set_pollinterval(0)\n SyncEngine.stop_sync\n \n Settings.initial_sync_complete = false\n Settings.password = ''\n goto_login(\"Your username/password is no longer valid. Please log in again.\")\n elsif err_code == Rho::RhoError::ERR_CUSTOMSYNCSERVER && !@params['server_errors'].to_s[/403 Forbidden/].nil?\n #proxy returned a 403, need to purge the database and log the user out\n log_error(\"Error: 403 Forbidden from proxy\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\")\n SyncEngine.set_pollinterval(0)\n SyncEngine.stop_sync\n \n full_reset_logout\n \n msg = ERR_403_MESSAGE\n goto_login(msg)\n elsif is_bad_request_data\n log_error(\"Bad request data\",\"Bad request data, client sent invalid data to CRM proxy, proxy returned 406. Error params: #{@params.inspect}\")\n else\n log_error(\"Unhandled error in sync_notify: #{err_code}\", Rho::RhoError.err_message(err_code) + \" #{@params.inspect}\")\n @on_sync_error.call({:error_source => 'unknown', :error_code => err_code})\n end\n end\n end",
"def sync_category\n \t@market_places = Spree::MarketPlace.all\n end",
"def sync\n run 'sync', :quiet => true\n end",
"def sync\n folders = get_gfolders(:refresh => true)\n folders or return\n\n by_title = gdocs_by_title(folders)\n\n @messages = []\n\n top = by_title['CMS']\n unless top\n flash[:error] = 'No CMS folder in your FixNix Docs'\n return render 'document/sync'\n end\n\n client = get_gdata_client\n return unless client\n\n unless by_title[cycle_gfolder(@cycle)]\n folder = client.create_folder(@cycle.slug, :parent => top)\n by_title[cycle_gfolder(@cycle)] = folder\n session[:gfolders] = {} # clear cache\n @messages << \"Created #{folder.full_title}\"\n end\n\n cycle_folder = by_title[\"#{top.full_title}/#{@cycle.slug}\"]\n\n ['Systems', 'Accepted'].each do |name|\n unless by_title[\"#{cycle_folder.full_title}/#{name}\"]\n folder = client.create_folder(name, :parent => cycle_folder)\n by_title[\"#{cycle_folder.full_title}/#{name}\"] = folder\n session[:gfolders] = {} # clear cache\n @messages << \"Created #{folder.full_title}\"\n end\n end\n\n systems = by_title[\"#{cycle_folder.full_title}/Systems\"]\n\n System.all.each do |sys|\n path = system_gfolder(@cycle, sys)\n unless by_title[path]\n folder = client.create_folder(sys.slug, :parent => systems)\n session[:gfolders] = {} # clear cache\n @messages << \"Created #{folder.full_title}\"\n end\n end\n end",
"def sync_with_facebook_profile(fb_user)\n fb_info = FacebookUserProfile.populate(fb_user)\n address_book.sync_with_facebook(fb_user, fb_info) && \n profile.sync_with_facebook(fb_user, fb_info)\n end"
] |
[
"0.5747459",
"0.5391222",
"0.53708833",
"0.53315777",
"0.5279871",
"0.52146894",
"0.5201553",
"0.51331216",
"0.5074301",
"0.5056382",
"0.4947139",
"0.4921181",
"0.49015215",
"0.4881808",
"0.48788768",
"0.48672387",
"0.48614055",
"0.4861185",
"0.4819095",
"0.4816582",
"0.4807918",
"0.47637057",
"0.4751946",
"0.4742778",
"0.47068158",
"0.46838444",
"0.46735582",
"0.4661218",
"0.46561453",
"0.4649536",
"0.4643362",
"0.4637635",
"0.4630519",
"0.4622424",
"0.4622059",
"0.4617807",
"0.46141917",
"0.45905152",
"0.45905152",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.4572681",
"0.45433822",
"0.45338407",
"0.45290813",
"0.45244688",
"0.4519563",
"0.4514689",
"0.45012963",
"0.45012963",
"0.45005795",
"0.450041",
"0.44981217",
"0.44949272",
"0.44923848",
"0.44869345",
"0.44847152",
"0.4478727",
"0.44778723",
"0.44764405",
"0.44755012",
"0.4472917",
"0.4468258",
"0.44646475",
"0.44540626",
"0.44504476",
"0.44458932",
"0.44396904",
"0.44369623",
"0.44309923",
"0.44302213",
"0.44224575",
"0.44163048",
"0.44150263",
"0.44118506",
"0.44075197",
"0.43973413",
"0.43786383",
"0.4367639",
"0.43660012",
"0.43644738",
"0.43596065",
"0.43554184",
"0.43460456",
"0.4342903",
"0.43391603",
"0.43374205",
"0.43275675",
"0.4320754",
"0.43167162",
"0.43135417",
"0.4311402",
"0.43078974",
"0.4304229"
] |
0.82963526
|
0
|
Provides operations to manage the targetedManagedAppConfigurations property of the microsoft.graph.deviceAppManagement entity.
|
def targeted_managed_app_configurations()
return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_apps\n return @managed_apps\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def managed_devices\n return @managed_devices\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def co_managed_device_count=(value)\n @co_managed_device_count = value\n end",
"def managed_models\n @managed_models\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def promote(device)\n device.inherited = false\n owner.save_config\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def co_managed_device_count\n return @co_managed_device_count\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def mobile_app_categories()\n return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_connections\n @@managed_connections\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def set_admin_app\n @admin_app = App.find(params[:id])\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def set_mapp\n @mapp = Mapp.find(params[:id])\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def metric_devices=(value)\n @metric_devices = value\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def manage\n @managed_orgs = managed_orgs(current_user)\n if (@managed_orgs.present?)\n @managed_jobs = Job.where(:organization_id => @managed_orgs.ids)\n @interviewing_postings = JobPosting.where(:job_id => @managed_jobs.ids, :status => \"interviewing\").order(\"deadline\").paginate(:page => params[:page], :per_page => 10)\n @applications = JobApplication.where(:job_posting_id => @interviewing_postings.ids, :status =>\"interview_scheduled\")\n @interviews = Interview.where(:job_application_id => @applications.ids).order(end_time: :asc)\n end\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def parse_management_device(node)\n parse(node, MANAGEMENT_DEVICE)\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def set_admin_device\n @admin_device = AdminDevice.find(params[:id])\n end",
"def active_model_configurations\n # return @active_model_configurations if @active_model_configurations\n\n olat = Admin::AppType.active_app_types\n\n # List of names that the associated_* items have already returned\n # to avoid building huge lists of repetitive joined queries\n got_names = []\n\n if olat&.present?\n qs = []\n olat.each do |app_type|\n resnames = []\n # Compare against string class names, to avoid autoload errors\n case name\n when 'ActivityLog'\n res = app_type.associated_activity_logs(not_resource_names: got_names)\n resnames = app_type.associated_activity_log_names\n when 'DynamicModel'\n res = app_type.associated_dynamic_models(valid_resources_only: false, not_resource_names: got_names)\n resnames = app_type.associated_dynamic_model_names\n when 'ExternalIdentifier'\n res = app_type.associated_external_identifiers(not_resource_names: got_names)\n resnames = app_type.associated_external_identifier_names\n end\n if resnames.present? && (resnames - got_names).present?\n qs << res.reorder('').to_sql\n got_names |= resnames\n end\n end\n if qs.present?\n unions = qs.join(\"\\nUNION\\n\")\n dma = from(Arel.sql(\"(#{unions}) AS #{table_name}\"))\n else\n dma = where(id: nil)\n end\n else\n dma = active\n end\n @active_model_configurations = dma\n end",
"def set_medicaldevice\n @medicaldevice = Medicaldevice.find(params[:id])\n end",
"def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"def associated_model_config\n @associated_model_config ||= RailsAdmin.config(association_klass)\n end",
"def managed?\n (options[:managed].present? && options[:managed] === true)\n end",
"def appman_params\n params.require(:appman).permit(:name, :stackmetadata, :stackid, :details, :cloud_ids)\n end",
"def set_goods_category_management\n @goods_category_management = GoodsCategoryManagement.find(params[:id])\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def update\n if params[:device_group][:property_ids]\n params[:device_group][:property_ids].each do |property_id|\n @property = Property.find(property_id)\n @device_group.properties << @property\n end\n end\n respond_to do |format|\n if @device_group.update(device_group_params)\n format.html { redirect_to @device_group, notice: 'Device group was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n end\n end\n end",
"def device_configuration_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceConfigurationStates::DeviceConfigurationStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def compliant_apps_list=(value)\n @compliant_apps_list = value\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def configured_handlers\n\t\treturn Mongrel2::Config::Handler.by_send_ident( self.app_id )\n\tend",
"def apps=(value)\n @apps = value\n end",
"def devices=(value)\n @devices = value\n end",
"def get_device_management_intent_per_setting_contributing_profiles()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentPerSettingContributingProfiles::GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_management\n @admin = Admin.find(params[:id])\n @management = Admin.find(params[:id])\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def device_category()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceCategory::DeviceCategoryRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find(params[:id])\n end",
"def configure_primary_build_configuration_settings(project, name, platforms)\n\n platforms.each do |platform|\n\n # FIXME: abstract away\n target = project.targets.find { |y| y.name == \"#{name} #{platform}\" }\n\n settings = {\n 'INFOPLIST_FILE' => \"#{name}/Info.plist\",\n 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => 'NO',\n 'PRODUCT_NAME' => \"#{name}\",\n 'CODE_SIGN_IDENTITY[sdk=iphoneos*]' => \"-\",\n 'PRODUCT_BUNDLE_IDENTIFIER' => \"com.dn-m.#{name}\"\n }\n\n settings.each do |key, val|\n target.build_configuration_list.set_setting(key, val)\n end\n end\nend",
"def get_device_management_intent_settings_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentSettingsReport::GetDeviceManagementIntentSettingsReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end",
"def set_manage_admin\n @manage_admin = Manage::Admin.find(params[:id])\n end",
"def enable_active_configurations\n if Admin::MigrationGenerator.table_or_view_exists? table_name\n active_model_configurations.each do |dm|\n klass = if dm.is_a? ExternalIdentifier\n Object\n else\n dm.class.name.constantize\n end\n\n if dm.ready_to_generate? && dm.implementation_class_defined?(klass, fail_without_exception: true)\n dm.add_master_association\n else\n msg = \"Failed to enable #{dm} #{dm.id} #{dm.resource_name}. Table ready? #{dm.table_or_view_ready?}\"\n puts msg\n Rails.logger.warn msg\n end\n end\n else\n msg = \"Table doesn't exist yet: #{table_name}\"\n puts msg\n Rails.logger.warn msg\n end\n end",
"def setup_mdadm\n Souffle::Log.info \"#{@node.log_prefix} Setting up mdadm...\"\n provider.setup_mdadm(@node)\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def set_app_config\n @app_config = AppConfig.find(params[:id])\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def update_admins\n\n @notification_types_config_hash.each do |n_type, data|\n include_admin_ids = @email_setting[n_type.to_s]\n\n @admins.each do |admin|\n if include_admin_ids.include?(admin.id)\n admin.send(\"set_#{n_type.to_s}\")\n else\n admin.send(\"unset_#{n_type.to_s}\")\n end\n end\n\n end\n\n @admins.each do |admin|\n if admin.changed?\n admin.save!\n @was_notification_setting_updated = true\n end\n end\n\n return error_with_data(\n 's_cm_uens_ua_1',\n 'Invalid parameters',\n 'You are choosing to save existing settings.',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !@was_notification_setting_updated\n\n success\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def set_prd_m_host_app\n @prd_m_host_app = PrdMHostApp.find(params[:id])\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def set_manage_app_version\n @manage_app_version = Manage::AppVersion.find(params[:id])\n end",
"def app_definitions=(value)\n @app_definitions = value\n end",
"def set_device_manufacturer\n @device_manufacturer = DeviceManufacturer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7347386",
"0.66561866",
"0.6338508",
"0.6231292",
"0.5843936",
"0.57476366",
"0.5617837",
"0.5516933",
"0.54802245",
"0.545087",
"0.5377525",
"0.5345815",
"0.5259468",
"0.5168223",
"0.51356244",
"0.49590248",
"0.4925007",
"0.49247476",
"0.4818033",
"0.4807955",
"0.4793031",
"0.47721797",
"0.47236636",
"0.46924412",
"0.46644303",
"0.46370012",
"0.46082908",
"0.45586154",
"0.45522538",
"0.4539334",
"0.4539334",
"0.45195684",
"0.45066455",
"0.4466152",
"0.44638157",
"0.44531107",
"0.4452692",
"0.43932384",
"0.43787408",
"0.43704817",
"0.4324549",
"0.43121463",
"0.43120944",
"0.43110684",
"0.4307301",
"0.42807233",
"0.4272771",
"0.42636806",
"0.42587504",
"0.4245858",
"0.42438716",
"0.42404693",
"0.42210433",
"0.42203048",
"0.42164806",
"0.4204433",
"0.41931218",
"0.4155647",
"0.41522628",
"0.41323933",
"0.4125751",
"0.41243076",
"0.40963703",
"0.40950605",
"0.40950605",
"0.40943548",
"0.40791172",
"0.4078355",
"0.4078351",
"0.4078134",
"0.40779895",
"0.40732747",
"0.40521476",
"0.40477103",
"0.40473574",
"0.40261695",
"0.40218532",
"0.40218532",
"0.40125117",
"0.40125117",
"0.39974388",
"0.3995589",
"0.39937592",
"0.39936507",
"0.3992863",
"0.3989433",
"0.39873558",
"0.3975025",
"0.39705873",
"0.3963852",
"0.39459866",
"0.39441058",
"0.3939517",
"0.39382797",
"0.39360118",
"0.39353874",
"0.39277896",
"0.392613",
"0.39235118",
"0.39210775"
] |
0.7684352
|
0
|
Provides operations to manage the vppTokens property of the microsoft.graph.deviceAppManagement entity.
|
def vpp_tokens()
return MicrosoftGraph::DeviceAppManagement::VppTokens::VppTokensRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vpp_tokens=(value)\n @vpp_tokens = value\n end",
"def vpp_tokens\n return @vpp_tokens\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def app_token=(value)\n @children['app-token'][:value] = value\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def vm_instances\n @conn.vminstances\n end",
"def tokens\r\n @tokens ||= TokensController.new(configuration: @configuration)\r\n end",
"def poweron_vapp(vAppId)\n params = {\n 'method' => :post,\n 'command' => \"/vApp/vapp-#{vAppId}/power/action/powerOn\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end",
"def ocp_apim_access_token\n ENV['VIPPS_PRIMARY_ACCESS_TOKEN']\n end",
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_tokens\n DeviceToken.where(user_id: user_ids)\n end",
"def add_tokens_to_apps(parsed_yaml, quiet: false, prefix: \"\")\n env = ENV.fetch('VAULT_ENV', nil)\n result = Marshal.load(Marshal.dump(parsed_yaml))\n result.each do |app_name, info|\n full_app_name = prefix + app_name\n if have_policy_for?(full_app_name)\n STDERR.puts(\"Issuing token for #{full_app_name}\") unless quiet\n token = create_token_for(full_app_name)\n info['environment'] ||= {}\n info['environment']['VAULT_ADDR'] =\n ENV.fetch('CONTAINER_VAULT_ADDR', ENV.fetch('VAULT_ADDR'))\n info['environment']['VAULT_ENV'] = env if env\n info['environment']['VAULT_TOKEN'] = token.auth.client_token\n else\n STDERR.puts(\"WARNING: No policy for #{full_app_name}, so no token issued\")\n end\n end\n result\n end",
"def suspend_vapp(vAppId)\n params = {\n 'method' => :post,\n 'command' => \"/vApp/vapp-#{vAppId}/power/action/suspend\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end",
"def managed_devices\n return @managed_devices\n end",
"def add(app_token)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'appToken', app_token)\n\t\t\tclient.queue_service_action_call('apptoken', 'add', 'KalturaAppToken', 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",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def setupvmotion\n Puppet.debug \"Entering setup vmotion method.\"\n @networksystem=host.configManager.networkSystem\n vnicdevice = nil\n\n if (resource[:portgrouptype] == :VMkernel)\n @virtualNicManager = host.configManager.virtualNicManager\n\n vnics=@networksystem.networkInfo.vnic\n\n #enabling vmotion\n vnics.each do |vnic|\n if (vnic.portgroup && resource[:portgrp] == vnic.portgroup)\n vnicdevice=vnic.device\n end\n end\n if (resource[:vmotion] == :enabled)\n if (vnicdevice != nil)\n @virtualNicManager.SelectVnicForNicType(:nicType => \"vmotion\" , :device => vnicdevice)\n end\n end\n\n begin\n #disabling vmotion\n if (resource[:vmotion] == :disabled)\n if (vnicdevice != nil)\n @virtualNicManager.DeselectVnicForNicType(:nicType => \"vmotion\" , :device => vnicdevice)\n end\n end\n rescue Exception => e\n=begin\n Exception is handled here to just log a debug message because there is no way to retrieve vMotion current status and if puupet tries to disable vMotion when it is already disabled,\n it throws an exception - just a workaround to handle this scenario.\n=end\n Puppet.debug \"vmotion is already disabled.\"\n end\n\n end\n end",
"def api_tokens\n ApiToken.all(self)\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def set_manage_app_version\n @manage_app_version = Manage::AppVersion.find(params[:id])\n end",
"def get_vapp(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n\n vapp_node = response.css('VApp').first\n if vapp_node\n name = vapp_node['name']\n status = convert_vapp_status(vapp_node['status'])\n end\n\n description = response.css(\"Description\").first\n description = description.text unless description.nil?\n\n ip = response.css('IpAddress').first\n ip = ip.text unless ip.nil?\n\n vms = response.css('Children Vm')\n vms_hash = {}\n\n # ipAddress could be namespaced or not: see https://github.com/astratto/vcloud-rest/issues/3\n vms.each do |vm|\n vapp_local_id = vm.css('VAppScopedLocalId')\n addresses = vm.css('rasd|Connection').collect{|n| n['vcloud:ipAddress'] || n['ipAddress'] }\n vms_hash[vm['name']] = {\n :addresses => addresses,\n :status => convert_vapp_status(vm['status']),\n :id => vm['href'].gsub(\"#{@api_url}/vApp/vm-\", ''),\n :vapp_scoped_local_id => vapp_local_id.text\n }\n end\n\n # TODO: EXPAND INFO FROM RESPONSE\n { :name => name, :description => description, :status => status, :ip => ip, :vms_hash => vms_hash }\n end",
"def token=(value)\n @token = value\n resources.each do |klass|\n update_token_header(klass)\n end\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def getToken\n @tokens\n end",
"def index\n @connection_tokens = ConnectionToken.all\n end",
"def poweron_vapp(vAppId)\n power_action(vAppId, 'powerOn')\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def app_token\n uri = URI.parse Facebook.config[:canvas_url] \n canvas_url = uri.host\n # where(\"page_access_token is not null\")\n @tokens ||= AppToken.where(\"platform='Facebook'\").where(\"client_id is not null\").to_a\n @access_token = @tokens.sample # [self.id % @tokens.size]\n end",
"def page access tokens_connections\n end",
"def retrieve_tokens\n return false unless oauth_credentials_valid?(@current_user)\n\n tokens = OpenStruct.new(get_tokens(@current_user, 'watch'))\n @watch_token = tokens.action_token\n @access_token = tokens.access_token\n\n !(@watch_token.nil? || @access_token.nil?)\n end",
"def update\n self.class.update_payment_token_by_id(self.id, self)\n end",
"def manage\n @devices = Device.page(params[:page])\n\n respond_with(@devices)\n end",
"def add_device_token(device_token)\n\t\tself.device_tokens |= [device_token]\n\t\tself.update_attribute(:device_tokens, self.device_tokens)\n\tend",
"def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end",
"def platforms\n expose Metadata.platforms(@oauth_token)\n end",
"def refresh_tokens\n @token = @token.refresh!\n tokens\n end",
"def count_apps_using_tokens(type)\n get_tokens(type).count\nend",
"def index\n @manage_app_versions = Manage::AppVersion.all\n end",
"def set_app\n @app = App.find_by(token: params[:token])\n end",
"def vms\n @conn.vms\n end",
"def index\n @magazine = Magazine.find_by_apps_id(params[:id])\n @push_tokens = PushToken.where(:magazine_id =>@magazine.id)\n end",
"def update_tokens(oauth_params)\n# binding.pry\n self.oauth_token = oauth_params.credentials.token\n # facebook, google provide this; twitter, linkedin don't\n self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.expires_at\n # twitter\n self.oauth_secret = oauth_params.credentials.secret if oauth_params.credentials.secret\n end",
"def token_windows(_resource)\n # TODO\n nil\n end",
"def update!(**args)\n @vm_token = args[:vm_token] if args.key?(:vm_token)\n end",
"def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list={}, network_config={})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.ComposeVAppParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\",\n \"xmlns:ovf\" => \"http://schemas.dmtf.org/ovf/envelope/1\",\n \"name\" => vapp_name) {\n xml.Description vapp_description\n xml.InstantiationParams {\n xml.NetworkConfigSection {\n xml['ovf'].Info \"Configuration parameters for logical networks\"\n xml.NetworkConfig(\"networkName\" => network_config[:name]) {\n xml.Configuration {\n xml.IpScopes {\n xml.IpScope {\n xml.IsInherited(network_config[:is_inherited] || \"false\")\n xml.Gateway network_config[:gateway]\n xml.Netmask network_config[:netmask]\n xml.Dns1 network_config[:dns1] if network_config[:dns1]\n xml.Dns2 network_config[:dns2] if network_config[:dns2]\n xml.DnsSuffix network_config[:dns_suffix] if network_config[:dns_suffix]\n xml.IpRanges {\n xml.IpRange {\n xml.StartAddress network_config[:start_address]\n xml.EndAddress network_config[:end_address]\n }\n }\n }\n }\n xml.ParentNetwork(\"href\" => \"#{@api_url}/network/#{network_config[:parent_network]}\")\n xml.FenceMode network_config[:fence_mode]\n\n xml.Features {\n xml.FirewallService {\n xml.IsEnabled(network_config[:enable_firewall] || \"false\")\n }\n }\n }\n }\n }\n }\n vm_list.each do |vm_name, vm_id|\n xml.SourcedItem {\n xml.Source(\"href\" => \"#{@api_url}/vAppTemplate/vm-#{vm_id}\", \"name\" => vm_name)\n xml.InstantiationParams {\n xml.NetworkConnectionSection(\n \"xmlns:ovf\" => \"http://schemas.dmtf.org/ovf/envelope/1\",\n \"type\" => \"application/vnd.vmware.vcloud.networkConnectionSection+xml\",\n \"href\" => \"#{@api_url}/vAppTemplate/vm-#{vm_id}/networkConnectionSection/\") {\n xml['ovf'].Info \"Network config for sourced item\"\n xml.PrimaryNetworkConnectionIndex \"0\"\n xml.NetworkConnection(\"network\" => network_config[:name]) {\n xml.NetworkConnectionIndex \"0\"\n xml.IsConnected \"true\"\n xml.IpAddressAllocationMode(network_config[:ip_allocation_mode] || \"POOL\")\n }\n }\n }\n xml.NetworkAssignment(\"containerNetwork\" => network_config[:name], \"innerNetwork\" => network_config[:name])\n }\n end\n xml.AllEULAsAccepted \"true\"\n }\n end\n\n params = {\n \"method\" => :post,\n \"command\" => \"/vdc/#{vdc}/action/composeVApp\"\n }\n\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.composeVAppParams+xml\")\n\n vapp_id = headers[:location].gsub(\"#{@api_url}/vApp/vapp-\", \"\")\n\n task = response.css(\"VApp Task[operationName='vdcComposeVapp']\").first\n task_id = task[\"href\"].gsub(\"#{@api_url}/task/\", \"\")\n\n { :vapp_id => vapp_id, :task_id => task_id }\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def reset_vapp(vAppId)\n params = {\n 'method' => :post,\n 'command' => \"/vApp/vapp-#{vAppId}/power/action/reset\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def manage_app_version_params\n params.require(:manage_app_version).permit(:app_type, :app_version, :name, :mode, :version_code, :url, :active)\n end",
"def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list={}, network_config={})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.ComposeVAppParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\",\n \"xmlns:ovf\" => \"http://schemas.dmtf.org/ovf/envelope/1\",\n \"name\" => vapp_name) {\n xml.Description vapp_description\n xml.InstantiationParams {\n xml.NetworkConfigSection {\n xml['ovf'].Info \"Configuration parameters for logical networks\"\n xml.NetworkConfig(\"networkName\" => network_config[:name]) {\n xml.Configuration {\n xml.IpScopes {\n xml.IpScope {\n xml.IsInherited(network_config[:is_inherited] || \"false\")\n xml.Gateway network_config[:gateway]\n xml.Netmask network_config[:netmask]\n xml.Dns1 network_config[:dns1] if network_config[:dns1]\n xml.Dns2 network_config[:dns2] if network_config[:dns2]\n xml.DnsSuffix network_config[:dns_suffix] if network_config[:dns_suffix]\n xml.IpRanges {\n xml.IpRange {\n xml.StartAddress network_config[:start_address]\n xml.EndAddress network_config[:end_address]\n }\n }\n }\n }\n xml.ParentNetwork(\"href\" => \"#{@api_url}/network/#{network_config[:parent_network]}\")\n xml.FenceMode network_config[:fence_mode]\n\n xml.Features {\n xml.FirewallService {\n xml.IsEnabled(network_config[:enable_firewall] || \"false\")\n }\n if network_config.has_key? :nat_type\n xml.NatService {\n xml.IsEnabled \"true\"\n xml.NatType network_config[:nat_type]\n xml.Policy(network_config[:nat_policy_type] || \"allowTraffic\")\n }\n end\n }\n }\n }\n }\n }\n vm_list.each do |vm_name, vm_id|\n xml.SourcedItem {\n xml.Source(\"href\" => \"#{@api_url}/vAppTemplate/vm-#{vm_id}\", \"name\" => vm_name)\n xml.InstantiationParams {\n xml.NetworkConnectionSection(\n \"xmlns:ovf\" => \"http://schemas.dmtf.org/ovf/envelope/1\",\n \"type\" => \"application/vnd.vmware.vcloud.networkConnectionSection+xml\",\n \"href\" => \"#{@api_url}/vAppTemplate/vm-#{vm_id}/networkConnectionSection/\") {\n xml['ovf'].Info \"Network config for sourced item\"\n xml.PrimaryNetworkConnectionIndex \"0\"\n xml.NetworkConnection(\"network\" => network_config[:name]) {\n xml.NetworkConnectionIndex \"0\"\n xml.IsConnected \"true\"\n xml.IpAddressAllocationMode(network_config[:ip_allocation_mode] || \"POOL\")\n }\n }\n }\n xml.NetworkAssignment(\"containerNetwork\" => network_config[:name], \"innerNetwork\" => network_config[:name])\n }\n end\n xml.AllEULAsAccepted \"true\"\n }\n end\n\n params = {\n \"method\" => :post,\n \"command\" => \"/vdc/#{vdc}/action/composeVApp\"\n }\n\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.composeVAppParams+xml\")\n\n vapp_id = headers[:location].gsub(/.*\\/vApp\\/vapp\\-/, \"\")\n\n task = response.css(\"VApp Task[operationName='vdcComposeVapp']\").first\n task_id = task[\"href\"].gsub(/.*\\/task\\//, \"\")\n\n { :vapp_id => vapp_id, :task_id => task_id }\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def app_params\n params.require(:app).permit(:Firstname, :Lastname, :description)\n params.require(:app).permit(:Voltage, :Current)\n end",
"def token_count_vector( token )\n token_pool_counts = []\n self.pools.each do |pool_name, pool|\n\tunless pool_name == '__Corpus__'\n\t token_pool_counts.push( get_token_counts( token, pool_name ) )\n\tend\n end\n return token_pool_counts\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def token\n @api.get(\"#{Paths::TOKENS}\")\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def set_PageToken(value)\n set_input(\"PageToken\", value)\n end",
"def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end",
"def index\n @payment_tokens = PaymentToken.all\n end",
"def poweroff_vapp(vAppId)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.UndeployVAppParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\") {\n xml.UndeployPowerAction 'powerOff'\n }\n end\n\n params = {\n 'method' => :post,\n 'command' => \"/vApp/vapp-#{vAppId}/action/undeploy\"\n }\n\n response, headers = send_request(params, builder.to_xml,\n \"application/vnd.vmware.vcloud.undeployVAppParams+xml\")\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end",
"def exchange_oauth_tokens\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"def create\n @app = App.new(app_params)\n #added code for realizers list\n\t#@developers = Developer.where(:id => params[:realizers])\n #logger.debug \"DEVELOPER: #{@developers.inspect} \\n\"\n\t#@app.developers << @developers \n #logger.debug \"DEVELOPERS: #{@app.developers.inspect} \\n\"\n\t#end code\n\n respond_to do |format|\n if @app.save\n @app.developers << current_dev \n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge_vm_parameters(host, global, vb)\n # These are arrays of hashes\n if global['vm_options'] or host['vm_options']\n merge_hash = merge_2_array_of_hashes(global['vm_options'], host['vm_options'])\n merge_hash.each do |key, value|\n vb.customize [\"modifyvm\", :id, \"--#{key}\", value]\n end\n end\nend",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def vmotion=(value)\n Puppet.debug \"Updating vmotion status flag of specified portgroup.\"\n begin\n setupvmotion\n rescue Exception => e\n fail \"Unable to configure the vMotion on a port group because the following exception occurred: -\\n #{e.message}\"\n end\n end",
"def appman_params\n params.require(:appman).permit(:name, :stackmetadata, :stackid, :details, :cloud_ids)\n end",
"def add_push_token\n if params[:push_token] && params[:push_token][:token] && params[:push_token][:user_device_type_id] && params[:push_token][:device_uuid]\n db_user = current_user.db_user\n device_type = UserDeviceType.find_by_id(params[:push_token][:user_device_type_id].to_i)\n if device_type\n # make sure we do not store a duplicate token\n UserPushToken.where(user_id: current_user.id, device_uuid: params[:push_token][:device_uuid]).destroy_all\n\n # add the token to the users push token listing\n db_user.user_push_tokens << UserPushToken.new(push_params)\n if db_user.save\n render status: 200, json: { message: 'Device token added!' }\n else\n render status: :unprocessable_entity, json: { message: \"A push token could not be added because: #{db_user.errors.full_messages.to_sentence}\" }\n end\n else\n render status: 400, json: { message: 'Device type if not found!' }\n end\n else\n render status: 400, json: { message: 'Incorrect parameters provided or parameters missing.' }\n end\n end",
"def admin_update_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n perms_ids = params[:perm_ids].blank? ? [] : params[:perm_ids].map(&:to_i)\n perms = Perm.where( id: perms_ids)\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n if ! perms.include? perm\n @user.perms.delete(perm)\n if perm.id == Perm.use_api.id\n @user.remove_token!\n end\n end\n else\n if perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n end\n end\n end\n end\n\n if @user.save!\n redirect_to({controller: 'users', action: 'admin_index'}, {notice: _('Information was successfully updated.')}) # helpers.success key does not exist, replaced with a generic string\n else\n flash[:notice] = failed_update_error(@user, _('user'))\n end\n end",
"def vm_management(options = {})\n Azure::VirtualMachineManagement::VirtualMachineManagementService.new(default_client(options))\n end",
"def disposable_tokens(params = {})\n post(\"/invite-token/generate\", params)\n end",
"def store_token\n user_config.set :pivotal_token, token\n end",
"def set_token\n\t\tputs \"---------\"\n\t\tresponse = @http.get(\"/gadgets/list?account=#{@account}\",cookie_hash)#needed for the case of new user. The list has to be initialized before it can be accessed.\n\t\tputs \"#{response.code} - #{response.message}: /gadgets/list\"\n\t\tcheck_cookie(response)\n\t\tsleep 2\n\t\tputs \"get token\"\n\t\tresponse2 = @http.get(\"/gadgets/list?context=sidebar&active=true&account=#{@account}\",cookie_hash)\n\t\tputs \"#{response2.code} - #{response2.message}: /gadgets/list?context=sidebar\"\n\t\tcheck_cookie(response2)\n\t\tputs \"---------\"\n\t\tgadgets = JSON.parse(response.body)\n\t\tif response2.code == \"200\"\n\t\t\ttoken = gadgets.first[\"token\"]\n\t\t\t@token = token\n\t\telse\n\t\t\tputs \"get token failed\"\n\t\tend\n\tend",
"def management_sdk_version=(value)\n @management_sdk_version = value\n end",
"def create\n \n if params[:pdevice_token]\n if @pdevice=Pdevice.find_by_token(params[:pdevice_token])\n @pdevice.user = params[:pdevice_user]\n else\n @pdevice = Pdevice.new(:token=>params[:pdevice_token],:user=>params[:pdevice_user])\n end\n else\n @pdevice = Pdevice.new(params[:pdevice])\n end\n\n respond_to do |format|\n if @pdevice.save\n format.html { redirect_to @pdevice, notice: 'Pdevice was successfully created.' }\n format.json { render json: @pdevice, status: :created, location: @pdevice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pdevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def principal_token=(token)\n end"
] |
[
"0.58985525",
"0.5865783",
"0.53844005",
"0.51103204",
"0.5009265",
"0.48977032",
"0.48176557",
"0.4722188",
"0.46599543",
"0.4658059",
"0.45846778",
"0.4567695",
"0.45508134",
"0.4543258",
"0.45325553",
"0.45120335",
"0.45057854",
"0.4498486",
"0.44790214",
"0.445957",
"0.44350114",
"0.4428356",
"0.44206333",
"0.43984345",
"0.4388091",
"0.43822557",
"0.43764284",
"0.43600738",
"0.4359399",
"0.43573886",
"0.43462497",
"0.43391007",
"0.4337992",
"0.4323579",
"0.43200937",
"0.43050867",
"0.43030682",
"0.42866874",
"0.4280835",
"0.4247938",
"0.4245966",
"0.42455646",
"0.42369044",
"0.42278168",
"0.421366",
"0.4208429",
"0.42029867",
"0.42018265",
"0.42012915",
"0.41972744",
"0.41913304",
"0.4189757",
"0.41870627",
"0.4184645",
"0.41696745",
"0.41475806",
"0.41414747",
"0.41406152",
"0.41363564",
"0.41358945",
"0.41331893",
"0.41267204",
"0.41096205",
"0.41031912",
"0.4099805",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40987137",
"0.40938914",
"0.40915787",
"0.40825778",
"0.4069585",
"0.4066156",
"0.4064871",
"0.40497047",
"0.40482402",
"0.40469953",
"0.4045647",
"0.40439984",
"0.4040004",
"0.40361217",
"0.40336522",
"0.40326923",
"0.4030587",
"0.40267065",
"0.40261403",
"0.40255705"
] |
0.6854494
|
0
|
Provides operations to manage the windowsInformationProtectionPolicies property of the microsoft.graph.deviceAppManagement entity.
|
def windows_information_protection_policies()
return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def windows_information_protection_policies\n return @windows_information_protection_policies\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def windows_protection_state()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::WindowsProtectionState::WindowsProtectionStateRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def android_managed_app_protections\n return @android_managed_app_protections\n end",
"def android_managed_app_protections=(value)\n @android_managed_app_protections = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsInformationProtection\"\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def information_protection()\n return MicrosoftGraph::InformationProtection::InformationProtectionRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def group_policies\r\n GroupPoliciesController.instance\r\n end",
"def work_profile_default_app_permission_policy\n return @work_profile_default_app_permission_policy\n end",
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def get_all_scoped_privileges_and_prohibitions(user_or_attribute, object_or_attribute, options = {})\n if policy_machine_storage_adapter.respond_to?(:scoped_privileges)\n policy_machine_storage_adapter.scoped_privileges(user_or_attribute.stored_pe, object_or_attribute.stored_pe, options).map do |op|\n operation = PM::Operation.convert_stored_pe_to_pe(op, policy_machine_storage_adapter, PM::Operation)\n [user_or_attribute, operation, object_or_attribute]\n end\n else\n operations.grep(->operation{is_privilege_ignoring_prohibitions?(user_or_attribute, operation, object_or_attribute)}) do |op|\n [user_or_attribute, op, object_or_attribute]\n end\n end\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def entitlement_management\n return @entitlement_management\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def windows_restriction\n return @windows_restriction\n end",
"def supported_privilege_set\n nil\n end",
"def permissions_policy(&block); end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.targetedManagedAppProtection\"\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def supported_privilege_set\n nil\n end",
"def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end",
"def get_field_deserializers()\n return super.merge({\n \"androidManagedAppProtections\" => lambda {|n| @android_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AndroidManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"defaultManagedAppProtections\" => lambda {|n| @default_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DefaultManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"iosManagedAppProtections\" => lambda {|n| @ios_managed_app_protections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IosManagedAppProtection.create_from_discriminator_value(pn) }) },\n \"isEnabledForMicrosoftStoreForBusiness\" => lambda {|n| @is_enabled_for_microsoft_store_for_business = n.get_boolean_value() },\n \"managedAppPolicies\" => lambda {|n| @managed_app_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"managedAppRegistrations\" => lambda {|n| @managed_app_registrations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppRegistration.create_from_discriminator_value(pn) }) },\n \"managedAppStatuses\" => lambda {|n| @managed_app_statuses = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppStatus.create_from_discriminator_value(pn) }) },\n \"managedEBooks\" => lambda {|n| @managed_e_books = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedEBook.create_from_discriminator_value(pn) }) },\n \"mdmWindowsInformationProtectionPolicies\" => lambda {|n| @mdm_windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MdmWindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n \"microsoftStoreForBusinessLanguage\" => lambda {|n| @microsoft_store_for_business_language = n.get_string_value() },\n \"microsoftStoreForBusinessLastCompletedApplicationSyncTime\" => lambda {|n| @microsoft_store_for_business_last_completed_application_sync_time = n.get_date_time_value() },\n \"microsoftStoreForBusinessLastSuccessfulSyncDateTime\" => lambda {|n| @microsoft_store_for_business_last_successful_sync_date_time = n.get_date_time_value() },\n \"mobileAppCategories\" => lambda {|n| @mobile_app_categories = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppCategory.create_from_discriminator_value(pn) }) },\n \"mobileAppConfigurations\" => lambda {|n| @mobile_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDeviceMobileAppConfiguration.create_from_discriminator_value(pn) }) },\n \"mobileApps\" => lambda {|n| @mobile_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileApp.create_from_discriminator_value(pn) }) },\n \"targetedManagedAppConfigurations\" => lambda {|n| @targeted_managed_app_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppConfiguration.create_from_discriminator_value(pn) }) },\n \"vppTokens\" => lambda {|n| @vpp_tokens = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::VppToken.create_from_discriminator_value(pn) }) },\n \"windowsInformationProtectionPolicies\" => lambda {|n| @windows_information_protection_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionPolicy.create_from_discriminator_value(pn) }) },\n })\n end",
"def enable_termination_protection\n data[:enable_termination_protection]\n end",
"def managed_apps\n return @managed_apps\n end",
"def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:extension_id, :version)))\n end",
"def have_policy_for?(app_name)\n @policies ||= Vault.sys.policies\n @policies.include?(app_name)\n end",
"def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:username, :extension_id, :version)))\n end",
"def windows_mobile_restriction\n return @windows_mobile_restriction\n end",
"def windows_restriction=(value)\n @windows_restriction = value\n end",
"def disable_power_policies\n return @disable_power_policies\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def implied_perms_for(permissions)\n implied_permissions = []\n permissions.each do |p|\n next if p.class_name.to_sym == :any\n next unless p.target_class_exists?\n p.target_class.sg_priv_to_implied_privs[p.privilege].each do |pi|\n\tp_new = p.dup\n\tp_new.privilege = pi\n\timplied_permissions << p_new\n\tend\n end\n implied_permissions \n end",
"def work_profile_default_app_permission_policy=(value)\n @work_profile_default_app_permission_policy = value\n end",
"def app_locker_application_control\n return @app_locker_application_control\n end",
"def protections\n @descriptive_detail.protections\n end",
"def store_definition policies\n # Policies may have been defined by other means. If it's not a hash, stop\n return unless policies.is_a? Hash\n\n base = current_base\n policies.each_pair do |widget, conditions|\n policy = base[widget] || {\n :self => true,\n :params => [],\n :models => {},\n :procs => [],\n :widget_params => true\n }\n add_conditions(policy, conditions)\n base[widget] = policy\n end\n end",
"def azure_rights_management_services_allowed\n return @azure_rights_management_services_allowed\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def content_security_policy_overrides\n {}\n end",
"def management_interface_settings\r\n ManagementInterfaceSettingsController.instance\r\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignments\" => lambda {|n| @assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TargetedManagedAppPolicyAssignment.create_from_discriminator_value(pn) }) },\n \"azureRightsManagementServicesAllowed\" => lambda {|n| @azure_rights_management_services_allowed = n.get_boolean_value() },\n \"dataRecoveryCertificate\" => lambda {|n| @data_recovery_certificate = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionDataRecoveryCertificate.create_from_discriminator_value(pn) }) },\n \"enforcementLevel\" => lambda {|n| @enforcement_level = n.get_enum_value(MicrosoftGraph::Models::WindowsInformationProtectionEnforcementLevel) },\n \"enterpriseDomain\" => lambda {|n| @enterprise_domain = n.get_string_value() },\n \"enterpriseIPRanges\" => lambda {|n| @enterprise_i_p_ranges = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionIPRangeCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseIPRangesAreAuthoritative\" => lambda {|n| @enterprise_i_p_ranges_are_authoritative = n.get_boolean_value() },\n \"enterpriseInternalProxyServers\" => lambda {|n| @enterprise_internal_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseNetworkDomainNames\" => lambda {|n| @enterprise_network_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProtectedDomainNames\" => lambda {|n| @enterprise_protected_domain_names = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxiedDomains\" => lambda {|n| @enterprise_proxied_domains = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionProxiedDomainCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServers\" => lambda {|n| @enterprise_proxy_servers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"enterpriseProxyServersAreAuthoritative\" => lambda {|n| @enterprise_proxy_servers_are_authoritative = n.get_boolean_value() },\n \"exemptAppLockerFiles\" => lambda {|n| @exempt_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"exemptApps\" => lambda {|n| @exempt_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"iconsVisible\" => lambda {|n| @icons_visible = n.get_boolean_value() },\n \"indexingEncryptedStoresOrItemsBlocked\" => lambda {|n| @indexing_encrypted_stores_or_items_blocked = n.get_boolean_value() },\n \"isAssigned\" => lambda {|n| @is_assigned = n.get_boolean_value() },\n \"neutralDomainResources\" => lambda {|n| @neutral_domain_resources = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n \"protectedAppLockerFiles\" => lambda {|n| @protected_app_locker_files = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionAppLockerFile.create_from_discriminator_value(pn) }) },\n \"protectedApps\" => lambda {|n| @protected_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionApp.create_from_discriminator_value(pn) }) },\n \"protectionUnderLockConfigRequired\" => lambda {|n| @protection_under_lock_config_required = n.get_boolean_value() },\n \"revokeOnUnenrollDisabled\" => lambda {|n| @revoke_on_unenroll_disabled = n.get_boolean_value() },\n \"rightsManagementServicesTemplateId\" => lambda {|n| @rights_management_services_template_id = n.get_guid_value() },\n \"smbAutoEncryptedFileExtensions\" => lambda {|n| @smb_auto_encrypted_file_extensions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WindowsInformationProtectionResourceCollection.create_from_discriminator_value(pn) }) },\n })\n end",
"def protected_apps=(value)\n @protected_apps = value\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def control_availability\n dpms_availability\n end",
"def upi_power_management=(upi_power_management)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(upi_power_management)\n fail ArgumentError, \"invalid value for \\\"upi_power_management\\\", must be one of #{validator.allowable_values}.\"\n end\n @upi_power_management = upi_power_management\n end",
"def migrate_permissions_for(object)\n # Find any access controls for this work. The must be sufia6F style in order to not show up on the Work.\n legacy_access_controls = access_controls_for object\n puts \"#{legacy_access_controls.count} AccessControls for #{object.class}: #{object.id}\"\n puts \"#{object.permissions}\"\n\n # Create equivalent access controls\n self.class.make_equivalent_permissions( object, legacy_access_controls )\n puts \"Created equivalent permissions.\"\n puts \"#{object.permissions}\"\n\n # Destroy legacy_access_controls\n if object.save\n puts \"Able to save #{object.class} with new permissions. Destroying old access controls.\"\n legacy_access_controls.each{ |ac| ac.destroy }\n else\n puts \"Unable to save #{object.class}.\"\n end\n end",
"def admin_app_params\n params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable)\n end",
"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",
"def setPolicies\n=begin\n Util.modifyPolicy(ncaEnclave, '', '\nPolicy DamlBootPolicyNCAServletForRearPolicyAdmin = [\n A user in role RearPolicyAdministration can access a servlet named NCAServlets\n]\n')\n=end\n end",
"def add_http_permissions_policy\n response.set_header(\n 'Permissions-Policy',\n 'fullscreen=(), geolocation=(), midi=(), ' \\\n 'notifications=(), push=(), sync-xhr=(), microphone=(), ' \\\n 'camera=(), magnetometer=(), gyroscope=(), speaker=(), ' \\\n 'vibrate=(), payment=()'\n )\n # Include the older Feature-Policy header, for older browser versions.\n # We can eventually drop this, but it doesn't hurt to include it for now.\n response.set_header(\n 'Feature-Policy',\n \"fullscreen 'none'; geolocation 'none'; midi 'none';\" \\\n \"notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none';\" \\\n \"camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none';\" \\\n \"vibrate 'none'; payment 'none'\"\n )\n end",
"def assert_pm_scoped_privilege_expectations\n users_or_attributes = policy_machine.users | policy_machine.user_attributes\n objects_or_attributes = policy_machine.objects | policy_machine.object_attributes\n users_or_attributes.product(objects_or_attributes) do |u, o|\n expected_scoped_privileges = policy_machine.operations.reject(&:prohibition?).grep(->op{policy_machine.is_privilege?(u, op.unique_identifier, o)}) do |op|\n [u, op, o]\n end\n expect(policy_machine.scoped_privileges(u,o)).to match_array(expected_scoped_privileges)\n end\n\nend",
"def update_policy new_policy_hash\n new_policy_hash = new_policy_hash.try(:to_hash) || {}\n\n new_policy = new_policy_hash.underscorify_keys\n policy = to_hash.underscorify_keys.deep_reset(false)\n\n policy.deep_merge! new_policy\n update_attribute(:the_policy, _jsonable(policy))\n end",
"def supported_control_oids\n\t\treturn self.root_dse[:supportedControl]\n\tend",
"def update\n respond_to do |format|\n if @permission_policy.update(permission_policy_params)\n format.html { redirect_to @permission_policy, notice: 'Permission policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @permission_policy }\n else\n format.html { render :edit }\n format.json { render json: @permission_policy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"androidManagedAppProtections\", @android_managed_app_protections)\n writer.write_collection_of_object_values(\"defaultManagedAppProtections\", @default_managed_app_protections)\n writer.write_collection_of_object_values(\"iosManagedAppProtections\", @ios_managed_app_protections)\n writer.write_boolean_value(\"isEnabledForMicrosoftStoreForBusiness\", @is_enabled_for_microsoft_store_for_business)\n writer.write_collection_of_object_values(\"managedAppPolicies\", @managed_app_policies)\n writer.write_collection_of_object_values(\"managedAppRegistrations\", @managed_app_registrations)\n writer.write_collection_of_object_values(\"managedAppStatuses\", @managed_app_statuses)\n writer.write_collection_of_object_values(\"managedEBooks\", @managed_e_books)\n writer.write_collection_of_object_values(\"mdmWindowsInformationProtectionPolicies\", @mdm_windows_information_protection_policies)\n writer.write_string_value(\"microsoftStoreForBusinessLanguage\", @microsoft_store_for_business_language)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastCompletedApplicationSyncTime\", @microsoft_store_for_business_last_completed_application_sync_time)\n writer.write_date_time_value(\"microsoftStoreForBusinessLastSuccessfulSyncDateTime\", @microsoft_store_for_business_last_successful_sync_date_time)\n writer.write_collection_of_object_values(\"mobileAppCategories\", @mobile_app_categories)\n writer.write_collection_of_object_values(\"mobileAppConfigurations\", @mobile_app_configurations)\n writer.write_collection_of_object_values(\"mobileApps\", @mobile_apps)\n writer.write_collection_of_object_values(\"targetedManagedAppConfigurations\", @targeted_managed_app_configurations)\n writer.write_collection_of_object_values(\"vppTokens\", @vpp_tokens)\n writer.write_collection_of_object_values(\"windowsInformationProtectionPolicies\", @windows_information_protection_policies)\n end",
"def permitted?\n appctrl_not_permitted() unless( @current_user.privileged? )\n end",
"def termination_policies\n @group.termination_policies\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def policy_hash\n to_hash\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windows10MobileCompliancePolicy\"\n end",
"def policy_class\n Hydra.config.permissions.policy_class || Hydra::AdminPolicy\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def home_realm_discovery_policies=(value)\n @home_realm_discovery_policies = value\n end",
"def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end",
"def device_compliance_policy_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceCompliancePolicyStates::DeviceCompliancePolicyStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def enterprise_app_block_trust_modification\n return @enterprise_app_block_trust_modification\n end",
"def windows_mobile_restriction=(value)\n @windows_mobile_restriction = value\n end",
"def protect(base, length = nil, protection = nil)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_PROTECT)\n\n if (length == nil)\n length = 4096\n end\n\n # If no protection was supplied, default to the most flexible\n if (protection == nil)\n protection = PAGE_EXECUTE_READWRITE\n else\n protection = gen_prot_to_specific(protection)\n end\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n request.add_tlv(TLV_TYPE_LENGTH, length)\n request.add_tlv(TLV_TYPE_PROTECTION, protection)\n\n # Send the request\n response = process.client.send_request(request)\n\n # Return the old protection to the caller\n return specific_prot_to_gen(response.get_tlv_value(TLV_TYPE_PROTECTION))\n end",
"def policy_division_params\n params.require(:policy_division).permit(:policy_id, :division_id, :support)\n end",
"def set_policy_division\n @policy_division = PolicyDivision.find(params[:id])\n @policy = Policy.all\n end",
"def device_threat_protection_required_security_level\n return @device_threat_protection_required_security_level\n end",
"def administrator_rights\n Lockdown::System.all_controllers_all_methods\n end",
"def encryptable_info\n wmi = WmiLite::Wmi.new(\"Root\\\\CIMV2\\\\Security\\\\MicrosoftVolumeEncryption\")\n disks = wmi.instances_of(\"Win32_EncryptableVolume\")\n encryption_properties(disks)\n rescue WmiLite::WmiException\n Ohai::Log.debug(\"Unable to access Win32_EncryptableVolume. Skipping encryptable details\")\n Mash.new\n end",
"def permitted?\n appctrl_not_permitted() unless ( @current_user.privileged? )\n end",
"def protected_apps\n return @protected_apps\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def is_privilege_ignoring_prohibitions?(user_or_attribute, operation, object_or_attribute, options = {})\n assert_privilege_parameters!(user_or_attribute, operation, object_or_attribute)\n\n if options.empty? && policy_machine_storage_adapter.respond_to?(:is_privilege?)\n privilege = [user_or_attribute, operation, object_or_attribute].map { |obj| obj.respond_to?(:stored_pe) ? obj.stored_pe : obj }\n return policy_machine_storage_adapter.is_privilege?(*privilege)\n end\n\n if options[:filters] && policy_machine_storage_adapter.respond_to?(:is_privilege_with_filters?)\n privilege = [user_or_attribute, operation, object_or_attribute].map { |obj| obj.respond_to?(:stored_pe) ? obj.stored_pe : obj }\n return policy_machine_storage_adapter.is_privilege_with_filters?(*privilege, filters: options[:filters])\n end\n\n unless operation.is_a?(PM::Operation)\n operation = operations(unique_identifier: operation.to_s).first or return false\n end\n\n # Try to get associations to check from options\n associations = options[:associations] || options['associations']\n if associations\n raise(ArgumentError, \"expected options[:associations] to be an Array; got #{associations.class}\") unless associations.is_a?(Array)\n raise(ArgumentError, \"options[:associations] cannot be empty\") if associations.empty?\n raise(ArgumentError, \"expected each element of options[:associations] to be a PM::Association\") unless associations.all?{|a| a.is_a?(PM::Association)}\n\n associations.keep_if do |association|\n association.operation_set.connected?(operation)\n end\n return false if associations.empty?\n else\n associations = operation.associations\n end\n\n # Is a privilege iff options[:in_user_attribute] is involved (given options[:in_user_attribute] is not nil)\n in_user_attribute = options[:in_user_attribute] || options['in_user_attribute']\n if in_user_attribute\n unless in_user_attribute.is_a?(PM::UserAttribute)\n raise(ArgumentError, \"expected options[:in_user_attribute] to be a PM::UserAttribute; got #{in_user_attribute.class}\")\n end\n if user_or_attribute.connected?(in_user_attribute)\n user_or_attribute = in_user_attribute\n else\n return false\n end\n end\n\n # Is a privilege iff options[:in_object_attribute] is involved (given options[:in_object_attribute] is not nil)\n in_object_attribute = options[:in_object_attribute] || options['in_object_attribute']\n if in_object_attribute\n unless in_object_attribute.is_a?(PM::ObjectAttribute)\n raise(ArgumentError, \"expected options[:in_object_attribute] to be a PM::ObjectAttribute; got #{in_object_attribute.class}\")\n end\n if object_or_attribute.connected?(in_object_attribute)\n object_or_attribute = in_object_attribute\n else\n return false\n end\n end\n\n policy_classes_containing_object = object_or_attribute.policy_classes\n if policy_classes_containing_object.empty?\n is_privilege_single_policy_class(user_or_attribute, object_or_attribute, associations)\n else\n is_privilege_multiple_policy_classes(user_or_attribute, object_or_attribute, associations, policy_classes_containing_object)\n end\n end",
"def bit_locker_removable_drive_policy\n return @bit_locker_removable_drive_policy\n end",
"def generate_policy\n {}\n end"
] |
[
"0.741853",
"0.7280711",
"0.7244826",
"0.68403834",
"0.6824301",
"0.62857646",
"0.6271584",
"0.6042058",
"0.59910494",
"0.5934107",
"0.58292943",
"0.5700528",
"0.5619593",
"0.5529103",
"0.53095096",
"0.5308677",
"0.52143645",
"0.5134495",
"0.5103885",
"0.48595434",
"0.48095226",
"0.48001462",
"0.4773198",
"0.47555813",
"0.47004062",
"0.46558034",
"0.46370387",
"0.4629225",
"0.4603091",
"0.46017408",
"0.46011806",
"0.4581942",
"0.45816427",
"0.45652148",
"0.4548571",
"0.4524462",
"0.4489698",
"0.44876555",
"0.44722778",
"0.44474587",
"0.44438833",
"0.44407907",
"0.44341046",
"0.4419411",
"0.44126347",
"0.44114298",
"0.44035286",
"0.4398034",
"0.43947887",
"0.43940243",
"0.43654153",
"0.43616042",
"0.43551728",
"0.4338669",
"0.43298876",
"0.4328572",
"0.43283644",
"0.43207425",
"0.43193918",
"0.43190956",
"0.4313686",
"0.43025026",
"0.42916417",
"0.42904994",
"0.42697418",
"0.42687157",
"0.426369",
"0.4245472",
"0.42388275",
"0.42376778",
"0.42308575",
"0.4210866",
"0.42097905",
"0.4208045",
"0.42063043",
"0.4205842",
"0.42033967",
"0.4197388",
"0.41917482",
"0.41848013",
"0.4177726",
"0.41764367",
"0.4172125",
"0.41720894",
"0.41718873",
"0.4171002",
"0.41700143",
"0.41667202",
"0.41657186",
"0.41597685",
"0.4158016",
"0.4150334",
"0.41479832",
"0.4145406",
"0.41436863",
"0.41335198",
"0.41271615",
"0.41101116",
"0.41088367",
"0.4107876"
] |
0.7787505
|
0
|
Instantiates a new DeviceAppManagementRequestBuilder and sets the default values.
|
def initialize(path_parameters, request_adapter)
super(path_parameters, request_adapter, "{+baseurl}/deviceAppManagement{?%24select,%24expand}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def devices()\n return MicrosoftGraph::Devices::DevicesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_registrations()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_configuration_device_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationDeviceActivity::DeviceConfigurationDeviceActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def mobile_apps()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def fill_default_params\n fill_organization\n fill_app\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(app, response_builder = DEFAULT_BUILDER)\n @app = app\n @response_builder = response_builder\n end",
"def get_device_management_intent_settings_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentSettingsReport::GetDeviceManagementIntentSettingsReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60, udid: nil)\n @platform_name = platform_name\n @device_name = device_name\n @platform_version = platform_version\n @app = app\n @new_command_timeout = new_command_timeout\n @udid = udid\n end",
"def device_category()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceCategory::DeviceCategoryRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(options = {})\n @options = default_options.merge(options)\n @app = @options.delete(:app)\n end",
"def construct_builder!\n @builder = Brainstem::ApiDocs::Builder.new(builder_options)\n end",
"def devices_with_device_id(device_id)\n raise StandardError, 'device_id cannot be null' if device_id.nil?\n return DevicesWithDeviceIdRequestBuilder.new(@path_parameters, @request_adapter, deviceId)\n end",
"def windows_defender_scan()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::WindowsDefenderScan::WindowsDefenderScanRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/deviceAppManagement/mobileApps{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\")\n end",
"def device_configuration_user_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationUserActivity::DeviceConfigurationUserActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.androidGeneralDeviceConfiguration\"\n end",
"def initialize(device_info)\n super()\n\n @device_info = device_info\n log \"<#{self.class}> Got device info: #{@device_info}\"\n @device_list = []\n @service_list = []\n @icon_list = []\n @xmlns = \"\"\n @done_creating_devices = false\n @done_creating_services = false\n end",
"def initialize_devices\n count = workers * devices\n client = Client.new(base_url, max_concurrency: [count, 200].min) # Typheous gets flaky above 200\n if end_point.nil?\n update(end_point: EndPoint.find_or_create_by(base_url: base_url))\n end\n log \"setup\", \"Checking for #{count} generated devices in the local database.\"\n end_point.generate_devices(count) {|progress| log \"setup\", \"Devices: #{progress}\" }\n log \"setup\", \"Checking for #{count} logged in users.\"\n end_point.register_and_login_devices client,\n ->(r) { log \"setup\", \"Warm-up completed!\";r },\n ->(r) { log_error \"setup\", \"Device registration or login failed: #{r}\" }\n end",
"def sync_device()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::SyncDevice::SyncDeviceRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/users/{user%2Did}/managedDevices/{managedDevice%2Did}{?%24select,%24expand}\")\n end",
"def default_params\n {\n \"pio_appkey\" => @app_key\n }\n end",
"def build_request_options!(datum)\n datadog_configuration(datum[:host]).options_hash.merge(@default_options)\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def applications_with_app_id(app_id)\n raise StandardError, 'app_id cannot be null' if app_id.nil?\n return ApplicationsWithAppIdRequestBuilder.new(@path_parameters, @request_adapter, appId)\n end",
"def wipe()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::Wipe::WipeRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(context, *args)\n @context = context\n @result = nil\n builder_setup(*args)\n end",
"def by_mobile_app_id(mobile_app_id)\n raise StandardError, 'mobile_app_id cannot be null' if mobile_app_id.nil?\n url_tpl_params = @path_parameters.clone\n url_tpl_params[\"mobileApp%2Did\"] = mobile_app_id\n return MicrosoftGraph::DeviceAppManagement::MobileApps::Item::MobileAppItemRequestBuilder.new(url_tpl_params, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.appManagementPolicy\"\n end",
"def initialize(app, options_hash={}, &block)\n super\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/applications/{application%2Did}/appManagementPolicies/{appManagementPolicy%2Did}\")\n end",
"def new(*args, &bk)\n setup_application!\n super(*args, &bk)\n end",
"def create_device request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_device_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Iot::V1::Device.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def device_configuration_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceConfigurationStates::DeviceConfigurationStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(**params)\n\t\t\tp12file = params[:pkcs12_file]\n\t\t\tdomain = params[:domain]\n\t\t\tservice_account_email = params[:service_account_email]\n\t\t\tact_on_behalf_email = params[:admin_email]\n\t\t\tapplication_name = params[:application_name] || @@default_application_name\n\t\t\tversion = params[:version] || @@default_application_version\n\n\t\t\tkey = Google::APIClient::KeyUtils.load_from_pkcs12(p12file, 'notasecret')\n\t\t\t@client = Google::APIClient.new(:application_name => application_name, :version => version)\n\n\t\t\t@client.authorization = Signet::OAuth2::Client.new(\n \t\t\t\t:token_credential_uri => @@token_credentialuri,\n \t\t\t\t:audience => @@audience,\n \t\t\t\t:scope => @@scope,\n \t\t\t\t:issuer => service_account_email,\n \t\t\t\t:person => act_on_behalf_email,\n \t\t\t\t:sub => act_on_behalf_email,\n \t\t\t\t:signing_key => key)\n\n\t\t\t@client.authorization.fetch_access_token!\n\n\t\t\t@api = @client.discovered_api(\"admin\", \"directory_v1\")\n\t\tend",
"def get_noncompliant_devices_and_settings_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetNoncompliantDevicesAndSettingsReport::GetNoncompliantDevicesAndSettingsReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration\"\n end",
"def shut_down()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::ShutDown::ShutDownRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end",
"def build_udoa_request(attrs={})\n\t\t UDOARequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n\t\tend",
"def locate_device()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::LocateDevice::LocateDeviceRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def builder\n @builder ||= Builder.new(self)\n end",
"def initialize(arg = nil, **opt)\n batch = opt.delete(:batch)\n opt_args = opt.compact_blank!.extract!(*template.keys)\n arg ||= opt_args\n m_id = opt_args[:manifest_id] ||= extract_manifest_id(arg, **opt)\n items = opt_args[:items] ||= extract_items(arg, **opt)\n opt[:batch] = batch if (batch = batch_size_for(batch, items))\n opt_args[:items] = make_sub_requests(items, **opt, manifest_id: m_id)\n super(**opt_args)\n end",
"def initialize\n super(ApplicationController, {}, DEFAULTS.dup)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end",
"def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(devtype,param)\n setupDevice(devtype,param) ;\n end",
"def builder_options\n @builder_options ||= options[:builder]\n end",
"def initialize(options = {})\n @app_name = options[:app_name].to_s if options[:app_name]\n @platform = options[:platform]\n\n @purpose = check_purpose!(options[:purpose])\n\n @compressors = options[:compressors] || []\n @wrapping_libraries = options[:wrapping_libraries]\n @server_api = options[:server_api]\n\n return unless options[:user] && !options[:auth_mech]\n\n auth_db = options[:auth_source] || 'admin'\n @request_auth_mech = \"#{auth_db}.#{options[:user]}\"\n end",
"def initialize(options = {}, &blk)\n options ||= {}\n options[:type] = :application\n init(options, &blk)\n end",
"def initialize(options={})\n [:quiet, :name, :min_priority, :max_priority, :job_types, :only_for, :group_by,\n :sleep_time\n ].each do |attr_name|\n send \"#{attr_name}=\", options.delete(attr_name)\n end\n # Default values\n self.name = DEFAULT_WORKER_NAME if self.name.nil?\n self.quiet = true if self.quiet.nil?\n self.sleep_time = SLEEP if self.sleep_time.nil?\n\n @options = options\n initialize_launcher\n end",
"def initialize attrs = Hash.new, client = FastbillAutomatic.client\n\n super prepare_hash!(attrs)\n\n @client = client\n @errors = []\n end",
"def initialize(device)\n super\n @status = 0\n @device = device\n end",
"def graph_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphMobileLobApp::GraphMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end",
"def graph_managed_mobile_lob_app()\n return MicrosoftGraph::DeviceAppManagement::MobileApps::GraphManagedMobileLobApp::GraphManagedMobileLobAppRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def application_templates()\n return MicrosoftGraph::ApplicationTemplates::ApplicationTemplatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(token, app, platform, data_fields = {}, conf = nil)\n @token = token\n @app = app\n @platform = platform\n @data_fields = data_fields\n super conf\n end",
"def initialize(options = nil)\n @options = options\n @app = options[:app] if options && options[:app]\n end",
"def initialize(app, name, client_id=nil, client_secret=nil, client_options={}, options={}, &block)\n self.client_id = client_id\n self.client_secret = client_secret\n self.client_options = client_options\n super\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.iosVppAppAssignmentSettings\"\n end",
"def initialize(options = default_options)\n options.each { |key, value| instance_variable_set(\"@#{key}\", value) }\n yield(self) if block_given?\n\n @auth_client = Fabricio::Authorization::AuthorizationClient.new\n raise StandardError.new(\"Session is empty: #{auth_data}\") if obtain_session.nil?\n\n network_client = Fabricio::Networking::NetworkClient.new(@auth_client, @session_storage)\n\n @organization_service ||= Fabricio::Service::OrganizationService.new(param_storage, network_client)\n @app_service ||= Fabricio::Service::AppService.new(param_storage, network_client)\n @build_service ||= Fabricio::Service::BuildService.new(param_storage, network_client)\n @version_service ||= Fabricio::Service::VersionService.new(param_storage, network_client)\n\n param_storage.store(options[:params]) unless options[:params].empty?\n fill_default_params\n end",
"def initialize(app_id:)\n @app_id = app_id\n end",
"def users()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::Users::UsersRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(options = {})\n @build_command = options.delete(:build_command)\n @spec_command = options.delete(:spec_command) \n @verbose = options.has_key?(:verbose) ? options.delete(:verbose) : false\n @update = options.has_key?(:update) ? options.delete(:update) : false\n @spec = options.has_key?(:spec) ? options.delete(:spec) : true\n @app_root = options.delete(:app_root)\n super\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.iosGeneralDeviceConfiguration\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration\"\n end",
"def initialize(info = {})\n ret = super(info)\n\n register_advanced_options(\n [\n Msf::OptBool.new('PrependSetresuid',\n [\n false,\n \"Prepend a stub that executes the setresuid(0, 0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetreuid',\n [\n false,\n \"Prepend a stub that executes the setreuid(0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetuid',\n [\n false,\n \"Prepend a stub that executes the setuid(0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetresgid',\n [\n false,\n \"Prepend a stub that executes the setresgid(0, 0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetregid',\n [\n false,\n \"Prepend a stub that executes the setregid(0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetgid',\n [\n false,\n \"Prepend a stub that executes the setgid(0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('AppendExit',\n [\n false,\n \"Append a stub that executes the exit(0) system call\",\n false\n ]\n ),\n ], Msf::Payload::Bsd)\n\n ret\n end",
"def builder\n @builder ||= self[ :definition_context_factory ].new( self )\n end",
"def get_device_management_intent_per_setting_contributing_profiles()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentPerSettingContributingProfiles::GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_device_non_compliance_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceNonComplianceReport::GetDeviceNonComplianceReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def builder opts = { }\n opts[:_mapping_set] = self\n Mapping::Builder.new(opts)\n end",
"def mobile_app_categories()\n return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def initialize(builder:, context:)\n @cache = {}\n @builder = builder\n @context = context\n end",
"def new(**settings)\n __new_without_defaults__(\n **default_settings.merge(settings)\n )\n end",
"def initialize(device)\n super\n @status = 0\n end",
"def initialize(app_id)\n @app_id = app_id\n end",
"def default(options = {})\n options.symbolize_keys!\n options.assert_valid_keys(:mailer_class, :mailer, :using, :batch_size)\n @defaults = options\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def builder; end",
"def builder; end",
"def builder; end",
"def initialize(device_uuid, secret)\n @device_uuid = device_uuid\n @secret = secret\n end",
"def initialize(app_id, app_secret, uuid = nil, hostname = 'gocarrot.com')\n @app_id = app_id\n @app_secret = app_secret\n @uuid = uuid\n @hostname = hostname\n end",
"def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend",
"def new(opts = {})\n klass.new(opts)\n end",
"def initialize(options = {})\n @options = options\n @request_options = {}\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/deviceManagement/reports{?%24select,%24expand}\")\n end",
"def reboot_now()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::RebootNow::RebootNowRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_device_enrollment_top_failures()\n return MicrosoftGraph::Reports::ManagedDeviceEnrollmentTopFailures::ManagedDeviceEnrollmentTopFailuresRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_builder_class\n Cybele::AppBuilder\n end",
"def initialize(options = {})\n # Mandatory params\n @client_id = @@client_id || options.fetch(:client_id)\n @client_key = @@client_key || options.fetch(:client_key)\n @tenant_id = @@tenant_id || options.fetch(:tenant_id)\n\n # Optional params\n @subscription_id = @@subscription_id || options[:subscription_id]\n @resource_group = @@resource_group || options[:resource_group]\n @api_version = @@api_version || options[:api_version] || '2015-01-01'\n @grant_type = @@grant_type || options[:grant_type] || 'client_credentials'\n\n # The content-type used for all internal http requests\n @content_type = @@content_type || 'application/json'\n\n # Call the get_token method to set this.\n @token = @@token || options[:token]\n\n # Base URL used for REST calls. Modify within method calls as needed.\n @base_url = Azure::Armrest::RESOURCE\n end"
] |
[
"0.7209858",
"0.66680187",
"0.55746",
"0.55090964",
"0.54941106",
"0.5345259",
"0.53223866",
"0.532088",
"0.5314688",
"0.5223433",
"0.5200963",
"0.51748246",
"0.5151056",
"0.49823293",
"0.4975952",
"0.49758455",
"0.49188557",
"0.48928013",
"0.48850247",
"0.48610565",
"0.4858748",
"0.48500028",
"0.4848415",
"0.48168963",
"0.48140624",
"0.48034194",
"0.47931784",
"0.47746176",
"0.47706795",
"0.47689858",
"0.47479594",
"0.4742993",
"0.4728202",
"0.47262827",
"0.47182837",
"0.4715476",
"0.47135237",
"0.47058138",
"0.47054306",
"0.46833277",
"0.46787155",
"0.46748266",
"0.46593606",
"0.4654391",
"0.46498963",
"0.46441996",
"0.4635578",
"0.46252593",
"0.46233127",
"0.46157414",
"0.45999077",
"0.45943373",
"0.45929646",
"0.45928538",
"0.45864725",
"0.4585873",
"0.45842147",
"0.4575415",
"0.4571005",
"0.45677426",
"0.45533353",
"0.4551818",
"0.4548738",
"0.45476758",
"0.45424315",
"0.45187807",
"0.45168325",
"0.45120257",
"0.45111176",
"0.4509584",
"0.45064464",
"0.45015678",
"0.44997525",
"0.4497699",
"0.44968903",
"0.44917136",
"0.44884866",
"0.44701502",
"0.44645366",
"0.44593152",
"0.44573033",
"0.44563544",
"0.44342527",
"0.44303408",
"0.44238433",
"0.44225758",
"0.44225758",
"0.44189355",
"0.44189355",
"0.44189355",
"0.4418784",
"0.44151708",
"0.43917954",
"0.43902746",
"0.4381499",
"0.43765575",
"0.43656173",
"0.43650013",
"0.43576682",
"0.4356304"
] |
0.54072833
|
5
|
Read properties and relationships of the deviceAppManagement object.
|
def get(request_configuration=nil)
request_info = self.to_get_request_information(
request_configuration
)
error_mapping = Hash.new
error_mapping["4XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
error_mapping["5XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_devices\n return @managed_devices\n end",
"def devices\n @devices\n end",
"def properties\n start = Time.now\n debug \"Checking properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n properties = Hash.new\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n device_group_properties = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_GET,\n build_query_params('type:custom,name!:system.categories,name!:puppet.update.on',\n 'name,value'))\n if valid_api_response?(device_group_properties, true)\n device_group_properties['data']['items'].each do |property|\n name = property['name']\n value = property['value']\n if value.include?('********') && resource[:properties].has_key?(name)\n debug 'Found password property. Verifying'\n verify_device_group_property = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_GET,\n build_query_params(\"type:custom,name:#{name},value:#{value}\", nil, 1))\n if valid_api_response?(verify_device_group_property)\n debug 'Property unchanged'\n value = resource[:properties][name]\n else\n debug 'Property changed'\n end\n end\n properties[name] = value\n end\n else\n alert device_group_properties\n end\n else\n alert device_group\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n properties\n end",
"def devices\n return @devices\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_configuration\n return @device_configuration\n end",
"def device_list\n @devices = Device.all\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\n end",
"def devices; end",
"def app_management_policies\n return @app_management_policies\n end",
"def properties\n self.class.get_properties\n end",
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Microvisor.V1.AppManifestInstance #{values}>\"\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def get_app_properties(*properties)\n json = @session.post('facebook.admin.getAppProperties', :properties => properties.to_json)\n hash = JSON.parse(CGI.unescapeHTML(json))\n @properties = ApplicationProperties.from_hash(hash)\n end",
"def get_app_properties(*properties)\n json = @session.post('facebook.admin.getAppProperties', :properties => properties.to_json)\n hash = JSON.parse(CGI.unescapeHTML(json))\n @properties = ApplicationProperties.from_hash(hash)\n end",
"def properties\n self.class.properties\n end",
"def list\n all.each { |device| puts(device.pretty_name) }\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def get_mobile_device()\n res = self.send_request 'get_mobile_device'\n device_info_xml = REXML::Document.new(res.body).root\n rez ={}\n device_info_xml.elements.each do |el|\n rez.merge! Hash[el.name.to_s,el.text.to_s]\n end\n return rez\n end",
"def properties\n _properties\n end",
"def device_model\n return @device_model\n end",
"def device_model\n return @device_model\n end",
"def managed_apps\n return @managed_apps\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def management_interface_settings\r\n ManagementInterfaceSettingsController.instance\r\n end",
"def devices\r\n DevicesController.instance\r\n end",
"def index\n @admin_devices = AdminDevice.all\n end",
"def properties\n @properties\n end",
"def properties\n @properties\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end",
"def platform_details\n data[:platform_details]\n end",
"def metric_devices\n return @metric_devices\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def parse_management_device(component)\n parse(component, fields_by_component_type(component))\n end",
"def command_get_device_info(command)\n\t\tcommand_get_device(command)\n\t\tif @device\n\t\t\tmessage(\" #{@device.description}\")\n\t\t\t@windows.each {|name,window| message(\" #{name}: #{window.info}\")}\n\t\tend\n\tend",
"def get_field_deserializers()\n return super.merge({\n \"apps\" => lambda {|n| @apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedMobileApp.create_from_discriminator_value(pn) }) },\n \"customBrowserDisplayName\" => lambda {|n| @custom_browser_display_name = n.get_string_value() },\n \"customBrowserPackageId\" => lambda {|n| @custom_browser_package_id = n.get_string_value() },\n \"deployedAppCount\" => lambda {|n| @deployed_app_count = n.get_number_value() },\n \"deploymentSummary\" => lambda {|n| @deployment_summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicyDeploymentSummary.create_from_discriminator_value(pn) }) },\n \"disableAppEncryptionIfDeviceEncryptionIsEnabled\" => lambda {|n| @disable_app_encryption_if_device_encryption_is_enabled = n.get_boolean_value() },\n \"encryptAppData\" => lambda {|n| @encrypt_app_data = n.get_boolean_value() },\n \"minimumRequiredPatchVersion\" => lambda {|n| @minimum_required_patch_version = n.get_string_value() },\n \"minimumWarningPatchVersion\" => lambda {|n| @minimum_warning_patch_version = n.get_string_value() },\n \"screenCaptureBlocked\" => lambda {|n| @screen_capture_blocked = n.get_boolean_value() },\n })\n end",
"def device_description\n return @device_description\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def properties\n @properties ||= {}\n end",
"def device\n attachments[0]['device'] if has_attachments?\n end",
"def device\n device_name\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def query\n self.class.instances.each do |pkg|\n return pkg.properties if pkg.name == @resource[:name]\n end\n return nil\n end",
"def get_field_deserializers()\n return super.merge({\n \"appIdentifier\" => lambda {|n| @app_identifier = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MobileAppIdentifier.create_from_discriminator_value(pn) }) },\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"appliedPolicies\" => lambda {|n| @applied_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"deviceTag\" => lambda {|n| @device_tag = n.get_string_value() },\n \"deviceType\" => lambda {|n| @device_type = n.get_string_value() },\n \"flaggedReasons\" => lambda {|n| @flagged_reasons = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppFlaggedReason.create_from_discriminator_value(pn) }) },\n \"intendedPolicies\" => lambda {|n| @intended_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"lastSyncDateTime\" => lambda {|n| @last_sync_date_time = n.get_date_time_value() },\n \"managementSdkVersion\" => lambda {|n| @management_sdk_version = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppOperation.create_from_discriminator_value(pn) }) },\n \"platformVersion\" => lambda {|n| @platform_version = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def devices\n response = get('/listDevices')\n devices = []\n response.body['devices'].each do |d|\n devices << Device.from_json(d, @token, @logger)\n end\n devices\n end",
"def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end",
"def properties\n self.class.properties.keys\n end",
"def list\n Airplay.devices.each do |device|\n puts <<-EOS.gsub(/^\\s{12}/,'')\n * #{device.name} (#{device.info.model} running #{device.info.os_version})\n ip: #{device.ip}\n mac: #{device.id}\n password?: #{device.password? ? \"yes\" : \"no\"}\n type: #{device.type}\n resolution: #{device.info.resolution}\n\n EOS\n end\n end",
"def device\n self.subscription.device\n end",
"def properties\n model.properties\n end",
"def metadata\n self.class.metadata\n end",
"def attributes\n @metadata\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def properties\n return @properties\n end",
"def modems(opts = {})\n @mm_service = @bus.service(@modem_service)\n @mm_object = @mm_service.object(@modem_bus_path)\n @mm_object.introspect\n NetworkManager::Modem.fetch(@mm_object.EnumerateDevices()[0], service: @mm_service)\n end",
"def command_get_device(command)\n\t\tif @device then message(\"device: #{@device.name}\")\n\t\telse error(\"no device loaded\")\n\t\tend\n\tend",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def device_identities\n return @device_identities\n end",
"def devices=(value)\n @devices = value\n end",
"def properties; @message_impl.getProperties; end",
"def properties\n @properties ||= {}\n end",
"def manufacturer\n fetch('device.manufacturer')\n end",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def load_device\n @device = Device.find(params[:device_id])\n end",
"def sync_app_information!(app_lookup)\n @name = app_lookup.try(:[],'trackName')\n @description = app_lookup.try(:[],'description')\n @small_icon_url = app_lookup.try(:[],'artworkUrl60')\n @publisher_name = app_lookup.try(:[],'sellerName')\n @price = app_lookup.try(:[],'price')\n @version = app_lookup.try(:[],'version')\n @average_user_rating = app_lookup.try(:[],'averageUserRatingForCurrentVersion')\n end",
"def index\n @devices = current_user.devices\n end",
"def get_devices\n get_device_paths.collect do |device_path|\n NetworkManager::Device.new(device_path)\n end\n end",
"def read_device_info (device, kind)\n kind = kind.to_sym\n kinds = [:ip, :udid, :serial]\n unless kinds.include?(kind)\n raise \"illegal argument '#{kind}' - must be one of '#{kinds}'\"\n end\n\n path = File.expand_path(\"~/.xamarin/devices/#{device}/#{kind}\")\n\n unless File.exist?(path)\n @log.fatal{\"cannot read device information for '#{device}'\"}\n @log.fatal{\"file '#{path}' does not exist\"}\n exit 1\n end\n\n begin\n IO.readlines(path).first.strip\n rescue Exception => e\n @log.fatal{\"cannot read device information for '#{device}'\"}\n @log.fatal{e}\n exit 1\n end\nend",
"def parse_management_device(node)\n parse(node, MANAGEMENT_DEVICE)\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def read_bridged_interfaces\n end",
"def index\n @device_models = DeviceModel.all\n end",
"def physical_device_id\n return @physical_device_id\n end",
"def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def device_states\n return @device_states\n end",
"def apps\n return @apps\n end",
"def get_properties()\n return @properties\n end",
"def read_appliance_management_service(opts = {})\n data, _status_code, _headers = read_appliance_management_service_with_http_info(opts)\n return data\n end",
"def swagger_info\n if app.respond_to?(:info)\n app.info\n else\n {}\n end\n end",
"def devices\n\texecute(\"devices\").split(\"\\n\")[1..-1]\nend",
"def app_definitions\n return @app_definitions\n end",
"def read_device_info (device, kind)\n kind = kind.to_sym\n kinds = [:ip, :udid, :serial]\n unless kinds.include?(kind)\n raise \"#{kind} must be one of '#{kinds}'\"\n end\n cmd = \"cat ~/.xamarin/devices/#{device}/#{kind} | tr -d '\\n'\"\n `#{cmd}`\nend",
"def devices\n puts `instruments -s devices | grep -v '(Simulator)'`\n end",
"def appl_settings\n @appl_settings\n end",
"def get_device_management_intent_settings_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentSettingsReport::GetDeviceManagementIntentSettingsReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def physical_devices\n @instruments_physical_devices ||= lambda do\n fetch_devices[:out].chomp.split(\"\\n\").map do |line|\n udid = line[DEVICE_UDID_REGEX, 0]\n if udid\n version = line[VERSION_REGEX, 0]\n if version\n name = line.split('(').first.strip\n if name\n RunLoop::Device.new(name, version, udid)\n end\n end\n else\n nil\n end\n end.compact\n end.call\n end",
"def query_resources\n powershell_exec(\"get-dscresource\").result\n end",
"def snmp_settings\r\n SNMPSettingsController.instance\r\n end",
"def info\n Plist::parse_xml(diskutil 'info', '-plist', @dev_node)\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicableArchitectures\" => lambda {|n| @applicable_architectures = n.get_enum_value(MicrosoftGraph::Models::WindowsArchitecture) },\n \"applicableDeviceTypes\" => lambda {|n| @applicable_device_types = n.get_enum_value(MicrosoftGraph::Models::WindowsDeviceType) },\n \"committedContainedApps\" => lambda {|n| @committed_contained_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileContainedApp.create_from_discriminator_value(pn) }) },\n \"identityName\" => lambda {|n| @identity_name = n.get_string_value() },\n \"identityPublisherHash\" => lambda {|n| @identity_publisher_hash = n.get_string_value() },\n \"identityResourceIdentifier\" => lambda {|n| @identity_resource_identifier = n.get_string_value() },\n \"identityVersion\" => lambda {|n| @identity_version = n.get_string_value() },\n \"isBundle\" => lambda {|n| @is_bundle = n.get_boolean_value() },\n \"minimumSupportedOperatingSystem\" => lambda {|n| @minimum_supported_operating_system = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsMinimumOperatingSystem.create_from_discriminator_value(pn) }) },\n })\n end"
] |
[
"0.5919667",
"0.5780612",
"0.57789814",
"0.5708176",
"0.5631735",
"0.5525409",
"0.55242884",
"0.5480965",
"0.53661984",
"0.5326116",
"0.52930397",
"0.5289022",
"0.524766",
"0.5226348",
"0.5221837",
"0.521806",
"0.51977646",
"0.51977646",
"0.5196834",
"0.51815414",
"0.5173878",
"0.51507604",
"0.51423717",
"0.5126595",
"0.5126595",
"0.512524",
"0.51160944",
"0.51152396",
"0.5109166",
"0.5083306",
"0.506482",
"0.5059847",
"0.5032564",
"0.49975657",
"0.49907887",
"0.4984994",
"0.4983261",
"0.49746007",
"0.49674398",
"0.49643862",
"0.49642465",
"0.49579722",
"0.4957771",
"0.4919458",
"0.49133524",
"0.49056563",
"0.48843658",
"0.4880286",
"0.48767152",
"0.4875437",
"0.48695865",
"0.48651895",
"0.4859577",
"0.4838258",
"0.48295975",
"0.48251793",
"0.48231268",
"0.48222443",
"0.48185056",
"0.4817054",
"0.48147634",
"0.48093626",
"0.4806529",
"0.48035157",
"0.47986802",
"0.47959438",
"0.479315",
"0.47900492",
"0.4768575",
"0.47647446",
"0.47607338",
"0.47584334",
"0.47531548",
"0.47494212",
"0.47446623",
"0.4732541",
"0.47301728",
"0.47229254",
"0.47229254",
"0.472015",
"0.4714593",
"0.4707387",
"0.47060686",
"0.4703437",
"0.4702254",
"0.46954462",
"0.46919805",
"0.469173",
"0.46895087",
"0.46886533",
"0.4679141",
"0.46733588",
"0.46718147",
"0.46660367",
"0.46650246",
"0.46561",
"0.46543482",
"0.4651333",
"0.46502447",
"0.46496612"
] |
0.5665409
|
4
|
Update the properties of a deviceAppManagement object.
|
def patch(body, request_configuration=nil)
raise StandardError, 'body cannot be null' if body.nil?
request_info = self.to_patch_request_information(
body, request_configuration
)
error_mapping = Hash.new
error_mapping["4XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
error_mapping["5XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n wmi_object.put_\n end",
"def properties=(value)\n start = Time.now\n debug \"Updating properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n value,\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def update\n if params[:device_group][:property_ids]\n params[:device_group][:property_ids].each do |property_id|\n @property = Property.find(property_id)\n @device_group.properties << @property\n end\n end\n respond_to do |format|\n if @device_group.update(device_group_params)\n format.html { redirect_to @device_group, notice: 'Device group was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n end\n end\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @by_device_id = args[:by_device_id] if args.key?(:by_device_id)\n @copresenter_device_ids = args[:copresenter_device_ids] if args.key?(:copresenter_device_ids)\n @presenter_device_id = args[:presenter_device_id] if args.key?(:presenter_device_id)\n end",
"def update\n if @device.update(device_params)\n respond_with(@device, location: devices_url, notice: 'Device was successfully updated.')\n else\n respond_with(@devices)\n end\n end",
"def update\n if @device_manufacturer.update(device_manufacturer_params)\n respond_with(@device_manufacturer, location: device_manufacturers_url, notice: 'Device manufacturer was successfully updated.')\n else\n respond_with(@device_manufacturer)\n end\n end",
"def update\n @device.update(device_params)\n head :no_content\n end",
"def update\n respond_to do |format|\n if @admin_device.update(admin_device_params)\n format.html { redirect_to @admin_device, notice: 'Admin device was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_device }\n else\n format.html { render :edit }\n format.json { render json: @admin_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t#params[:device][:asset_ids] ||= []\n\t\tparams[:device][:register_ids] ||= []\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n format.html { redirect_to(@device) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device = args[:device] if args.key?(:device)\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update!(**args)\n @device_model_capabilities = args[:device_model_capabilities] if args.key?(:device_model_capabilities)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"def update!(**args)\n @android_device_id = args[:android_device_id] if args.key?(:android_device_id)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n end",
"def update\n respond_to do |format|\n if @device_assignment.update(device_assignment_params)\n format.html { redirect_to @device_assignment.device, notice: 'Device assignment was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_assignment }\n else\n set_default_variables\n format.html { render :edit }\n format.json { render json: @device_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def update!(**args)\n @device_action_capability = args[:device_action_capability] if args.key?(:device_action_capability)\n @project_configs = args[:project_configs] if args.key?(:project_configs)\n end",
"def update\n respond_to do |format|\n if @device_status.update(admin_device_status_params)\n format.html { redirect_to admin_device_status_path(@device_status), notice: 'Device Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_status }\n else\n format.html { render :edit }\n format.json { render json: @device_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @device.user == current_user or current_user.is_admin?\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @device }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to devices_url, :notice => 'Access denied! You can update your device only'\n end\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n @device_type = args[:device_type] if args.key?(:device_type)\n @guid_fingerprint = args[:guid_fingerprint] if args.key?(:guid_fingerprint)\n @os = args[:os] if args.key?(:os)\n @os_version = args[:os_version] if args.key?(:os_version)\n @possibly_trimmed_model = args[:possibly_trimmed_model] if args.key?(:possibly_trimmed_model)\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device_assignment = DeviceAssignment.find(params[:id])\n @locations = Location.order(\"location_name ASC\")\n @patients = Patient.order(\"last_name ASC\")\n @devices = Device.order(\"serial_number ASC\")\n\n respond_to do |format|\n if @device_assignment.update_attributes(params[:device_assignment])\n format.html { redirect_to @device_assignment, notice: 'Device assignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_properties(properties)\n properties = properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @machine = args[:machine] if args.key?(:machine)\n end",
"def update\n @device = Device.find(params[:id])\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n redirect_to \"/index\"\n end\n end",
"def update\n @gcm_device = GcmDevice.find(params[:id])\n\n respond_to do |format|\n if @gcm_device.update_attributes(params[:gcm_device])\n format.html { redirect_to @gcm_device, notice: 'Gcm device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gcm_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n end",
"def set_app_properties(properties)\n properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end",
"def update_usage\n logger.debug 'update usage'\n\n # TODO: replace `where` method to get sublist\n usage_data = ResourcesData.where.not(appname: nil)\n\n usage_data.each do |usage; data|\n data = {}\n %w(cpu disk memory perm).each do |item|\n data[item] = usage.send(item)\n end\n app_data[usage.appname] = data\n end\n\n logger.debug 'update usage completed'\n rescue ActiveRecord::ActiveRecordError => ex\n logger.debug \"access database failed with #{ex.message}.\"\n rescue => ex\n logger.error \"update usage data failed with #{ex.message}.\"\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @device_name = args[:device_name] if args.key?(:device_name)\n @device_type = args[:device_type] if args.key?(:device_type)\n end",
"def update\n puts @device.inspect\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :index, status: :ok, location: @device }\n else\n format.html { render :index }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_device\n @admin_device = AdminDevice.find(params[:id])\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_server_properties_with_http_info(did, device_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.update_server_properties ...\"\n end\n # verify the required parameter 'did' is set\n fail ArgumentError, \"Missing the required parameter 'did' when calling DevicesManagementApi.update_server_properties\" if did.nil?\n # verify the required parameter 'device_properties' is set\n fail ArgumentError, \"Missing the required parameter 'device_properties' when calling DevicesManagementApi.update_server_properties\" if device_properties.nil?\n # resource path\n local_var_path = \"/devicemgmt/devices/{did}/serverproperties\".sub('{format}','json').sub('{' + 'did' + '}', did.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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(device_properties)\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'MetadataEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#update_server_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to devices_path, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device_model.update(device_model_params)\n format.html { redirect_to @device_model, notice: 'Device model was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_model }\n else\n format.html { render :edit }\n format.json { render json: @device_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_install_type = args[:app_install_type] if args.key?(:app_install_type)\n @app_source = args[:app_source] if args.key?(:app_source)\n @app_type = args[:app_type] if args.key?(:app_type)\n @browser_device_count = args[:browser_device_count] if args.key?(:browser_device_count)\n @description = args[:description] if args.key?(:description)\n @disabled = args[:disabled] if args.key?(:disabled)\n @display_name = args[:display_name] if args.key?(:display_name)\n @homepage_uri = args[:homepage_uri] if args.key?(:homepage_uri)\n @os_user_count = args[:os_user_count] if args.key?(:os_user_count)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update\n @device = Device.find(params[:id])\n\n if @device.update(device_params)\n redirect_to devices_path, :notice => 'Gerät erfolgreich aktualisiert.'\n else\n render 'edit'\n end\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @low_confidence_reason = args[:low_confidence_reason] if args.key?(:low_confidence_reason)\n @result_confidence_level = args[:result_confidence_level] if args.key?(:result_confidence_level)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { render :show, status: :ok, location: @device }\n else\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { head :no_content }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def update!(**args)\n @device_registries = args[:device_registries] if args.key?(:device_registries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @device_registries = args[:device_registries] if args.key?(:device_registries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n @product_management = ProductManagement.find(params[:id])\n\n if @product_management.update(product_management_params)\n head :no_content\n else\n render json: @product_management.errors, status: :unprocessable_entity\n end\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n if @dns_device_assoc.update_attributes(params[:dns_device_assoc])\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute\n super\n device_ids.each do |d|\n device_id, device_label = d.split ':'\n API::Firestore.doc('devices/' + device_id).set(device_id: device_id, label: device_label)\n end\n trigger_updates\n end",
"def update\n respond_to do |format|\n if @mapp.update(mapp_params)\n format.html { redirect_to @mapp, notice: 'Mapp was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapp }\n else\n format.html { render :edit }\n format.json { render json: @mapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def update!(**args)\n @device_name = args[:device_name] if args.key?(:device_name)\n @device_types = args[:device_types] if args.key?(:device_types)\n @effective_arg_span_length = args[:effective_arg_span_length] if args.key?(:effective_arg_span_length)\n @has_ambiguous_resolutions = args[:has_ambiguous_resolutions] if args.key?(:has_ambiguous_resolutions)\n @has_resolved_device_id = args[:has_resolved_device_id] if args.key?(:has_resolved_device_id)\n @room_name = args[:room_name] if args.key?(:room_name)\n end",
"def update!(**args)\n @app_info = args[:app_info] if args.key?(:app_info)\n end",
"def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end",
"def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end",
"def promote(device)\n device.inherited = false\n owner.save_config\n end",
"def update!(**args)\n @device_index = args[:device_index] if args.key?(:device_index)\n @media_excuse = args[:media_excuse] if args.key?(:media_excuse)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_setting.update(app_setting_params)\n format.html { redirect_to @app_setting, notice: 'App setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_setting }\n else\n format.html { render :edit }\n format.json { render json: @app_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@service_in_app = ServiceInApp.find(params[:id])\n\n if @service_in_app.update_attributes(params[:app])\n format.html {redirect_to mesapps_url(current_user), :notice => 'Data of App Technique was successfully updated.' }\n\n else\n render :action => \"edit\"\n end\n\n end",
"def update_app_profile app_profile, update_mask, ignore_warnings: nil\n instances.update_app_profile app_profile: app_profile,\n update_mask: update_mask,\n ignore_warnings: ignore_warnings\n end",
"def update \n @rma_device = RmaDevice.find(params[:id])\n @rma_device.update_attributes(params[:rma_device])\n if @rma_device.save\n redirect_to :action => 'list'\n end\n end",
"def update!(**args)\n @carrier_call_device_settings = args[:carrier_call_device_settings] if args.key?(:carrier_call_device_settings)\n @duo_call_device_settings = args[:duo_call_device_settings] if args.key?(:duo_call_device_settings)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params) &&\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @gcm_registration_id = args[:gcm_registration_id] if args.key?(:gcm_registration_id)\n @supports_assistant_gcm = args[:supports_assistant_gcm] if args.key?(:supports_assistant_gcm)\n @supports_client_input_over_gcm = args[:supports_client_input_over_gcm] if args.key?(:supports_client_input_over_gcm)\n end",
"def update_app data={}\n put '/app', data\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pdevice = Pdevice.find(params[:id])\n\n respond_to do |format|\n if @pdevice.update_attributes(params[:pdevice])\n format.html { redirect_to @pdevice, notice: 'Pdevice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pdevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def update\n respond_to do |format|\n if @adm_sets.update(admin_setting_params)\n format.html { redirect_to [:admin, :settings], notice: 'Setting updated.' }\n format.json { render :show, status: :ok, location: @adm_sets }\n else\n format.html { render :edit }\n format.json { render json: @adm_sets.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_device_status\n @device_status = DeviceStatus.find(params[:id])\n end",
"def update\r\n @device = Device.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @device.update_attributes(params[:device])\r\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @device.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end"
] |
[
"0.63075316",
"0.6080054",
"0.60480165",
"0.5920676",
"0.5898391",
"0.5898391",
"0.58927375",
"0.58395094",
"0.57998675",
"0.5744023",
"0.571048",
"0.5648379",
"0.5599876",
"0.5580509",
"0.5569869",
"0.5539044",
"0.5535193",
"0.5532164",
"0.5523894",
"0.5522327",
"0.55095917",
"0.5481411",
"0.5471103",
"0.5466621",
"0.5466124",
"0.54553527",
"0.54550976",
"0.54433787",
"0.5435364",
"0.54202616",
"0.5418027",
"0.5408968",
"0.5400327",
"0.5395578",
"0.5381608",
"0.5367254",
"0.5344775",
"0.53242004",
"0.53242004",
"0.5323189",
"0.5313501",
"0.5311482",
"0.5295326",
"0.5289214",
"0.52882504",
"0.52793956",
"0.52772015",
"0.5264808",
"0.52625406",
"0.5257691",
"0.5256708",
"0.5238708",
"0.5232171",
"0.5218235",
"0.5218235",
"0.52136236",
"0.5212376",
"0.5212376",
"0.52117443",
"0.52070576",
"0.52070576",
"0.52070576",
"0.52070576",
"0.520362",
"0.52035946",
"0.5189227",
"0.51890457",
"0.5188559",
"0.51867104",
"0.5181387",
"0.5181387",
"0.51760316",
"0.51713264",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162157",
"0.51587874",
"0.515731",
"0.514885",
"0.5146529",
"0.5142937",
"0.5141283",
"0.5140643",
"0.5139005",
"0.5136893",
"0.5130357",
"0.51281726",
"0.5124425",
"0.5124425",
"0.5124425",
"0.51183134",
"0.51183134",
"0.5104355",
"0.5102241",
"0.5088396"
] |
0.51097935
|
97
|
Read properties and relationships of the deviceAppManagement object.
|
def to_get_request_information(request_configuration=nil)
request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
request_info.url_template = @url_template
request_info.path_parameters = @path_parameters
request_info.http_method = :GET
request_info.headers.add('Accept', 'application/json')
unless request_configuration.nil?
request_info.add_headers_from_raw_object(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
end
return request_info
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managed_devices\n return @managed_devices\n end",
"def devices\n @devices\n end",
"def properties\n start = Time.now\n debug \"Checking properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n properties = Hash.new\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n device_group_properties = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_GET,\n build_query_params('type:custom,name!:system.categories,name!:puppet.update.on',\n 'name,value'))\n if valid_api_response?(device_group_properties, true)\n device_group_properties['data']['items'].each do |property|\n name = property['name']\n value = property['value']\n if value.include?('********') && resource[:properties].has_key?(name)\n debug 'Found password property. Verifying'\n verify_device_group_property = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_GET,\n build_query_params(\"type:custom,name:#{name},value:#{value}\", nil, 1))\n if valid_api_response?(verify_device_group_property)\n debug 'Property unchanged'\n value = resource[:properties][name]\n else\n debug 'Property changed'\n end\n end\n properties[name] = value\n end\n else\n alert device_group_properties\n end\n else\n alert device_group\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n properties\n end",
"def devices\n return @devices\n end",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def device_configuration\n return @device_configuration\n end",
"def device_list\n @devices = Device.all\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\n end",
"def devices; end",
"def app_management_policies\n return @app_management_policies\n end",
"def properties\n self.class.get_properties\n end",
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Microvisor.V1.AppManifestInstance #{values}>\"\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def get_app_properties(*properties)\n json = @session.post('facebook.admin.getAppProperties', :properties => properties.to_json)\n hash = JSON.parse(CGI.unescapeHTML(json))\n @properties = ApplicationProperties.from_hash(hash)\n end",
"def get_app_properties(*properties)\n json = @session.post('facebook.admin.getAppProperties', :properties => properties.to_json)\n hash = JSON.parse(CGI.unescapeHTML(json))\n @properties = ApplicationProperties.from_hash(hash)\n end",
"def properties\n self.class.properties\n end",
"def list\n all.each { |device| puts(device.pretty_name) }\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def get_mobile_device()\n res = self.send_request 'get_mobile_device'\n device_info_xml = REXML::Document.new(res.body).root\n rez ={}\n device_info_xml.elements.each do |el|\n rez.merge! Hash[el.name.to_s,el.text.to_s]\n end\n return rez\n end",
"def properties\n _properties\n end",
"def device_model\n return @device_model\n end",
"def device_model\n return @device_model\n end",
"def managed_apps\n return @managed_apps\n end",
"def mobile_apps\n return @mobile_apps\n end",
"def management_interface_settings\r\n ManagementInterfaceSettingsController.instance\r\n end",
"def devices\r\n DevicesController.instance\r\n end",
"def index\n @admin_devices = AdminDevice.all\n end",
"def properties\n @properties\n end",
"def properties\n @properties\n end",
"def device_management()\n return MicrosoftGraph::DeviceManagement::DeviceManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end",
"def platform_details\n data[:platform_details]\n end",
"def metric_devices\n return @metric_devices\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def parse_management_device(component)\n parse(component, fields_by_component_type(component))\n end",
"def command_get_device_info(command)\n\t\tcommand_get_device(command)\n\t\tif @device\n\t\t\tmessage(\" #{@device.description}\")\n\t\t\t@windows.each {|name,window| message(\" #{name}: #{window.info}\")}\n\t\tend\n\tend",
"def get_field_deserializers()\n return super.merge({\n \"apps\" => lambda {|n| @apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedMobileApp.create_from_discriminator_value(pn) }) },\n \"customBrowserDisplayName\" => lambda {|n| @custom_browser_display_name = n.get_string_value() },\n \"customBrowserPackageId\" => lambda {|n| @custom_browser_package_id = n.get_string_value() },\n \"deployedAppCount\" => lambda {|n| @deployed_app_count = n.get_number_value() },\n \"deploymentSummary\" => lambda {|n| @deployment_summary = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicyDeploymentSummary.create_from_discriminator_value(pn) }) },\n \"disableAppEncryptionIfDeviceEncryptionIsEnabled\" => lambda {|n| @disable_app_encryption_if_device_encryption_is_enabled = n.get_boolean_value() },\n \"encryptAppData\" => lambda {|n| @encrypt_app_data = n.get_boolean_value() },\n \"minimumRequiredPatchVersion\" => lambda {|n| @minimum_required_patch_version = n.get_string_value() },\n \"minimumWarningPatchVersion\" => lambda {|n| @minimum_warning_patch_version = n.get_string_value() },\n \"screenCaptureBlocked\" => lambda {|n| @screen_capture_blocked = n.get_boolean_value() },\n })\n end",
"def device_description\n return @device_description\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def properties\n @properties ||= {}\n end",
"def device\n attachments[0]['device'] if has_attachments?\n end",
"def device\n device_name\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def query\n self.class.instances.each do |pkg|\n return pkg.properties if pkg.name == @resource[:name]\n end\n return nil\n end",
"def get_field_deserializers()\n return super.merge({\n \"appIdentifier\" => lambda {|n| @app_identifier = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MobileAppIdentifier.create_from_discriminator_value(pn) }) },\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"appliedPolicies\" => lambda {|n| @applied_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"deviceTag\" => lambda {|n| @device_tag = n.get_string_value() },\n \"deviceType\" => lambda {|n| @device_type = n.get_string_value() },\n \"flaggedReasons\" => lambda {|n| @flagged_reasons = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppFlaggedReason.create_from_discriminator_value(pn) }) },\n \"intendedPolicies\" => lambda {|n| @intended_policies = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppPolicy.create_from_discriminator_value(pn) }) },\n \"lastSyncDateTime\" => lambda {|n| @last_sync_date_time = n.get_date_time_value() },\n \"managementSdkVersion\" => lambda {|n| @management_sdk_version = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedAppOperation.create_from_discriminator_value(pn) }) },\n \"platformVersion\" => lambda {|n| @platform_version = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def devices\n response = get('/listDevices')\n devices = []\n response.body['devices'].each do |d|\n devices << Device.from_json(d, @token, @logger)\n end\n devices\n end",
"def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end",
"def properties\n self.class.properties.keys\n end",
"def list\n Airplay.devices.each do |device|\n puts <<-EOS.gsub(/^\\s{12}/,'')\n * #{device.name} (#{device.info.model} running #{device.info.os_version})\n ip: #{device.ip}\n mac: #{device.id}\n password?: #{device.password? ? \"yes\" : \"no\"}\n type: #{device.type}\n resolution: #{device.info.resolution}\n\n EOS\n end\n end",
"def device\n self.subscription.device\n end",
"def properties\n model.properties\n end",
"def metadata\n self.class.metadata\n end",
"def attributes\n @metadata\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def properties\n return @properties\n end",
"def modems(opts = {})\n @mm_service = @bus.service(@modem_service)\n @mm_object = @mm_service.object(@modem_bus_path)\n @mm_object.introspect\n NetworkManager::Modem.fetch(@mm_object.EnumerateDevices()[0], service: @mm_service)\n end",
"def command_get_device(command)\n\t\tif @device then message(\"device: #{@device.name}\")\n\t\telse error(\"no device loaded\")\n\t\tend\n\tend",
"def get(request_configuration=nil)\n request_info = self.to_get_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def device_identities\n return @device_identities\n end",
"def devices=(value)\n @devices = value\n end",
"def properties; @message_impl.getProperties; end",
"def properties\n @properties ||= {}\n end",
"def manufacturer\n fetch('device.manufacturer')\n end",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def load_device\n @device = Device.find(params[:device_id])\n end",
"def sync_app_information!(app_lookup)\n @name = app_lookup.try(:[],'trackName')\n @description = app_lookup.try(:[],'description')\n @small_icon_url = app_lookup.try(:[],'artworkUrl60')\n @publisher_name = app_lookup.try(:[],'sellerName')\n @price = app_lookup.try(:[],'price')\n @version = app_lookup.try(:[],'version')\n @average_user_rating = app_lookup.try(:[],'averageUserRatingForCurrentVersion')\n end",
"def index\n @devices = current_user.devices\n end",
"def get_devices\n get_device_paths.collect do |device_path|\n NetworkManager::Device.new(device_path)\n end\n end",
"def read_device_info (device, kind)\n kind = kind.to_sym\n kinds = [:ip, :udid, :serial]\n unless kinds.include?(kind)\n raise \"illegal argument '#{kind}' - must be one of '#{kinds}'\"\n end\n\n path = File.expand_path(\"~/.xamarin/devices/#{device}/#{kind}\")\n\n unless File.exist?(path)\n @log.fatal{\"cannot read device information for '#{device}'\"}\n @log.fatal{\"file '#{path}' does not exist\"}\n exit 1\n end\n\n begin\n IO.readlines(path).first.strip\n rescue Exception => e\n @log.fatal{\"cannot read device information for '#{device}'\"}\n @log.fatal{e}\n exit 1\n end\nend",
"def parse_management_device(node)\n parse(node, MANAGEMENT_DEVICE)\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def read_bridged_interfaces\n end",
"def index\n @device_models = DeviceModel.all\n end",
"def physical_device_id\n return @physical_device_id\n end",
"def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def device_states\n return @device_states\n end",
"def apps\n return @apps\n end",
"def get_properties()\n return @properties\n end",
"def read_appliance_management_service(opts = {})\n data, _status_code, _headers = read_appliance_management_service_with_http_info(opts)\n return data\n end",
"def swagger_info\n if app.respond_to?(:info)\n app.info\n else\n {}\n end\n end",
"def devices\n\texecute(\"devices\").split(\"\\n\")[1..-1]\nend",
"def app_definitions\n return @app_definitions\n end",
"def read_device_info (device, kind)\n kind = kind.to_sym\n kinds = [:ip, :udid, :serial]\n unless kinds.include?(kind)\n raise \"#{kind} must be one of '#{kinds}'\"\n end\n cmd = \"cat ~/.xamarin/devices/#{device}/#{kind} | tr -d '\\n'\"\n `#{cmd}`\nend",
"def devices\n puts `instruments -s devices | grep -v '(Simulator)'`\n end",
"def appl_settings\n @appl_settings\n end",
"def get_device_management_intent_settings_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetDeviceManagementIntentSettingsReport::GetDeviceManagementIntentSettingsReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def physical_devices\n @instruments_physical_devices ||= lambda do\n fetch_devices[:out].chomp.split(\"\\n\").map do |line|\n udid = line[DEVICE_UDID_REGEX, 0]\n if udid\n version = line[VERSION_REGEX, 0]\n if version\n name = line.split('(').first.strip\n if name\n RunLoop::Device.new(name, version, udid)\n end\n end\n else\n nil\n end\n end.compact\n end.call\n end",
"def query_resources\n powershell_exec(\"get-dscresource\").result\n end",
"def snmp_settings\r\n SNMPSettingsController.instance\r\n end",
"def info\n Plist::parse_xml(diskutil 'info', '-plist', @dev_node)\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicableArchitectures\" => lambda {|n| @applicable_architectures = n.get_enum_value(MicrosoftGraph::Models::WindowsArchitecture) },\n \"applicableDeviceTypes\" => lambda {|n| @applicable_device_types = n.get_enum_value(MicrosoftGraph::Models::WindowsDeviceType) },\n \"committedContainedApps\" => lambda {|n| @committed_contained_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileContainedApp.create_from_discriminator_value(pn) }) },\n \"identityName\" => lambda {|n| @identity_name = n.get_string_value() },\n \"identityPublisherHash\" => lambda {|n| @identity_publisher_hash = n.get_string_value() },\n \"identityResourceIdentifier\" => lambda {|n| @identity_resource_identifier = n.get_string_value() },\n \"identityVersion\" => lambda {|n| @identity_version = n.get_string_value() },\n \"isBundle\" => lambda {|n| @is_bundle = n.get_boolean_value() },\n \"minimumSupportedOperatingSystem\" => lambda {|n| @minimum_supported_operating_system = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsMinimumOperatingSystem.create_from_discriminator_value(pn) }) },\n })\n end"
] |
[
"0.5919667",
"0.5780612",
"0.57789814",
"0.5708176",
"0.5665409",
"0.5631735",
"0.5525409",
"0.55242884",
"0.5480965",
"0.53661984",
"0.5326116",
"0.52930397",
"0.5289022",
"0.524766",
"0.5226348",
"0.5221837",
"0.521806",
"0.51977646",
"0.51977646",
"0.5196834",
"0.51815414",
"0.5173878",
"0.51507604",
"0.51423717",
"0.5126595",
"0.5126595",
"0.512524",
"0.51160944",
"0.51152396",
"0.5109166",
"0.5083306",
"0.506482",
"0.5059847",
"0.5032564",
"0.49975657",
"0.49907887",
"0.4984994",
"0.4983261",
"0.49746007",
"0.49674398",
"0.49643862",
"0.49642465",
"0.49579722",
"0.4957771",
"0.4919458",
"0.49133524",
"0.49056563",
"0.48843658",
"0.4880286",
"0.48767152",
"0.4875437",
"0.48695865",
"0.48651895",
"0.4859577",
"0.4838258",
"0.48295975",
"0.48251793",
"0.48231268",
"0.48222443",
"0.48185056",
"0.4817054",
"0.48147634",
"0.48093626",
"0.4806529",
"0.48035157",
"0.47986802",
"0.47959438",
"0.479315",
"0.47900492",
"0.4768575",
"0.47647446",
"0.47607338",
"0.47584334",
"0.47531548",
"0.47494212",
"0.47446623",
"0.4732541",
"0.47301728",
"0.47229254",
"0.47229254",
"0.472015",
"0.4714593",
"0.4707387",
"0.47060686",
"0.4703437",
"0.4702254",
"0.46954462",
"0.46919805",
"0.469173",
"0.46895087",
"0.46886533",
"0.4679141",
"0.46733588",
"0.46718147",
"0.46660367",
"0.46650246",
"0.46561",
"0.46543482",
"0.4651333",
"0.46502447",
"0.46496612"
] |
0.0
|
-1
|
Update the properties of a deviceAppManagement object.
|
def to_patch_request_information(body, request_configuration=nil)
raise StandardError, 'body cannot be null' if body.nil?
request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
request_info.url_template = @url_template
request_info.path_parameters = @path_parameters
request_info.http_method = :PATCH
request_info.headers.add('Accept', 'application/json')
unless request_configuration.nil?
request_info.add_headers_from_raw_object(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
end
request_info.set_content_from_parsable(@request_adapter, "application/json", body)
return request_info
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n wmi_object.put_\n end",
"def properties=(value)\n start = Time.now\n debug \"Updating properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n value,\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def update\n if params[:device_group][:property_ids]\n params[:device_group][:property_ids].each do |property_id|\n @property = Property.find(property_id)\n @device_group.properties << @property\n end\n end\n respond_to do |format|\n if @device_group.update(device_group_params)\n format.html { redirect_to @device_group, notice: 'Device group was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n end\n end\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @by_device_id = args[:by_device_id] if args.key?(:by_device_id)\n @copresenter_device_ids = args[:copresenter_device_ids] if args.key?(:copresenter_device_ids)\n @presenter_device_id = args[:presenter_device_id] if args.key?(:presenter_device_id)\n end",
"def update\n if @device.update(device_params)\n respond_with(@device, location: devices_url, notice: 'Device was successfully updated.')\n else\n respond_with(@devices)\n end\n end",
"def update\n if @device_manufacturer.update(device_manufacturer_params)\n respond_with(@device_manufacturer, location: device_manufacturers_url, notice: 'Device manufacturer was successfully updated.')\n else\n respond_with(@device_manufacturer)\n end\n end",
"def update\n @device.update(device_params)\n head :no_content\n end",
"def update\n respond_to do |format|\n if @admin_device.update(admin_device_params)\n format.html { redirect_to @admin_device, notice: 'Admin device was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_device }\n else\n format.html { render :edit }\n format.json { render json: @admin_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t#params[:device][:asset_ids] ||= []\n\t\tparams[:device][:register_ids] ||= []\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n format.html { redirect_to(@device) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device = args[:device] if args.key?(:device)\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update!(**args)\n @device_model_capabilities = args[:device_model_capabilities] if args.key?(:device_model_capabilities)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"def update!(**args)\n @android_device_id = args[:android_device_id] if args.key?(:android_device_id)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n end",
"def update\n respond_to do |format|\n if @device_assignment.update(device_assignment_params)\n format.html { redirect_to @device_assignment.device, notice: 'Device assignment was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_assignment }\n else\n set_default_variables\n format.html { render :edit }\n format.json { render json: @device_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def update!(**args)\n @device_action_capability = args[:device_action_capability] if args.key?(:device_action_capability)\n @project_configs = args[:project_configs] if args.key?(:project_configs)\n end",
"def update\n respond_to do |format|\n if @device_status.update(admin_device_status_params)\n format.html { redirect_to admin_device_status_path(@device_status), notice: 'Device Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_status }\n else\n format.html { render :edit }\n format.json { render json: @device_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n @mobile_app.touch\n if @mobile_app.published?\n @mobile_app.published!\n end\n @mobile_app.build_notifications(:updated)\n ELASTIC_SEARCH_CLIENT.index index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id, body: @mobile_app.as_indexed_json\n format.html { redirect_to admin_mobile_app_path(@mobile_app), notice: \"Mobile Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: admin_mobile_app_path(@mobile_app) }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @device.user == current_user or current_user.is_admin?\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @device }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to devices_url, :notice => 'Access denied! You can update your device only'\n end\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n @device_type = args[:device_type] if args.key?(:device_type)\n @guid_fingerprint = args[:guid_fingerprint] if args.key?(:guid_fingerprint)\n @os = args[:os] if args.key?(:os)\n @os_version = args[:os_version] if args.key?(:os_version)\n @possibly_trimmed_model = args[:possibly_trimmed_model] if args.key?(:possibly_trimmed_model)\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device_assignment = DeviceAssignment.find(params[:id])\n @locations = Location.order(\"location_name ASC\")\n @patients = Patient.order(\"last_name ASC\")\n @devices = Device.order(\"serial_number ASC\")\n\n respond_to do |format|\n if @device_assignment.update_attributes(params[:device_assignment])\n format.html { redirect_to @device_assignment, notice: 'Device assignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_properties(properties)\n properties = properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @machine = args[:machine] if args.key?(:machine)\n end",
"def update\n @device = Device.find(params[:id])\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n redirect_to \"/index\"\n end\n end",
"def update\n @gcm_device = GcmDevice.find(params[:id])\n\n respond_to do |format|\n if @gcm_device.update_attributes(params[:gcm_device])\n format.html { redirect_to @gcm_device, notice: 'Gcm device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gcm_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n end",
"def set_app_properties(properties)\n properties.respond_to?(:to_json) ? properties.to_json : properties\n (@session.post 'facebook.admin.setAppProperties', :properties => properties) == '1'\n end",
"def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end",
"def update_usage\n logger.debug 'update usage'\n\n # TODO: replace `where` method to get sublist\n usage_data = ResourcesData.where.not(appname: nil)\n\n usage_data.each do |usage; data|\n data = {}\n %w(cpu disk memory perm).each do |item|\n data[item] = usage.send(item)\n end\n app_data[usage.appname] = data\n end\n\n logger.debug 'update usage completed'\n rescue ActiveRecord::ActiveRecordError => ex\n logger.debug \"access database failed with #{ex.message}.\"\n rescue => ex\n logger.error \"update usage data failed with #{ex.message}.\"\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @device_name = args[:device_name] if args.key?(:device_name)\n @device_type = args[:device_type] if args.key?(:device_type)\n end",
"def update\n puts @device.inspect\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :index, status: :ok, location: @device }\n else\n format.html { render :index }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_device\n @admin_device = AdminDevice.find(params[:id])\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_server_properties_with_http_info(did, device_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.update_server_properties ...\"\n end\n # verify the required parameter 'did' is set\n fail ArgumentError, \"Missing the required parameter 'did' when calling DevicesManagementApi.update_server_properties\" if did.nil?\n # verify the required parameter 'device_properties' is set\n fail ArgumentError, \"Missing the required parameter 'device_properties' when calling DevicesManagementApi.update_server_properties\" if device_properties.nil?\n # resource path\n local_var_path = \"/devicemgmt/devices/{did}/serverproperties\".sub('{format}','json').sub('{' + 'did' + '}', did.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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(device_properties)\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'MetadataEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#update_server_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to devices_path, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device_model.update(device_model_params)\n format.html { redirect_to @device_model, notice: 'Device model was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_model }\n else\n format.html { render :edit }\n format.json { render json: @device_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_install_type = args[:app_install_type] if args.key?(:app_install_type)\n @app_source = args[:app_source] if args.key?(:app_source)\n @app_type = args[:app_type] if args.key?(:app_type)\n @browser_device_count = args[:browser_device_count] if args.key?(:browser_device_count)\n @description = args[:description] if args.key?(:description)\n @disabled = args[:disabled] if args.key?(:disabled)\n @display_name = args[:display_name] if args.key?(:display_name)\n @homepage_uri = args[:homepage_uri] if args.key?(:homepage_uri)\n @os_user_count = args[:os_user_count] if args.key?(:os_user_count)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update\n @device = Device.find(params[:id])\n\n if @device.update(device_params)\n redirect_to devices_path, :notice => 'Gerät erfolgreich aktualisiert.'\n else\n render 'edit'\n end\n end",
"def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n @low_confidence_reason = args[:low_confidence_reason] if args.key?(:low_confidence_reason)\n @result_confidence_level = args[:result_confidence_level] if args.key?(:result_confidence_level)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { render :show, status: :ok, location: @device }\n else\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { head :no_content }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def update!(**args)\n @device_registries = args[:device_registries] if args.key?(:device_registries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @device_registries = args[:device_registries] if args.key?(:device_registries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n @product_management = ProductManagement.find(params[:id])\n\n if @product_management.update(product_management_params)\n head :no_content\n else\n render json: @product_management.errors, status: :unprocessable_entity\n end\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n if @dns_device_assoc.update_attributes(params[:dns_device_assoc])\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute\n super\n device_ids.each do |d|\n device_id, device_label = d.split ':'\n API::Firestore.doc('devices/' + device_id).set(device_id: device_id, label: device_label)\n end\n trigger_updates\n end",
"def update\n respond_to do |format|\n if @mapp.update(mapp_params)\n format.html { redirect_to @mapp, notice: 'Mapp was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapp }\n else\n format.html { render :edit }\n format.json { render json: @mapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def update!(**args)\n @device_name = args[:device_name] if args.key?(:device_name)\n @device_types = args[:device_types] if args.key?(:device_types)\n @effective_arg_span_length = args[:effective_arg_span_length] if args.key?(:effective_arg_span_length)\n @has_ambiguous_resolutions = args[:has_ambiguous_resolutions] if args.key?(:has_ambiguous_resolutions)\n @has_resolved_device_id = args[:has_resolved_device_id] if args.key?(:has_resolved_device_id)\n @room_name = args[:room_name] if args.key?(:room_name)\n end",
"def update!(**args)\n @app_info = args[:app_info] if args.key?(:app_info)\n end",
"def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end",
"def update!(**args)\n @device_states = args[:device_states] if args.key?(:device_states)\n end",
"def promote(device)\n device.inherited = false\n owner.save_config\n end",
"def update!(**args)\n @device_index = args[:device_index] if args.key?(:device_index)\n @media_excuse = args[:media_excuse] if args.key?(:media_excuse)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_setting.update(app_setting_params)\n format.html { redirect_to @app_setting, notice: 'App setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_setting }\n else\n format.html { render :edit }\n format.json { render json: @app_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@service_in_app = ServiceInApp.find(params[:id])\n\n if @service_in_app.update_attributes(params[:app])\n format.html {redirect_to mesapps_url(current_user), :notice => 'Data of App Technique was successfully updated.' }\n\n else\n render :action => \"edit\"\n end\n\n end",
"def update_app_profile app_profile, update_mask, ignore_warnings: nil\n instances.update_app_profile app_profile: app_profile,\n update_mask: update_mask,\n ignore_warnings: ignore_warnings\n end",
"def update \n @rma_device = RmaDevice.find(params[:id])\n @rma_device.update_attributes(params[:rma_device])\n if @rma_device.save\n redirect_to :action => 'list'\n end\n end",
"def update!(**args)\n @carrier_call_device_settings = args[:carrier_call_device_settings] if args.key?(:carrier_call_device_settings)\n @duo_call_device_settings = args[:duo_call_device_settings] if args.key?(:duo_call_device_settings)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params) &&\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @gcm_registration_id = args[:gcm_registration_id] if args.key?(:gcm_registration_id)\n @supports_assistant_gcm = args[:supports_assistant_gcm] if args.key?(:supports_assistant_gcm)\n @supports_client_input_over_gcm = args[:supports_client_input_over_gcm] if args.key?(:supports_client_input_over_gcm)\n end",
"def update_app data={}\n put '/app', data\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pdevice = Pdevice.find(params[:id])\n\n respond_to do |format|\n if @pdevice.update_attributes(params[:pdevice])\n format.html { redirect_to @pdevice, notice: 'Pdevice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pdevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::DeviceAppManagement.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def update\n respond_to do |format|\n if @adm_sets.update(admin_setting_params)\n format.html { redirect_to [:admin, :settings], notice: 'Setting updated.' }\n format.json { render :show, status: :ok, location: @adm_sets }\n else\n format.html { render :edit }\n format.json { render json: @adm_sets.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_device_status\n @device_status = DeviceStatus.find(params[:id])\n end",
"def update\r\n @device = Device.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @device.update_attributes(params[:device])\r\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @device.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end"
] |
[
"0.63075316",
"0.6080054",
"0.60480165",
"0.5920676",
"0.5898391",
"0.5898391",
"0.58927375",
"0.58395094",
"0.57998675",
"0.5744023",
"0.571048",
"0.5648379",
"0.5599876",
"0.5580509",
"0.5569869",
"0.5539044",
"0.5535193",
"0.5532164",
"0.5523894",
"0.5522327",
"0.55095917",
"0.5481411",
"0.5471103",
"0.5466621",
"0.5466124",
"0.54553527",
"0.54550976",
"0.54433787",
"0.5435364",
"0.54202616",
"0.5418027",
"0.5408968",
"0.5400327",
"0.5395578",
"0.5381608",
"0.5367254",
"0.5344775",
"0.53242004",
"0.53242004",
"0.5323189",
"0.5313501",
"0.5311482",
"0.5295326",
"0.5289214",
"0.52882504",
"0.52793956",
"0.52772015",
"0.5264808",
"0.52625406",
"0.5257691",
"0.5256708",
"0.5238708",
"0.5232171",
"0.5218235",
"0.5218235",
"0.52136236",
"0.5212376",
"0.5212376",
"0.52117443",
"0.52070576",
"0.52070576",
"0.52070576",
"0.52070576",
"0.520362",
"0.52035946",
"0.5189227",
"0.51890457",
"0.5188559",
"0.51867104",
"0.5181387",
"0.5181387",
"0.51760316",
"0.51713264",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162508",
"0.5162157",
"0.51587874",
"0.515731",
"0.514885",
"0.5146529",
"0.5142937",
"0.5141283",
"0.5140643",
"0.5139005",
"0.5136893",
"0.5130357",
"0.51281726",
"0.5124425",
"0.5124425",
"0.5124425",
"0.51183134",
"0.51183134",
"0.51097935",
"0.5104355",
"0.5102241",
"0.5088396"
] |
0.0
|
-1
|
Maps the query parameters names to their encoded names for the URI template parsing.
|
def get_query_parameter(original_name)
raise StandardError, 'original_name cannot be null' if original_name.nil?
case original_name
when "expand"
return "%24expand"
when "select"
return "%24select"
else
return original_name
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def map_params(query)\n params = {\n bandName: query[:name] || \"\",\n exactBandMatch: (query[:exact] ? 1 : 0),\n genre: query[:genre] || \"\",\n yearCreationFrom: query[:year]&.begin || \"\",\n yearCreationTo: query[:year]&.end || \"\",\n bandNotes: query[:comment] || \"\",\n status: map_status(query[:status]),\n themes: query[:lyrical_themes] || \"\",\n location: query[:location] || \"\",\n bandLabelName: query[:label] || \"\",\n indieLabelBand: (query[:independent] ? 1 : 0),\n }\n\n params[:country] = []\n Array(query[:country]).each do |country|\n params[:country] << (country.is_a?(ISO3166::Country) ? country.alpha2 : (country || \"\"))\n end\n params[:country] = params[:country].first if params[:country].size == 1\n\n params\n end",
"def params\n split_query_string.flat_map do |keyword|\n [\"%#{keyword}%\".mb_chars.downcase.to_s] * query_for_one_keyword.count('?')\n end\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val | \n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def convert_parameters_into_suitable_url_query_string\n exclude_list = [\n 'controller',\n 'action',\n 'locale',\n 'format'\n ]\n\n converted_params = ActionController::Parameters.new\n\n self.map do |key, map|\n unless exclude_list.include?(key)\n converted_params[key] = map\n end\n end\n\n query_string = converted_params.to_query\n\n return query_string\n end",
"def __to_params__\n map { |k,v| \"#{k.to_s}=#{URI.escape(v.to_s)}\" }.join('&')\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val |\n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def query_values\n CGI.parse(parsed_url.query || \"\").inject({}) do |hash, (key, values)|\n hash.merge!(key.to_sym => values.first)\n end\n end",
"def encode_params(uri, params)\n params_str = \"?\"\n params.each do |k,v|\n if v\n params_str << \"#{k}=#{CGI::escape(v.to_s)}&\"\n end\n end\n params_str.chop!\n uri + params_str\n end",
"def to_query(params)\n params.map do |key,value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end * '&'\n end",
"def param_string\n keys.collect do |p|\n \"#{ p }=#{ CGI.escape(@params[:\"#{ p }\"].to_s) }\"\n end.join('&')\n end",
"def parse_params(mapping, *args)\n if args.length == 0\n args = mapping.keys\n end\n args.collect{ |a| CGI::escape(a.to_s) + \"=\" + CGI::escape(mapping[a].to_s)}.join(\";\")\n end",
"def to_params\n elements = []\n keys.size.times do |i|\n elements << \"#{CGI::escape keys[i].to_s}=#{CGI::escape values[i].to_s}\"\n end\n elements.join('&')\n end",
"def querinize(hash)\n \"?\" + hash.map { |k, v| \"#{k}=#{URI.encode(v.to_s)}\" }.join(\"&\")\n end",
"def mapping_for(name)\n params[MAPPING[name]]\n end",
"def mapping_for(name)\n params[MAPPING[name]]\n end",
"def normalize_encode_params(params); end",
"def encode_parameters!(prm)\n prm.transform_keys! { |k| encode_parameter(k) }\n end",
"def params(query_string)\n begin\n params_prime = query_string.split('&').inject({}) { |h,(k,v)|\n values = k.split('=')\n # Drop any query params that have blank values\n h[values[0].downcase.intern] = (CGI.unescape(values[1])).downcase if values.length == 2 \n h\n }\n rescue NoMethodError => e\n params_prime = Hash.new\n end\n params_prime\n end",
"def format_hash_as_query_string(query_params)\n # replace Ruby => assignment operators with JSON standard colons (:)\n sanitized_params = query_params.to_s.gsub(/=>/, ':')\n CGI.escape(sanitized_params)\n end",
"def query_params\n URI.encode_www_form(\n {\n affiliate:,\n access_key:,\n module_code:,\n url:,\n query:,\n position:,\n user_agent:\n }\n )\n end",
"def query_parameters\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def normalize\n @parameters.inject({}) do |hash, (k, v)|\n v = v.is_a?(Array) ? v.join(',') : v.to_s\n k = k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join\n hash[k] = v\n\n hash\n end\n end",
"def encode_parameters(**prm)\n encode_parameters!(prm)\n end",
"def prepare_request_params(options)\n params = detect_request_input options.delete(:input)\n\n options.inject(params) do |params, kv|\n key, value = kv\n params.merge!(\"#{key.to_s.downcase.gsub(/_+/,'')}\" => value) \n end\n end",
"def to_query(key)\n \"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}\"\n end",
"def parameterize(params)\n params.collect{|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n end",
"def parameterize(params)\n params.collect{|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n end",
"def substitute_values(param_vals)\n @param_mids.inject(@prefix) do |accum, (param, mid)|\n accum + (param_vals[param] || param) + mid\n end\n end",
"def params_string(params_hash)\n params_hash.keys.map do |k|\n [ Rack::Utils.escape(k.to_s),\n Rack::Utils.escape(params_hash[k].to_s)\n ] * '='\n end * '&'\n end",
"def to_param\n encoded_name\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def transform_param_keys_casing\n params.transform_keys!(&:underscore)\n end",
"def transform_params\n params.transform_keys! { |key| key.underscore }\n end",
"def comparable_query_params\n @query_parameters.each_with_object({}) do |(k,v),hash| \n hash[k.to_s] = v.nil? ? v : v.to_s\n end\n end",
"def sorted_parameters_query\n @request_parameters.to_query.gsub(/^&/, '')\n end",
"def get_params(keys, mappings)\n params = {}\n [keys].flatten.each do |key|\n value = arguments[key.to_s]\n params[key] = value if value\n end\n mappings.each do |final_name, substitutes|\n value = substitutes.map { |s| arguments[s] }.find { |el| el }\n params[final_name] = value if value\n end\n params\n end",
"def to_query(params)\n params.to_query.gsub(\"=\", \"%3D\").gsub(\"&\", \"%26\")\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def encoded_local_params(local_params_hash, container = nil)\n local_params_hash.map do |key, val|\n key = \"#{container}[#{key}]\" if !key.nil?\n if val.is_a?(Hash)\n encoded_local_params(val, key)\n else\n \"#{ERB::Util::url_encode(key)}=#{ERB::Util::url_encode(val)}\"\n end\n end.flatten\n end",
"def query_string_params\n super + [\n :chtm, # region\n :chld, # countries/states\n ]\n end",
"def params_for(options)\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n \"?#{params.join(\"&\")}\"\n end",
"def query_string(**params)\n params.map { |k, v| [k, v].join('=') }.join('&')\n end",
"def to_query(params)\n params.map{|k,v| \"#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}\"}.join('&')\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n\n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n\n end\n\n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n\n return res.join(' > ')\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def parameterize(hash)\n hash.map { |key, value| \"#{key}=#{value}\" }.join \"&\"\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n \n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n \n end\n \n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n \n return res.join(' > ')\n end",
"def params_for(options)\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n \"?#{params.join(\"&\")}\"\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend",
"def get_encoded_url(params, uri)\n raise TypeError, 'params must be a Hash or respond to #to_h' unless params.is_a?(Hash) || params.respond_to?(:to_h)\n raise TypeError, 'uri must be an instance of Addressable::URI ' unless uri.is_a?(Addressable::URI)\n \n # NOTE: Have to pass the Rack::Request instance and use the `request.params` method to retrieve the parameters because:\n # uri.to_s # => \"http://localhost/snapsearch/path1?key1=value1&_escaped_fragment_=%2Fpath2%3Fkey2=value2\"\n # uri.query_values # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2\"}\n # request.params # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2=value2\"}\n # Is seems Addressable screws up the spliting of params into a Hash, but Rack does not.\n if !uri.query_values.nil? && uri.query_values.has_key?('_escaped_fragment_')\n qs_and_hash = get_real_qs_and_hash_fragment(params, true)\n url = \"#{uri.scheme}://#{uri.authority}#{uri.path}\" # Remove the query and fragment (SCHEME + AUTHORITY + PATH)... Addressable::URI encodes the uri\n \n url.to_s + qs_and_hash['qs'] + qs_and_hash['hash']\n else\n uri.to_s\n end\n end",
"def compiled_params\n params_array = []\n params_array << \"l1=#{escape(@params[:from])}\" if @params[:from]\n params_array << \"l2=#{escape(@params[:to])}\" if @params[:to]\n params_array << \"d1=#{escape(@params[:depart])}\" if @params[:depart]\n params_array << \"d2=#{escape(@params[:return])}\" if @params[:return]\n params_array.join('&')\n end",
"def open_url_params_map\n {\n issn: 'rft.issn',\n volume: 'rft.volume',\n issue: 'rft.issue',\n start_page: 'rft.spage',\n publication_date: 'rft.date'\n }\n end",
"def parameters_as_string(hash)\n hash.keys.sort.map{|key| %{#{key}=#{hash[key]}}} * '&'\n end",
"def query_parameters; end",
"def canonical_query_string\n params.sort\n .map { |key, value| \"#{uri_escape(key)}=#{uri_escape(value)}\" }\n .join('&')\n end",
"def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def query_string(options)\n # Omit parameters which appear in the URI path.\n query_params = options.reject { |key, value| prefix_parameters.include?(key) }\n\n # Accumulate a list of escaped key=value pairs for the given parameters.\n pairs = []\n query_params.each do |key, value|\n key = CGI.escape(key.to_s)\n\n # a => b becomes a=b\n # a => [b, c] becomes a[]=b&a[]=c\n case value\n when Array\n value.each { |val| pairs << \"#{key}[]=#{CGI.escape(val.to_s)}\" }\n else\n pairs << \"#{key}=#{CGI.escape(value.to_s)}\"\n end\n end\n\n \"?#{pairs * '&'}\" unless pairs.empty?\n end",
"def load_param\n to_hash.select { |_key, value| value }\n .map { |key, value| [key.to_s.split('_').map(&:capitalize).join.sub!(/\\D/, &:downcase), value] }\n .to_h\n end",
"def url_placeholders\n {\n :path => @dir,\n :basename => basename,\n :output_ext => output_ext,\n }\n end",
"def query_string_params\n super + [:chls]\n end",
"def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end",
"def routing_params\n routing_params_with_patterns.map { |param, _| param }\n end",
"def transform_parameters(params)\n Smash.new.tap do |new_hash|\n (params || []).each do |key, value|\n new_hash[snakecase(key)] = value\n end\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def to_params\n params = {}\n\n split(/[&;]/).each do |pairs|\n key, value = pairs.split('=',2).collect { |v| CGI.unescape(v) }\n\n if key and value\n params[key] ||= []\n params[key] << value\n end\n end\n\n params.map_values { |v| v.size > 1 ? v : v.first }\n end",
"def transform_params\n params.transform_keys! { |key| key.tr(\"-\", \"_\") }\n end",
"def to_query_string(params)\n params.map do |key, value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end.join('&')\n end",
"def hash_to_querystring(hash)\n hash.keys.inject('') do |query_string, key|\n query_string << '&' unless key == hash.keys.first\n query_string << \"#{URI.encode(key.to_s)}=#{URI.encode(hash[key])}\"\n end\n end",
"def query_params; end",
"def query_string_to_hash query_string\n Hash[*query_string.scan(/(.+?)=(.*?)(?:&|$)/).flatten].each_value {|v|\n v.gsub!('+', ' ')\n v.gsub!(/%([0-9a-f]{2})/i) { [$1.hex].pack 'C' }\n }\nend",
"def get_reqd_params_and_values \n# logger.info \"get_reqd_params_and_values----------------------\"\n values = {}\n i = 1\n while !params[:rparams_.to_s + \"#{i}\"].nil?\n if(!params[:rparams_.to_s + \"#{i}\"].empty?)\n value = params[:rparam_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n # logger.info \"--------------\"+params[:rparam_values_.to_s + \"#{i}\"].to_s\n values[params[:rparams_.to_s + \"#{i}\"]] = value \n end \n i += 1\n end\n # logger.info \"--------------\"+values.to_s\n values\nend",
"def query_symbols(query); end",
"def query_symbols(query); end",
"def query\n params.sort.map { |k, v| \"#{k}=\" + escape(v) }.join('&')\n end",
"def params_to_with_format(params, pre = \"\")\n params.to_a.inject([]) do |s, kv|\n key, value = kv\n head = pre == \"\" ? \"'#{key}\" : pre + \"[#{key}]\"\n if value.is_a?(Hash)\n value.each do |v| \n v_key, v_value = v\n s << params_to_with_format({v_key => v_value}, head)\n end \n else\n s << \"#{head}=' + encodeURIComponent('#{value}')\"\n end\n s\n end.join(\"+ '&' + \")\n end",
"def parameters\n url_params = \"\"\n\n if @resource == :catalog\n url_params += \"&\" + \"offset=#{URI.escape(@offset.to_s)}\" if @offset\n url_params += \"&\" + \"size=#{URI.escape(@size.to_s)}\" if @size\n url_params += \"&\" + \"search=#{URI.escape(@search)}\" if @search\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n url_params += \"&\" + \"state=#{URI.escape(@state)}\" if @state\n url_params += \"&\" + \"sort=#{URI.escape(@sort)}\" if @sort\n url_params += \"&\" + \"instock=#{@instock}\" if @instock\n elsif @resource == :categorymap\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n url_params += \"&\" + \"search=#{URI.escape(@search)}\" if @search\n elsif @resource == :reference\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n end\n\n return url_params\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def routing_params\n routing_params_with_patterns.map { |param, _| param }\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end",
"def query_normalization\n uri = Addressable::URI.parse(@url)\n tmp_q = (uri.query_values || {}).merge(@query)\n\n return tmp_q if tmp_q.empty? && tmp_q.values.all? { |v| v.encode == @encoding }\n tmp_q.each_key { |k| tmp_q[k].encode! @encoding }\n tmp_q\n end",
"def create_query_string(hash)\n parts = hash.map {|key,value| \"#{CGI.escape(key)}=#{CGI.escape(value)}\"}\n return parts.join('&')\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def normalize_with_encoded_query\n normalize_without_encoded_query.tap do |uri|\n if uri.query_values.present?\n uri.query_values = uri.query_values.map { |key, value| [key, value] }\n end\n uri\n end\n end",
"def query_string(params)\n params.map do |k, v|\n \"#{CGI::escape(k)}=#{CGI::escape(v)}\"\n end.join(\"&\")\n end",
"def query_params=(_arg0); end",
"def render_params\n { :order_by => 'LOWER(name) ASC' }\n end",
"def encode_parameter(key)\n IGNORED_PARAMETERS.include?(key) ? \"_#{key}\".to_sym : key\n end"
] |
[
"0.60915565",
"0.605133",
"0.5986709",
"0.59832704",
"0.5906048",
"0.58652514",
"0.5841027",
"0.5797896",
"0.5774637",
"0.5710433",
"0.57084304",
"0.5695974",
"0.5660978",
"0.5642493",
"0.5642493",
"0.5634886",
"0.56341594",
"0.56057274",
"0.55981034",
"0.5559806",
"0.5526872",
"0.55214214",
"0.5517553",
"0.5512461",
"0.54977083",
"0.549147",
"0.54846936",
"0.54846936",
"0.5471092",
"0.54652554",
"0.5456806",
"0.54562646",
"0.5451775",
"0.5446794",
"0.54382443",
"0.54230016",
"0.5413343",
"0.54118556",
"0.5386735",
"0.5386735",
"0.53820014",
"0.5379882",
"0.5378147",
"0.5374483",
"0.53731686",
"0.53707016",
"0.53615206",
"0.5359725",
"0.5354716",
"0.534488",
"0.534195",
"0.534195",
"0.534195",
"0.53386545",
"0.53296924",
"0.53236705",
"0.53229517",
"0.5322432",
"0.5322",
"0.5308603",
"0.530694",
"0.52973884",
"0.52973884",
"0.52916485",
"0.52908844",
"0.52836794",
"0.52766937",
"0.527594",
"0.52675486",
"0.5258977",
"0.5250586",
"0.5250586",
"0.5247862",
"0.52452147",
"0.5243791",
"0.52428555",
"0.52403176",
"0.52368385",
"0.52295184",
"0.52236474",
"0.52236474",
"0.52204496",
"0.52183396",
"0.5209568",
"0.5208664",
"0.5208664",
"0.5208664",
"0.52086616",
"0.51897967",
"0.5187792",
"0.5185583",
"0.5184426",
"0.5184426",
"0.5182366",
"0.51703995",
"0.5154076",
"0.514144",
"0.5141182"
] |
0.51743954
|
95
|
Defines a new query pattern
|
def query_api_pattern(method_name, verb, path='', opts={}, storage=nil, &block)
opts = opts.dup
method_name = method_name.to_s
storage ||= query_api_patterns
before = opts.delete(:before)
after = opts.delete(:after) || block
defaults = opts.delete(:defaults) || {}
params = opts.delete(:params) || {}
headers = opts.delete(:headers) || {}
options = opts.delete(:options) || {}
options[:method_name] = method_name
body = opts.delete(:body) || nil
# Complain if there are any unused keys left.
fail(Error.new("#{method_name.inspect} pattern: unsupported key(s): #{opts.keys.map{|k| k.inspect}.join(',')}")) if opts.any?
# Store the new pattern.
storage[method_name] = {
:verb => verb.to_s.downcase.to_sym,
:path => path.to_s,
:before => before,
:after => after,
:defaults => defaults,
:params => params,
:headers => HTTPHeaders::new(headers),
:options => options,
:body => body }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end",
"def query_pattern(pattern, **options, &block)\n return super unless pattern.graph_name == DEFAULT_GRAPH\n\n if block_given?\n pattern = pattern.dup\n pattern.graph_name = nil\n\n each_statement do |statement|\n yield statement if (statement.graph_name == DEFAULT_GRAPH ||\n statement.graph_name.nil?) && pattern === statement\n end\n else\n enum_for(:query_pattern, pattern, options)\n end\n end",
"def query(pattern, &block)\n raise TypeError.new(\"#{self} is not readable\") if respond_to?(:readable) && !readable?\n\n case pattern\n when Query\n pattern.execute(self, &block)\n when Array\n query(Statement.new(*pattern), &block)\n when Statement\n if block_given?\n find_all { |statement| pattern === statement }.each(&block)\n else\n find_all { |statement| pattern === statement }.extend(RDF::Enumerable, RDF::Queryable)\n end\n else\n raise ArgumentError.new(\"expected RDF::Query or RDF::Pattern, got #{pattern.inspect}\")\n end\n end",
"def query_patterns\n self.rdf_statements.select{|rdfs| rdfs[1] != Vocabularies::Alignment.measure}.collect{|qp|\n RDF::Query::Pattern.new(*qp.map!{|x| x == resource ? :cell : x })\n }\n end",
"def create_queries(keyword)\n sql = \"\"\n self.column_names .each do |col|\n\n sql += col + \" LIKE \" + \"\\'\" + keyword + \"\\'\"\n sql += \" OR \"\n end\n sql[0..-5] #removes the last AND. A temporary dirty fix.\n end",
"def query_def; query.name; end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query_api_patterns\n @query_api_patterns ||= {}\n # The current set of patterns may override whatever is defined at the class level.\n self.class.query_api_patterns.merge(@query_api_patterns)\n end",
"def match_query(query); end",
"def method_missing(method_name, *args, &block)\n begin\n invoke_query_api_pattern_method(method_name, *args, &block)\n rescue PatternNotFoundError\n super\n end\n end",
"def query_pattern(pattern, options = {}, &block)\n if block_given?\n graph_name = pattern.graph_name\n subject = pattern.subject\n predicate = pattern.predicate\n object = pattern.object\n\n cs = @data.has_key?(graph_name) ? {graph_name => @data[graph_name]} : @data.dup\n cs.each do |c, ss|\n next unless graph_name.nil? || graph_name == false && !c || graph_name.eql?(c)\n ss = if ss.has_key?(subject)\n { subject => ss[subject] }\n elsif subject.nil? || subject.is_a?(RDF::Query::Variable)\n ss.dup\n else\n []\n end\n ss.each do |s, ps|\n next unless subject.nil? || subject.eql?(s)\n ps = if ps.has_key?(predicate)\n { predicate => ps[predicate] }\n elsif predicate.nil? || predicate.is_a?(RDF::Query::Variable)\n ps.dup\n else\n []\n end\n ps.each do |p, os|\n next unless predicate.nil? || predicate.eql?(p)\n os = os.dup # TODO: is this really needed?\n os.each do |o|\n next unless object.nil? || object.eql?(o)\n # FIXME: yield has better performance, but broken in MRI 2.2: See https://bugs.ruby-lang.org/issues/11451.\n block.call(RDF::Statement.new(s, p, o, graph_name: c.equal?(DEFAULT_GRAPH) ? nil : c))\n end\n end\n end\n end\n else\n enum_for(:query_pattern, pattern, options)\n end\n end",
"def query(query_definition)\n return\n end",
"def initialize(query=\"\")\n @symbols = {\n :begin => %r/\\(\\s*(?=[^\\s\\)&,\\|])/,\n :end => %r/\\s*\\)(?=[^\\w]|\\Z)/,\n :and => %r/(?:\\s+|\\s*&{1,2}\\s*)(?=[\\w\\(\"])/,\n :or => %r/\\s*(?:,|\\|{1,2})\\s*(?=[\\w\\(\"])/,\n :label => %r/(\\w+(?:-\\w+)?):\\s*(?=[\\w\\(\"])/,\n # :not => %r/!\\s*(?=[\\w\\(\"])/, # NOT is VERY HARD\n :word => %r/([\\w\\-]+(?:'[\\w\\-]+)?)(?=[^:\\w\\-\\(]|\\Z)/,\n :quoted => %r/\"([^\"]+)\"/\n }\n @query = query\n end",
"def sql_wildcard\n \"%#{self}%\"\n end",
"def initialize\n @query_fields = nil \n @query_params = {}\n \n @sql_like = 'LIKE'\n \n if ActiveRecord::Base.connected? and ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'\n @sql_like = 'ILIKE'\n end\n end",
"def initial_query; end",
"def graph_pattern(quin)\n s = quin_values(quin)\n query = ''\n case @schema\n when :naryrel\n query += \"#{s[:s]} #{s[:p]} ?c . ?c #{s[:ps]} #{s[:o]} ; #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:p]} wikibase:propertyValue #{s[:ps]} . \" if @mask[1] == '0'\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n when :onaryrel\n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:naryrel, @mask).graph_pattern(quin)\n else\n query += \"{ #{s[:s]} #{s[:p]} ?c . ?c #{s[:ps]} #{s[:o]} . \"\n query += \"#{s[:p]} wikibase:propertyValue #{s[:ps]} . \" if @mask[1] == '0'\n query += \"} OPTIONAL { \"\n query += \"?c #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n query += \"}\"\n end\n when :ngraphs\n query += \"GRAPH ?c { #{s[:s]} #{s[:p]} #{s[:o]} . ?c #{s[:q]} #{s[:qo]} } . \"\n query += \"#{s[:p]} a wikibase:Property . \" if @mask[1] == '0'\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0'\n when :ongraphs\n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:ngraphs, @mask).graph_pattern(quin)\n else\n query += \"{ GRAPH ?c { #{s[:s]} #{s[:p]} #{s[:o]} } . \"\n query += \"#{s[:p]} a wikibase:Property . \" if @mask[1] == '0'\n query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0'\n query += \"} OPTIONAL { \"\n query += \"GRAPH ?c { ?c #{s[:q]} #{s[:qo]} } . \"\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n query += \"}\"\n end\n when :fngraphs\n query += \"GRAPH ?c { #{s[:s]} #{s[:p]} #{s[:o]} . ?c #{s[:q]} #{s[:qo]} } . \"\n query += \"FILTER EXISTS {#{s[:p]} a wikibase:Property .} . \" if @mask[1] == '0'\n query += \"FILTER EXISTS {#{s[:q]} a wikibase:Property .} . \" if @mask[3] == '0' \n query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0'\n when :fongraphs\n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:fngraphs, @mask).graph_pattern(quin)\n else\n query += \"{ GRAPH ?c { #{s[:s]} #{s[:p]} #{s[:o]} } . \"\n query += \"FILTER EXISTS {#{s[:p]} a wikibase:Property .} . \" if @mask[1] == '0'\n query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0'\n query += \"} OPTIONAL { \"\n query += \"GRAPH ?c { ?c #{s[:q]} #{s[:qo]} } . \"\n query += \"FILTER EXISTS {#{s[:q]} a wikibase:Property .} . \" if @mask[3] == '0'\n query += \"}\"\n end \n when :rdr #BIND( <<?i ?p ?o>> as ?st) .\n query += \"BIND ( <<#{s[:s]} #{s[:p]} #{s[:o]} >> as ?st). ?st wikibase:hasSID ?c. ?c #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:p]} a wikibase:Property . \" if @mask[1] == '0'\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n #query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0' # we don't need that i think because it should already hold in rdr \n when :ordr \n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:rdr, @mask).graph_pattern(quin)\n else\n query += \"{ BIND ( <<#{s[:s]} #{s[:p]} #{s[:o]} >> as ?st). ?st wikibase:hasSID ?c. \"\n query += \"#{s[:p]} a wikibase:Property . \" if @mask[1] == '0'\n #query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0' # we don't need that i think because it should already hold in rdr \n query += \"} OPTIONAL { \"\n query += \" ?c #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n query += \"}\"\n end\n when :frdr #BIND( <<?i ?p ?o>> as ?st) .\n query += \"BIND ( <<#{s[:s]} #{s[:p]} #{s[:o]} >> as ?st). ?st wikibase:hasSID ?c. ?c #{s[:q]} #{s[:qo]} . \"\n query += \"FILTER EXISTS {#{s[:p]} a wikibase:Property .} . \" if @mask[1] == '0'\n query += \"FILTER EXISTS {#{s[:q]} a wikibase:Property .} . \" if @mask[3] == '0' \n #query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0' # we don't need that i think because it should already hold in rdr \n when :fordr \n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:frdr, @mask).graph_pattern(quin)\n else\n query += \"{ BIND ( <<#{s[:s]} #{s[:p]} #{s[:o]} >> as ?st). ?st wikibase:hasSID ?c. \"\n query += \"FILTER EXISTS {#{s[:p]} a wikibase:Property .} . \" if @mask[1] == '0'\n #query += \"FILTER (#{s[:s]} != ?c) \" if @mask[0] == '0' # we don't need that i think because it should already hold in rdr \n query += \"} OPTIONAL { \"\n query += \"?c #{s[:q]} #{s[:qo]} . \"\n query += \"FILTER EXISTS {#{s[:q]} a wikibase:Property .} . \" if @mask[3] == '0'\n query += \"}\"\n end \n when :sgprop\n query += \"#{s[:s]} ?c #{s[:o]} . ?c rdf:singletonPropertyOf #{s[:p]} ; #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n when :osgprop\n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:sgprop, @mask).graph_pattern(quin)\n else\n query += \"{ #{s[:s]} ?c #{s[:o]} . ?c rdf:singletonPropertyOf #{s[:p]} \"\n query += \"} OPTIONAL { \"\n query += \"?c #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property \" if @mask[3] == '0'\n query += \"}\"\n end\n when :stdreif\n query += \"?c rdf:subject #{s[:s]} ; rdf:predicate #{s[:p]} ; rdf:object #{s[:o]} ; #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property . \" if @mask[3] == '0'\n when :ostdreif\n if @mask[3] == '1' or @mask[4] == '1'\n query += QuinQueryBuilder.new(:stdreif, @mask).graph_pattern(quin)\n else\n query += \"{ ?c rdf:subject #{s[:s]} ; rdf:predicate #{s[:p]} ; rdf:object #{s[:o]} \"\n query += \"} OPTIONAL { \"\n query += \"?c #{s[:q]} #{s[:qo]} . \"\n query += \"#{s[:q]} a wikibase:Property \" if @mask[3] == '0'\n query += \"}\"\n end\n end\n query\n end",
"def initialize\n super(\"query\")\n end",
"def query; end",
"def query_def; mrna.definition; end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def query\n end",
"def compute_query_api_pattern_based_params(query_pattern_name, query_params={})\n # fix a method name\n pattern = query_api_patterns[query_pattern_name.to_s]\n # Complain if we dont know the method\n raise PatternNotFoundError::new(\"#{query_pattern_name.inspect} pattern not found\") unless pattern\n # Make sure we got what we expected\n query_params ||= {}\n raise Error::new(\"Params must be Hash but #{query_params.class.name} received.\") unless query_params.is_a?(Hash)\n # Make a new Hash instance from the incoming Hash.\n # Do not clone because we don't want to have HashWithIndifferentAccess instance or\n # something similar because we need to have Symbols and Strings separated.\n query_params = Hash[query_params]\n opts = {}\n opts[:body] = query_params.delete(:body)\n opts[:headers] = query_params.delete(:headers) || {}\n opts[:options] = query_params.delete(:options) || {}\n opts[:params] = query_params._stringify_keys\n opts[:manager] = self\n request_opts = compute_query_api_pattern_request_data(query_pattern_name, pattern, opts)\n # Try to use custom :process_rest_api_request method first because some auth things\n # may be required.\n # (see OpenStack case) otherwise use standard :process_api_request method\n { :method => respond_to?(:process_rest_api_request) ? :process_rest_api_request : :process_api_request,\n :verb => request_opts.delete(:verb),\n :path => request_opts.delete(:path),\n :opts => request_opts }\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def initialize(*query)\n @query = parse_query_list(query)\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def initial_query=(_arg0); end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def query\n\t\tQuery.new(\"true\")\n\tend",
"def initialize(query)\n @query = query \n end",
"def compile_query\r\n str = []\r\n\r\n str << \"controller|#{q[:controller]}|\" if q[:controller].present?\r\n str << \"action|#{q[:action]}|\" if q[:action].present?\r\n str << \"format|#{q[:format]}|\" if q[:format].present?\r\n str << \"status|#{q[:status]}|\" if q[:status].present?\r\n\r\n str << \"datetime|#{q[:on].strftime('%Y%m%d')}*|\" if q[:on].present?\r\n\r\n str << \"method|#{q[:method]}|\" if q[:method].present?\r\n str << \"path|#{q[:path]}|\" if q[:path].present?\r\n\r\n str.join(\"*\")\r\n end",
"def query_param(raw_query_str)\n \"query:(query_string:(analyze_wildcard:\" \\\n \"!t,query:'#{escape(raw_query_str)}'))\"\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def create_query( relation )\n Query.new(relation)\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def query\n @query = Riddle::Query.escape params[:search]\n end",
"def query\n @query = Riddle::Query.escape params[:search]\n end",
"def initialize(query={})\n @query = query\n end",
"def query_regexp( query )\n read_db do |dbm|\n dbm.each_key do |key|\n puts RDictCcEntry.format_str(dbm[key]) if key =~ /#{query}/\n end\n end\n end",
"def query\n super\n end",
"def query\n @operation = :query\n self\n end",
"def to_like(pattern)\n <<~SQL\n REPLACE(REPLACE(REPLACE(#{pattern},\n #{q('%')}, #{q('\\\\%')}),\n #{q('_')}, #{q('\\\\_')}),\n #{q('*')}, #{q('%')})\n SQL\n end",
"def compute_query_api_pattern_param(query_api_method_name, source, params_with_defaults, used_query_params) # :nodoc:\n case\n when source.is_a?(Hash) then compute_query_api_pattern_hash_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(Array) then compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(Symbol) then compute_query_api_pattern_symbol_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(String) then compute_query_api_pattern_string_data(query_api_method_name, source, params_with_defaults, used_query_params)\n else source\n end\n end",
"def of(query)\n query\n end",
"def sql_query\n case @operator\n when :equals\n arel_field.eq(transmogrified_value)\n when :does_not_equal\n arel_field.not_eq(transmogrified_value)\n when :contains\n arel_field.matches(\"%#{transmogrified_value}%\")\n when :does_not_contain\n arel_field.does_not_match(\"%#{transmogrified_value}%\")\n when :starts_with\n arel_field.matches(\"#{transmogrified_value}%\")\n when :ends_with\n arel_field.matches(\"%#{transmogrified_value}\")\n when :greater_than\n arel_field.gt(transmogrified_value)\n when :greater_than_or_equal_to\n arel_field.gteq(transmogrified_value)\n when :less_than\n arel_field.lt(transmogrified_value)\n when :less_than_or_equal_to\n arel_field.lteq(transmogrified_value)\n when :in\n arel_field.in(transmogrified_value.split(/\\,\\s*/))\n when :not_in\n arel_field.not_in(transmogrified_value.split(/\\,\\s*/))\n when :blank\n arel_field.eq(nil)\n when :not_blank\n arel_field.not_eq(nil)\n end\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, &block)\n self.class.query_api_pattern(method_name, verb, path, opts, @query_api_patterns, &block)\n end",
"def add_wildcard_permission(query)\n if @permission.to_sym != Permission::WILDCARD.to_sym\n query.where(Permission.arel_table[:action].eq(@permission))\n end\n end",
"def process_query(query)\n # Nothing in default\n end",
"def get_query_pattern(field, should_nested = false)\n return {pattern: :geo_point} if field.to_sym == :geo_point\n\n # return first match of query pattern\n @mappings_hashes.keys.each do |index|\n type = type_by(index, field, should_nested).present? && type_by(index, field, should_nested)\n case type\n when :date, :integer, :boolean, :geo_point, :nested\n return {pattern: type.to_sym}\n else\n case analyzer_by(index, field, should_nested).to_sym\n when *PARTIAL_MATCH_ANALYZERS\n return {pattern: :partial_match}\n when :autocomplete_analyzer\n return {pattern: :prefix_match}\n else\n return {pattern: :full_match_with_analyzer, analyzer: analyzer_by(index, field, should_nested)}\n end\n end\n end\n\n # doesn't match any query patterns\n {}\n end",
"def create_query(mid)\n query = Dynamicloud::API::RecordQuery.new mid\n query.set_credentials @credential\n\n query\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def query_def; seq1.definition; end",
"def query_string\n _f = @params.fields.include?(:full_text) ? [:full_text] : fields\n # byebug\n a = query.gsub('/', '').scan( /\"[^\"]+\"|[^ ]+/ ).map do |word|\n if word[0] === '\"'\n m = word.match( /^\"(.*)\"$/ );\n word = m ? m[1] : word;\n end\n Unicode.downcase(word.gsub('\"', ''))\n end\n _q = '(' + a.join('* AND ') + '*)'\n # _q = '/(?=.*?'+a.join( ')(?=.*?' )+').*/';\n #byebug\n index.filter{ ~q(query_string: {fields: _f, query: \"#{_q}\", default_operator: 'or'}) } if _q.present? && _f.present?\n\n #index.query(multi_match: {query: \"#{_q}*\", fields: _f}) if _q.present? && _f.present\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def scrooge_select_regex\n @@scrooge_select_regexes[self.table_name] ||= Regexp.compile( \"SELECT (`?(?:#{table_name})?`?.?\\\\*) FROM\" )\n end",
"def parse_query(query); end",
"def parse_query(query); end",
"def search(query); end",
"def AddQuery(query, index = '*', comment = '')\n # build request\n \n # mode and limits\n request = Request.new\n request.put_int @offset, @limit, @mode, @ranker\n # process the 'expr' ranker\n if @ranker == SPH_RANK_EXPR\n request.put_string @rankexpr\n end\n\n request.put_int @sort\n\n request.put_string @sortby\n # query itself\n request.put_string query\n # weights\n request.put_int_array @weights\n # indexes\n request.put_string index\n # id64 range marker\n request.put_int 1\n # id64 range\n request.put_int64 @min_id.to_i, @max_id.to_i \n \n # filters\n request.put_int @filters.length\n @filters.each do |filter|\n request.put_string filter['attr']\n request.put_int filter['type']\n\n case filter['type']\n when SPH_FILTER_VALUES\n request.put_int64_array filter['values']\n when SPH_FILTER_RANGE\n request.put_int64 filter['min'], filter['max']\n when SPH_FILTER_FLOATRANGE\n request.put_float filter['min'], filter['max']\n else\n raise SphinxInternalError, 'Internal error: unhandled filter type'\n end\n request.put_int filter['exclude'] ? 1 : 0\n end\n \n # group-by clause, max-matches count, group-sort clause, cutoff count\n request.put_int @groupfunc\n request.put_string @groupby\n request.put_int @maxmatches\n request.put_string @groupsort\n request.put_int @cutoff, @retrycount, @retrydelay\n request.put_string @groupdistinct\n \n # anchor point\n if @anchor.empty?\n request.put_int 0\n else\n request.put_int 1\n request.put_string @anchor['attrlat'], @anchor['attrlong']\n request.put_float @anchor['lat'], @anchor['long']\n end\n \n # per-index weights\n request.put_int @indexweights.length\n @indexweights.each do |idx, weight|\n request.put_string idx\n request.put_int weight\n end\n \n # max query time\n request.put_int @maxquerytime\n \n # per-field weights\n request.put_int @fieldweights.length\n @fieldweights.each do |field, weight|\n request.put_string field\n request.put_int weight\n end\n \n # comment\n request.put_string comment\n \n # attribute overrides\n request.put_int @overrides.length\n for entry in @overrides do\n request.put_string entry['attr']\n request.put_int entry['type'], entry['values'].size\n entry['values'].each do |id, val|\n assert { id.instance_of?(Fixnum) || id.instance_of?(Bignum) }\n assert { val.instance_of?(Fixnum) || val.instance_of?(Bignum) || val.instance_of?(Float) }\n \n request.put_int64 id\n case entry['type']\n when SPH_ATTR_FLOAT\n request.put_float val\n when SPH_ATTR_BIGINT\n request.put_int64 val\n else\n request.put_int val\n end\n end\n end\n \n # select-list\n request.put_string @select\n \n # store request to requests array\n @reqs << request.to_s;\n return @reqs.length - 1\n end",
"def initialize(query)\n @query = query\n end",
"def all(query); end",
"def find(query); end",
"def find(query); end",
"def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def pattern\n pattern = params[:pattern].to_s\n loc = Location.safe_find(pattern) if /^\\d+$/.match?(pattern)\n if loc\n redirect_to(location_path(loc.id))\n else\n query = create_query(\n :Location, :pattern_search,\n pattern: Location.user_name(@user, pattern)\n )\n show_selected_locations(query, link_all_sorts: true)\n end\n end",
"def random_query\n # Use a fake query\n # TODO: better random queries\n 'query ' + (rand*5000).to_i.to_s\nend",
"def query ; @query ||= Waves::Request::Query.new( request.query ) ; end",
"def initialize(pattern)\n @pattern = pattern\n end",
"def object_query_generator(data)\n # query header\n query = \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX : <http://www.semanticweb.org/simon/ontologies/2016/1/medienprojekt#>\n \n SELECT *\n {\"\n \n # combine the parameters with the query\n data.each {\n |hash| if hash.has_key?(:predicate)\n # its possible to have predicate and object parameters \n query = query << \"?name \" << hash[:predicate] << \" :\" << hash[:object] << \" .\\n\"\n else\n # or just an object parameter\n query = query << \"?name ?predicate :\" << hash[:object] << \" .\\n\"\n end\n }\n\n # query footer\n query = query << \" }\\nLIMIT 400\"\n # return the resulting query\n return query\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def query(args = {})\n initialize_query unless initialized?\n\n our_select = args[:select] || \"DISTINCT #{model.table_name}.id\"\n our_join = join.dup\n our_join += args[:join] if args[:join].is_a?(Array)\n our_join << args[:join] if args[:join].is_a?(Hash)\n our_join << args[:join] if args[:join].is_a?(Symbol)\n our_tables = tables.dup\n our_tables += args[:tables] if args[:tables].is_a?(Array)\n our_tables << args[:tables] if args[:tables].is_a?(Symbol)\n our_from = calc_from_clause(our_join, our_tables)\n our_where = where.dup\n our_where += args[:where] if args[:where].is_a?(Array)\n our_where << args[:where] if args[:where].is_a?(String)\n our_where = calc_where_clause(our_where)\n our_group = args[:group] || group\n our_order = args[:order] || order\n our_order = reverse_order(order) if our_order == :reverse\n our_limit = args[:limit]\n\n # Tack id at end of order to disambiguate the order.\n # (I despise programs that render random results!)\n if our_order.present? &&\n !our_order.match(/.id( |$)/)\n our_order += \", #{model.table_name}.id DESC\"\n end\n\n sql = %(\n SELECT #{our_select}\n FROM #{our_from}\n )\n sql += \" WHERE #{our_where}\\n\" if our_where.present?\n sql += \" GROUP BY #{our_group}\\n\" if our_group.present?\n sql += \" ORDER BY #{our_order}\\n\" if our_order.present?\n sql += \" LIMIT #{our_limit}\\n\" if our_limit.present?\n\n @last_query = sql\n sql\n end",
"def pattern_find_with_like\n <<-EOT\n SendWithArguments<\n arguments = ActualArguments<\n array = [\n any+,\n HashLiteral<\n array = [\n any{even},\n SymbolLiteral<value = :limit | :conditions>,\n StringLiteral<string *= 'LIKE'>,\n any{even}\n ]\n >\n ]\n >,\n name *= /^find/\n >\n EOT\n end",
"def query( string )\n self.parser.query(string)\n end",
"def query_string(expr)\n new(dataset.query_string(expr))\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def construct_filter_query(queries)\n query_string = '?'\n query_list = Array[]\n\n # Format the include_* queries similarly to other queries for easier\n # processing\n if queries.key?('include_deleted')\n queries['include_deleted'] = if queries['include_deleted']\n ['true']\n else\n ['false']\n end\n end\n\n if queries.key?('include_revisions')\n queries['include_revisions'] = if queries['include_revisions']\n ['true']\n else\n ['false']\n end\n end\n\n # If uuid is included, the only other accepted queries are the\n # include_*s\n if queries.key?('uuid')\n query_string = format('/%s?', queries['uuid'])\n if queries.key?('include_deleted')\n query_string += format('include_deleted=%s&',\n queries['include_deleted'][0])\n end\n\n if queries.key?('include_revisions')\n query_string += format('include_revisions=%s&',\n queries['include_revisions'][0])\n end\n\n # Everthing is a list now, so iterate through and push\n else\n # Sort them into an alphabetized list for easier testing\n # sorted_qs = sorted(queries.to_a, key = operator.itemgetter(0))\n sorted_qs = queries.to_a.sort\n sorted_qs.each do |query, param|\n param.each do |slug|\n # Format each query in the list\n # query_list.push('%s=%s' % Array[query, slug])\n query_list.push(format('%s=%s', query, slug))\n end\n end\n\n # Construct the query_string using the list.\n # Last character will be an & so we can push the token\n query_list.each do |string|\n query_string += format('%s&', string)\n end\n end\n query_string\n end",
"def pattern; end",
"def pattern; end",
"def pattern; end",
"def match(pattern, options = {})\n options = {:use_prefix => true, :use_suffix => true, :method => :execute}.merge(options)\n @matchers << Match.new(pattern, options[:use_prefix], options[:use_suffix], options[:method])\n end",
"def initialize(query)\n raise ArgumentError, 'Query should be string' unless query.is_a? String\n @raw_query = query\n end",
"def compile_query\n #puts \"DATASET COMPILE self #{self}\"\n #puts \"DATASET COMPILE queries #{queries}\"\n \n # Old way: works but doesn't handle fmp compound queries.\n #query.each_with_object([{},{}]){|x,o| o[0].merge!(x[0] || {}); o[1].merge!(x[1] || {})}\n \n # New way: handles compound queries. Reqires ginjo-rfm 3.0.11.\n return unless queries # This should help introspecting dataset that results from record deletion. TODO: test this.\n queries.inject {|new_query,scope| apply_scope(new_query, scope)} ##puts \"SCOPE INJECTION scope:#{scope} new_query:#{new_query}\"; \n end",
"def query_with_modifier(query, strategy, with_timing = false)\n key = query.respond_to?(:key) ? query.key : 'custom'\n\n instrument(\"gql.query.#{key}.#{strategy}\") do\n if strategy.nil?\n if with_timing\n query_standard_with_timing(query)\n else\n query_standard(query)\n end\n elsif Gquery::GQL_MODIFIERS.include?(strategy.strip)\n if with_timing\n with_timing { send(\"query_#{strategy}\", query) }\n else\n send(\"query_#{strategy}\", query)\n end\n end\n end\n end",
"def query_def; @seq1.definition; end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def pattern_template\n \"*\"\n end",
"def sql_match_pattern(column, value, **opt)\n '(%s)' % sql_test(column, value, **opt)\n end",
"def initialize(name, pattern)\n @name, @pattern = name, pattern\n end",
"def create_classic_query(options)\n raise ArgumentError, \"Query name is not present\" unless options[:query_name]\n raise ArgumentError, \"Parent list id is not present\" unless options[:parent_list_id]\n raise ArgumentError, \"Criteria is required\" unless options[:criteria]\n\n options[:visibility] ||= 0\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.instruct!\n\n xml.Envelope do\n xml.Body do\n xml.CreateQuery do\n xml.QUERY_NAME options[:query_name]\n xml.PARENT_LIST_ID options[:parent_list_id]\n xml.VISIBILITY options[:visibility]\n\n xml.PARENT_FOLDER_ID options[:parent_folder_id] if options.has_key?(:parent_folder_id)\n xml.SELECT_COLUMNS options[:select_columns] if options.has_key?(:select_columns)\n xml.ALLOW_FIELD_CHANGE options[:allow_field_change] if options.has_key?(:allow_field_change)\n\n xml.CRITERIA do\n xml.TYPE options[:criteria][:type] if options[:criteria].has_key?(:type)\n\n options[:criteria][:expressions].each do |exp|\n xml.EXPRESSION do\n xml.TYPE exp[:type] if exp.has_key?(:type)\n xml.COLUMN_NAME exp[:column_name] if exp.has_key?(:column_name)\n xml.OPERATORS exp[:operators] if exp.has_key?(:operators)\n xml.VALUES exp[:values] if exp.has_key?(:values)\n xml.TABLE_ID exp[:table_id] if exp.has_key?(:table_id)\n xml.LEFT_PARENS exp[:left_parens] if exp.has_key?(:left_parens)\n xml.RIGHT_PARENS exp[:right_parens] if exp.has_key?(:right_parens)\n xml.AND_OR exp[:and_or] if exp.has_key?(:and_or)\n if exp[:rt_expressions]\n exp[:rt_expressions].each do |rt_exp|\n xml.RT_EXPRESSION do\n xml.TYPE rt_exp[:type] if rt_exp.has_key?(:type)\n xml.COLUMN_NAME rt_exp[:column_name] if rt_exp.has_key?(:column_name)\n xml.OPERATORS rt_exp[:operators] if rt_exp.has_key?(:operators)\n xml.VALUES rt_exp[:values] if rt_exp.has_key?(:values)\n xml.LEFT_PARENS rt_exp[:left_parens] if rt_exp.has_key?(:left_parens)\n xml.RIGHT_PARENS rt_exp[:right_parens] if rt_exp.has_key?(:right_parens)\n xml.AND_OR rt_exp[:and_or] if rt_exp.has_key?(:and_or)\n end\n end\n end\n end\n end\n end\n\n if options[:behavior]\n xml.BEHAVIOR do\n xml.OPTION_OPERATOR options[:behavior] if options.has_key?(:behavior)\n xml.TYPE_OPERATOR options[:type_operator] if options.has_key?(:type_operator)\n xml.MAILING_ID options[:mailing_id] if options.has_key?(:mailing_id)\n xml.REPORT_ID options[:report_id] if options.has_key?(:report_id)\n xml.LINK_NAME options[:link_name] if options.has_key?(:link_name)\n xml.WHERE_OPERATOR options[:where_operator] if options.has_key?(:where_operator)\n xml.CRITERIA_OPERATOR options[:criteria_operator] if options.has_key?(:criteria_operator)\n xml.VALUES options[:values] if options.has_key?(:values)\n end\n end\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['ListId']\n end",
"def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end",
"def gen_query(item, qtype = :document, o = {})\n o[:length] ||= 3\n case qtype\n when :document\n begin\n query = item.get_index().lm.p.sample_pdist(o[:length]).join(' ')\n rescue Exception => e\n error \"Error in query generation\", e\n return nil\n end \n end\n search_result = @ss.search_by_keyword(query, :doc_only=>true, :page=>1, :per_page=>100)\n return nil if !search_result || !search_result[0]\n tgt_item = choose_position(search_result, item.id)\n History.create(:htype=>'query', :basetime=>Time.now, :item_id=>tgt_item, :src_item_id=>item.id, :user_id=>@user_id,\n :game_id=>@game_id, :metadata=>{:query=>query, :rank=>get_search_rank(search_result, item.id)})\n end",
"def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end",
"def query_params\n params.require(:query).permit(:name, :label, :description, :created_by, :sql, :conditions)\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end"
] |
[
"0.69121635",
"0.66614455",
"0.63049686",
"0.62333",
"0.6186912",
"0.6121629",
"0.6033767",
"0.60221285",
"0.6006964",
"0.59696007",
"0.596924",
"0.5965933",
"0.5907596",
"0.58410114",
"0.5833032",
"0.5824188",
"0.58212095",
"0.58176756",
"0.58053535",
"0.5786554",
"0.56871593",
"0.5668443",
"0.56640667",
"0.56480527",
"0.5598467",
"0.5566043",
"0.55362725",
"0.5525885",
"0.5520897",
"0.55205166",
"0.5508156",
"0.5499436",
"0.54982114",
"0.5498139",
"0.54968333",
"0.5487813",
"0.54840374",
"0.5472068",
"0.5470835",
"0.54556376",
"0.5453306",
"0.5451831",
"0.5442783",
"0.5429245",
"0.54029816",
"0.5392266",
"0.53895223",
"0.538511",
"0.53826225",
"0.53606486",
"0.53475624",
"0.5347167",
"0.5341819",
"0.5341801",
"0.5316248",
"0.53162014",
"0.5312192",
"0.5299108",
"0.5299108",
"0.52939427",
"0.52925044",
"0.5291771",
"0.527416",
"0.52658004",
"0.52658004",
"0.5254911",
"0.52393556",
"0.52393556",
"0.52393556",
"0.52227604",
"0.52208924",
"0.5219499",
"0.520939",
"0.52020067",
"0.52014786",
"0.51872194",
"0.5186805",
"0.51822144",
"0.5178871",
"0.516099",
"0.51536876",
"0.51488614",
"0.51488614",
"0.51488614",
"0.5148749",
"0.5145745",
"0.5142986",
"0.5141743",
"0.51401585",
"0.5135215",
"0.5133946",
"0.5131708",
"0.5129623",
"0.5119527",
"0.51179826",
"0.5117787",
"0.51177096",
"0.5111933",
"0.51115656",
"0.5109714"
] |
0.5510166
|
30
|
Returns the list of current patterns The patterns can be defined at the class levels or/and in special Wrapper modules. The patterns defined at the class levels are always inherited by the instances of this class, when the wrapper defined patterns are applied to this particular object only. This allows one to define generic patterns at the class level and somehow specific at the level of wrappers.
|
def query_api_patterns
@query_api_patterns ||= {}
# The current set of patterns may override whatever is defined at the class level.
self.class.query_api_patterns.merge(@query_api_patterns)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end",
"def patterns\n # BNodes in statements are existential variables.\n @patterns ||= enum_for(:each_pattern).to_a\n end",
"def patterns\n @patterns ||= []\n end",
"def patterns\n @patterns ||=\n [\n {\n :type => :erb,\n :rx => /\\.erb\\Z/,\n :rep => '',\n },\n {\n :type => :none,\n :rx => /\\Z/,\n :rep => '',\n },\n ]\n end",
"def patterns; end",
"def patterns\n\t\t@@patterns ||= []\n\n\t\tif @@patterns.size == 0\n\t\t\tfor i in 0..9\n\t\t\t\tfor j in 0..9\n\t\t\t\t\tfor k in 0..9\n\t\t\t\t\t\tfor l in 0..9\n\t\t\t\t\t\t\t@@patterns << Regexp.new(\"[#{i}]{4}[#{j}]{4}[#{k}]{4}[#{l}]{4}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t@@patterns\n\tend",
"def get_patterns\n patterns = BASE_PATTERNS\n # add the colour keywords. generate these from the colour wheel's constants\n colours = Yay::ColourWheel::all_names.join('|')\n patterns.unshift [:colour, Regexp.new(\"\\\\b(#{colours})\\\\b\", Regexp::IGNORECASE)]\n return patterns\n end",
"def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end",
"def pattern_classifiers\n classifiers.grep(Pattern)\n end",
"def all_patterns\n @mutex.synchronize do\n @patterns.keys.map{ |a_| a_.dup }\n end\n end",
"def patterns_path\n patterns_path = []\n case ecs_compatibility\n when :disabled\n patterns_path << LogStash::Patterns::Core.path # :legacy\n when :v1\n patterns_path << LogStash::Patterns::Core.path('ecs-v1')\n when :v8\n @logger.warn(\"ECS v8 support is a preview of the unreleased ECS v8, and uses the v1 patterns. When Version 8 of the Elastic Common Schema becomes available, this plugin will need to be updated\")\n patterns_path << LogStash::Patterns::Core.path('ecs-v1')\n else\n fail(NotImplementedError, \"ECS #{ecs_compatibility} is not supported by this plugin.\")\n end\n # allow plugin to be instantiated outside the LS environment (in tests)\n if defined? LogStash::Environment.pattern_path\n patterns_path << LogStash::Environment.pattern_path(\"*\")\n end\n patterns_path\n end",
"def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end",
"def to_a\n @patterns\n end",
"def classes_matching_patterns(patterns, ant, platform, build_results)\n out = PathSet.new\n \n patterns.each do |pattern|\n # Yup, gotta use a fresh, new Ant property name each time. Yuck.\n path_property_name = platform.next_ant_property_name('patterns_search_path')\n classes_directory = build_results.classes_directory(self).to_s\n pattern_spec = \"**/%s.class\" % pattern\n \n ant.path(:id => path_property_name) {\n ant.fileset(:dir => classes_directory, :includes => pattern_spec)\n }\n\n property_name = platform.next_ant_property_name('patterns_search_path_property')\n # This turns the path into an Ant property. Double yuck, but necessary.\n ant.property(:name => property_name, :refid => path_property_name)\n out << ant.get_ant_property(property_name)\n end\n \n out\n end",
"def pattern\n @pattern\n end",
"def each(&block)\n @patterns.each(&block)\n end",
"def patterns_for_file( file )\n Hash(config_file(file)[:patterns]).keys + \\\n Hash(defaults[:patterns]).keys\n end",
"def check_patterns\n [@check_patterns].flatten.compact.uniq\n end",
"def select_methods(pattern)\n methods = []\n class_cache.keys.sort.each do |klass|\n class_cache[klass][\"instance_methods\"].map{|h|h[\"name\"]}.grep(pattern) do |name|\n method = load_cache_for(klass)[klass+'#'+name]\n methods << method if method\n end\n class_cache[klass][\"class_methods\"].map{|h|h[\"name\"]}.grep(pattern) do |name|\n method = load_cache_for(klass)[klass+'::'+name]\n methods << method if method\n end\n end\n methods\n end",
"def group_patterns\n\t\t\tpatterns = @glob.split(' ')\n\t\t\tnegatives = []\n\t\t\tpositives = []\n\t\t\tpatterns.each do |x|\n\t\t\t\tif is_negative?(x)\n\t\t\t\t\tnegatives << x\n\t\t\t\telse\n\t\t\t\t\tpositives << x\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn { negatives: negatives, positives: positives }\n\t\tend",
"def test_methods(patterns=[])\n return @test_methods if !@test_methods.nil?\n\n @test_methods = create.public_methods.find_all { |m|\n m.to_s =~ /^test_/\n }\n\n if !(patterns.nil? or patterns.empty?) then\n # filter\n @test_methods.reject!{ |m|\n patterns.find{ |t| m.to_s.include?(t.to_s) }.nil?\n }\n end\n\n @test_methods\n end",
"def serialize\n Marshal.dump(@patterns)\n end",
"def <<(pattern)\n @patterns << pattern\n end",
"def file_patterns\n [@file_patterns].flatten.compact.uniq\n end",
"def pattern\n @pattern ||= Pattern.patterns[pattern_name]\n end",
"def index\n @static_patterns = StaticPattern.all\n end",
"def pattern_template\n \"*\"\n end",
"def patterns_for_type(type_)\n @mutex.synchronize do\n typedata_ = @types[type_]\n typedata_ ? typedata_.dup : []\n end\n end",
"def grep_methods(obj, pattern=nil)\n klass = obj.is_a?(Class) ? obj : obj.class\n ancs = klass.ancestors\n mtds = pattern ? obj.methods.grep(Regexp.new(pattern.to_s)) : obj.methods\n mtds.sort.each do |e|\n ent = ancs.find {|c| c.instance_methods(false).include?(e) } || \"self\"\n puts \"#{e} in #{ent}\"\n end\n end",
"def event_patterns\n return [] if current_table.nil?\n current_table.event_patterns\n end",
"def pattern_template\n pattern\n end",
"def pattern_template\n pattern\n end",
"def initialize( *patterns )\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_procs = DEFAULT_IGNORE_PROCS.dup\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def matchers\n @known_classes.select {|c| c <= ::Dat::Analysis::Matcher }\n end",
"def roboclassify(desc)\n @pat_matches = []\n Pattern.all.each do |pattern|\n @pat_matches += pattern.codes if regex(pattern).match(desc)\n end\n @pat_matches\n end",
"def expanded_paths(patterns, options = {})\n return [] if patterns.empty?\n path_list.glob(patterns, options).flatten.compact.uniq\n end",
"def region_patterns\n @@region_patterns\n end",
"def pattern; end",
"def pattern; end",
"def pattern; end",
"def generate_pattern(pattern)\n plist.dict do\n append_single('begin', pattern.begin)\n append_dictionary('beginCaptures', pattern.begin_captures)\n append_dictionary('captures', pattern.captures)\n append_single('comment', pattern.comment)\n append_single('contentName', pattern.content_name)\n append_single('disabled', 1) if pattern.disabled\n append_single('end', pattern.end)\n append_dictionary('endCaptures', pattern.end_captures)\n append_single('include', pattern.include)\n append_single('match', pattern.match)\n append_single('name', pattern.name)\n append_array('patterns', pattern.patterns)\n end\n end",
"def patterns\n begin\n pattern_attr = params[:patternable_attribute]\n raise raise AppExceptions::InvalidParameter.new('Invalid input. Must specify a patternable_attribute attribute!') if pattern_attr.nil?\n @parent = @service\n @patternable = @service_development_cost\n @patterns_hash = @patternable.get_all_patterns_ordered(pattern_attr)\n @prev_state = params[:prev_state]\n @guided_workflow = params[:guided_workflow]\n\n respond_to do |format|\n format.html { render :template => \"/shared/patterns.html.erb\", :content_type => 'text/plain', :layout => false}\n format.json { render :json => @patterns_hash }\n end\n rescue AppExceptions::InvalidParameter => ex\n respond_to do |format|\n format.html { render :text => ex.message, :content_type => 'text/plain', :layout => false}\n format.json { render :json => ex.message }\n end\n rescue Exception => e\n logger.error(e.message)\n logger.debug(e.backtrace)\n generic_user_msg = \"Something went wrong, please contact the administrator to solve this issue.\"\n respond_to do |format|\n\n format.html { render :text => generic_user_msg, :content_type => 'text/plain', :layout => false}\n format.json { render :json => generic_user_msg.message }\n end\n end\n\n end",
"def apply_patterns(patterns=Pattern.all)\n raise 'Not an array' unless patterns.instance_of?(Array)\n patterns.each do |pattern|\n raise 'Not a pattern' unless pattern.instance_of?(Pattern)\n if self.apply_pattern(pattern)\n # only apply first pattern\n return true\n end\n end\n false\n end",
"def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def patterns\n begin\n pattern_attr = params[:patternable_attribute]\n raise raise AppExceptions::InvalidParameter.new('Invalid input. Must specify a patternable_attribute attribute!') if pattern_attr.nil?\n @parent = @service_demand\n @patternable = @service_demand_breakdown\n @patterns_hash = @patternable.get_all_patterns_ordered(pattern_attr)\n @prev_state = params[:prev_state]\n @guided_workflow = params[:guided_workflow]\n\n respond_to do |format|\n format.html { render :template => \"/shared/patterns.html.erb\", :content_type => 'text/plain', :layout => false}\n format.json { render :json => @patterns_hash }\n end\n rescue AppExceptions::InvalidParameter => ex\n respond_to do |format|\n format.html { render :text => ex.message, :content_type => 'text/plain', :layout => false}\n format.json { render :json => ex.message }\n end\n rescue Exception => e\n logger.error(e.message)\n logger.debug(e.backtrace)\n generic_user_msg = \"Something went wrong, please contact the administrator to solve this issue.\"\n respond_to do |format|\n\n format.html { render :text => generic_user_msg, :content_type => 'text/plain', :layout => false}\n format.json { render :json => generic_user_msg.message }\n end\n end\n\n end",
"def get_patterns(pattern_string)\r\n split_and_strip(pattern_string, \";\").select do |name|\r\n name != \"\"\r\n end.map {|name| Regexp.new(name, true)}\r\n end",
"def anon_pattern \n /#<(Class|Module):([^>]*)>/\n end",
"def glob(*patterns)\n selection = []\n patterns.each do |pattern|\n selection.concat(Dir.glob(File.join(path, pattern))) \n end\n selection\n end",
"def list_heuristics!\n @application.heuristics.patterns.keys.each do |pattern|\n puts %{- \"#{pattern}\"}\n end\n exit\n end",
"def fetch_pattern(type, indentation); end",
"def matching_types(&matcher)\n yield(self) ? [self] : []\n end",
"def subclasses\n @subclasses ||= []\n end",
"def all_linter_classes\n @application.linter_base_class.descendants\n end",
"def children(pat=nil, *rest, &blk)\n return descendants(*rest, &blk) if pat == :*\n res = []\n @contents.each{|c|\n if pat.nil? or pat === c\n if rest == []\n res << c\n yield c if block_given?\n else\n res += c.children(*rest, &blk)\n end\n end\n }\n res\n end",
"def add_matching(pattern)\n self.class.glob(pattern).each do |fn|\n self << fn unless excluded_from_list?(fn)\n end\n end",
"def glob(*patterns)\n require \"pathname\"\n patterns.reduce([]) do |result, pattern|\n if pattern.end_with?(\"/**\")\n pattern += \"/\"\n end\n result += Dir.glob(pattern).map do |path|\n Pathname.new(path.gsub(\"\\\\\", \"/\")).cleanpath.to_s\n end\n end.sort\n end",
"def subclasses\n @subclasses ||= []\n end",
"def ls(pattern='**/*', _opts={})\n root = pattern[%r{^[^\\*\\?\\{\\}\\[\\]]+/}]\n root.chomp!('/') if root\n Enumerator.new do |y|\n glob(root) do |path|\n y << path if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end",
"def get_commands(pattern)\n commands = []\n Dir.chdir(@dev.log_dir) do\n Dir.glob(\"*#{pattern.gsub(\"/\", \"-\")}*.*\").each do |logfile|\n commands << Command.new(JSON.parse(IO.read(logfile)))\n end\n end\n commands\n end",
"def pattern( *args )\n return ::Logging::Layouts::Pattern if args.empty?\n ::Logging::Layouts::Pattern.new(*args)\n end",
"def scan_patterns\n @max_level = 0\n @root.bfs do |r|\n reached = false\n curr_instances = yield(r.parent_id)\n curr_instances.each do |c_instance|\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_next_instances(c_instance.uri, r.node.edge, r.node.value)\n q.execute do |i|\n @action.call(i, r.id, r.level, r.node.edge, c_instance.id)\n reached = true\n end\n end if ! curr_instances.nil?\n @max_level = r.level if r.level > @max_level\n reached\n end if @pass\n @max_level\n end",
"def regexps; end",
"def onlychildren_list\n if matches.length == 1\n [self] + matches[0].onlychildren_list\n else\n [self]\n end\n end",
"def initialize(dir)\n # Create a new patterns hash\n @patterns = Hash.new\n\n # Get the pattern files in the directory\n dir += '/' if(!dir.end_with?('/'))\n files = Dir.glob(dir + \"*.pattern\")\n\n # Create a DesignPattern for each file\n files.each do |f|\n pattern = DesignPattern.new(f)\n @patterns[pattern.name] = pattern\n end\n end",
"def cmd_list pattern = '.'\n puts \"Following mnemo's #{pattern && \"matching regexp /#{pattern}/\"} are present\"\n puts\n references_by_pattern(pattern).each do |reference|\n puts (\" \" * 4) + reference\n end\n\n puts\n puts \"Done ..\"\n end",
"def index\n @public_patterns = Pattern.where(public: true).order(:name)\n @personal_patterns = Pattern.where(public: false, user_id: current_user&.id).order(:name)\n if current_user&.admin?\n @all_patterns = Pattern.all.order(:name)\n end\n end",
"def add_pattern(pattern)\n @patterns << pattern\n end",
"def find(pattern)\n patterns= [pattern].flatten\n contents=[]\n self.each_pair do |path, content|\n patterns.each do |pattern|\n contents << content if Content.path_match? path, pattern\n end\n end\n contents\n end",
"def load_all\n\t\tPluggability.log.debug \"Loading all %p derivatives.\" % [ self ]\n\t\tpatterns = []\n\t\tprefixes = self.plugin_prefixes\n\n\t\tif prefixes && !prefixes.empty?\n\t\t\tPluggability.log.debug \"Using plugin prefixes (%p) to build load patterns.\" % [ prefixes ]\n\t\t\tprefixes.each do |prefix|\n\t\t\t\tpatterns << \"#{prefix}/*.rb\"\n\t\t\tend\n\t\telse\n\t\t\t# Use all but the last pattern, which will just be '*.rb'\n\t\t\tPluggability.log.debug \"Using plugin type (%p) to build load patterns.\" %\n\t\t\t\t[ self.plugin_type ]\n\t\t\tpatterns += self.make_require_path( '*', '' )[0..-2].\n\t\t\t\tmap {|f| f + '.rb' }\n\t\tend\n\n\t\tpatterns.each do |glob|\n\t\t\tPluggability.log.debug \" finding derivatives matching pattern %p\" % [ glob ]\n\t\t\tcandidates = if Gem.respond_to?( :find_latest_files )\n\t\t\t\t\tGem.find_latest_files( glob )\n\t\t\t\telse\n\t\t\t\t\tGem.find_files( glob )\n\t\t\t\tend\n\n\t\t\tPluggability.log.debug \" found %d matching files\" % [ candidates.length ]\n\t\t\tnext if candidates.empty?\n\n\t\t\tcandidates.each do |path|\n\t\t\t\tnext if self.is_excluded_path?( path )\n\t\t\t\tKernel.require( path )\n\t\t\tend\n\t\tend\n\n\t\treturn self.derivative_classes\n\tend",
"def glob(pattern)\n root = self.root\n Pathname.glob(root.join(pattern)).map do |match|\n match.relative_path_from(root).to_s\n end\n end",
"def clean_referenced_patterns\n refs = [:referenced_patterns]\n # refs << :referenced_subroutine_patterns if Origen.tester.v93k?\n refs.each do |ref|\n var = send(ref)\n var = var.uniq.map do |pat|\n pat = pat.sub(/\\..*/, '')\n pat unless pat =~ /_part\\d+$/\n end.uniq.compact\n singleton_class.class_variable_set(\"@@#{ref}\", var)\n end\n end",
"def classes\n self\n end",
"def list_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n\n found.concat matches\n end\n end\n\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n\n found.concat matches\n end\n end\n\n found.uniq\n end",
"def find_all_plugin_specs(*pattern)\n return Array.new if pattern.empty?\n pattern = pattern.first\n if pattern.size == 1 && pattern[:plugin_name]\n spec = @plugin_specs[pattern[:plugin_name]]\n return Array(spec) if spec \n #try to find a cplusplus widget which is not registered \n #and register it \n if widget?(pattern[:plugin_name])\n result = Array(UiLoader.extend_cplusplus_widget_class(pattern[:plugin_name]))\n return result\n end\n end\n @plugin_specs.values.find_all do |spec|\n spec.match?(pattern)\n end\n end",
"def wildmask\n super\n end",
"def my_routes\n my_routes = []\n exceptions = %w(Login Signin)\n self.class.routes['GET'].each do |r|\n route = r.first.to_s.gsub(/\\W+|mix/,'').capitalize\n my_routes << route unless exceptions.include?(route)\n end\n return my_routes\n end",
"def pattern_candidates(pattern,representative)\n candidate_set_for_syntax_trees(representative.head_trees,@category_filters,pattern)\n end",
"def Pattern(*pattern)\n (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label)\n ::PatternMatching::PatternMatch.new(*pattern)\n end",
"def routing_params_with_patterns\n @routing_params_with_patterns ||= begin\n Gapic::UriTemplate.parse_arguments(path).map do |name, pattern|\n [name, pattern.empty? ? \"*\" : pattern]\n end\n end\n end",
"def ls(pattern = '**/*', **_opts)\n Enumerator.new do |acc|\n walk(pattern) {|path| acc << path }\n end\n end",
"def list_methods_matching_orig name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n found.push(*matches)\n end\n end\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n found.push(*matches)\n end\n end\n found.uniq\n end",
"def read patterns\n Dir[*patterns].uniq.map do |f|\n filename = File.join(Dir.pwd, f)\n\n @files ||= []; @files << filename\n STDERR.puts filename\n\n case File.extname(filename)\n when '.erb'\n Dir.chdir File.dirname(filename) do\n ERB.new(File.read(File.basename(filename))).result(binding)\n end\n else\n File.read filename\n end\n end.join(\"\\n\")\nend",
"def list\n interceptors_mutex do\n @registry.map { |h| h[:klass] }\n end\n end",
"def classes\n @classes\n end",
"def descendants\n Base.descendants\n end",
"def ignore(*patterns)\n @ignore_patterns += patterns\n end",
"def all_routes\n matching_routes\n end",
"def add_matching(pattern)\n Dir[pattern].each do |fn|\n\tself << fn unless exclude?(fn)\n end\n end",
"def subclasses\n @subclasses\n end",
"def simplified_pattern\n pattern\n end",
"def simplified_pattern\n pattern\n end",
"def match_classes(fullpath)\n Dir.foreach(fullpath) do |patternfile|\n filepath = \"#{fullpath}/#{patternfile}\"\n next unless File.file?(filepath) and\n File.readable?(filepath)\n next if patternfile =~ /^\\./\n log(\"Attempting to match [#{@hostname}] in [#{filepath}]\")\n if matched_in_patternfile?(filepath,@hostname)\n @classes << patternfile.to_s\n log(\"Appended #{patternfile} to classes instance variable\")\n end\n end\n end",
"def ls(pattern = '**/*', **_opts)\n Enumerator.new do |y|\n walk(pattern) do |path, _|\n y << path if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end",
"def get_all(regexp)\n Jamie::Config::Collection.new(\n __getobj__.find_all { |i| i.name =~ regexp }\n )\n end",
"def classes()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"def all_objects\n Registry.all(:root, :module, :class)\n end",
"def matched_configs(object, node)\n return [] unless node\n mod = object.is_a?(Module) ? object : object.class\n path = underscore(mod.name)\n\n [node[mod.name],\n node[path],\n node.get(path),\n ].uniq.compact\n end",
"def declare_chefignore_patterns\n @flavor.class.do_declare_resources do\n chefignore_patterns << 'Guardfile' if snippet?('standard_ignore')\n end\n end",
"def pattern(neck = \"\", digits = nil)\n if digits\n if parent\n parent.pattern(@atlas + neck, digits)\n else\n Pattern.new(neck, digits).to_s\n end\n else\n digits = if gethead then gethead else [0] * (depth + 1) end\n pattern('', digits)\n end\n end"
] |
[
"0.6875152",
"0.6835282",
"0.6818043",
"0.6648354",
"0.6587895",
"0.6543487",
"0.6517851",
"0.61777425",
"0.6122028",
"0.59411126",
"0.5925849",
"0.5900743",
"0.5774054",
"0.5741235",
"0.56699604",
"0.55791473",
"0.55403584",
"0.55159557",
"0.54527724",
"0.5416432",
"0.53259164",
"0.5295547",
"0.5287931",
"0.52745146",
"0.5265775",
"0.5234815",
"0.5231445",
"0.5221382",
"0.52195287",
"0.5213979",
"0.5205553",
"0.5205553",
"0.5188556",
"0.5181723",
"0.5172207",
"0.51475406",
"0.51197225",
"0.510922",
"0.5107738",
"0.5107738",
"0.5107738",
"0.5105044",
"0.50923973",
"0.50831664",
"0.5071924",
"0.50369084",
"0.49971598",
"0.49871308",
"0.49811697",
"0.49753308",
"0.49742407",
"0.49729833",
"0.49638146",
"0.4960566",
"0.49584118",
"0.49554375",
"0.49543697",
"0.493968",
"0.4938515",
"0.49383688",
"0.49304444",
"0.49257913",
"0.49217564",
"0.4900714",
"0.48997363",
"0.48969588",
"0.48741624",
"0.48559004",
"0.48528296",
"0.48519844",
"0.48362422",
"0.4820652",
"0.47874984",
"0.47826242",
"0.47752145",
"0.47667617",
"0.47663975",
"0.47646883",
"0.47627866",
"0.4762445",
"0.47389144",
"0.47264403",
"0.4723974",
"0.472289",
"0.47122788",
"0.47101408",
"0.47092545",
"0.4699832",
"0.46948573",
"0.4689723",
"0.46835306",
"0.46835306",
"0.46788165",
"0.46783352",
"0.4677263",
"0.4674504",
"0.46729082",
"0.46629333",
"0.46622744",
"0.46556503"
] |
0.56173575
|
15
|
Set object specific QUERYlike pattern This guy is usually called from Wrapper's module from self.extended method (see S3 default wrapper)
|
def query_api_pattern(method_name, verb, path='', opts={}, &block)
self.class.query_api_pattern(method_name, verb, path, opts, @query_api_patterns, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def initialize\n @query_fields = nil \n @query_params = {}\n \n @sql_like = 'LIKE'\n \n if ActiveRecord::Base.connected? and ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'\n @sql_like = 'ILIKE'\n end\n end",
"def setQuery(query) \n\t\tself.queryString = query\n end",
"def query\n super\n end",
"def set_query_attributes!\n attr_names = self.class.search_query_attributes.map(&:to_s)\n self.query = attr_names.inject({}) { |memo, attr|\n memo[attr] = self.send(attr)\n memo\n }\n end",
"def query_options; end",
"def method_missing(name, *args, &block)\n super unless respond_to_missing?(name)\n _update_query(name, *args, &block)\n end",
"def set_like\n\n end",
"def object_query_generator(data)\n # query header\n query = \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX : <http://www.semanticweb.org/simon/ontologies/2016/1/medienprojekt#>\n \n SELECT *\n {\"\n \n # combine the parameters with the query\n data.each {\n |hash| if hash.has_key?(:predicate)\n # its possible to have predicate and object parameters \n query = query << \"?name \" << hash[:predicate] << \" :\" << hash[:object] << \" .\\n\"\n else\n # or just an object parameter\n query = query << \"?name ?predicate :\" << hash[:object] << \" .\\n\"\n end\n }\n\n # query footer\n query = query << \" }\\nLIMIT 400\"\n # return the resulting query\n return query\n end",
"def initialize\n super(\"query\")\n end",
"def controller_query(sObjectType, hQuery, params = nil)\n _add_instant_config(params)\n\n # Check if we can re-use a previous query\n list = @object_data[:query, sObjectType]\n unless list.nil?\n if list[:query] == hQuery\n Lorj.debug(3, \"Using Object '%s' query cache : %s\",\n sObjectType, hQuery)\n return list\n end\n end\n\n controller_params = _get_controller_params(sObjectType,\n :query_e, :query)\n controller_query = _query_map(sObjectType, hQuery)\n\n controller_obj = @controller.query(sObjectType, controller_query,\n controller_params)\n\n data_obj = Lorj::Data.new :list\n data_obj.base = self\n data_obj.set(controller_obj,\n sObjectType, hQuery) do |sObjType, key|\n begin\n _return_map(sObjType, key)\n rescue => e\n PrcLib.runtime_fail 'query %s.%s : %s',\n @process.class, sObjectType, e.message\n end\n end\n\n Lorj.debug(2, 'Object %s - queried. Found %s object(s).',\n sObjectType, data_obj.length)\n\n @object_data.add data_obj\n\n _remove_instant_config(params)\n\n data_obj\n end",
"def method_missing(method_name, *args, &block)\n begin\n invoke_query_api_pattern_method(method_name, *args, &block)\n rescue PatternNotFoundError\n super\n end\n end",
"def to_query(_model)\n raise 'subclasses should implement this method.'\n end",
"def n_plus_one_query_enable=(_arg0); end",
"def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end",
"def initial_query=(_arg0); end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def set_c_like\n\n end",
"def initialize(options={})\n self.query = Query.new\n self.query.table = options.delete(:table)\n self.query.limit = options.delete(:limit)\n self.query.offset = options.delete(:offset)\n self.query.select = options.delete(:select)\n self.query.conditions = options.delete(:conditions) || []\n self.query.uses = options.delete(:uses) || []\n self.query.tail = options.delete(:tail)\n self.query.truncate = options.delete(:truncate)\n self.query.reverse = options.delete(:reverse)\n self.query.unique = options.delete(:unique)\n self.query.sanitize = options.delete(:sanitize)\n self.query.remote_limit = options.delete(:remote_limit)\n self.query.remote_offset = options.delete(:remote_offset)\n end",
"def set_query(settings)\n return false if settings.blank?\n\n h = {}\n settings.each do |para|\n parameter = para['param']\n defn = simulator.parameter_definition_for(parameter)\n type = defn.type\n value = para['value']\n matcher = para['matcher']\n\n # cast value to the specified type\n casted_value = ParametersUtil.cast_value(value, type)\n if casted_value.nil?\n self.errors.add(:set_query, \"value (#{value}) is not valid as a #{type}\")\n return false\n end\n\n h[parameter] = { matcher => casted_value }\n end\n\n #h includes one or more hash(s) that can be converted to selector(s)\n self.query = h\n end",
"def search_field(object_name, method, options = T.unsafe(nil)); end",
"def query\n @operation = :query\n self\n end",
"def query; end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def initial_query; end",
"def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end",
"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",
"def liszt_query(obj={})\n if @liszt_query.nil?\n query = ['1 = 1']\n\n @liszt_conditions.each do |key, value|\n query.first << \" AND (#{table_name}.#{key} \"\n if value.nil?\n query.first << \"IS NULL)\"\n else\n query.first << \"= ?)\"\n query << value\n end\n end\n\n @liszt_scope.each do |scope|\n query.first << \" AND (#{table_name}.#{scope} = ?)\"\n end\n\n @liszt_query = query\n end\n\n @liszt_query + @liszt_scope.map { |scope| obj[scope] }\n end",
"def initialize(query)\n @query = query \n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def custom_param(query_str)\n @query[:custom_param] = query_str\n self\n end",
"def buildObjClause(object, tableName)\n case object\n # when REGEXTerm\n # when Array\n when Graph\n [\"#{tableName}.object=?\", self.normalizeTerm(object.identifier)]\n else\n [\"#{tableName}.object=?\", object] if object\n end\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def __setobj__\n excl_list = self.class.send(:excl_list)\n @hashobj.each do |key, value|\n snake = key.to_s.gsub(/\\W/, '_').underscore\n\n unless excl_list.include?(snake) # Must deal with nested models\n if value.kind_of?(Array)\n newval = value.map { |elem| elem.kind_of?(Hash) ? nested_object(snake.camelize.singularize, elem) : elem }\n @hashobj[key] = newval\n elsif value.kind_of?(Hash)\n @hashobj[key] = nested_object(snake.camelize, value)\n end\n end\n\n add_accessor_methods(snake, key)\n end\n end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def evolve(object)\n case object\n when QDM::Code then object.mongoize\n else object\n end\n end",
"def scaffold_get_objects(options)\n optionshash = {}\n data = self.all\n if options[:conditions]\n conditions = options[:conditions]\n if conditions && Array === conditions && conditions.length > 0\n if String === conditions[0]\n data = data.all(:conditions => conditions)\n else\n conditions.each do |cond|\n next if cond.nil?\n data = case cond\n when Hash, String then data.all(:conditions => [cond.gsub(\"NULL\",\"?\"),nil])\n when Array then \n if cond.length==1\n data.all(:conditions => [cond[0].gsub(\"NULL\",\"?\"),nil])\n else\n data.all(:conditions => cond)\n end\n when Proc then data.all(&cond)\n end\n end\n end\n end\n end\n slice = nil\n if options[:limit]\n startpos = options[:offset] || 0\n endpos = options[:limit]\n slice = [startpos,endpos]\n end\n # TODO includes break SQL generation\n # optionshash[:links] = options[:include] if options[:include]\n # optionshash[:links] = [optionshash[:links]] unless optionshash[:links].is_a?(Array)\n if options[:order] then\n optionshash[:order] = get_ordering_options(options[:order])\n end\n if slice then\n q = data.all(optionshash).slice(*slice)\n else\n q = data.all(optionshash)\n end\n #p repository.adapter.send(\"select_statement\",q.query)\n q.to_a\n end",
"def mongoize(object)\n case object\n when nil then nil\n when QDM::Code then object.mongoize\n when Hash\n object = object.symbolize_keys\n QDM::Code.new(object[:code], object[:system], object[:display], object[:version]).mongoize\n else object\n end\n end",
"def initialize(query:, schema: query.schema, values:, object:)\n @query = query\n @schema = schema\n @provided_values = values || {}\n @object = object\n # Namespaced storage, where user-provided values are in `nil` namespace:\n @storage = Hash.new { |h, k| h[k] = {} }\n @storage[nil] = @provided_values\n @errors = []\n @path = []\n @value = nil\n @context = self # for SharedMethods TODO delete sharedmethods\n @scoped_context = ScopedContext.new(self)\n end",
"def initialize(obj)\n super\n @search_in_database = obj.is_a?(ActiveRecord::Relation) && !obj.loaded?\n end",
"def initialize(*query)\n @query = parse_query_list(query)\n end",
"def get_objects(data,*moredata)\n parms = legacy_getparms(data,moredata)\n # def get_objects(objecttype, get, exactget, regexget, exclude, andget, includes=nil, login=nil, password_callback=PasswordCallback)\n objecttype = parms[:objecttype]\n get = parms[:get]\n exactget = parms[:exactget]\n regexget = parms[:regexget]\n exclude = parms[:exclude]\n andget = parms[:andget]\n includes = parms[:includes]\n login = parms[:login]\n password_callback = parms[:password_callback]\n # PS-704 - node_groups controller when format.xml, includes some custom model methods that create a lot of querying joins, so this is\n # a way to 'override' it on cli side - the server will look for that param to skip these def methods when it renders. webparams = {:nodefmeth => 1}\n webparams = parms[:webparams]\n #\n # Package up the search parameters in the format the server expects\n #\n metaget = []\n if get\n get.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exactget\n exactget.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"exact_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exact_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if regexget\n regexget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"regex_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"regex_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exclude\n exclude.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"exclude_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exclude_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if andget\n andget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"and_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"and_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if includes\n # includes = ['status', 'rack:datacenter']\n # maps to\n # include[status]=&include[rack]=datacenter\n includes.each do |inc|\n incstring = ''\n if inc.include?(':')\n incparts = inc.split(':')\n lastpart = incparts.pop\n incstring = 'include'\n incparts.each { |part| incstring << \"[#{part}]\" }\n incstring << \"=#{lastpart}\"\n else\n incstring = \"include[#{inc}]=\"\n end\n metaget << incstring\n end\n end\n if webparams && webparams.kind_of?(Hash)\n webparams.each_pair{|k,v| metaget << \"#{k}=#{v}\"}\n end\n\n querystring = metaget.join('&')\n\n #\n # Send the query to the server\n #\n\n if parms[:format] == 'json'\n if HAS_JSON_GEM\n uri = URI::join(@server, \"#{objecttype}.json?#{querystring}\")\n else\n warn \"Warning: Cannot use json format because json gem is not installed. Using xml format instead.\"\n parms[:format] = 'xml'\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n else\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n\n req = Net::HTTP::Get.new(uri.request_uri)\n warn \"GET URL: #{uri}\" if (@debug)\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Get.new(uri.request_uri)\n response = send_request(req, uri, login, password_callback)\n end\n if !response.kind_of?(Net::HTTPOK)\n puts response.body\n response.error!\n end\n\n if parms[:format] == 'json'\n results = JSON.parse(response.body)\n else\n #\n # Parse the XML data from the server\n # This tries to render the XML into the best possible representation\n # as a Perl hash. It may need to evolve over time.\n puts response.body if (@debug)\n results_xml = REXML::Document.new(response.body)\n results = {}\n if results_xml.root.elements[\"/#{objecttype}\"]\n results_xml.root.elements[\"/#{objecttype}\"].each do |elem|\n # For some reason Elements[] is returning things other than elements,\n # like text nodes\n next if elem.node_type != :element\n data = xml_to_ruby(elem)\n name = data['name'] || data['id']\n if !results[name].nil?\n warn \"Duplicate entries for #{name}. Only one will be shown.\"\n end\n results[name] = data\n end\n end\n end\n\n #puts results.inspect if (@debug)\n puts YAML.dump(results) if (@debug)\n results\n end",
"def Query(sCloudObj, hQuery)\n\n return nil if not sCloudObj\n\n raise ForjError.new(), \"$s.Get: '%s' is not a known object type.\" % [self.class, sCloudObj] if rhExist?(@@meta_obj, sCloudObj) != 1\n\n # Check if we can re-use a previous query\n oList = @ObjectData[:query, sCloudObj]\n unless oList.nil?\n if oList[:query] == hQuery\n ForjLib.debug(3, \"Using Object '%s' query cache : %s\" % [sCloudObj, hQuery])\n return oList\n end\n end\n\n pProc = rhGet(@@meta_obj, sCloudObj, :lambdas, :query_e)\n\n return nil if pProc.nil?\n\n # Check required parameters\n oObjMissing = _check_required(sCloudObj, :query_e, pProc).reverse\n\n while oObjMissing.length >0\n sElem = oObjMissing.pop\n raise ForjError.new(),\"Unable to create Object '%s'\" % sElem if not Create(sElem)\n oObjMissing = _check_required(sCloudObj, :query_e, pProc).reverse\n raise ForjError.new(), \"loop detection: '%s' is required but Query(%s) did not loaded it.\" % [sElem, sElem] if oObjMissing.include?(sElem)\n end\n @RuntimeContext[:oCurrentObj] = sCloudObj # Context: Default object used.\n\n # build Function params to pass to the Process Event handler.\n aParams = _get_object_params(sCloudObj, :query_e, pProc)\n\n # Call the process function.\n # At some point, the process will call the controller, via the framework.\n # This controller call via the framework has the role to\n # create an ObjectData well formatted, with _return_map function\n # See Definition.connect/create/update/query/get functions (lowercase)\n oObject = @oForjProcess.method(pProc).call(sCloudObj, hQuery, aParams)\n # return usually is the main object that the process called should provide.\n unless oObject.nil?\n # Save Object if the object has been created by the process, without controller\n @ObjectData.add(oObject)\n end\n end",
"def jqstar_rateable(options = {})\n send :include, InstanceMethods\n send :extend, SingletonMethods\n has_many :rates_without_dimension, :as => :rateable, :class_name => 'Rate',\n :dependent => :destroy, :conditions => {:dimension => nil}\n\n\n options[:dimensions].each do |dimension|\n has_many \"#{dimension}_rates\", :dependent => :destroy,\n :conditions => {:dimension => dimension.to_s}, :class_name => 'Rate', :as => :rateable\n end if options[:dimensions].is_a?(Array)\n\n @options = options.reverse_merge(\n :stars => 5,\n :allow_update => true,\n :cache_column => :rating_average\n )\n #include JqStarRating::InstanceMethods\n #extend JqStarRating::SingletonMethods\n end",
"def query(value = nil, &block)\n __define__(:query, value, block)\n end",
"def process_query(query)\n # Nothing in default\n end",
"def query(pattern, &block)\n raise TypeError.new(\"#{self} is not readable\") if respond_to?(:readable) && !readable?\n\n case pattern\n when Query\n pattern.execute(self, &block)\n when Array\n query(Statement.new(*pattern), &block)\n when Statement\n if block_given?\n find_all { |statement| pattern === statement }.each(&block)\n else\n find_all { |statement| pattern === statement }.extend(RDF::Enumerable, RDF::Queryable)\n end\n else\n raise ArgumentError.new(\"expected RDF::Query or RDF::Pattern, got #{pattern.inspect}\")\n end\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def method_missing(m, *args, &block)\n method_name = m.to_s.gsub(/=$/, '')\n if self.class.schema.keys.include?(method_name)\n m.to_s.match(/=$/) ? @hash[method_name] = args[0] : @hash[method_name]\n else\n super\n end\n end",
"def relation_objects_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods.\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"first\", \"last\", \"take\"\n amount = params[:amount].to_i if params[:amount].present?\n @results = relation.send(params[:method], *amount)\n when \"to_a\", \"all\", \"load\", \"reload\", \"first!\", \"last!\", \"take!\"\n @results = relation.send(params[:method])\n when \"select\"\n @results = relation.send(params[:method]) { true } # Select with a block acts as a finder method. The block simply returns true to not futher limit the results.\n when \"find\"\n case params[:option]\n when \"sub_method\"\n if FIND_SUB_METHODS.include?(params[:sub_method])\n @results = relation.send(params[:method], params[:sub_method].to_sym)\n else\n flash[:alert] = \"Unknown sub method selected\" unless running?\n end\n when \"single_id\"\n @results = relation.send(params[:method], params[:id])\n when \"id_list\"\n @results = relation.send(params[:method], *params[:id])\n when \"id_array\"\n @results = relation.send(params[:method], params[:id])\n end\n when \"find_by\", \"find_by!\"\n conditions = build_conditions('joined', 'list', params[:conditions]).first || [nil]\n @results = relation.send(params[:method], *conditions)\n when \"find_or_initialize_by\", \"find_or_create_by\", \"find_or_create_by!\"\n conditions = build_conditions('joined', 'hash', params[:conditions]).flatten.first || {}\n attributes = params[:attributes].reject { |k,v| v.blank? }\n if attributes.present?\n @results = relation.send(params[:method], conditions) { |object| object.attributes = attributes }\n else\n @results = relation.send(params[:method], conditions)\n end\n when \"dynamic_find_by\", \"dynamic_find_by!\"\n # Check if the attribute name is allowed to prevent errors.\n return redirect_to read_test_relation_objects_form_path(params[:method], params[:option]), :alert => \"Selected attribute is not a valid attribute of AllTypesObject!\" unless AllTypesObject.column_names.include?(params[:attribute])\n method = \"find_by_#{params[:attribute]}\" + (params[:method] == \"dynamic_find_by!\" ? \"!\" : \"\")\n @results = relation.send(method, params[:value])\n when \"find_each\", \"find_in_batches\"\n @results = []\n options = {}\n options[:start] = params[:start].to_i if params[:start].present?\n options[:batch_size] = params[:batch_size].to_i if params[:batch_size].present?\n relation.send(params[:method], options) { |results| @results << results }\n when \"first_or_initialize\", \"first_or_create\", \"first_or_create!\"\n @results = relation.send(params[:method], params[:attributes].presence)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n # Wrap the result(s) in array and flatten (since the template expects an array of results)\n @all_types_objects = (@results.present? ? [@results].flatten : nil)\n\n @includes = (relation.eager_load_values + relation.includes_values + relation.preload_values).uniq\n\n respond_with(@all_types_objects)\n end",
"def initialize(logger = nil)\n # per-query settings\n @offset = 0 # how many records to seek from result-set start (default is 0)\n @limit = 20 # how many records to return from result-set starting at offset (default is 20)\n @mode = SPH_MATCH_ALL # query matching mode (default is SPH_MATCH_ALL)\n @weights = [] # per-field weights (default is 1 for all fields)\n @sort = SPH_SORT_RELEVANCE # match sorting mode (default is SPH_SORT_RELEVANCE)\n @sortby = '' # attribute to sort by (defualt is \"\")\n @min_id = 0 # min ID to match (default is 0, which means no limit)\n @max_id = 0 # max ID to match (default is 0, which means no limit)\n @filters = [] # search filters\n @groupby = '' # group-by attribute name\n @groupfunc = SPH_GROUPBY_DAY # function to pre-process group-by attribute value with\n @groupsort = '@group desc' # group-by sorting clause (to sort groups in result set with)\n @groupdistinct = '' # group-by count-distinct attribute\n @maxmatches = 1000 # max matches to retrieve\n @cutoff = 0 # cutoff to stop searching at (default is 0)\n @retrycount = 0 # distributed retries count\n @retrydelay = 0 # distributed retries delay\n @anchor = [] # geographical anchor point\n @indexweights = [] # per-index weights\n @ranker = SPH_RANK_PROXIMITY_BM25 # ranking mode (default is SPH_RANK_PROXIMITY_BM25)\n @maxquerytime = 0 # max query time, milliseconds (default is 0, do not limit)\n @fieldweights = {} # per-field-name weights\n @overrides = [] # per-query attribute values overrides\n @select = '*' # select-list (attributes or expressions, with optional aliases)\n\n # per-reply fields (for single-query case)\n @error = '' # last error message\n @warning = '' # last warning message\n @connerror = false # connection error vs remote error flag\n\n @reqs = [] # requests storage (for multi-query case)\n @mbenc = '' # stored mbstring encoding\n @timeout = 0 # connect timeout\n @retries = 1 # number of connect retries in case of emergency\n @reqtimeout = 0 # request timeout\n @reqretries = 1 # number of request retries in case of emergency\n\n # per-client-object settings\n # searchd servers list\n @servers = [Sphinx::Server.new(self, 'localhost', 9312, false)].freeze\n @logger = logger\n\n logger.info { \"[sphinx] version: #{VERSION}, #{@servers.inspect}\" } if logger\n end",
"def ** other\n #This is a stub, used for indexing\n end",
"def query(query_definition)\n return\n end",
"def query_api_patterns\n @query_api_patterns ||= {}\n # The current set of patterns may override whatever is defined at the class level.\n self.class.query_api_patterns.merge(@query_api_patterns)\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def mongoize(object)\n case object\n when Expert then object.mongoize\n when Hash then Expert.new(object[:name], object[:quote], object[:image_url]).mongoize\n else object\n end\n end",
"def query\n\t\tQuery.new(\"true\")\n\tend",
"def * other\n #This is a stub, used for indexing\n end",
"def query_with_modifier(query, strategy, with_timing = false)\n key = query.respond_to?(:key) ? query.key : 'custom'\n\n instrument(\"gql.query.#{key}.#{strategy}\") do\n if strategy.nil?\n if with_timing\n query_standard_with_timing(query)\n else\n query_standard(query)\n end\n elsif Gquery::GQL_MODIFIERS.include?(strategy.strip)\n if with_timing\n with_timing { send(\"query_#{strategy}\", query) }\n else\n send(\"query_#{strategy}\", query)\n end\n end\n end\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def query ; @query ||= Waves::Request::Query.new( request.query ) ; end",
"def evolve(object)\n case object\n when self then object.mongoize\n when Symbol then mongoize(object)\n else object\n end\n end",
"def initialize\n # per-client-object settings\n @host = 'localhost' # searchd host (default is \"localhost\")\n @port = 9312 # searchd port (default is 9312)\n \n # per-query settings\n @offset = 0 # how many records to seek from result-set start (default is 0)\n @limit = 20 # how many records to return from result-set starting at offset (default is 20)\n @mode = SPH_MATCH_ALL # query matching mode (default is SPH_MATCH_ALL)\n @weights = [] # per-field weights (default is 1 for all fields)\n @sort = SPH_SORT_RELEVANCE # match sorting mode (default is SPH_SORT_RELEVANCE)\n @sortby = '' # attribute to sort by (defualt is \"\")\n @min_id = 0 # min ID to match (default is 0, which means no limit)\n @max_id = 0 # max ID to match (default is 0, which means no limit)\n @filters = [] # search filters\n @groupby = '' # group-by attribute name\n @groupfunc = SPH_GROUPBY_DAY # function to pre-process group-by attribute value with\n @groupsort = '@group desc' # group-by sorting clause (to sort groups in result set with)\n @groupdistinct = '' # group-by count-distinct attribute\n @maxmatches = 1000 # max matches to retrieve\n @cutoff = 0 # cutoff to stop searching at (default is 0)\n @retrycount = 0 # distributed retries count\n @retrydelay = 0 # distributed retries delay\n @anchor = [] # geographical anchor point\n @indexweights = [] # per-index weights\n @ranker = SPH_RANK_PROXIMITY_BM25 # ranking mode (default is SPH_RANK_PROXIMITY_BM25)\n @rankexpr\t = '' # ranker expression for SPH_RANK_EXPR\n @maxquerytime = 0 # max query time, milliseconds (default is 0, do not limit) \n @fieldweights = {} # per-field-name weights\n @overrides = [] # per-query attribute values overrides\n @select = '*' # select-list (attributes or expressions, with optional aliases)\n \n # per-reply fields (for single-query case)\n @error = '' # last error message\n @warning = '' # last warning message\n \n @reqs = [] # requests storage (for multi-query case)\n @mbenc = '' # stored mbstring encoding\n end",
"def ratings_query\n super\n end",
"def initialize(query={})\n @query = query\n end",
"def *(obj)\n raise 'Not Implemented'\n end",
"def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end",
"def query(hash = nil)\n hash ? @query = hash : @query\n end",
"def or(query_hash)\n self | self.class.new(query_hash)\n end",
"def initialize(q = nil)\n q ||= {}\n @q = Q.new(q, columns, self.relation.table_name)\n end",
"def sql_wildcard\n \"%#{self}%\"\n end",
"def query(options)\n Direction.define_methods(self, options) do |query, accessor|\n %{\n def #{query}(*args, &block)\n #{accessor}.__send__(:#{query}, *args, &block)\n end\n }\n end\n end",
"def query_methods(result_type); end",
"def initialize(query)\n raise ArgumentError, 'Query should be string' unless query.is_a? String\n @raw_query = query\n end",
"def mongoize(object)\n case object\n when self then object.mongoize\n when Symbol then new(object).mongoize\n else object\n end\n end",
"def query\n end",
"def matches_conditions?(object, query); end",
"def query\n self\n end",
"def query\n self\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def single_object_db=(v); end",
"def extend_object(obj) end",
"def single_object_db; end",
"def matches?(object, query = T.unsafe(nil)); end",
"def set _obj, _args\n \"_obj set _args;\" \n end",
"def update(obj, options = nil)\n if options and attrs = options[:only]\n if attrs.is_a?(Array)\n set = []\n for a in attrs\n set << \"#{a}=#{quote(obj.send(a))}\"\n end\n set = set.join(',')\n else\n set = \"#{attrs}=#{quote(obj.send(attrs))}\"\n end\n sql = \"UPDATE #{obj.class.table} SET #{set} WHERE #{pk_field obj.class}=#{quote(obj.pk)}\"\n sql << \" AND #{options[:condition]}\" if options[:condition]\n sql_update(sql)\n else\n obj.og_update(self, options)\n end\n end",
"def method_missing(meth, *args, &block)\n meth = meth.to_s\n if meth.ends_with?('=') && @keys.include?(meth[0, meth.size - 1].to_sym)\n self[meth[0, meth.size - 1].to_sym] = args.first\n elsif meth.ends_with?('?') && @keys.include?(meth[0, meth.size - 1].to_sym)\n self[meth[0, meth.size - 1].to_sym]\n else\n get_model_attr.send(meth.to_sym, *args, &block)\n end\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query_def; query.name; end"
] |
[
"0.59348685",
"0.56808645",
"0.5632828",
"0.56049305",
"0.54671735",
"0.54070777",
"0.5399473",
"0.5396979",
"0.53913575",
"0.537633",
"0.53683335",
"0.53572387",
"0.5321244",
"0.5310514",
"0.52856326",
"0.5284533",
"0.52660924",
"0.5246995",
"0.5235153",
"0.5195139",
"0.5186597",
"0.51818514",
"0.5173793",
"0.5163439",
"0.51581687",
"0.51581687",
"0.51581687",
"0.51393354",
"0.512493",
"0.51230896",
"0.512088",
"0.5117816",
"0.5110584",
"0.50571924",
"0.5051531",
"0.5033079",
"0.50213",
"0.5017374",
"0.5002994",
"0.49794847",
"0.49721152",
"0.49688676",
"0.49635908",
"0.49571726",
"0.4939642",
"0.49308965",
"0.49255008",
"0.49232468",
"0.49178317",
"0.49139914",
"0.49100226",
"0.49009398",
"0.49004596",
"0.49004596",
"0.49004596",
"0.49004596",
"0.49004596",
"0.49004596",
"0.490017",
"0.48976618",
"0.48934528",
"0.48927414",
"0.48907068",
"0.48670322",
"0.4862268",
"0.48588198",
"0.4857149",
"0.48540622",
"0.48539397",
"0.48521897",
"0.48521897",
"0.48521897",
"0.48511952",
"0.48464856",
"0.48432845",
"0.4843238",
"0.48389605",
"0.48356694",
"0.48317686",
"0.4829536",
"0.48292655",
"0.48277068",
"0.48194063",
"0.4818871",
"0.48143038",
"0.48135635",
"0.4813353",
"0.48014432",
"0.4801401",
"0.4799909",
"0.4799909",
"0.47978318",
"0.47816694",
"0.4775759",
"0.4769784",
"0.4769468",
"0.4768243",
"0.47633275",
"0.47613087",
"0.47590384",
"0.47575963"
] |
0.0
|
-1
|
Build request based on the given set of variables and QUERYlike api pattern
|
def compute_query_api_pattern_based_params(query_pattern_name, query_params={})
# fix a method name
pattern = query_api_patterns[query_pattern_name.to_s]
# Complain if we dont know the method
raise PatternNotFoundError::new("#{query_pattern_name.inspect} pattern not found") unless pattern
# Make sure we got what we expected
query_params ||= {}
raise Error::new("Params must be Hash but #{query_params.class.name} received.") unless query_params.is_a?(Hash)
# Make a new Hash instance from the incoming Hash.
# Do not clone because we don't want to have HashWithIndifferentAccess instance or
# something similar because we need to have Symbols and Strings separated.
query_params = Hash[query_params]
opts = {}
opts[:body] = query_params.delete(:body)
opts[:headers] = query_params.delete(:headers) || {}
opts[:options] = query_params.delete(:options) || {}
opts[:params] = query_params._stringify_keys
opts[:manager] = self
request_opts = compute_query_api_pattern_request_data(query_pattern_name, pattern, opts)
# Try to use custom :process_rest_api_request method first because some auth things
# may be required.
# (see OpenStack case) otherwise use standard :process_api_request method
{ :method => respond_to?(:process_rest_api_request) ? :process_rest_api_request : :process_api_request,
:verb => request_opts.delete(:verb),
:path => request_opts.delete(:path),
:opts => request_opts }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_request(*args); end",
"def build_request(**args)\n params = {}\n\n self.class.parameter_validations.each do |validation|\n validation.call(args, params)\n end\n\n if self.class.parameter_formatter\n params = self.class.parameter_formatter.call(params)\n else\n params.except!(*self.class.parameters_to_filter)\n end\n\n request = Apidiesel::Request.new(action: self, action_arguments: args, parameters: params)\n request.url = build_url(args, request)\n\n request\n end",
"def queries\n urls, url_base, url_vals = params.values_at('urls', 'url_base', 'url_vals')\n\n if urls && urls.is_a?(Hash)\n # the outcome of a json-encoded POST body\n raw_queries = urls\n\n elsif url_base && url_vals\n # assemble queries by slapping each url_val on the end of url_base\n raise BadRequestError, \"url_base must be a string\" unless url_base.is_a?(String)\n raise BadRequestError, \"url_vals must be an array or comma-delimited string\" unless url_vals.is_a?(String) || url_vals.is_a?(Array)\n url_vals = url_vals.split(',') if url_vals.is_a?(String)\n #\n raw_queries = {}\n url_vals.each_with_index do |val, idx|\n raw_queries[idx] = \"#{url_base}#{val}\"\n end\n else\n raise BadRequestError, \"Need either url_base and url_vals, or a JSON post body giving a hash of req_id:url pairs.\"\n end\n\n # make all the queries safe\n normalized_queries = {}\n raw_queries.each do |req_id, raw_q|\n raise BadRequestError, \"Request IDs must be numbers or simple identifiers\" unless (req_id.to_s =~ IDENTIFIER_OR_NUM_RE)\n norm_q = normalize_query(raw_q) or next\n normalized_queries[req_id.to_s] = norm_q\n end\n normalized_queries\n end",
"def build_request(method); end",
"def compute_query_api_pattern_param(query_api_method_name, source, params_with_defaults, used_query_params) # :nodoc:\n case\n when source.is_a?(Hash) then compute_query_api_pattern_hash_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(Array) then compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(Symbol) then compute_query_api_pattern_symbol_data(query_api_method_name, source, params_with_defaults, used_query_params)\n when source.is_a?(String) then compute_query_api_pattern_string_data(query_api_method_name, source, params_with_defaults, used_query_params)\n else source\n end\n end",
"def construct_request_body(input)\n names = selected_fields.empty? || selected_fields.any? { |f| f.to_s.include?('name') || f.to_s.include?('.*$') }\n { input: input,\n equate_il: options[:equate] == true,\n extra: options[:all] == true,\n names: options[:all] == true && names }\n end",
"def compile_query\r\n str = []\r\n\r\n str << \"controller|#{q[:controller]}|\" if q[:controller].present?\r\n str << \"action|#{q[:action]}|\" if q[:action].present?\r\n str << \"format|#{q[:format]}|\" if q[:format].present?\r\n str << \"status|#{q[:status]}|\" if q[:status].present?\r\n\r\n str << \"datetime|#{q[:on].strftime('%Y%m%d')}*|\" if q[:on].present?\r\n\r\n str << \"method|#{q[:method]}|\" if q[:method].present?\r\n str << \"path|#{q[:path]}|\" if q[:path].present?\r\n\r\n str.join(\"*\")\r\n end",
"def construct_filter_query(queries)\n query_string = '?'\n query_list = Array[]\n\n # Format the include_* queries similarly to other queries for easier\n # processing\n if queries.key?('include_deleted')\n queries['include_deleted'] = if queries['include_deleted']\n ['true']\n else\n ['false']\n end\n end\n\n if queries.key?('include_revisions')\n queries['include_revisions'] = if queries['include_revisions']\n ['true']\n else\n ['false']\n end\n end\n\n # If uuid is included, the only other accepted queries are the\n # include_*s\n if queries.key?('uuid')\n query_string = format('/%s?', queries['uuid'])\n if queries.key?('include_deleted')\n query_string += format('include_deleted=%s&',\n queries['include_deleted'][0])\n end\n\n if queries.key?('include_revisions')\n query_string += format('include_revisions=%s&',\n queries['include_revisions'][0])\n end\n\n # Everthing is a list now, so iterate through and push\n else\n # Sort them into an alphabetized list for easier testing\n # sorted_qs = sorted(queries.to_a, key = operator.itemgetter(0))\n sorted_qs = queries.to_a.sort\n sorted_qs.each do |query, param|\n param.each do |slug|\n # Format each query in the list\n # query_list.push('%s=%s' % Array[query, slug])\n query_list.push(format('%s=%s', query, slug))\n end\n end\n\n # Construct the query_string using the list.\n # Last character will be an & so we can push the token\n query_list.each do |string|\n query_string += format('%s&', string)\n end\n end\n query_string\n end",
"def build_query\n query = { key: @api_key }\n query.merge! @parameters if @parameters\n query.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)\n container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)\n end",
"def url_builder(url,parameters = {}) # vals = {} assigns emtpy hash as default if nothing passed in\n parameters[:results] = 10 unless parameters.key?(:results)\n #debugger\n \n # -OR-\n ## sets defaults and overrides original parameters with passed in vals\n #parameters = { :results => 10, :sort_by => \"date\"}.merge(parameters)\n \n #final_url = \"#{url}?results=10\"\n #\n #if parameters.key? :sort_by\n # url = \"#{url}?sort_by=#{parameters[:sort_by]}\"\n #else \n # \"#{url}?results=#{}\"\n #\n #end\n #\n #param_array = parameters.map do |key, value|\n # \"#{key}=#{value}\" unless value == nil\n # # last true statement value gets mapped into param_array\n #end\n #\n ## KEY=VALUE&KEY=VALUE&KEY=VALUE\n #param_string = \"?#{param_array.join(\"&\")}\"\n #\n #if parameters.key? :search\n # \"#{url}?results=#{parameters[:results]}&search=#{parameters[:search]}\"\n #else \n # \"#{url}?results=#{}\"\n #\n #end\n\n\n#### --ALT--\n final_url = \"#{url}?results=10\"\n \n if parameters.key? :sort_by\n final_url = \"#{url}?sort_by=#{parameters[:sort_by]}\"\n else \n \"#{url}?results=#{parameters[:results]}\"\n \n end\n \n \n if parameters.key? :search\n \"#{url}?results=#{parameters[:results]}&search=#{parameters[:search]}\"\n else \n \"#{url}?results=#{parameters[:results]}\"\n \n end\nend",
"def query ; @request.params ; end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def build_request(method, resource = nil, id = nil, body =nil, query = {})\n\n url = self.endpoint\n url += \"/\" + resource unless resource.nil? || resource == \"parent_page\"\n if resource == \"exhibit_pages\"\n \turl += \"?exhibit=\" + id.to_s unless id.nil?\n elsif resource == \"parent_page\"\n \turl += \"/exhibit_pages/\" + id.to_s\n elsif resource == \"files?item\"\n \turl += \"=\" + id.to_s unless id.nil?\n else\n \turl += \"/\" + id.to_s unless id.nil?\n end\n \tquery[:key] = self.api_key unless self.api_key.nil?\n\n case method\n when \"get\"\n self.connection.get(url, :params => query)\n end\n\n end",
"def build_request\n case action\n when 'charge'\n self.class.include Requests::ChargeRequest\n validate_charge_params!\n @request = build_charge_request\n when 'refund'\n self.class.include Requests::RefundRequest\n validate_refund_params!\n @request = build_refund_request\n when 'payment_status'\n self.class.include Requests::PaymentStatusRequest\n validate_payment_status_params!\n @request = build_payment_status_request\n when 'create_card_token'\n self.class.include Requests::CreateCardTokenRequest\n validate_card_token_params!\n @request = build_create_card_token_request\n when 'list_tokens'\n self.class.include Requests::ListTokensRequest\n validate_list_tokens_params!\n @request = build_list_tokens_request\n when 'delete_token'\n self.class.include Requests::DeleteTokenRequest\n validate_delete_token_params!\n @request = build_delete_token_request\n end\n # rubocop:enable Metrics/AbcSize\n # rubocop:enable Metrics/MethodLength\n end",
"def build_request path, opts\n opts[:method] ||= :get\n raise \"The :data option can only be used if :method => :post\" if opts[:method] != :post and opts[:data]\n opts[:params] = opts[:params].nil? ? {:wt => :ruby} : opts[:params].merge(:wt => :ruby)\n query = RSolr::Uri.params_to_solr(opts[:params]) unless opts[:params].empty?\n opts[:query] = query\n if opts[:data].is_a? Hash\n opts[:data] = RSolr::Uri.params_to_solr opts[:data]\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'application/x-www-form-urlencoded'\n end\n opts[:path] = path\n opts[:uri] = base_uri.merge(path.to_s + (query ? \"?#{query}\" : \"\")) if base_uri\n opts\n end",
"def parse_request_params\n @column_names = []\n @searchable_column_names = []\n\n @request_params[:columns].map {|i| i[1]}.each do |column|\n @column_names << column[:data]\n @searchable_column_names << column[:data] if column[:searchable]\n end\n\n @search_value = @request_params[:search][:value].presence\n\n @orders = []\n\n @request_params[:order].map {|i| i[1]}.each do |order|\n @orders << \"#{@column_names[order[:column].to_i]} #{order[:dir]}\"\n end\n\n @start = @request_params[:start]\n @length = @request_params[:length]\n end",
"def build_request_url(path, params)\n\t\t\t\t\tURI::HTTP.build :host => API_SERVER,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:path => \"#{API_BASE}/#{path}\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t:query => params.map {|k,v| \"#{k}=#{v}\"}.join('&')\n\t\t\t\tend",
"def api_params(q = {})\n @api[:optional].deep_merge(@api[:required]).deep_merge(q)\n end",
"def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def build_request(params = {}, env = {})\n params = Merb::Parse.params_to_query_string(params)\n\n query_string = env[:query_string] || env['QUERY_STRING']\n env[:query_string] = query_string ? \"#{query_string}&#{params}\" : params\n \n post_body = env[:post_body] || env['POST_BODY']\n fake_request(env, { :post_body => post_body, :req => env[:req] })\n end",
"def request(type, id=\"\", params=\"\")\n id = id.to_s\n params = params.to_s\n api_path = case type\n when \"orders\"\n \"/api/v2/orders?\"\n when \"order_metadata\"\n raise \"ID required\" if id.empty?\n \"/api/v2/orders/#{id}?\"\n when \"shop_metadata\"\n raise \"ID required\" if id.empty?\n \"/api/v2/shop/#{id}?\"\n end\n api_path.chop! if params.empty?\n\n response = HTTParty.get(\n @domain + api_path + params, \n basic_auth: @auth\n )\n response_valid?(response)\n response\nend",
"def prepare_request_params(options)\n params = detect_request_input options.delete(:input)\n\n options.inject(params) do |params, kv|\n key, value = kv\n params.merge!(\"#{key.to_s.downcase.gsub(/_+/,'')}\" => value) \n end\n end",
"def build_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n urlpath = erb.extra_params(@arguments)\n render json: { success: urlpath }, status: 200\n end\n end",
"def discovery_api_params(app_params)\n if app_params['advanced'].include? 'true'\n api_params = generate_advanced_query(app_params)\n else\n api_params = app_params\n end\n api_params[\"facetFields\"] = ['inLanguage:10', 'itemType:10', 'creator:10']\n api_params[\"heldBy\"] = library_symbols if app_params['scope'].nil? or app_params['scope'].first != 'worldcat'\n api_params\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def build_request_url(params)\n \"http://api.nytimes.com/svc/search/v2/articlesearch.json?\"+params\n end",
"def build_args(args)\n args.each do |arg|\n arg.each do |key, value|\n case key.to_s\n when 'query_params'\n @query_params = value\n when 'request_headers'\n update_headers(value)\n when 'request_body'\n @request_body = value\n end\n end\n end\n end",
"def build_request\n client.request request_name\n end",
"def request\n @request ||= begin\n res = {}\n\n if must_values || must_not_values || filter_values\n res[:query] = {\n bool: {\n must: must_values.to_a,\n must_not: must_not_values.to_a,\n filter: filter_values.to_a\n }.reject { |_, value| value.empty? }\n }\n end\n\n res.update(from: offset_value_with_default, size: limit_value_with_default)\n\n res[:track_total_hits] = track_total_hits_value unless track_total_hits_value.nil?\n res[:explain] = explain_value unless explain_value.nil?\n res[:timeout] = timeout_value if timeout_value\n res[:terminate_after] = terminate_after_value if terminate_after_value\n res[:highlight] = highlight_values if highlight_values\n res[:suggest] = suggest_values if suggest_values\n res[:sort] = sort_values if sort_values\n res[:aggregations] = aggregation_values if aggregation_values\n\n if post_must_values || post_must_not_values || post_filter_values\n res[:post_filter] = {\n bool: {\n must: post_must_values.to_a,\n must_not: post_must_not_values.to_a,\n filter: post_filter_values.to_a\n }.reject { |_, value| value.empty? }\n }\n end\n\n res[:_source] = source_value unless source_value.nil?\n res[:profile] = true if profile_value\n\n res.update(custom_value) if custom_value\n\n res\n end\n end",
"def initialize(params={})\r\n # Initiate a new request object with given query params.\r\n #\r\n # Each request must have at least one searchable parameter, meaning\r\n # a name (at least first and last name), email, phone or username.\r\n # Multiple query params are possible (for example querying by both email\r\n # and phone of the person).\r\n #\r\n # Args:\r\n #\r\n # api_key -- str, a valid API key (use \"samplekey\" for experimenting).\r\n # Note that you can set a default API key\r\n # (PiplApi::SearchApi.default_api_key = '<your_key>') instead of\r\n # passing it to each request object.\r\n # first_name -- unicode, minimum 2 chars.\r\n # middle_name -- unicode.\r\n # last_name -- unicode, minimum 2 chars.\r\n # raw_name -- unicode, an unparsed name containing at least a first name\r\n # and a last name.\r\n # email -- unicode.\r\n # phone -- int/long. If a unicode/str is passed instead then it'll be\r\n # striped from all non-digit characters and converted to int.\r\n # IMPORTANT: Currently only US/Canada phones can be searched by\r\n # so country code is assumed to be 1, phones with different\r\n # country codes are considered invalid and will be ignored.\r\n # username -- unicode, minimum 4 chars.\r\n # country -- unicode, a 2 letter country code from:\r\n # http://en.wikipedia.org/wiki/ISO_3166-2\r\n # state -- unicode, a state code from:\r\n # http://en.wikipedia.org/wiki/ISO_3166-2%3AUS\r\n # http://en.wikipedia.org/wiki/ISO_3166-2%3ACA\r\n # city -- unicode.\r\n # raw_address -- unicode, an unparsed address.\r\n # from_age -- int.\r\n # to_age -- int.\r\n # person -- A PiplApi::Person object (available at containers.rb).\r\n # The person can contain every field allowed by the data-model\r\n # (fields.rb) and can hold multiple fields of\r\n # the same type (for example: two emails, three addresses etc.)\r\n # query_params_mode -- str, one of \"and\"/\"or\" (default \"and\").\r\n # Advanced parameter, use only if you care about the\r\n # value of record.query_params_match in the response\r\n # records.\r\n # Each record in the response has an attribute\r\n # \"query_params_match\" which indicates whether the\r\n # record has the all fields from the query or not.\r\n # When set to \"and\" all query params are required in\r\n # order to get query_params_match=True, when set to\r\n # \"or\" it's enough that the record has at least one\r\n # of each field type (so if you search with a name\r\n # and two addresses, a record with the name and one\r\n # of the addresses will have query_params_match=true)\r\n # exact_name -- bool (default false).\r\n # If set to True the names in the query will be matched\r\n # \"as is\" without compensating for nicknames or multiple\r\n # family names. For example \"Jane Brown-Smith\" won't return\r\n # results for \"Jane Brown\" in the same way \"Alexandra Pitt\"\r\n # won't return results for \"Alex Pitt\".\r\n #\r\n # Each of the arguments that should have a unicode value accepts both\r\n # unicode objects and utf8 encoded str (will be decoded automatically).\r\n\r\n fparams = { :query_params_mode => 'and', :exact_name => false }.merge(params)\r\n\r\n if not(fparams[:person].nil?)\r\n person = fparams[:person]\r\n else\r\n person = PiplApi::Person.new()\r\n end\r\n\r\n if fparams[:first_name] || fparams[:middle_name] || fparams[:last_name]\r\n name = Name.new({:first=>fparams[:first_name], :middle=>fparams[:middle_name], :last=>fparams[:last_name]})\r\n person.add_fields([name])\r\n end\r\n\r\n person.add_fields([PiplApi::Name.new({:raw=>fparams[:raw_name]})]) unless fparams[:raw_name].nil?\r\n person.add_fields([PiplApi::Email.new({:address=>fparams[:email]})]) unless fparams[:email].nil?\r\n\r\n if not(fparams[:phone].nil?)\r\n if fparams[:phone].is_a?(String)\r\n person.add_fields([PiplApi::Phone.from_text(fparams[:phone])])\r\n else\r\n person.add_fields([PiplApi::Phone.new({:number=>fparams[:phone]})])\r\n end\r\n end\r\n\r\n person.add_fields([PiplApi::Username.new({:content=>fparams[:username]})]) unless fparams[:username].nil?\r\n\r\n if fparams[:country] || fparams[:state] || fparams[:city]\r\n address = PiplApi::Address.new({:country=>fparams[:country], :state=>fparams[:state], :city=>fparams[:city]})\r\n person.add_fields([address])\r\n end\r\n\r\n person.add_fields([PiplApi::Address.new({:raw=>fparams[:raw_address]})]) unless fparams[:raw_address].nil?\r\n\r\n if fparams[:from_age] || fparams[:to_age]\r\n dob = PiplApi::DOB.from_age_range(fparams[:from_age] || 0, fparams[:to_age] || 1000)\r\n person.add_fields([dob])\r\n end\r\n\r\n @api_key = fparams[:api_key]\r\n @person = person\r\n @query_params_mode = fparams[:query_params_mode]\r\n @exact_name = fparams[:exact_name]\r\n @_filter_records_by = []\r\n @_prioritize_records_by = []\r\n end",
"def build_request(method, path, body, request_options)\n request = {}\n request[:method] = method.downcase\n request[:path] = build_uri_path(path, request_options.params)\n request[:body] = build_body(body, request_options, method)\n request[:headers] = generate_headers(request_options)\n request[:timeout] = request_options.timeout\n request[:connect_timeout] = request_options.connect_timeout\n request\n end",
"def query_builder(options)\r\n parsed_options = []\r\n\r\n options.each do |key,value|\r\n case key\r\n when :offset\r\n parsed_options << \"page[offset]=#{value}\"\r\n when :limit\r\n parsed_options << \"page[limit]=#{value}\"\r\n when :sort\r\n parsed_options << \"sort=#{value}\"\r\n when :created_at_start\r\n parsed_options << \"filter[createdAt-start]=#{value}\"\r\n when :created_at_end\r\n parsed_options << \"filter[createdAt-end]=#{value}\"\r\n when :player_ids\r\n parsed_options << \"filter[playerIds]=#{value.join(',')}\"\r\n when :game_mode\r\n parsed_options << \"filter[gameMode]=#{value}\"\r\n end\r\n end\r\n\r\n if options.empty?\r\n \"/matches\"\r\n else\r\n queries = parsed_options.join(\"&\")\r\n \"/matches?#{queries}\"\r\n end\r\n end",
"def requestify(vars)\n arr = vars.split(\"&\").sort!\n requestify = \"\"\n arr.each do |e|\n requestify << \"&\" if !e.eql?(arr.first)\n tmp = e.split(\"=\")\n requestify << CGI.escape(tmp[0]).gsub(\"+\", \"%20\") + \"=\" + CGI.escape(tmp[1]).gsub(\"+\", \"%20\")\n end \n return requestify \n end",
"def build_from_params(params)\n if params[:fields] || params[:f]\n self.filters = {}\n add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v])\n else\n available_filters.keys.each do |field|\n add_short_filter(field, params[field]) if params[field]\n end\n end\n self.group_by = params[:group_by] || (params[:query] && params[:query][:group_by])\n self.column_names = params[:c] || (params[:query] && params[:query][:column_names])\n self\n end",
"def request_and_adapter_from(args)\n return args if args[0].kind_of? Request\n [Request.new(:url => args[0], :body => args[1]), args[2]]\n end",
"def request_and_adapter_from(args)\n return args if args[0].kind_of? Request\n [Request.new(:url => args[0], :body => args[1]), args[2]]\n end",
"def build_request(name, args)\n build_args(args) if args\n # build the request & http object\n build_http_request(name)\n # set the content type & request body\n update_content_type(name)\n make_request(@http, @request)\n end",
"def http_parse_args\n [(self.api.base_url + self.method), self.params]\n end",
"def apiQuery(query, vars = {}, privileged = false)\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n headers = { 'Content-Type' => 'application/json' }\n privKey = ENV['ESCHOL_PRIV_API_KEY'] or raise(\"missing env ESCHOL_PRIV_API_KEY\")\n privileged and headers['Privileged'] = privKey\n response = HTTParty.post($api_url, :headers => headers, :body => { variables: varHash, query: query }.to_json)\n response.code == 200 or raise(\"Internal error (graphql): HTTP code #{response.code}\")\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend",
"def build_request(identity, next_service, username, hostname, client_username); end",
"def build_query(key, queries, localparams = \"\")\n query_string = ''\n case queries\n when String\n query_string = queries\n when Array\n query_string = queries.join(' ')\n when Hash\n query_string_array = []\n queries.each do |k,v|\n query_string_array << key_value_pair_string(k, v)\n end\n query_string = query_string_array.join(' ')\n end\n\n query_string = localparams + query_string\n\n {key => query_string}\n end",
"def build_request(rule, from_date=nil, to_date=nil)\n\n\t request = {:query => rule}\n\n if !from_date.nil?\n request[:fromDate] = from_date\n end\n\n if !to_date.nil?\n request[:toDate] = to_date\n end\n\n return request\n end",
"def generate_request(query)\n validate(query)\n URI(API_URL + '?' + query + \"&hashkey=\" + hashkey_calculation(query))\n end",
"def execute_manual_request\n http_method = params[:http_method]\n path = params[:path]\n headers = params[:headers]\n body = params[:body]\n params.each do |key, value|\n if key.start_with?(\"replace_\") && !key.end_with?(\"_by\")\n path.gsub!(\"XXX#{value}XXX\",params[key + \"_by\"]) if params[key + \"_by\"] != \"\"\n headers.gsub!(\"XXX#{value}XXX\",params[key + \"_by\"]) if params[key + \"_by\"] != \"\"\n body.gsub!(\"XXX#{value}XXX\",params[key + \"_by\"]) if params[key + \"_by\"] != \"\"\n end\n end\n if params[:task_id]\n @task = Task.find(params[:task_id])\n @regexpressions = @task.regexpressions\n end\n begin\n if @cloud\n if @cloud.api == \"Atmos\"\n @response, @headers, @url = atmos_request(http_method, path, headers, body)\n elsif @cloud.api == \"Amazon\"\n @response, @headers, @url = amazon_request(http_method, path, headers, body)\n elsif @cloud.api == \"Swift\"\n @response, @headers, @url = swift_request(http_method, path, headers, body)\n end\n else\n url = path\n uri = URI.parse(url)\n headers_to_send = Hash.new\n headers.split(\"\\n\").each do |row|\n hash = eval(row)\n headers_to_send[hash.keys.first.downcase] = hash.values.first.to_s\n end\n if params[:user] != \"\" && params[:password] != \"\"\n login = Base64.urlsafe_encode64(\"#{params[:user]}:#{params[:password]}\")\n headers_to_send[\"Authorization\"] = \"Basic #{login}\"\n end\n @response = http_request(url, uri.port, http_method, headers_to_send, body)\n @headers = headers_to_send\n end\n rescue Exception => e\n @exception = e\n end\n respond_to do |format|\n format.js { render 'shared/execute_manual_request' }\n end\n end",
"def build_request(verb, uri, opts = T.unsafe(nil)); end",
"def query_api_patterns\n @query_api_patterns ||= {}\n # The current set of patterns may override whatever is defined at the class level.\n self.class.query_api_patterns.merge(@query_api_patterns)\n end",
"def query_parameters; end",
"def dh_api_query(command, params = ''); end",
"def build_query(uri, args = {})\n new_query = URI.decode_www_form(uri.query || '')\n args.to_a.each { |arg| new_query << arg }\n key = Phantomblaster.configuration.api_key\n new_query << ['key', key] if key && ENV['GEM_ENV'] != 'test'\n URI.encode_www_form(new_query)\n end",
"def buildRequest(payload)\n # ...\n end",
"def request_query(query)\n query[:token] = configuration[:token]\n query[:version] = configuration[:version] if query[:version].nil?\n query[:cv] = configuration[:cache_version] if query[:cache_version].nil?\n query\n end",
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end",
"def query_params; end",
"def build_request(format, hash = {})\n context_object = OpenURL::ContextObject.new\n context_object.referent.set_format(format) if format\n \n hash.each_pair do |key, value| \n context_object.referent.set_metadata(key.to_s, value.to_s)\n end\n \n rft = Referent.create_by_context_object(context_object)\n \n req = Request.new\n req.referent = rft\n req.save!\n \n return req\n end",
"def request_params; end",
"def request(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end",
"def build_get_options( params={}, user_headers={})\n get_options = {}\n query ={}\n\n query.merge!(params)\n\n # pass any headers\n headers ={}\n headers.merge!( user_headers )\n\n get_options[:query] = query\n get_options[:headers] = headers\n get_options[:basic_auth] = { username: Edelements.options[:api_key], password: ''}\n get_options\n end",
"def build_url\n unless key && key.length > 0\n raise ArgumentError, 'Missing API key parameter. Visit http://developer.oodle.com/request-api-key/ to get one.'\n end\n\n unless region && region.length > 0\n raise ArgumentError, 'Missing region paramter. Visit http://developer.oodle.com/regions-list/ for possible regions.'\n end\n\n unless (category && category.length > 0) || (q && q.length > 0)\n raise ArgumentError, 'You must supply a category or query parameter. Visit http://developer.oodle.com/categories-list/ for possible categories.'\n end\n\n unless num.to_i >= 1 && num.to_i <= 50\n warn \"num parameter is #{num.to_i} but should be between 1 and 50\"\n end\n\n url = VERSION_URLS[self.version]\n url += \"?\" unless url && url[-1] == '?'\n # must CGI escape each param value\n url = \"#{url}key=#{CGI::escape(self.key)}\"\n url = \"#{url}®ion=#{CGI::escape(self.region)}\" if self.region\n url = \"#{url}&category=#{CGI::escape(self.category)}\" if self.category\n url = \"#{url}&q=#{CGI::escape(self.q)}\" if self.q\n url = \"#{url}&attributes=#{CGI::escape(self.attributes_as_string)}\" if self.attributes.size > 0\n url = \"#{url}&location=#{CGI::escape(self.location)}\" if self.location\n url = \"#{url}&radius=#{CGI::escape(self.radius.to_s)}\" if self.radius\n url = \"#{url}&start=#{CGI::escape(self.start.to_s)}\" if self.start\n url = \"#{url}&num=#{CGI::escape(self.num.to_s)}\" if self.num\n url = \"#{url}&sort=#{CGI::escape(self.sort)}\" if self.sort\n url = \"#{url}&refinements=#{CGI::escape(self.refinements_as_string)}\" if self.refinements.size > 0\n url = \"#{url}&ctime_low=#{CGI::escape(self.ctime_low)}\" if self.ctime_low\n url = \"#{url}&ctime_high=#{CGI::escape(self.ctime_high)}\" if self.ctime_high\n url = \"#{url}&exclude_sources=#{CGI::escape(self.exclude_sources_as_string)}\" if self.exclude_sources.size > 0\n url = \"#{url}&assisted_search=#{CGI::escape(self.assisted_search)}\" if self.assisted_search\n url = \"#{url}&format=#{CGI::escape(self.format)}&jsoncallback=none\" if self.format\n url\n end",
"def build_search_url(options = {})\n url = APP_CONFIG['ac']['api_url']\n search_path = APP_CONFIG['ac']['api_search_path']\n search_url = \"#{url}#{search_path}\"\n\n api_params = {}\n\n # basic query params\n basics = %w(q page per_page sort order)\n basics.each do |key|\n api_params[key] = options[key] if options[key].present?\n end\n\n # If we get non-AC sort params, either fix or ignore\n sort_key = options['sort']\n order_key = options['order']\n\n # combined, e.g.: sort=pub_date_sort+desc\n if sort_key.present? && sort_key.match(/\\w+ \\w+sc/)\n sort_key, order_key = sort_key.match(/(\\w+) (\\w+sc)/).captures\n end\n sort_key = 'date' if sort_key == 'pub_date_sort'\n if %w(best_match date title).include? sort_key\n api_params['sort'] = sort_key\n api_params['order'] = order_key if %w(asc desc).include? order_key\n end\n\n # *** remap params ***\n # \"SEARCH FIELD\" V.S. \"SEARCH TYPE\"\n key_remaps = {\n 'search_field' => 'search_type'\n }\n value_remaps = {\n 'all_fields' => 'keyword',\n 'all' => 'keyword'\n }\n key_remaps.each do |clio_key, api_key|\n # We have a key that needs to be remapped\n next unless options[clio_key].present?\n # if the value is in our remap table, remap value also\n clio_value = options[clio_key]\n api_value = value_remaps[clio_value] || clio_value\n api_params[api_key] = api_value\n end\n\n # facet filter params\n filters = %w(author date department subject type columbia_series)\n filters.each do |key|\n api_params[key] = options[key] if options[key].present?\n end\n\n # DISSERTATIONS\n # hardcode filter to show only dissertations if we're in that datasource\n api_params['type[]'] = 'Theses' if options['datasource'] == 'ac_dissertations'\n\n search_url = \"#{search_url}?#{api_params.to_query}\" if api_params.present?\n Rails.logger.debug \"Spectrum::SearchEngines::Ac build_search_url(options)\\n #{search_url}\"\n search_url\n end",
"def generate(params, fallback)\n query_params = params.dup\n \n # Condition#generate will delete from the hash any params that it uses\n # that way, we can just append whatever is left to the query string\n uri = generate_path(query_params, fallback)\n \n query_params.delete_if { |k, v| v.nil? }\n \n uri << \"?#{Rack::Utils.build_query(query_params)}\" if query_params.any?\n uri\n end",
"def build_params(input)\n # prepare empty params hash\n @params = {}\n # separate command from other params\n _command, *input_params = input.split(' ')\n # check arguments count before proceed\n check_arguments_count(input_params)\n # validate every input param and put in params hash\n declared_params.each_with_index do |param, index|\n @params[param[0]] = validate_param(param, input_params[index])\n end\n end",
"def url_builder(url,parameters={:results => 10})\n params = []\n parameters.map do |key, value|\n if key != nil and value != nil\n params.push(\"#{key}=#{value}\")\n end\n end\n\n \"#{url}?#{params.join(\"&\")}\"\nend",
"def makeConditions #:doc:\n @condition_string = \"\"\n @condition_values = Hash.new\n i = 0\n \n # if search is from spesific devices\n if @device_ids.size > 0\n @device_ids.uniq!\n firstdevid = true\n @device_ids.each do |id|\n if firstdevid\n @condition_string += \"(devices.id in (\"\n firstdevid = false\n else\n @condition_string += \", \"\n end\n @condition_string += \":cond#{i}\"\n @condition_values.merge!({\"cond#{i}\".intern => id})\n i += 1\n end\n @condition_string += \"))\"\n if not @conditions.empty? or @locationdata.size == 3\n @condition_string += \" AND \"\n end\n end\n \n # take each condition and combine them\n firstcond = true\n @conditions.each do |keyword, values|\n condition = \"(\"\n statement = @condition_rules[keyword]\n \n # combine values\n firstvalue = true\n values.each do |value|\n condition_part = statement.gsub(\"?\") do |s|\n new = \":cond#{i}\"\n # bind the value\n @condition_values.merge!({\"cond#{i}\".intern => value})\n \n # do some special processing if the keyword is type and there's 2 \"?\"'s in the statement\n if keyword == \"type\" and statement.count(\"?\") == 2\n value = value[0..-2].insert(1, \".\")\n end\n i += 1\n new\n end\n \n if not firstvalue\n condition += \" OR \"\n end\n condition += condition_part\n \n firstvalue = false\n end\n \n condition += \")\"\n \n # append condition_string with the condition\n if not firstcond\n @condition_string += \" AND \"\n end\n @condition_string += condition\n firstcond = false\n end\n \n # add distance-search to conditions\n if @locationdata.size == 3\n statement = \"(\" + @condition_rules[\"distance\"] + \")\"\n j = 0\n statement.gsub!(\"?\") do |s|\n j += 1\n new = \":cond#{i}\"\n # bind the value\n if j == 1\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lat\"]})\n elsif j == 3\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lon\"]})\n elsif j == 5\n @condition_values.merge!({\"cond#{i}\".intern => (@locationdata[\"distance\"].to_f / @@kms_per_degree) **2})\n else\n i += 1\n end\n new\n end\n \n if not @conditions.empty?\n @condition_string += \" AND \"\n end\n @condition_string += statement\n end\n end",
"def parse_query_vars\n parse_query\n end",
"def build_url_request(params)\n logger.debug(\"build_url_request: params #{params.inspect}\")\n #add constants\n #add key\n params << @public_key_param \n # need to encode rest of the values\n encoded = encode_params(params)\n #encode the URL\n url = @api_path + '?' +encoded.join('&')\n logger.debug(\"build_url_request: url is #{url}\")\n url\n end",
"def query_params=(_arg0); end",
"def format_params(params)\n \n # this is just used for multi_index search\n params[:indexes] ||= ['documents', 'people', 'topics', 'places' ]\n \n \n # return loaded models?\n params[:load] ||= true\n \n # will_paginate settings\n params[:page] ||= 1\n params[:per_page] ||= 25\n params[:offset] = ( ( params[:page].to_i - 1) * params[:per_page].to_i)\n\n # sort by\n params[:sort_by], params[:order_by] = params[:sort].split(\":\") if params[:sort]\n params[:order_by] = \"desc\" unless params[:order_by] == \"asc\"\n\n # facet filters and query\n params[:facet] ||= []\n params[:facet].compact!\n\n params[:request_query] = params[:q] ? params[:q].compact : \"*\"\n \n # facet filtering/limits\n params[:facet_filters] = params[:facet].collect do |f|\n facet, value = f.split(\":\")\n lambda { |boolean| boolean.must { term facet.to_sym, value } }\n end\n \n # facets to be returned\n params[:request_facets] ||= self.facets\n params[:facet_query] = {} \n params[:request_facets].each { |f| params[:facet_query][f] = params[:\"#{f}_page\"] ? ( ( params[:\"#{f}_page\"].to_i * 10 ) + 1 ) : 11 }\n \n return params\n end",
"def map_params_for_node_api(params)\n api_params = params.dup\n unless api_params[:has].blank?\n api_params[:has].each do |h|\n api_params[h.to_sym] = true\n end\n api_params.delete(:has)\n end\n unless api_params[:projects].blank?\n api_params[:project_id] = params[:projects].map{ |p| p.try(:id) || p }\n api_params.delete(:projects)\n end\n unless api_params[:user].blank?\n api_params[:user_id] = params[:user].id\n api_params.delete(:user)\n end\n unless api_params[:iconic_taxa_instances].blank?\n api_params[:iconic_taxa] = params[:iconic_taxa_instances].map{ |i| i ? i.id : \"unknown\" }\n api_params.delete(:iconic_taxa_instances)\n end\n unless api_params[:place].blank?\n api_params[:place_id] = params[:place].id\n api_params.delete(:place)\n end\n unless api_params[:viewer].blank?\n api_params[:viewer_id] = params[:viewer].id\n api_params.delete(:viewer)\n end\n if api_params[:order_by] == \"observations.id\"\n api_params[:order_by] = \"id\"\n end\n api_params[:taxon_id] = [ ]\n if !api_params[:observations_taxon].blank?\n api_params[:taxon_id] = [ api_params[:observations_taxon].id ]\n api_params.delete(:observations_taxon)\n elsif !api_params[:observations_taxa].blank?\n api_params[:taxon_id] = api_params[:observations_taxa].map(&:id)\n api_params.delete(:observations_taxa)\n api_params.delete(:observations_taxon_ids)\n end\n unless api_params[:taxon_ids].blank?\n api_params[:taxon_id] += params[:taxon_ids].map{ |id| id.to_s.split(\",\") }.flatten.map(&:to_i)\n api_params[:taxon_id].uniq!\n api_params.delete(:taxon_ids)\n end\n unless api_params[:min_id].blank?\n api_params[:id_above] = api_params[:min_id]\n api_params.delete(:min_id)\n end\n api_params.delete(:partial)\n api_params.delete(:controller)\n api_params.delete(:action)\n api_params.delete(:with_photos)\n api_params.delete(:with_sounds)\n api_params.delete(:_query_params_set)\n api_params.reject!{ |k,v| v == \"any\" || v.blank? }\n if api_params[:reviewed].blank?\n api_params.delete(:viewer_id)\n end\n if api_params[:per_page] && api_params[:per_page].to_i > 200\n api_params[:per_page] = 200\n end\n api_params\n end",
"def apiQuery(query, vars = {})\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n response = EscholSchema.execute(query, variables: varHash)\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend",
"def params ; @params ||= Waves::Request::Query.new( request.query.merge( captured.to_h ) ) ; end",
"def request(*args); end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n \n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n \n end\n \n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n \n return res.join(' > ')\n end",
"def conditions(host,port,verb,path,query)\n\t response=nil\n if path.include?(\"/blue/\") \n host=\"doom.zoom.com\"\n port=9141\n elsif port==9142\n host=\"doom2.zoom.com\"\n port=9141\n elsif path.match(/myregularexpression/)\n host=\"doom.zoom.com\"\n port=9134\n elsif port==443 and path.match(/myregularexpression/) and verb==\"POST\"\n host=\"doom.zoom.com\"\n port=9157\n\t #when adding autoresponses only the path and the verb can be used to select\t\n\t elsif path.include?(\"/cp/xala/\")\n\t\tresponse=[200, {'Content-Type' => 'application/json'}, \n\t\t { \n\t\t\tname: 'Peter Daily',\n\t\t\tcity: 'New York',\n\t\t\tisClient: false,\n\t\t\tcurrency: 'EUR',\n\t\t\tbalance: 4663\n\t\t }.to_json\n\t\t]\n\t #when adding autoresponses only the path and the verb can be used to select\t\n\t elsif path.include?(\"/cp/alabi/\")\n\t\tresponse=[200, {'Content-Type' => 'application/json'}, \n\t\t { \n\t\t\tname: 'Mario',\n\t\t\tcity: 'London',\n\t\t\tisClient: true,\n\t\t\tcurrency: 'EUR',\n\t\t\tbalance: 323\n\t\t }.to_json\n\t\t]\n end\n if !response.nil? #to use rack for autoresponses\n\t\thost=\"localhost\"\n\t\tport=9292\n\t end\n return host,port,verb,path,query,response\n \n end",
"def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pattern)\n raise_exception(404) if candidacies.empty?\n candidacies, allows = *candidacies.partition{ |route| route.verb == verb }\n raise_exception(405, :verbs => allows.map(&:verb)) if candidacies.empty?\n candidacies.map{ |route| [route, route.params_for(pattern, params)] }\n end",
"def build(params); end",
"def build_query(options)\n array = []\n\n options.each do |key, value|\n next if key == :all\n if [:filter, :select, :top].include?(key)\n array << \"$#{key}=#{value}\" if value\n elsif key == :continuation_token\n value.each { |k, token| array << \"#{k}=#{token}\" if token }\n else\n array << \"#{key}=#{value}\" if value\n end\n end\n\n array.join('&')\n end",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def generate_request(request)\n\n\t\t\trequest_uri = request[:uri].request_uri\n\n\t\t\tcase request[:method]\n\t\t\twhen :get\n\t\t\t\treq = Net::HTTP::Get.new request_uri\n\t\t\twhen :post\n\t\t\t\treq = Net::HTTP::Post.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :put\n\t\t\t\treq = Net::HTTP::Put.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :patch\n\t\t\t\treq = Net::HTTP::Patch.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :delete\n\t\t\t\treq = Net::HTTP::Delete.new request_uri\n\t\t\tend\n\t\tend",
"def assemble_request(tweets_of_interest)\n\n\t request = {}\n\n\t request['tweet_ids'] = tweets_of_interest\n\n\t if @endpoint == 'historical'\n\t\t request['start'] = @utils.get_ISO_date_string(@utils.get_date_object(@start_date)) unless @start_date.nil?\n\t\t request['end'] = @utils.get_ISO_date_string(@utils.get_date_object(@end_date)) unless @end_date.nil? #Let API default to now.\n\t end\n\n\t request['engagement_types'] = []\n\n\t if @endpoint == 'totals'\n\t\t @engagement_types.each do |engagement_type|\n\t\t\tif TOTALS_ENGAGEMENT_TYPES.include?(engagement_type[0])\n\t\t\t if engagement_type[1] then\n\t\t\t\t request['engagement_types'] << engagement_type[0]\n\t\t\t end\n\t\t\tend\n\t\t end\n\t else\n\t\t @engagement_types.each do |engagement_type|\n\t\t\tif engagement_type[1] then\n\t\t\t request['engagement_types'] << engagement_type[0]\n\t\t\tend\n\t\t end\n\t end\n\n\t #Assemble groupings section.\n \t request['groupings'] = {}\n\t @groupings.each do |key, items|\n\t\t \n\t\t \n\t\t if @endpoint == 'totals'\n\n\t\t if !items.include? 'engagement.hour' and !items.include? 'engagement.day'\n\t\t\t request['groupings'][key] = {}\n\t\t\t request['groupings'][key]['group_by'] = []\n\t\t\t items.each do |item|\n\t\t\t \t\trequest['groupings'][key]['group_by'] << item\n \t\t\t end\n\t\t\telse\n\t\t\t AppLogger.log_info \"Not adding time-series grouping to /totals request\"\n\t\t\t @groupings = @groupings.tap { |h| h.delete(key)}\n\t\t end\n\t\t else\n\t\t\trequest['groupings'][key] = {}\n\t\t\trequest['groupings'][key]['group_by'] = []\n\t\t\titems.each do |item|\n\t\t\t request['groupings'][key]['group_by'] << item\n\t\t\tend\n\t end\n\t end\n\n\t request.to_json\n\n end",
"def query_params\n URI.encode_www_form(\n {\n affiliate:,\n access_key:,\n module_code:,\n url:,\n query:,\n position:,\n user_agent:\n }\n )\n end",
"def request_params\n {\n pickup_address: build_address(origin),\n dropoff_address: build_address(destination),\n pickup_name: ship_address.full_name,\n dropoff_name: Spree::Store.default.name,\n pickup_phone_number: number_to_phone(ship_address.phone),\n dropoff_phone_number: number_to_phone(SolidusPostmates::Config[:postmates_phone]),\n manifest: order.line_items.map(&:name).join(', '),\n }.to_query\n end",
"def prepare(variables, config)\n @format ||= 'xml'\n @failures = []\n @send_count = 0\n @config_delay = config.delay\n @config_use_ssl = config.use_ssl\n\n # 1. Normalize call fields\n @headers ||= []\n @params ||= []\n # Clone config values so we don't mess with them when expanding variables\n config.headers.each do |h|\n value = @headers.detect { |header| header['name'] == h['name'] }\n @headers << { 'name' => h['name'].dup, 'value' => h['value'].dup } unless value\n end if config.headers\n config.params.each do |p|\n value = @params.detect { |header| header['name'] == h['name'] }\n @params << { 'name' => h['name'].dup, 'value' => h['value'].dup } unless value\n end if config.params && request_class.REQUEST_HAS_BODY\n variables.substitute!(@params)\n variables.substitute!(@headers)\n\n # 2. Build URI\n variables.substitute!(@id) if @id\n uri_class = (@use_ssl || @use_ssl.nil? && config.use_ssl) ? URI::HTTPS : URI::HTTP\n port = @port || config.port || uri_class::DEFAULT_PORT\n variables.substitute!(port)\n host = @host || config.host\n variables.substitute!(host)\n @uri = uri_class.build( :host => host, :port => port )\n base_url = \"/#{@base_url || config.base_url}/\".squeeze('/')\n variables.substitute!(base_url)\n path = @path\n unless path\n path = \"#{base_url}#{@resource}\"\n path = \"#{path}/#{@id}\" if @id\n path = \"#{path}.#{@format}\" if @format && !@format.empty? && !@custom\n path = \"#{path}#{@custom.separator}#{@custom.name}\" if @custom\n end\n variables.substitute!(path)\n @uri.merge!(path)\n\n # 3. Build request\n case @operation\n when 'index', 'show' then request_class = Net::HTTP::Get\n when 'create' then request_class = Net::HTTP::Post\n when 'update' then request_class = Net::HTTP::Put\n when 'destroy' then request_class = Net::HTTP::Delete\n else\n if type = (@type || @custom && @custom.type)\n case type\n when 'get' then request_class = Net::HTTP::Get\n when 'post' then request_class = Net::HTTP::Post\n when 'put' then request_class = Net::HTTP::Put\n when 'delete' then request_class = Net::HTTP::Delete\n end\n else\n @failures << \"Missing request type for request on '#{@resource}'.\"\n return\n end\n end\n @request = request_class.new(@uri.to_s)\n username = @username || config.username\n variables.substitute!(username) if username\n password = @password || config.password\n variables.substitute!(password) if password\n if username && password\n @request.basic_auth(username, password)\n end\n form_data = Hash.new\n @headers.each { |header| @request[header['name']] = header['value'] }\n @params.each { |param| form_data[param['name']] = param['value'] }\n @request.set_form_data(form_data) unless form_data.empty?\n Log.request(@request)\n\n # 4. Send request and check response code\n @oks = @valid_codes.map { |r| r.to_s } if @valid_codes\n @oks ||= %w{200 201 202 203 204 205 206}\n end",
"def build_request path, opts = {}\n connection.build_request path, opts\n end",
"def request_params_all(request)\n request_params = HashWithIndifferentAccess.new\n request_params.merge!(request.params || {})\n\n # read post or put params. this will erase params\n # {code: 123, mode: 123}\n # \"code=123&mode=123\"\n request_body = request.body.read\n if request_body.present?\n body_params = begin\n JSON.parse(request_body) # {code: 123, mode: 123}\n rescue JSON::ParserError\n Rack::Utils.parse_nested_query(request_body) # \"code=123&mode=123\"\n end\n else\n body_params = {}\n end\n\n request_params.merge(body_params)\n end",
"def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end",
"def request_matching specs\n specs = specs_matching specs\n req = specs && pack_path(specs)\n req\n end",
"def make_conditions(params, model)\n search_string = params[SEARCH_KEY]\n filter_string = params[FILTER_KEY]\n if search_string && filter_string\n error 400, convert(body_for(:invalid_params, [FILTER_KEY]))\n elsif search_string\n words = search_string.downcase.split(\" \")\n { :_keywords => { '$all' => words } }\n elsif filter_string\n begin\n unsafe = QS_FILTER.parse(filter_string)\n sanitize(unsafe, model)\n rescue QueryStringFilter::ParseError\n error 400, convert(body_for(:invalid_filter, filter_string))\n end\n else\n {}\n end\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, storage=nil, &block)\n opts = opts.dup\n method_name = method_name.to_s\n storage ||= query_api_patterns\n before = opts.delete(:before)\n after = opts.delete(:after) || block\n defaults = opts.delete(:defaults) || {}\n params = opts.delete(:params) || {}\n headers = opts.delete(:headers) || {}\n options = opts.delete(:options) || {}\n options[:method_name] = method_name\n body = opts.delete(:body) || nil\n # Complain if there are any unused keys left.\n fail(Error.new(\"#{method_name.inspect} pattern: unsupported key(s): #{opts.keys.map{|k| k.inspect}.join(',')}\")) if opts.any?\n # Store the new pattern.\n storage[method_name] = {\n :verb => verb.to_s.downcase.to_sym,\n :path => path.to_s,\n :before => before,\n :after => after,\n :defaults => defaults,\n :params => params,\n :headers => HTTPHeaders::new(headers),\n :options => options,\n :body => body }\n end",
"def request_params\n rid = create_uuid\n request_type = params[:request_type]\n request_url = params[:url]\n request_parameters = params[:request_parameters]\n request_headers = params[:request_headers]\n request_payload = params[:request_payload]\n username = params[:username]\n password = params[:password]\n private_request = params[:private_request]\n\n request = Faraday.new\n\n # If authentication is filled out, apply it.\n request.basic_auth(username, password) if username.present?\n\n # Be nice and send a descriptive user agent. Also handy for debugging and\n # tracking down potential problems.\n request.headers['User-Agent'] = 'ReHTTP/v1.0'\n\n # Split the additional headers out into the name and value and then apply\n # then to the request.\n request_headers.split(\"\\r\\n\").each do |header|\n header_components = header.split(':')\n request.headers[header_components[0]] = header_components[1]\n end\n\n # Ensure the parameters are available before trying to create a new hash\n # from them.\n if request_parameters.present?\n request_params = Hash[request_parameters.split(\"\\r\\n\").map {|params| params.split('=') }]\n else\n request_params = {}\n end\n\n case request_type\n when 'GET'\n response = request.get(request_url, request_params)\n when 'POST'\n response = request.post(request_url, request_payload)\n when 'PUT'\n response = request.put(request_url, request_params)\n when 'DELETE'\n response = request.delete request_url\n when 'OPTIONS'\n response = request.options request_url\n when 'HEAD'\n response = request.head request_url\n when 'PATCH'\n response = request.patch request_url\n end\n\n {\n rid: rid,\n request_type: request_type,\n url: request_url,\n private_request: private_request,\n request_data: {\n headers: request.headers,\n data: {}\n }.to_json,\n response_data: {\n headers: response.headers,\n body: response.body,\n status: response.status\n }.to_json\n }\n end",
"def query_parameters\n end",
"def build_common_request\n common_set_body_contents\n set_receiver_id\n process_header\n add_body_to_header\n end",
"def params() request.params end",
"def get_buy_requests_query\n s1='\"properties\".\"order_type\" = '+\"'#{params[:property][:order_type]}'\"\n if params[:property][:property_type] != 0 && params[:property][:property_type] != \"NILL\" && params[:property][:property_type].present?\n s1=s1+\" AND \"+'\"properties\".\"property_type\" = '+\"'#{params[:property][:property_type]}'\"\n end\n if params[:property][:property_location] != 0 && params[:property][:property_location] != \"NILL\" && params[:property][:property_location].present? \n s1=s1+\" AND \"+'\"properties\".\"property_location\" = '+\"'#{params[:property][:property_location]}'\"\n end\n if params[:property][:property_locality] != 0 && params[:property][:property_locality] != \"NILL\" && params[:property][:property_locality].present? \n s1=s1+\" AND \"+'\"properties\".\"property_locality\" = '+\"'#{params[:property][:property_locality]}'\" \n end \n return s1\n end",
"def build_payload_request(payload, user)\n # Generate the params hash.\n parameters = payload['parameters'] || payload['params']\n\n # Build a request object.\n request = Hg::Request.new(\n user: user,\n intent: payload['intent'],\n action: payload['action'],\n parameters: parameters\n )\n end",
"def build_danske_generic_request\n common_set_body_contents\n set_receiver_id\n encrypted_request = encrypt_application_request\n add_encrypted_generic_request_to_soap(encrypted_request)\n\n process_header\n add_body_to_header\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n\n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n\n end\n\n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n\n return res.join(' > ')\n end",
"def params(search_string)\n { text: search_string, city: CITY, country: COUNTRY, key: KEY }.compact\n end",
"def query_params\n { v: version, prerelease: prerelease, nightlies: nightlies,\n p: platform, pv: platform_version, m: machine_arch }\n end"
] |
[
"0.65821856",
"0.65083283",
"0.64105535",
"0.6227571",
"0.61576045",
"0.5906652",
"0.59020334",
"0.5890922",
"0.58692807",
"0.5861532",
"0.5859799",
"0.58561933",
"0.5832082",
"0.58067083",
"0.5802134",
"0.5800186",
"0.57933646",
"0.5774031",
"0.57732654",
"0.574966",
"0.5723234",
"0.57203156",
"0.5713492",
"0.57008934",
"0.56910855",
"0.5690068",
"0.5688907",
"0.568632",
"0.5680535",
"0.5674869",
"0.5670859",
"0.566802",
"0.5663482",
"0.5660852",
"0.56439483",
"0.5620606",
"0.56159526",
"0.56159526",
"0.56138283",
"0.5599965",
"0.55865884",
"0.5580482",
"0.5578583",
"0.5560082",
"0.5532591",
"0.5529743",
"0.5508318",
"0.55040616",
"0.5494883",
"0.5493543",
"0.5489803",
"0.548884",
"0.54706186",
"0.5468962",
"0.54670405",
"0.54425704",
"0.5441961",
"0.54377973",
"0.5427185",
"0.54111993",
"0.5408222",
"0.539994",
"0.5390708",
"0.53903824",
"0.53903246",
"0.5385833",
"0.5384449",
"0.5382358",
"0.5369149",
"0.53582895",
"0.53513217",
"0.53511804",
"0.5348133",
"0.53463507",
"0.5344725",
"0.5339507",
"0.533466",
"0.5321566",
"0.53203964",
"0.5319048",
"0.5318613",
"0.53156614",
"0.5310692",
"0.5310587",
"0.53027517",
"0.5302357",
"0.529932",
"0.5298251",
"0.52982503",
"0.5290209",
"0.52716947",
"0.5269886",
"0.5268534",
"0.5259547",
"0.5257499",
"0.5253031",
"0.5250721",
"0.52506274",
"0.5246352",
"0.52402616"
] |
0.6095319
|
5
|
Create custom method_missing method If the called method is not explicitly defined then it tries to find the method definition in the QUERYlike patterns. And if the method is there it builds a request based on the pattern definition.
|
def method_missing(method_name, *args, &block)
begin
invoke_query_api_pattern_method(method_name, *args, &block)
rescue PatternNotFoundError
super
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end",
"def method_missing(method_name, *args)\n req(method_name.to_s)\n end",
"def method_missing(method, *args, &block)\n self.class.class_eval do\n attr_accessor method.to_sym\n\n # Defined a method according to the given method name\n define_method method.to_sym do\n obj = OpenStruct.new(request_options: @request_options)\n obj.extend Zcloudjp.const_get(method.capitalize.to_sym)\n instance_variable_set(:\"@#{method}\", obj)\n end\n end\n\n # Sends to the now-defined method.\n self.__send__(method.to_sym)\n end",
"def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end",
"def respond_to_missing?(method, include_private = false) #OK\n (method.to_s.start_with? \"find_by_\") || super\n end",
"def method_missing(name, *args, &block)\n if name.to_s =~ /^to_(\\w+)$/\n return send(name) if define_conversion($1)\n end\n raise \"Method '#{ name }' unknown\" # TODO use standard exception\n end",
"def method_missing(method, params={})\n call(method, params)\n end",
"def method_missing(method, *args)\n if (service = method.to_s.match(/^(ip|vlm|dns)_(site|subnet6?|pool6?|address6?|alias6?|domain|range|vlan|server|view|zone|rr)_(add|update|info|list|delete|count)$/))\n r_module, r_object, r_action = service.captures\n\n if (@servicemapper.has_key?(service.to_s))\n r_mapped_service = @servicemapper[service.to_s][0]\n end\n\n # case r_action with add, update, list, delete, count to set r_method\n case r_action\n when 'add'\n r_method = 'post'\n when 'update'\n r_method = 'put'\n when 'delete'\n r_method = 'delete'\n else\n r_method = 'get'\n end\n\n self.call(r_method, r_mapped_service, args)\n else\n super\n end\n end",
"def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end",
"def method_missing(method_name, *args) self end",
"def method_missing(method_name, *args) self end",
"def method_missing(method, *args, &block)\n if name?(method.to_sym)\n find(method.to_sym)\n else\n super\n end\n end",
"def method_missing(meth, *args); end",
"def method_missing(meth, *args) = parameters.has_key?(meth) ? parameters[meth] : meth",
"def method_missing(methodSymbol, *params)\n methodString = methodSymbol.to_s.gsub!(\"_\", \".\")\n # TODO: check here for valid method names\n call_method(methodString, params.first.update(:format=>\"JSON\"))\n end",
"def method_missing(m, *args)\n\n if m.to_s.eql?('describe')\n self.client.describe\n elsif m.to_s.eql?('search')\n self.client.search(args[0])\n else\n #todo We need to add a list of available 'methods' here to gut check\n begin\n self.client.find(m.to_s, args[0])\n rescue\n super\n end\n end\n\n end",
"def method_missing(method_name, *args)\n # TODO: Add permission checking for all updates to the model\n # TODO: Add permission checking for read access?\n\n update = method_name.to_s[-1..-1] == '='\n\n shortcut = if update \n method_name.to_s[0..-2]\n else\n method_name.to_s\n end\n\n # Otherwise, check for the RDF predicate\n registered = N::URI[shortcut.to_s]\n\n return super(method_name, *args) unless(registered) # normal handler if not a registered uri\n raise(ArgumentError, \"Must give a namspace as argument\") unless(registered.is_a?(N::Namespace))\n\n DummyHandler.new(registered, self)\n end",
"def method_missing(method_name, *args)\n # TODO: Add permission checking for all updates to the model\n # TODO: Add permission checking for read access?\n \n update = method_name.to_s[-1..-1] == '='\n \n shortcut = if update \n method_name.to_s[0..-2]\n else\n method_name.to_s\n end\n\n # Otherwise, check for the RDF predicate\n registered = N::URI[shortcut.to_s]\n \n return super(method_name, *args) unless(registered) # normal handler if not a registered uri\n raise(ArgumentError, \"Must give a namspace as argument\") unless(registered.is_a?(N::Namespace))\n \n DummyHandler.new(registered, self)\n end",
"def method_missing(method, *args, &block)\n if Parser::PROPERTIES.include?(method)\n self.class.define_property_method(method)\n send(method, *args, &block)\n elsif Parser::METHODS.include?(method)\n self.class.define_method_method(method)\n send(method, *args, &block)\n elsif method.to_s =~ /([a-z_]+)\\?/ and (Parser::PROPERTIES + Parser::METHODS).include?($1.to_sym)\n self.class.define_question_method($1)\n send(method)\n else\n super\n end\n end",
"def method_missing(method, *args) #:nodoc:\n self[method]\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, storage=nil, &block)\n opts = opts.dup\n method_name = method_name.to_s\n storage ||= query_api_patterns\n before = opts.delete(:before)\n after = opts.delete(:after) || block\n defaults = opts.delete(:defaults) || {}\n params = opts.delete(:params) || {}\n headers = opts.delete(:headers) || {}\n options = opts.delete(:options) || {}\n options[:method_name] = method_name\n body = opts.delete(:body) || nil\n # Complain if there are any unused keys left.\n fail(Error.new(\"#{method_name.inspect} pattern: unsupported key(s): #{opts.keys.map{|k| k.inspect}.join(',')}\")) if opts.any?\n # Store the new pattern.\n storage[method_name] = {\n :verb => verb.to_s.downcase.to_sym,\n :path => path.to_s,\n :before => before,\n :after => after,\n :defaults => defaults,\n :params => params,\n :headers => HTTPHeaders::new(headers),\n :options => options,\n :body => body }\n end",
"def method_missing(method, *args)\n ## If not loaded, load and retry.\n unless loaded\n return self.get.send(method, *args)\n end\n\n\n ## Otherwise, try to match against attributes, then objects, then links.\n method = method.to_s\n if method[-1,1] == '='\n return attributes[method[0..-2]] = args.first if attributes && attributes.has_key?(method[0..-2])\n else\n return attributes[method] if attributes && attributes.has_key?(method.to_s)\n return objects[method] if objects && objects[method]\n if links && links[method]\n if args.count > 0\n return links[method].where(*args)\n else\n return links[method]\n end\n end\n end\n\n raise NoMethodError, \"undefined method `#{method}' for #{self.inspect}\"\n end",
"def respond_to_missing?( method, include_private = false )\n super || (method.to_s =~ METHOD_NAME_REGEXP ) || true\n end",
"def method_missing(*rest) end",
"def method_missing(method)\n\t\t self[method]\n\t\tend",
"def method_missing(name, *args)\n raise \"MethodMissing loop when searching for #{name} with #{args.inspect}\" if searching_for_method?\n @searching_for_method = true\n return create_resource(name, args[0], args[1]) if valid_type?(name)\n\n name = map_function(name)\n\n return call_function(name, args) if Puppet::Parser::Functions.function(name)\n\n super\n ensure\n @searching_for_method = false\n end",
"def method_missing(input)\n\t\tself.checkMethod(input.to_s)\n\tend",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args); end",
"def create_match_method(name)\n \n instance_variable_name = :\"@#{name}_implementations\"\n \n instance_variable_set(instance_variable_name, [])\n klass = self\n \n define_method(name) do |*arguments|\n clauses = klass.instance_variable_get(instance_variable_name)\n pattern, proc = clauses.find do |pattern, proc| \n pattern === arguments\n end\n \n unless proc\n begin\n super(*arguments)\n rescue NoMethodError => e\n patterns = clauses.map(&:first)\n raise NoMethodError.new(\"There is no Method matching these Arguments: #{arguments.inspect}, available patterns: #{patterns.inspect}\")\n end\n else\n instance_exec(*arguments, &proc)\n end\n \n end\n end",
"def method_missing(method, *arguments, &block); end",
"def method_missing method, *params, &block\n __tag_and_raise__ NoMethodError.new(method) if ProhibitedNames.include?(method)\n\n case\n # assignment in conditionals is usually a bad smell, here it helps minimize regex matching\n when (name = method[/^\\w+$/, 0]) && params.length == 0\n # the call is an attribute reader\n\n return self.class.new.freeze if frozen? and not @hash.has_key?(method)\n self.class.send :__define_attribute__, name\n\n return send(method) if @hash.has_key? method\n\n # close the scope for storing call chain\n parent = self\n nested_blobject = self.class.new\n\n store_in_parent = lambda do\n parent.send \"#{name}=\", nested_blobject\n nested_blobject.send :remove_instance_variable, :@store_in_parent\n end\n\n nested_blobject.instance_variable_set :@store_in_parent, store_in_parent\n\n return nested_blobject\n\n when (name = method[/^(\\w+)=$/, 1]) && params.length == 1\n # the call is an attribute writer\n\n self.class.send :__define_attribute__, name\n return send method, params.first\n\n when (name = method[/^(\\w+)\\?$/, 1]) && params.length == 0\n # the call is an attribute checker\n\n self.class.send :__define_attribute__, name\n return send method\n end\n\n super\n end",
"def method_missing(method, *args, &block)\n if method.to_s =~ /(to_)(.*)/ && prefix = Prefix.for($2.to_sym)\n return self.with_prefix(prefix)\n elsif method.to_s =~ /(alternatives_by_)(.*)/ && self.respond_to?($2.to_sym)\n return self.alternatives($2.to_sym)\n end\n super\n end",
"def method_missing(method_name, params = {})\n component, *action = method_name.to_s.split('__')\n component = component.to_sym\n action = !action.empty? && action.join(\"__\").to_sym\n\n if action\n if components[component]\n # only actions starting with \"endpoint_\" are accessible\n endpoint_action = action.to_s.index('__') ? action : \"_#{action}_ep_wrapper\"\n component_instance(component).send(endpoint_action, params)\n else\n component_missing(component)\n end\n else\n super\n end\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, &block)\n self.class.query_api_pattern(method_name, verb, path, opts, @query_api_patterns, &block)\n end",
"def method_missing(method_id, *params)\n _request(method_id.to_s.sub('_api', ''), *params)\n end",
"def method_missing(method, *args)\n self[method]\n end",
"def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end",
"def method_missing(method, *args, &block); end",
"def method_missing(method_name, *args)\n call_api_method(method_name, *args)\n end",
"def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end",
"def method_missing(method_name, *args, &block)\n # Quick check to see if changes or was are being called, this check\n # keeps us from needing to parse out the parts if we're not going\n # to use them.\n if method_name =~ /[_](changes|was)$/\n # Break apart the method call\n # TODO: no destructuring because of https://github.com/opal/opal/issues/663\n *parts = method_name.to_s.split('_')\n action = parts.pop\n key = parts.join('_').to_sym\n\n # Handle changes or was calls.\n case action\n when 'changes'\n return changes(key)\n when 'was'\n return was(key)\n end\n end\n\n # Otherwise, run super\n super\n end",
"def method_missing(method, *args, &blk); end",
"def method_missing(meth, *args, &block)\n\n end",
"def method_missing method, *args, &block\n case method.to_s\n when /^of_(.*)$/\n return self.of($1, *args, &block)\n when /^and_(.*)$/\n return self.and($1, *args, &block)\n end\n\n return to_proc.send method, *args, &block if Proc.instance_methods.include? method\n\n super\n end",
"def method_missing(name, *args); end",
"def method_missing(name, *args); end",
"def method_missing(method, *args)\n send(method, *args)\n end",
"def method_missing *args, &blk\n if m = caller.first.match(/^(#{__FILE__}:\\d+):in `method_missing'$/) # protect against a typo within this function creating a stack overflow\n raise \"Method missing calling itself with #{args.first} in #{m[1]}\"\n end\n is_built_in = false\n # If you define a method named get,post,create,etc don't require the method type\n if Endpoint::BUILT_IN_METHODS.include?(args.first) && !Endpoint::BUILT_IN_METHODS.include?(args[1])\n name = args.shift\n\n if Endpoint::BUILT_IN_MAP.has_key?(name.to_sym)\n method = name.to_sym\n is_built_in = true\n else\n method = Endpoint::BULT_IN_MAP.find do |meth,aliases|\n aliases.include?(name)\n end\n\n method = method[0] if method\n end\n else\n name = args.shift\n method = args.shift if args.first.is_a?(Symbol)\n end\n name = name.to_sym\n\n method ||= :get\n \n options = args.shift||{}\n options[:requires] ||= []\n options[:requires] = [options[:requires]] unless options[:requires].is_a?(Array)\n options[:into] ||= blk if block_given?\n @_endpoint.method_inflate_into[name] = options[:into]\n\n @_endpoint.class_eval <<-RUBY, __FILE__, __LINE__\n def #{name} force_params={}, args={}\n params = #{(options[:default]||{}).inspect}.merge(force_params)\n #{(options[:requires]||[]).inspect}.each do |req|\n raise RequiredParameter, \"#{name} endpoint requires the \"<<req<<\" paramerter\" unless params.include?(req.to_sym) || params.include?(req.to_s)\n end\n\n if #{is_built_in.inspect}\n super(params,args)\n else\n transform_response(#{method}(params,args),method_inflate_into[#{name.inspect}])\n end\n end\n RUBY\n end",
"def method_missing method, *args, &block\n if args.size > 1\n raise ArgumentError.new \"wrong number of arguments (#{args.size} for 0..1)\"\n end\n\n args.push({}) if args.size == 0\n\n method = method.to_s.split('_').inject([]){ |b,e| b.push(b.empty? ? e : e.capitalize) }.join\n\n call(method, args[0])\n end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing method, *args, &block\n self.class.send(:define_method, method) do \n return @fields[method.to_sym]\n end\n self.send method, *args, &block\n end",
"def method_missing(method_sym, *arguments, &block)\n method = method_sym.to_s\n\n #puts \"%s %s %s\" % [\"---- \", method, \" ----\"]\n #\n if method =~ /^[A-Z]\\d{2}(_\\d{2})?/\n Array(parse(get_spec(method))).join(', ') rescue ''\n elsif respond_to?((/(\\w+)/.match(method))[0])\n instance_eval(method) rescue ''\n # for testing:\n elsif %w(E_STRING E_MULTI_STRING E_NUMBER E_DATETIME E_DATE E_TIME E_YES_NO E_SINGLE E_MULTIPLE E_ALLOW_NEGATIVE E_LOOKUP).include?(method)\n Array(parse(get_spec(method))).join(', ') rescue ''\n else\n super\n end\n end",
"def method_missing(:name, *args)\nend",
"def method_missing( missing, *args )\n candidates = methods_that_sound_like( missing.to_s )\n message = \"You called an undefined method: #{missing}.\"\n unless candidates.empty?\n message += \"\\nDid you mean #{candidates.join(' or ')}?\"\n\t\tend\n raise raise NoMethodError.new( message )\n end",
"def method_missing(mth, *args, &block); end",
"def method_missing(meth, *args, &block)\n\t\t@r.send(meth, *args, &block)\n\tend",
"def method_missing(meth, *args, &block)\n if object\n begin\n object.send(meth, *args, &block)\n rescue\n if meth.to_sym == :url\n \"/#{object.class.to_s.underscore.pluralize}/#{object.id}\"\n else\n \"No method #{meth} found for decorated #{object.class.to_s}\"\n end\n end\n else\n placeholder(meth)\n end\n end",
"def respond_to_missing?(method_name, include_private = false)\n Query.instance_methods(false).include?(method_name) || super\n end",
"def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end",
"def method_missing sym, *args, &block # :nodoc:\n meth, name = missing_method_name( sym )\n if name\n self.send(meth) do |job|\n # I can't remember why I'm using union... :/\n # job.send(name).to_s.gsub(/-/, \"_\") =~ Regexp.union( args.map(&:to_s) )\n # args is an array because of method_missing. but find(_all)_by only\n # takes one parameter (for now..)\n # to_s for symbols, also removes warnings if given a regexp with options.\n arg = args.first.to_s #.gsub(/-/, \"_\")\n regex = Regexp.new(arg, Regexp::IGNORECASE)\n # gsub used so I can pass in symbols as names (which don't allow dashes\n # to_s as job.url returns a URI\n job.send(name).to_s.gsub(/-/, \"_\") =~ regex\n end\n else\n super sym, *args, &block\n end\n end",
"def method_missing(meth, *args, &block)\n Interrogate.is_interrogatory?(meth) ? Interrogate.interrogate(meth, *args, &block) : super\n end",
"def respond_to_missing?(method_name, include_private = false)\n #Basically this is doing the exact same thing as the above regular expression\n # method, except we are doing it on one line of code.\n #Taking the method name as the argument, converting it to a string, and checking\n #to see if it starts with author and if it does it will return true\n #if false then it will return super.\n method_name.to_s.start_with?('author_') || super\n end",
"def respond_to_missing?(method, include_private = true)\n method.to_s.end_with?(ACTION_SUFFIX) || super\n end",
"def method_missing(method_name, *args)\n\t\tif DELEGATED_METHODS.include?(method_name)\n\t\t\t@user.send(method_name, *args)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def method_missing(msg, *args, &block)\n puts \"#{self.class}#method_missing(#{msg})\" \n proc = self.singleton_class.resolve_dynamic_method(msg) || self.class.resolve_dynamic_method(msg)\n\n begin\n if !proc.nil?\n args.unshift self \n res = if block.nil?\n proc.call(*args)\n else\n proc.call(*args, &block)\n end\n return res\n elsif msg != :method_missing! && self.respond_to?(:method_missing!)\n puts \"\\tdelgating to method_missing!\"\n return method_missing!(msg, *args, &block)\n else\n return super(msg, *args, &block)\n # TODO - report RM bug for when block is empty\n end\n rescue NoMethodError => ex\n new_ex = NoMethodError.new(\"undefined method \\`#{msg}' for #{self.inspect}:#{self.class}\")\n new_ex.set_backtrace ex.backtrace\n raise new_ex\n end\n end",
"def method_missing(name, *args)\n api_method = get_api_method(name)\n\n if api_method\n call_api_method(api_method, *args)\n else\n super(name, *args)\n end\n end",
"def method_missing( sym, *args )\n\t\tself.log.debug \"Dynamic dispatch to %p with args: %p\" % [ sym, args ]\n\n\t\t# First, if the entry hasn't yet been loaded, try loading it to make sure the\n\t\t# object is already extended with any applicable objectClass mixins. If that ends\n\t\t# up defining the method in question, call it.\n\t\tif (( meth = self.entry_method(sym) ))\n\t\t\treturn meth.call( *args )\n\t\tend\n\n\t\t# Next, super to rdn-traversal if it looks like a reader but has arguments\n\t\tplainsym, methodtype = attribute_from_method( sym )\n\t\treturn super if methodtype == :reader && !args.empty?\n\n\t\t# Now make a method body for a new method based on what attributeType it is if\n\t\t# it's a valid attribute\n\t\tattrtype = self.find_attribute_type( plainsym ) or return super\n\t\tmethodbody = case methodtype\n\t\t\twhen :writer\n\t\t\t\tself.make_writer( attrtype )\n\t\t\twhen :predicate\n\t\t\t\tself.make_predicate( attrtype )\n\t\t\telse\n\t\t\t\tself.make_reader( attrtype )\n\t\t\tend\n\n\t\t# Define the new method and call it by fetching the corresponding Method object\n\t\t# so we don't loop back through #method_missing if something goes wrong\n\t\tself.class.send( :define_method, sym, &methodbody )\n\t\treturn self.method( sym ).call( *args )\n\tend",
"def method_missing(method_name, *args, &block)\n if self.has_key?(method_name.to_s)\n self.[](method_name, &block)\n elsif self.body.respond_to?(method_name)\n self.body.send(method_name, *args, &block)\n elsif self.request[:api].respond_to?(method_name)\n self.request[:api].send(method_name, *args, &block)\n else\n super\n end\n end",
"def respond_to_missing?(method, include_private = false)\n method.to_s.start_with?('generates_') || super\n end",
"def method_missing(method_name, *args)\n warn \"Method missing '#{method_name}'\"\n # if (method_name =~ /request_(.+)/)\n # property.key?($1) ? property.send($1) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n # elsif (method_name =~ /configure_(.+)/)\n # property.key?($1) ? property.send(\"[]=\", $1, *args) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n # else\n super\n # end\n end",
"def method_missing(*args, &block); end",
"def respond_to_missing?(method, include_all = false)\n instance_variable_get(\"@#{method}\".to_sym) || super\n end",
"def method_missing(missing, *args)\n candidates = methods_that_sound_like(missing.to_s)\n\n message = \"You called an undefined method: #{missing}\"\n\n unless candidates.empty?\n message += \"\\nDid you mean #{candidates.join(' or ')}?\"\n end\n\n raise NoMethodError.new(message)\n end",
"def method_missing(meth, *args)\n hyves_method = meth.to_s.gsub('_', '.')\n options = {:ha_method => hyves_method}\n options.merge!(args.first) if args.first.is_a?(Hash)\n hyves_log('Hyves', \"Sent request: #{options.inspect}\")\n response = request(options)\n hyves_log('Hyves', \"Got response: #{response.inspect}\")\n return response\n end",
"def method_missing(method_name, *args)\n warn \"Method missing: '#{method_name}'\"\n if (method_name =~ /request_(.+)/)\n property.key?($1) ? property.send($1) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n elsif (method_name =~ /configure_(.+)/)\n property.key?($1) ? property.send(\"[]=\", $1, *args) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n else\n super\n end\n end",
"def method_missing(func, *params)\n @reagent.send(func, *params) \n end",
"def add_convenience_method(name_, pattern_, indexes_)\n @mutex.synchronize do\n raise ConfigurationLockedError if @locked\n name_ = name_.to_sym\n if @methods.has_key?(name_)\n raise IllegalConfigurationError, \"Factory method already exists\"\n end\n @methods[name_] = [pattern_, indexes_]\n end\n self\n end",
"def respond_to_missing?(method_symbol, *args, &block)\n block.nil? && args.length == 1 && !method_symbol.match(/^to_/) || super\n end",
"def respond_to_missing?(method, include_private = false)\n @source_data.respond_to?(\"get_#{method}\") || super\n end",
"def lookup(method_name, args)\n # puts \"Looking up method #{method_name} with #{args} arguments\"\n if @methods[[method_name, args]]\n # puts \"Found #{method_name} (#{args} args)\"\n @methods[[method_name, args]]\n elsif @superclass\n @superclass.lookup(method_name, args)\n else\n raise \"Method not found: #{method_name}\"\n end\n end",
"def method_missing(m, *args, &block)\n # Attempt to call a method on the object directly\n if(method_names.index(m.to_s))\n $DEBUG and puts(\"Attempting to invoke_method '#{m}'\")\n invoke_method(get_method(m.to_s), args)\n else\n super.method_missing(m, *args, &block)\n end\n end",
"def method_missing(method_symbol, *args)\n method = method_symbol.to_s\n method = $1 if method =~ /(.+)=$/\n if args.length > 0\n self[method] = args[0]\n else\n self[method]\n end\n end",
"def define_request_methods\n\t MODEL_CLASSES.each do |request_class|\n\t endpoint_instance = request_class.new(self)\n\t create_methods_from_instance(endpoint_instance)\n\t end\n\t end",
"def method_missing(method, *args)\n api_obj.send(method, *args)\n end",
"def method_missing(method, *args)\n self.get unless self.loaded\n\n [:attributes, :objects, :links].each do |field|\n if self.send(field).respond_to?(method)\n if self.class == HyperResource\n define_singleton_method(method) do |*argz|\n self.send(field).send(method, *argz)\n end\n else\n self.class.send(:define_method, method) do |*argz|\n self.send(field).send(method, *argz)\n end\n end\n return self.send(field).send(method, *args)\n end\n end\n super\n end",
"def method_missing(method, *args, &block)\n if match = /^func_(.*)$/i.match(method.to_s)\n return Soroban::Functions.call(self, match[1], *args)\n elsif match = /^([a-z][\\w]*)=$/i.match(method.to_s)\n return _add(match[1], args[0])\n end\n super\n end",
"def method_missing(method_sym, *arguments, &block)\n if self[\"#{method_sym.to_s}\"] != nil\n self[\"#{method_sym.to_s}\"]\n else\n super\n end\n end",
"def respond_to_missing?(method_name, include_private = false)\n valid?(method_name) || super\n end",
"def respond_to_missing?(method_name, include_private = false)\n /^(?<id>[^=]+)=?$/ =~ method_name.to_s && self[id] || super\n end",
"def method_missing(meth, *args, &block)\n # Check to see if it can be evaluated\n if(matches? meth)\n #Defines the method and caches it to the class\n self.class.send(:define_method, meth) do\n if element_id_exists_method?(meth)\n if respond_to?(meth.to_s.chop)\n begin\n send meth.to_s.chop\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n return false\n end\n return true\n end\n elsif wait_method?(meth)\n send :wait_for, meth.to_s.sub('wait_for_','').to_sym\n elsif navigate_method?(meth)\n send :navigate_to, instance_variable_get(\"@#{meth.to_s.sub('navigate_to_','')}\")\n elsif element_id_method?(meth)\n @driver.find_element(:id, meth)\n end\n end\n # calls the method\n send meth, *args, &block\n else\n super\n end\n end",
"def method_missing(method, **args, &block)\n path = method.to_s.split(\"_\", 2).join(\"/\")\n args.merge!(access_token: access_token)\n case path\n when /create$/\n raw_post path, args\n else\n raw_get path, args\n end\n end",
"def method_missing(name, *args)\n options = args.first\n options = {} unless options.kind_of?(Hash)\n method_name = toCamel(name)\n get(options.merge(:method => method_name))\n end",
"def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend"
] |
[
"0.68908876",
"0.6640613",
"0.6578027",
"0.6505683",
"0.6474533",
"0.63532174",
"0.63520944",
"0.63334846",
"0.6246511",
"0.62444043",
"0.62444043",
"0.6210736",
"0.6193969",
"0.6192093",
"0.6170323",
"0.6157224",
"0.61466014",
"0.6145581",
"0.61400056",
"0.61383915",
"0.6127945",
"0.6103989",
"0.60996145",
"0.60927236",
"0.60867757",
"0.6085285",
"0.6071324",
"0.60648334",
"0.60648334",
"0.60648334",
"0.6044841",
"0.6044841",
"0.60306954",
"0.6026597",
"0.6024746",
"0.60079277",
"0.6002918",
"0.60017365",
"0.5992882",
"0.5986845",
"0.5973327",
"0.5968968",
"0.5963053",
"0.5946102",
"0.59411526",
"0.5918026",
"0.591561",
"0.5896926",
"0.5881671",
"0.5881671",
"0.58766735",
"0.5876636",
"0.5871091",
"0.5869328",
"0.5869328",
"0.5869328",
"0.5869328",
"0.58676535",
"0.5850636",
"0.5842219",
"0.58269304",
"0.5824763",
"0.5821605",
"0.58180445",
"0.5802328",
"0.5797054",
"0.57912415",
"0.57903945",
"0.5784832",
"0.5783043",
"0.57829034",
"0.5774882",
"0.5766197",
"0.57646686",
"0.5759306",
"0.5752608",
"0.5748733",
"0.5746138",
"0.5738431",
"0.5736513",
"0.5733967",
"0.5732259",
"0.57275444",
"0.5725162",
"0.57238597",
"0.57213026",
"0.57208997",
"0.57191765",
"0.5713065",
"0.57122546",
"0.5712084",
"0.57080746",
"0.5701625",
"0.5694891",
"0.568799",
"0.56760275",
"0.566356",
"0.5663183",
"0.5661618",
"0.56601286"
] |
0.7029882
|
0
|
Computes the path for the API request
|
def compute_query_api_pattern_path(query_api_method_name, container, used_query_params)
container[:path] = compute_query_api_pattern_param(query_api_method_name, container[:path], container[:params_with_defaults], used_query_params)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_path\n path = %w(api where)\n path.concat api_method\n path = path.join('/')\n @path = \"/#{path}.json\"\n end",
"def build_request_path()\n path = \"/#{self.action}\"\n if query_string = build_query_string\n path += \"/#{query_string}\"\n end\n path\n end",
"def request_path; end",
"def request_path(end_point)\n \"/api/v#{@api_version}/#{end_point}\"\n end",
"def api_path(path)\n \"#{options[:base_path]}/#{path}\" || \"/#{path}\"\n end",
"def request_path\n current = requester\n path = []\n\n while current do\n path << current.spec.full_name\n\n current = current.request.requester\n end\n\n path\n end",
"def path ; @request.path_info ; end",
"def api_path\n @api_path ||= find_api_path(base_uri)\n end",
"def api_url(path)\n path\n end",
"def path\n # if an api_version is specified and the path does not already contain\n # one, prepend it to the path\n api_version = raw_options[:api_version] || Blupee.config.api_version\n \"/#{api_version}/#{raw_path}\"\n end",
"def build_urlpath\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n extra_params = erb.formatted_url_path(@arguments)\n render json: { success: extra_params }, status: 200\n end\n end",
"def path\n request.path\n end",
"def request_path\n [request.base_url, request.path].join\n end",
"def api_path(path)\n \"/rest/v#{options[:api_version]}/#{path}\"\n end",
"def _path uri, subject\n [uri.request_uri, subject].join\nend",
"def _path uri, subject\n [uri.request_uri, subject].join\nend",
"def path(request)\n request.path\n end",
"def request_uri(path)\n \"#{@api_url}#{path}\"\n end",
"def request_path(params = {})\n self.class.build_request_path(params.merge(attributes.dup))\n end",
"def path\n parse_request! if @path.nil?\n @path\n end",
"def base_path\n \"/api/v1\"\n end",
"def path_component\n path_component = \"/#{self.class.endpoint_name}\"\n path_component += '/' + key_value if key_value\n path_component\n end",
"def path\n metadata.fetch(:path) do\n return if request_response_pairs.empty?\n request_response_pairs.first.first.path\n end\n end",
"def request_path\n \"/nodes/id/681e84fd-b06b-4044-9c51-2b74a9e2dc24/storage/id/d66570fa-9d51-4f6e-ab26-bdace295353e\"\nend",
"def api_path(path)\n \"/services/data/v#{@options[:api_version]}/#{path}\"\n end",
"def path\n return @path if defined?(@path)\n @path = headers[PATH_KEY]\n @path = @path.split('?').first if @path\n end",
"def api_path(*args)\n ver = api_version.presence\n arg = args.flatten.join('/').strip\n uri = URI.parse(arg)\n qry = uri.query.presence\n path = uri.path.presence\n host = uri.host.presence\n url =\n if host\n rel = (host == base_uri.host)\n scheme = uri.scheme.presence || (base_uri.scheme.presence if rel)\n port = uri.port.presence || (base_uri.port.presence if rel)\n scheme ||= 'https'\n port &&= nil if COMMON_PORTS.include?(port)\n [scheme, \"//#{host}\", port].compact.join(':')\n end\n base = base_uri.path.presence\n base = base&.split('/')&.compact_blank!&.presence\n path = path&.split('/')&.compact_blank!&.presence\n ver = nil if ver && (base&.include?(ver) || path&.include?(ver))\n base = base&.join('/')\n path = path&.join('/')\n path = \"#{base}/#{path}\" if base && path && !path.start_with?(base)\n [url, ver, *path].compact_blank!.join('/').tap do |result|\n result << \"?#{qry}\" if qry\n end\n end",
"def resource_api_path(path=nil)\n @resource_api_path = path if path\n @resource_api_path || \"1.0/#{self.path}\"\n end",
"def build_path\n @path_values.inject(base_value){|uri,path| uri.merge URI::Generic.build(path: path) }.path\n end",
"def api_path(*args)\n \"/v#{api_version}/#{args.unshift(api_tier).compact.join('/')}\"\n end",
"def api_path\n parent.api_path\n end",
"def path(params = {})\n rep_for_params!(params).path(params)\n end",
"def path\n @uri.request_uri\n end",
"def url(path)\n \"#{API}/#{path}\"\n end",
"def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end",
"def get_path\n request_object.path\n end",
"def path_component\n path_component = \"/#{self.class.endpoint_name}\"\n if key_value\n path_component += '/' + key_value\n end\n path_component\nend",
"def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end",
"def request_uri(path)\n \"/#{API_VERSION}/#{path}\"\n end",
"def build_path\n end",
"def path\n '%s/%s/' % [root, (@node.http.route if @node)]\n end",
"def get_api_url_for(path)\n\t\treturn ('https://api.spotify.com' << path)\n\tend",
"def request_path(path, version: API_VERSION, personal_access_token: nil, oauth_access_token: nil)\n full_path = File.join('/api', version, path)\n\n if oauth_access_token\n query_string = \"access_token=#{oauth_access_token}\"\n elsif personal_access_token\n query_string = \"private_token=#{personal_access_token}\"\n end\n\n if query_string\n full_path << (path.include?('?') ? '&' : '?')\n full_path << query_string\n end\n\n full_path\n end",
"def path\n @path ||= Rack::Utils.unescape(request.path_info)\n end",
"def url_path\n @path ||= params[:path].present? ? params[:path].split('/') : []\n end",
"def api_path\n @api_path ||= \"/api/security/permissions/#{url_safe(name)}\"\n end",
"def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end",
"def get path\n uri = BASE_URI.dup.tap do |uri|\n uri.path = path\n end\n\n @http.get uri, headers: REQUEST_HEADERS\n end",
"def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end",
"def api_path(path)\n \"/v3/company/#{options[:realm_id]}/#{path}\"\n end",
"def getApiRoute(endpoint)\n apiRoute = $drugbank_api + $drugbank_region\n\n if $drugbank_region != \"\"\n apiRoute = apiRoute + \"/\" \n end \n\n return apiRoute + endpoint\n\nend",
"def path()\n\t\t\t\t@basePath + \"/\" + hierarchy().join( \"/\" )\n\t\t\tend",
"def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end",
"def endpoint_for(path)\n File.join(MemoTomato::ROOT_URL, \"#{path}.json\")\n end",
"def path\n \"/\" + @prefix.join(\"/\")\n end",
"def return_api_path(array)\n api_version = '1.0'\n return \"/#{api_version}/#{array.join('/')}\"\n end",
"def path\n ensure_valid\n @path\n end",
"def path\n return @path\n end",
"def path\n\t\t@path\n\tend",
"def handle_get_request(client_request)\n parse_uri(client_request)\n path_name(uri)\n end",
"def build_path path, params = {}\n params.size > 0 ? [path, hash_to_params(params)].join(\"?\") : path\n end",
"def path_setup\n raise ArgumentError, \"Required path param missing\" unless path_params?\n path_params.values.join(\".\")\n end",
"def api_url(path)\n return path if path.include?('//')\n \"#{api_root}/#{api_version}/#{tenancy_code}/#{path}\"\n end",
"def path\n query_parts = []\n @query.each_pair { |key, value| query_parts << \"#{key}=#{URI.escape(value)}\" }\n query_parts.length > 0 ? \"#{@path}?#{query_parts.join('&')}\" : @path\n end",
"def request_path\n @path = controller_path + '#' + action_name\n def @path.is(*str)\n str.map{|s| self.include?(s)}.include?(true)\n end\n end",
"def path(v)\n endpoint_info[:path] = v\n end",
"def path\n return @path unless @path.nil?\n\n substitute_keys_with(@route_params)\n substitute_keys_with(known_params)\n @path = @route\n end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def make_url(apipath)\n @base_url + \"/api/open-v1.0/\" + apipath\n end",
"def path\n return get_path self\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def base_dir_for_path_parameters; end",
"def get_metadata_request_path(metadata_path)\n return \"/\" + metadata_path.join(\"/\")\n end",
"def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end",
"def api_url path, params = {}\n url = File.join File.join(api_base_url, api_base_path), path\n \"#{url}?#{api_query_string params}\"\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n path_for({})\n end",
"def path\n URI.parse(@url).path\n end",
"def path(*) end",
"def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end",
"def api_path\n if remote?\n \"drives/#{@remote_drive_id}/items/#{@remote_id}\"\n else\n \"drive/items/#{@id}\"\n end\n end",
"def request_path current\n path = []\n\n while current do\n requirement = current.request.dependency.requirement\n path << \"#{current.spec.full_name} (#{requirement})\"\n\n current = current.parent\n end\n\n path = ['user request (gem command or Gemfile)'] if path.empty?\n\n path\n end",
"def build_request_url(path, params)\n\t\t\t\t\tURI::HTTP.build :host => API_SERVER,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:path => \"#{API_BASE}/#{path}\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t:query => params.map {|k,v| \"#{k}=#{v}\"}.join('&')\n\t\t\t\tend",
"def path\n @uri.path\n end",
"def path\n end",
"def keys_path_base(request, client_or_user_name = nil)\n rest_path = (rest_path || request.rest_path).dup\n rest_path = rest_path.dup\n case rest_path[-2]\n when \"users\"\n rest_path[-2] = \"user_keys\"\n when \"clients\"\n rest_path[-2] = \"client_keys\"\n else\n raise \"Unexpected URL #{rest_path.join(\"/\")}: cannot determine key path\"\n end\n rest_path << \"keys\"\n rest_path\n end",
"def url_for(path, opts = {})\r\n api_host = opts[:api_host] || Moviepilot.config.api_host\r\n version = opts[:api_version] || Moviepilot.config.api_version\r\n [api_host, version, path].join('/')\r\n end",
"def path() end",
"def path() end",
"def path() end",
"def path\n\t\trequest.original_fullpath\n\tend",
"def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end",
"def api_base_path\n \"/lol/platform/#{api_version}\"\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end"
] |
[
"0.8110587",
"0.7501966",
"0.7481521",
"0.74205613",
"0.7340097",
"0.7314376",
"0.7255199",
"0.7254122",
"0.72255975",
"0.71835375",
"0.71815455",
"0.7157831",
"0.71500844",
"0.71145463",
"0.70081943",
"0.70081943",
"0.7006095",
"0.69952446",
"0.69499505",
"0.6946979",
"0.6930333",
"0.69223386",
"0.6912716",
"0.68957657",
"0.68808997",
"0.6841561",
"0.6840266",
"0.6818236",
"0.6778003",
"0.6770699",
"0.6750036",
"0.672308",
"0.6709473",
"0.6695423",
"0.6690903",
"0.6689004",
"0.66851526",
"0.66677207",
"0.66574",
"0.6652118",
"0.66228753",
"0.66045964",
"0.6603358",
"0.6586155",
"0.6539324",
"0.65312743",
"0.6524883",
"0.65148",
"0.6508297",
"0.65044564",
"0.64975876",
"0.64903057",
"0.64886093",
"0.64881426",
"0.64793134",
"0.6474878",
"0.6463203",
"0.6456245",
"0.64561284",
"0.64553714",
"0.6452895",
"0.6448869",
"0.64413077",
"0.64401454",
"0.64136785",
"0.6410047",
"0.64043856",
"0.63893837",
"0.63883966",
"0.63868904",
"0.63841283",
"0.63841283",
"0.63841283",
"0.63841283",
"0.6367689",
"0.63527644",
"0.6350579",
"0.63448614",
"0.63382244",
"0.63382244",
"0.6337365",
"0.6325801",
"0.6321759",
"0.6321508",
"0.63159776",
"0.6313997",
"0.63007706",
"0.62940556",
"0.6292134",
"0.62845457",
"0.6283167",
"0.62789536",
"0.62789536",
"0.62789536",
"0.6268871",
"0.6266482",
"0.62647015",
"0.6251766",
"0.6251766",
"0.6251766"
] |
0.69510937
|
18
|
Computes the set of URL params for the API request
|
def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)
container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request_params\n params = get_params_hash(@url.query)\n params['body'] = percent_encode(Base64.strict_encode64(@request_body))\n params.sort.map { |key, value| \"#{key}=#{value}\" }.join('&')\n end",
"def parameters\n url_params = \"\"\n\n if @resource == :catalog\n url_params += \"&\" + \"offset=#{URI.escape(@offset.to_s)}\" if @offset\n url_params += \"&\" + \"size=#{URI.escape(@size.to_s)}\" if @size\n url_params += \"&\" + \"search=#{URI.escape(@search)}\" if @search\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n url_params += \"&\" + \"state=#{URI.escape(@state)}\" if @state\n url_params += \"&\" + \"sort=#{URI.escape(@sort)}\" if @sort\n url_params += \"&\" + \"instock=#{@instock}\" if @instock\n elsif @resource == :categorymap\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n url_params += \"&\" + \"search=#{URI.escape(@search)}\" if @search\n elsif @resource == :reference\n url_params += \"&\" + \"filter=#{URI.escape(@filter)}\" if @filter\n end\n\n return url_params\n end",
"def url_params\n []\n end",
"def url_params\n if self.respond_to? :source_param\n source_params = Array(source_param)\n else\n source_params = []\n end\n\n (parameters - source_params)\n end",
"def query_params\n URI.encode_www_form(\n {\n affiliate:,\n access_key:,\n module_code:,\n url:,\n query:,\n position:,\n user_agent:\n }\n )\n end",
"def build_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n urlpath = erb.extra_params(@arguments)\n render json: { success: urlpath }, status: 200\n end\n end",
"def query_parameters\n request.GET\n end",
"def get_request_parameters(url)\n options = {\n :head => { \"Content-Type\" => \"application/json\" },\n :body => { \"longUrl\" => url }.to_json\n }\n\n if @account_apikey\n options[:query] = { \"key\" => @account_apikey }\n end\n\n options\n end",
"def url_params\n {}\n end",
"def http_parse_args\n [(self.api.base_url + self.method), self.params]\n end",
"def parse_url_params \n return if !Caboose.use_url_params \n url = \"#{request.fullpath}\"\n url[0] = \"\" if url.starts_with?('/') \n url = url.split('?')[0] if url.include?('?') \n arr = url.split('/') \n i = arr.count - 1\n while i >= 1 do\n k = arr[i-1]\n v = arr[i] \n if v && v.length > 0\n v = v.gsub('%20', ' ')\n params[k] = v\n end\n i = i-2\n end \n end",
"def request_params; end",
"def params\n @params||=Addressable::URI.parse(\"?#{@http_query_string}\").query_values\n end",
"def generate_api_parameters(url_params_hash)\n url_params_hash.present? ? ('?' + url_params_hash.to_query) : ''\n end",
"def build_url\n unless key && key.length > 0\n raise ArgumentError, 'Missing API key parameter. Visit http://developer.oodle.com/request-api-key/ to get one.'\n end\n\n unless region && region.length > 0\n raise ArgumentError, 'Missing region paramter. Visit http://developer.oodle.com/regions-list/ for possible regions.'\n end\n\n unless (category && category.length > 0) || (q && q.length > 0)\n raise ArgumentError, 'You must supply a category or query parameter. Visit http://developer.oodle.com/categories-list/ for possible categories.'\n end\n\n unless num.to_i >= 1 && num.to_i <= 50\n warn \"num parameter is #{num.to_i} but should be between 1 and 50\"\n end\n\n url = VERSION_URLS[self.version]\n url += \"?\" unless url && url[-1] == '?'\n # must CGI escape each param value\n url = \"#{url}key=#{CGI::escape(self.key)}\"\n url = \"#{url}®ion=#{CGI::escape(self.region)}\" if self.region\n url = \"#{url}&category=#{CGI::escape(self.category)}\" if self.category\n url = \"#{url}&q=#{CGI::escape(self.q)}\" if self.q\n url = \"#{url}&attributes=#{CGI::escape(self.attributes_as_string)}\" if self.attributes.size > 0\n url = \"#{url}&location=#{CGI::escape(self.location)}\" if self.location\n url = \"#{url}&radius=#{CGI::escape(self.radius.to_s)}\" if self.radius\n url = \"#{url}&start=#{CGI::escape(self.start.to_s)}\" if self.start\n url = \"#{url}&num=#{CGI::escape(self.num.to_s)}\" if self.num\n url = \"#{url}&sort=#{CGI::escape(self.sort)}\" if self.sort\n url = \"#{url}&refinements=#{CGI::escape(self.refinements_as_string)}\" if self.refinements.size > 0\n url = \"#{url}&ctime_low=#{CGI::escape(self.ctime_low)}\" if self.ctime_low\n url = \"#{url}&ctime_high=#{CGI::escape(self.ctime_high)}\" if self.ctime_high\n url = \"#{url}&exclude_sources=#{CGI::escape(self.exclude_sources_as_string)}\" if self.exclude_sources.size > 0\n url = \"#{url}&assisted_search=#{CGI::escape(self.assisted_search)}\" if self.assisted_search\n url = \"#{url}&format=#{CGI::escape(self.format)}&jsoncallback=none\" if self.format\n url\n end",
"def set_params(base_url, params)\n for item in params\n if item[1].instance_of?(Array)\n for elem in item[1]\n query = \"#{query}#{item[0]}=#{elem}&\"\n end\n else\n query = \"#{query}#{item[0]}=#{item[1]}&\"\n end\n end\n\n url = base_url + \"?\" + query\n url[url.length-1]=\"\"\n\n return url\n end",
"def request_params( params = {} )\n params\n end",
"def build_url_request(params)\n logger.debug(\"build_url_request: params #{params.inspect}\")\n #add constants\n #add key\n params << @public_key_param \n # need to encode rest of the values\n encoded = encode_params(params)\n #encode the URL\n url = @api_path + '?' +encoded.join('&')\n logger.debug(\"build_url_request: url is #{url}\")\n url\n end",
"def params\n # URI parameters take precendence\n @params ||= post_params.merge(get_params.merge(uri_params))\n end",
"def request_params(params = {})\n params\n end",
"def request_params(params = {})\n params\n end",
"def query_params; end",
"def jsonapi_path_parameters\n return request.path_parameters if request.respond_to?(:path_parameters)\n\n request.send(:parse_query, request.query_string, '&;')\n end",
"def process_url_params(url, headers); end",
"def paramaterize params\n segments = @url.split('/')\n segments.map { |item| item[0] == ':' ? params.shift : item }.join('/')\n end",
"def params\n # endpoint.declared(endpoint.params)\n @params = \"#{env['QUERY_STRING']}_#{env[Grape::Env::RACK_INPUT].read}\"\n end",
"def get_url_params\n params = {}\n self.class::POST_DATA_FIELDS.each do |f|\n params[f] = @post_data[f] unless @post_data[f].nil?\n end\n URI.encode_www_form(params.sort.to_h)\n end",
"def set_params(resource_type, section, time_period, offset=\"0\") \n @processed_url = @@base_url + @@resource_type[resource_type]\n @processed_url += @@section[section]\n @processed_url += @@time_period[time_period]\n @processed_url += \".json?offset=\"+ offset\n @processed_url += \"&api-key=\" + @@app_key\n return @processed_url\n end",
"def request_query_params\n {}\n end",
"def get_full_url(req_params)\n full_url=self.url\n\n if self.input_params.size>0\n full_url+=\"?\"\n\n self.input_params.each do |param|\n #puts \"name:\"+param.name+\"->value:\"+param.value\n if req_params.has_key? param.name #this was a dynamic param -> overwrite\n value=req_params[param.name]\n else\n value=param.value\n end\n\n full_url+=encode(param.name)+\"=\"+encode(value)+\"&\"\n end\n full_url=full_url[0..-2] #remove last &\n end\n\n return full_url\n end",
"def params() request.params end",
"def request_params(method)\n @request_params = {\n :api_key => ENV['LASTFM_API_KEY'],\n :token => @auth_token,\n :api_sig => nil,\n :method => method,\n :format => 'json'\n }\n end",
"def queries\n urls, url_base, url_vals = params.values_at('urls', 'url_base', 'url_vals')\n\n if urls && urls.is_a?(Hash)\n # the outcome of a json-encoded POST body\n raw_queries = urls\n\n elsif url_base && url_vals\n # assemble queries by slapping each url_val on the end of url_base\n raise BadRequestError, \"url_base must be a string\" unless url_base.is_a?(String)\n raise BadRequestError, \"url_vals must be an array or comma-delimited string\" unless url_vals.is_a?(String) || url_vals.is_a?(Array)\n url_vals = url_vals.split(',') if url_vals.is_a?(String)\n #\n raw_queries = {}\n url_vals.each_with_index do |val, idx|\n raw_queries[idx] = \"#{url_base}#{val}\"\n end\n else\n raise BadRequestError, \"Need either url_base and url_vals, or a JSON post body giving a hash of req_id:url pairs.\"\n end\n\n # make all the queries safe\n normalized_queries = {}\n raw_queries.each do |req_id, raw_q|\n raise BadRequestError, \"Request IDs must be numbers or simple identifiers\" unless (req_id.to_s =~ IDENTIFIER_OR_NUM_RE)\n norm_q = normalize_query(raw_q) or next\n normalized_queries[req_id.to_s] = norm_q\n end\n normalized_queries\n end",
"def query_params\n {\n affiliate:,\n access_key:,\n query:,\n offset:,\n limit:\n }\n end",
"def parameters\r\n request_parameters.update(query_parameters)\r\n end",
"def request_parameters; end",
"def query_parameters\n end",
"def build_request_url(path, params)\n\t\t\t\t\tURI::HTTP.build :host => API_SERVER,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:path => \"#{API_BASE}/#{path}\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t:query => params.map {|k,v| \"#{k}=#{v}\"}.join('&')\n\t\t\t\tend",
"def url_for_params( options = {} )\n new_params = request.POST.merge( request.GET ).merge( options )\n if without = new_params.delete(:without)\n without = [without] unless without.is_a?(Array)\n without.map!(&:to_s)\n new_params = new_params.reject {|k,v| without.include?(k) }\n end\n url_for( new_params )\n end",
"def params\n @params ||= options.inject([]) do |res, pair|\n res << \"%s=%s\" % [pair.first, pair.last]\n end.join('&')\n end",
"def url_with_params\n url + \"/?\" + URI.encode_www_form(@options[:request_params])\n end",
"def build_request_url(params)\n \"http://api.nytimes.com/svc/search/v2/articlesearch.json?\"+params\n end",
"def params\n self.class.const_get(\"REQUEST_PARAMETERS\").inject({}) do |parameters, parameter|\n parameters[parameter] = instance_variable_get(\"@#{parameter}\") unless instance_variable_get(\"@#{parameter}\").nil?\n parameters\n end\n end",
"def params\n split_query_string.flat_map do |keyword|\n [\"%#{keyword}%\".mb_chars.downcase.to_s] * query_for_one_keyword.count('?')\n end\n end",
"def query_parameters; end",
"def params ; @params ||= Waves::Request::Query.new( request.query.merge( captured.to_h ) ) ; end",
"def build_url(url, params = nil)\n if params.respond_to? :each\n params.each do |key, value|\n # Convert dates to CC date format\n if value.respond_to? :iso8601\n params[key] = value.iso8601\n end\n\n if key.to_s == 'next' && value.match(/^.*?next=(.*)$/)\n params[key] = $1\n end\n end\n else\n params ||= {}\n end\n url + '?' + Util::Helpers.http_build_query(params)\n end",
"def urls_params\n params.permit(urls: []).dig(:urls) || ParallelFetcher::DEFAULT_URLS\n end",
"def request_parameters(endpoint, custom_params={})\n custom_params.merge!(\"request_time\" => Time.now.to_i, \"api_key\" => @api_key)\n signature_params = {\n url: endpoint,\n api_secret: @api_secret,\n request_parameters: custom_params.dup\n }\n signature = HttpHelper::SignatureGenerator.new(signature_params).perform\n custom_params.merge!(signature: signature)\n {\n url: @api_base_url + endpoint,\n request_parameters: custom_params\n }\n end",
"def sort_query_parameters(url)\n # Addressable automatically sorts query params.\n uri = Addressable::URI.parse(url)\n params = uri.query_values\n\n # Removed parameters that are generated or dynamic (but not required)\n # The urls with these params return 404 when they do not match a stub.\n if params!=nil && params!='' && !params.blank?\n # params.delete(\"session_id\")\n # params.delete(\"latitude\")\n # params.delete(\"longitude\")\n # params.delete(\"verifier\")\n # params.delete(\"nearStoreNumbers\")\n # params.delete(\"shopper_id\")\n # params.delete(\"placement\")\n # params.delete(\"bound\")\n # params.delete(\"miles\")\n uri.query_values = params\n uri.path+\"?\"+ URI.unescape(uri.query)\n else\n logger.fatal \"no params uri.path: \" + uri.path.to_s\n uri.path\n end\n\tend",
"def get_query_params(url)\n url_partitioned_at_question_mark = url.partition(\"?\")\n url_partitioned_at_question_mark[2]\nend",
"def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end",
"def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end",
"def process_url_params url, headers\n url_params = {}\n headers.delete_if do |key, value|\n if 'params' == key.to_s.downcase && value.is_a?(Hash)\n url_params.merge! value\n true\n else\n false\n end\n end\n unless url_params.empty?\n query_string = url_params.collect { |k, v| \"#{k.to_s}=#{CGI::escape(v.to_s)}\" }.join('&')\n url + \"?#{query_string}\"\n else\n url\n end\n end",
"def http_params\n {}\n end",
"def format_params(params)\n \n # this is just used for multi_index search\n params[:indexes] ||= ['documents', 'people', 'topics', 'places' ]\n \n \n # return loaded models?\n params[:load] ||= true\n \n # will_paginate settings\n params[:page] ||= 1\n params[:per_page] ||= 25\n params[:offset] = ( ( params[:page].to_i - 1) * params[:per_page].to_i)\n\n # sort by\n params[:sort_by], params[:order_by] = params[:sort].split(\":\") if params[:sort]\n params[:order_by] = \"desc\" unless params[:order_by] == \"asc\"\n\n # facet filters and query\n params[:facet] ||= []\n params[:facet].compact!\n\n params[:request_query] = params[:q] ? params[:q].compact : \"*\"\n \n # facet filtering/limits\n params[:facet_filters] = params[:facet].collect do |f|\n facet, value = f.split(\":\")\n lambda { |boolean| boolean.must { term facet.to_sym, value } }\n end\n \n # facets to be returned\n params[:request_facets] ||= self.facets\n params[:facet_query] = {} \n params[:request_facets].each { |f| params[:facet_query][f] = params[:\"#{f}_page\"] ? ( ( params[:\"#{f}_page\"].to_i * 10 ) + 1 ) : 11 }\n \n return params\n end",
"def url_builder(url,parameters={:results => 10})\n params = []\n parameters.map do |key, value|\n if key != nil and value != nil\n params.push(\"#{key}=#{value}\")\n end\n end\n\n \"#{url}?#{params.join(\"&\")}\"\nend",
"def params\n (@params + [:host, :port]).uniq\n end",
"def params\n options = @options.dup\n options.empty? ? '' : '?' + options.to_param\n end",
"def curl_params params\n params.map do |param, value|\n \"-F #{param}='#{value}'\"\n end.join(' ')\n end",
"def query_params\n get_query_params\n end",
"def sorted_parameters_query\n @request_parameters.to_query.gsub(/^&/, '')\n end",
"def parse_request_params\n @column_names = []\n @searchable_column_names = []\n\n @request_params[:columns].map {|i| i[1]}.each do |column|\n @column_names << column[:data]\n @searchable_column_names << column[:data] if column[:searchable]\n end\n\n @search_value = @request_params[:search][:value].presence\n\n @orders = []\n\n @request_params[:order].map {|i| i[1]}.each do |order|\n @orders << \"#{@column_names[order[:column].to_i]} #{order[:dir]}\"\n end\n\n @start = @request_params[:start]\n @length = @request_params[:length]\n end",
"def get_params(api, params)\n url2json(:GET, \"#{@endpoint}#{api}\", params)\n end",
"def params(request)\n request.query\n end",
"def build_request_params(_options)\n raise NotImplementedError\n end",
"def query_parameters\n params = {}\n params['filter'] = @optional['filter'] if @optional['filter']\n params\n end",
"def jsonapi_pagination_params\n pagination = params[:page].try(:slice, :number, :size) || {}\n per_page = jsonapi_page_size(pagination)\n num = [1, pagination[:number].to_f.to_i].max\n\n [(num - 1) * per_page, per_page, num]\n end",
"def params \n @params ||= Waves::Request::Query.new( captured ? \n Waves::Request::Utilities.destructure( request.query ).merge( captured.to_h ) : \n Waves::Request::Utilities.destructure( request.query ) ) \n end",
"def base_params(endpoint, custom_params={})\n request_time = DateTime.now.to_s\n query_param = custom_params.merge(\"request-time\" => request_time).to_query.gsub(/^&/, '')\n str = \"#{endpoint}?#{query_param}\"\n {\n \"request-time\" => request_time,\n \"signature\" => generate_signature(str),\n \"api-key\" => @api_key\n }\n end",
"def api_params(q = {})\n @api[:optional].deep_merge(@api[:required]).deep_merge(q)\n end",
"def url_builder(url,parameters = {}) # vals = {} assigns emtpy hash as default if nothing passed in\n parameters[:results] = 10 unless parameters.key?(:results)\n #debugger\n \n # -OR-\n ## sets defaults and overrides original parameters with passed in vals\n #parameters = { :results => 10, :sort_by => \"date\"}.merge(parameters)\n \n #final_url = \"#{url}?results=10\"\n #\n #if parameters.key? :sort_by\n # url = \"#{url}?sort_by=#{parameters[:sort_by]}\"\n #else \n # \"#{url}?results=#{}\"\n #\n #end\n #\n #param_array = parameters.map do |key, value|\n # \"#{key}=#{value}\" unless value == nil\n # # last true statement value gets mapped into param_array\n #end\n #\n ## KEY=VALUE&KEY=VALUE&KEY=VALUE\n #param_string = \"?#{param_array.join(\"&\")}\"\n #\n #if parameters.key? :search\n # \"#{url}?results=#{parameters[:results]}&search=#{parameters[:search]}\"\n #else \n # \"#{url}?results=#{}\"\n #\n #end\n\n\n#### --ALT--\n final_url = \"#{url}?results=10\"\n \n if parameters.key? :sort_by\n final_url = \"#{url}?sort_by=#{parameters[:sort_by]}\"\n else \n \"#{url}?results=#{parameters[:results]}\"\n \n end\n \n \n if parameters.key? :search\n \"#{url}?results=#{parameters[:results]}&search=#{parameters[:search]}\"\n else \n \"#{url}?results=#{parameters[:results]}\"\n \n end\nend",
"def api_params\n params.fetch(:api, {})\n end",
"def prepare_params(url)\n params = parse_params(url)\n params['client'] = ENV['SINGLEPLATFORM_CLIENT_ID']\n params\n end",
"def to_http_params\n params = ''\n stack = []\n\n each do |k, v|\n if v.is_a?(Hash)\n stack << [k,v]\n elsif v.is_a?(Array)\n stack << [k,Hash.from_array(v)]\n else\n params << \"#{k}=#{v}&\"\n end\n end\n\n stack.each do |parent, hash|\n hash.each do |k, v|\n if v.is_a?(Hash)\n stack << [\"#{parent}[#{k}]\", URI::Escape.escape(v)]\n else\n params << \"#{parent}[#{k}]=#{URI::Escape.escape(v)}&\"\n end\n end\n end\n\n params.chop!\n params\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n \n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n \n end\n \n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n \n return res.join(' > ')\n end",
"def request_params_all(request)\n request_params = HashWithIndifferentAccess.new\n request_params.merge!(request.params || {})\n\n # read post or put params. this will erase params\n # {code: 123, mode: 123}\n # \"code=123&mode=123\"\n request_body = request.body.read\n if request_body.present?\n body_params = begin\n JSON.parse(request_body) # {code: 123, mode: 123}\n rescue JSON::ParserError\n Rack::Utils.parse_nested_query(request_body) # \"code=123&mode=123\"\n end\n else\n body_params = {}\n end\n\n request_params.merge(body_params)\n end",
"def url_parameters\n \n if self.burn_after_date\n sharing_url_parameters = {\n :privlyApp => self.privly_application,\n :random_token => self.random_token,\n :privlyInject1 => true}\n else\n sharing_url_parameters = {\n :privlyApp => self.privly_application,\n :random_token => self.random_token,\n :privlyInject1 => true}\n end\n \n return sharing_url_parameters\n end",
"def combine_params(renamed_params, url_params)\n params_combinator = ParamsOperators::Combinator.new(renamed_params, url_params)\n params_combinator.run\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n\n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n\n end\n\n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n\n return res.join(' > ')\n end",
"def url_params\n params_syms = %I[\n endpoint\n slug\n expiration\n ]\n\n params.require(:url).permit(*params_syms)\n end",
"def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end",
"def url_params # :nodoc:\n raise BuildDataMissing, \"Need at least 2 points to create a path!\" unless can_build?\n out = 'path='\n\n path_params = OPTIONAL_OPTIONS.inject([]) do |path_params, attribute|\n value = send(attribute)\n path_params << \"#{attribute}:#{URI::DEFAULT_PARSER.escape(value.to_s)}\" unless value.nil?\n path_params\n end.join('|')\n\n out += \"#{path_params}|\" unless path_params.empty?\n\n out += encoded_url_points if encoding_points?\n out += unencoded_url_points unless encoding_points?\n out\n end",
"def build_url_parameters(parameters)\n sorted_params = parameters.to_a.sort_by{|x| x[0]}\n query_string = sorted_params.map do |key, value|\n if value.is_a? Array\n value.map{|subvalue| \"#{key}[]=#{subvalue}\"}.join(\"&\")\n else\n \"#{key}=#{value}\"\n end\n end.join(\"&\")\n\n query_string\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def params\n @pagination.request.query_parameters\n end",
"def request_url(method, params={})\n url = \"#{@host}#{@api}/#{method}?ApiKey=#{@api_key}\"\n params.each_pair do |key, val|\n url += \"&#{key}=\" + CGI::escape(val.to_s)\n end\n url\n end",
"def build_query_params(url, query_params)\n params = URI.encode_www_form(query_params)\n url.concat(\"?#{params}\")\n end",
"def urlparser_params\n params.fetch(:url, {})\n end",
"def api_params\n params[:api]\n end",
"def build_params\n ids_sliced_by_ten.each_slice(2).map do |batch|\n build_params_from_batch(batch)\n end\n end",
"def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def params(request)\n result = decode_params(request.params)\n result.merge(extract_client_info(request))\n end",
"def params\n flat = {}\n @options[:params].merge( :track => @options[:filters] ).each do |param, val|\n next if val.to_s.empty? || (val.respond_to?(:empty?) && val.empty?)\n val = val.join(\",\") if val.respond_to?(:join)\n flat[param.to_s] = val.to_s\n end\n flat\n end",
"def open_url_params_map\n {\n issn: 'rft.issn',\n volume: 'rft.volume',\n issue: 'rft.issue',\n start_page: 'rft.spage',\n publication_date: 'rft.date'\n }\n end",
"def params_with_authentication\n raise Europeana::Errors::MissingAPIKeyError unless Europeana.api_key.present?\n params.merge(:wskey => Europeana.api_key).reverse_merge(:query => \"\")\n end",
"def get_params\n params.fetch(:get, {})\n end",
"def params\n self.GET.update(self.POST)\n rescue EOFError => boom\n self.GET\n end",
"def params_for(options)\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n \"?#{params.join(\"&\")}\"\n end",
"def query ; @request.params ; end"
] |
[
"0.7138753",
"0.7097966",
"0.70769316",
"0.6975737",
"0.6893567",
"0.6885916",
"0.6872389",
"0.68647146",
"0.6861682",
"0.68573695",
"0.6852328",
"0.6842345",
"0.6814392",
"0.67723185",
"0.6745835",
"0.67377913",
"0.66913235",
"0.669115",
"0.6660924",
"0.66310006",
"0.6603211",
"0.65711695",
"0.6548974",
"0.6535332",
"0.6530879",
"0.6530818",
"0.6516995",
"0.651486",
"0.6506851",
"0.6480579",
"0.6465041",
"0.6464511",
"0.6451552",
"0.6449052",
"0.64425766",
"0.6438811",
"0.6432185",
"0.6431337",
"0.6416571",
"0.64162326",
"0.6415986",
"0.641359",
"0.6407528",
"0.64072204",
"0.6402477",
"0.63971996",
"0.63938373",
"0.6342285",
"0.6331825",
"0.6329261",
"0.6324184",
"0.6321127",
"0.6321127",
"0.6313423",
"0.63090813",
"0.6307691",
"0.6288172",
"0.62782305",
"0.6274836",
"0.62643564",
"0.62639153",
"0.62474066",
"0.62465495",
"0.6239052",
"0.62363434",
"0.6227626",
"0.62209964",
"0.6192468",
"0.6189393",
"0.6187242",
"0.6175781",
"0.6168739",
"0.616671",
"0.6156223",
"0.6150521",
"0.61391807",
"0.61354285",
"0.61334187",
"0.61322236",
"0.6123896",
"0.6123416",
"0.61232376",
"0.6117738",
"0.6112901",
"0.61096287",
"0.61016273",
"0.60960937",
"0.6082737",
"0.6073865",
"0.607336",
"0.6063635",
"0.60524523",
"0.60442364",
"0.6037004",
"0.6026168",
"0.6024427",
"0.60197526",
"0.6014809",
"0.60068077",
"0.60047776",
"0.5998492"
] |
0.0
|
-1
|
Computes the set of headers for the API request
|
def compute_query_api_pattern_headers(query_api_method_name, container, used_query_params)
container[:headers].dup.each do |header, header_values|
container[:headers][header].each_with_index do |header_value, idx|
container[:headers][header] = container[:headers][header].dup
container[:headers][header][idx] = compute_query_api_pattern_param(query_api_method_name, header_value, container[:params_with_defaults], used_query_params)
container[:headers][header].delete_at(idx) if container[:headers][header][idx] == Utils::NONE
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_headers\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/headers'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n end",
"def request_headers\n headers = {'Content-Type' => 'application/json'}\n headers[:user_agent] = @client.user_agent\n headers[:authorization] = auth_header\n headers\n end",
"def request_headers; end",
"def request_headers; end",
"def headers\n @headers ||= {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{@token}\",\n }\n end",
"def get_headers(content_type = 'application/json')\n {\n :content_type => content_type,\n :accept => 'application/json',\n :user_agent => \"Iterable Ruby SDK v#{Iterable::VERSION} (#{RUBY_DESCRIPTION})\",\n :x_ctct_request_source => \"sdk.ruby.#{Iterable::VERSION}\",\n 'Api-Key' => @api_key\n }\n end",
"def get_headers\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/headers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n validate_response(_response)\n end",
"def dynamic_headers\n {\n 'Authorization' => token,\n 'RequestID' => request_id,\n }\n end",
"def headers\n if @key_type == \"bearer\"\n {\n 'Authorization': \"Bearer #{@key}\",\n \"Content-Type\": \"application/json\"\n }\n else\n {\n 'Authorization': \"API-Key #{@key}\",\n \"Content-Type\": \"application/json\"\n }\n end\n end",
"def headers\n h = {\n 'X-Api-Version' => @api_version,\n :accept => :json,\n }\n\n if @account_id\n h['X-Account'] = @account_id\n end\n\n if @access_token\n h['Authorization'] = \"Bearer #{@access_token}\"\n elsif @cookies\n h[:cookies] = @cookies\n end\n\n if @local_token\n h['X-RLL-Secret'] = @local_token\n end\n\n h\n end",
"def headers\n @headers.tap do |headers|\n headers[:algorithm] = configuration.algorithm if verification?\n case configuration.claim\n when CLAIM_EXPIRATION_TIME\n headers.merge!(exp_headers)\n when CLAIM_NOT_BEFORE_TIME\n headers.merge!(nbf_headers)\n end\n end\n end",
"def headers\n hash = {}\n hash['Content-Type'] = 'application/json'\n hash['Authorization'] = \"ShacipKey #{api_key}\" unless api_key.nil?\n hash\n end",
"def headers\n base_headers = {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n 'Sovren-AccountId' => @account_id,\n 'Sovren-ServiceKey' => @service_key\n }\n\n @additional_parse_request_headers.merge(base_headers)\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def headers\n @headers ||= begin\n [\n 'estimated_amount',\n 'country',\n 'kyc_confirm_date',\n 'kyc_approval_status',\n 'proof_of_support',\n 'alt_bonus',\n 'purchased_amount',\n 'phase_1_purchased_amount',\n 'phase_2_purchased_amount',\n 'number_of_transactions'\n ]\n end\n end",
"def headers\n {\n \"Authorization\" => basic_auth,\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"application/json\"\n }\n end",
"def make_request_headers(opts); end",
"def generate_headers\n nonce = Time.now.to_i.to_s\n {\n 'X-Auth-Apikey' => @api_key,\n 'X-Auth-Nonce' => nonce,\n 'X-Auth-Signature' => OpenSSL::HMAC.hexdigest('SHA256', @secret, nonce + @api_key),\n 'Content-Type' => 'application/json'\n }\n end",
"def headers\n [\n { :key => \"User-Agent\", :value => user_agent},\n { :key => \"Content-Type\", :value => \"application/json; charset=utf-8\" },\n { :key => \"Accept\", :value => \"application/json\"}\n ]\n end",
"def request_headers\n {}\n end",
"def headers\n headers = {}\n headers[:accept] = '*/*'\n headers[:content_type] = 'Application/json;charset=UTF-8'\n headers[:Authorization] = encode_credentials\n headers\n end",
"def request_headers=(_arg0); end",
"def headers\n\t\t\tuser = \"#{config[:oauth_key]}|#{config[:fingerprint]}\"\n\t\t\tgateway = \"#{config[:client_id]}|#{config[:client_secret]}\"\n\t\t\theaders = {\n\t\t\t\tcontent_type: :json,\n\t\t\t\taccept: :json,\n\t\t\t\t'X-SP-GATEWAY' => gateway,\n\t\t\t 'X-SP-USER' => user,\n\t\t\t 'X-SP-USER-IP' => config[:ip_address],\n\t\t\t}\n if config[:idemopotency_key]\n headers['X-SP-IDEMPOTENCY-KEY'] = config[:idemopotency_key]\n end\n headers\n\t\tend",
"def headers\n {\n \"Authorization\" => \"Bearer #{ENV.fetch(\"SALESLOFT_ACCESS_TOKEN\")}\"\n }\n end",
"def headers\n {\n 'Authorization' => \"key=#{@server_key}\",\n 'Content-Type' => 'application/json'\n }\n end",
"def headers\n {\n 'Host' => host,\n 'Content-Type' => 'application/json',\n api_key => settings.api_key\n }\n end",
"def headers\n @headers ||= {}\n end",
"def build_headers(token)\n headers = {'Content-Type' =>'application/json'}\n unless token.nil? \n headers['X-Auth-Token'] = token\n end\n return headers\n end",
"def headers\n { 'X-Auth-Token' => self.api_key }\n end",
"def headers\n {'Authorization' => options[:header_format] % token}\n end",
"def headers\n @headers ||= {}\n end",
"def get_headers\n @headers = headers\n @headers\n end",
"def build_headers(token)\n headers = {'Content-Type' =>'application/json'}\n unless token.nil? \n headers['X-Auth-Token'] = token\n end\n return headers\n end",
"def get_headers_\n hin = ATS::Headers_in.new\n hin.all.reduce({}) do |memo, pair| \n memo[pair.first.downcase] = pair[1]; memo\n end\n end",
"def headers\n @headers ||= HeaderHash.new(@http_response.to_hash)\n end",
"def headers\n @headers ||={}\n end",
"def headers\n # units and source have to go last, so if we push in a new header, these go\n # at end\n @headers+['units','source']\n end",
"def headers\n matching_masks = self.hr_config.matching_masks_for_url(self.url)\n matching_masks.inject({}) do |hash, mask|\n hash.merge(self.hr_config.get(mask, 'headers') || {})\n end\n end",
"def generate_request_header()\n headers = @auth_handler.headers(@credential_handler.credentials(@version))\n return headers.inject({}) do |request_header, (header, value)|\n request_header[prepend_namespace(header)] = value\n request_header\n end\n end",
"def http_headers\n {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n 'User-Agent' => \"resque-exceptional/#{Version}\"\n }\n end",
"def connection_headers\n {\n \"User-Agent\" => \"Montage Ruby v#{Montage::VERSION}\",\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"*/*\",\n \"Authorization\" => \"Token #{token}\",\n \"Referer\" => \"#{default_url_prefix}/\"\n }\n end",
"def get_headers(content_type = 'application/json')\n {\n :content_type => content_type,\n :accept => 'application/json',\n }\n end",
"def make_headers(user_headers); end",
"def headers; return {}; end",
"def headers; return {}; end",
"def headers\n {\n 'Accept' => 'application/json',\n 'Content-type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.strict_encode64(@options[:api_key].to_s).strip}\",\n 'User-Agent' => \"Netbanx-Paysafe v1.0/ActiveMerchant #{ActiveMerchant::VERSION}\"\n }\n end",
"def http_headers(environment)\n http_headers = headers\n environment.each do |env|\n key, value = env\n match = key.match(/\\AHTTP_(.*)\\Z/)\n next unless match\n\n header = match[1].split('_').map(&:capitalize).join('-')\n http_headers[header] = value\n end\n\n return http_headers\n end",
"def set_sasc_request_headers(api_version = nil)\n sasc_request_headers(api_version).each { |header, value| request.headers[header] = value }\n end",
"def request_headers(headers = {}, auth: true, gzip: true)\n headers = default_headers.merge(headers)\n headers.merge!(bearer_authorization_header) if auth\n headers[ACCEPT_ENCODING] = GZIP if gzip\n headers.reject{|_,v| v.nil? || (v.respond_to?(:empty?) && v.empty?)}\n end",
"def headers\n call_once\n @headers\n end",
"def build_headers(method, partition_keys, time_gmt_now, auth_token)\r\n headers = Hash.new\r\n headers[\"x-ms-date\"] = time_gmt_now\r\n headers[\"authorization\"] = auth_token\r\n headers[\"x-ms-version\"] = '2018-12-31'\r\n headers[\"Content-Type\"] = \"application/json\" \r\n\r\n if (method == 'post' && partition_keys.length <= 0)\r\n headers[\"Content-Type\"] = \"application/query+json\"\r\n headers[\"x-ms-documentdb-isquery\"] = \"True\"\r\n headers[\"x-ms-documentdb-query-enablecrosspartition\"] = \"True\"\r\n elsif ((method == 'post' || method == 'put' || method='delete') && partition_keys.length > 0)\r\n headers[\"x-ms-documentdb-partitionkey\"] = partition_keys\r\n end\r\n\r\n return headers\r\n end",
"def headers\n @headers ||= self.class.beautify_headers(@net_http_res.to_hash)\n end",
"def headers\n if self.middleware.to_sym == :reso_api\n reso_headers\n else\n spark_headers\n end\n end",
"def request_http_headers env\n env.inject({}) { |acc, (k, v)| acc[$1.downcase] = v if k =~ /^http_(.*)/i; acc }\n end",
"def generate_headers(request, soap)\n credentials = @credential_handler.credentials\n headers = @auth_handler.headers(credentials)\n request_header = headers.inject({}) do |request_header, (header, value)|\n if header == :access_token\n request.url = soap.endpoint\n request.headers['Authorization'] =\n @auth_handler.generate_oauth_parameters_string(credentials,\n request)\n else\n request_header[prepend_namespace(header)] = value\n end\n request_header\n end\n soap.header[prepend_namespace(@element_name)] = request_header\n end",
"def api_user_headers\n user = create(:user)\n headers = api_user_login(user.email, user.password)\n request.headers['access-token'] = headers['access-token']\n request.headers['client'] = headers['client']\n request.headers['uid'] = headers['uid']\n end",
"def set_request_headers!(request); end",
"def headers(request)\n raise NotImplementedError\n end",
"def add_headers\n @headers.each do |field, value|\n @request_header << \"#{field}: #{value}\"\n end\n end",
"def headers\n {\n \"X-Ridepilot-Token\" => @token,\n \"Content-Type\" => \"application/json\"\n }\n end",
"def rest_headers\n { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'Authorization' => \"Token token=#{@user[:authentication_token]}\" }\n end",
"def headers\r\n # give access to helpers to opts with a different name\r\n @opts\r\n end",
"def headers(headers); end",
"def headers\n end",
"def headers\n auth_object = auth_objects_cache[RequestStore.store[:cache_key]]\n # AuthClient, generates the header for us\n auth_object.auth_header\n end",
"def auth_headers(headers = {})\n h = headers.dup\n h['X-Tableau-Auth'] = @client.auth.token\n h\n end",
"def headers\n @attributes + @includes.values.flatten\n end",
"def build_headers method:, path:, headers:\n h = {\n AUTHORITY_KEY => [@host, @port.to_s].join(':'),\n METHOD_KEY => method.to_s.upcase,\n PATH_KEY => path,\n SCHEME_KEY => @scheme\n }.merge USER_AGENT\n h.merge! stringify_headers(headers)\n end",
"def headers\n @request_headers\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"OpenStack::Compute Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def get_request_headers\n request.env.find_all {|k, v|\n UnprefixedHeaders.include?(k) || k.start_with?('HTTP_')\n }.map {|k, v|\n range = UnprefixedHeaders.include?(k) ? 0..-1 : 1..-1\n [k.split('_')[range].map(&:downcase).map(&:capitalize).join('-'),\n v]\n }\n end",
"def headers\n if @values.key? :auth_token\n { Authorization: 'Bearer ' + @values[:auth_token] }\n else\n {}\n end\n end",
"def headers\n headerRet = {\n 'x-myobapi-version' => 'v2',\n 'Content-Type' => 'application/json'\n }\n token = (@current_company_file || {})[:token]\n unless token.nil? || token.empty?\n headerRet['x-myobapi-cftoken'] = token\n end\n key = (@consumer || {})[:key]\n unless key.nil? || key.empty?\n headerRet['x-myobapi-key'] = key\n end\n headerRet\n end",
"def add_headers; end",
"def headers\n @headers ||= response ? Hash[response.headers.map{ |k,v| [k.downcase,v] }] : {}\n end",
"def request_headers(env)\n env.select { |key, _| key[0, 5] == 'HTTP_' }\n end",
"def headers\n headers = {}\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n headers['X-SILENCE-LOGGER'] = 'true'\n headers['Dont-Chunk'] = 'true' unless self.class.long_polling\n\n headers\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend",
"def auth_headers\n {\n username: request.headers[\"X-USER-USERNAME\"], \n authentication_token: request.headers[\"X-USER-TOKEN\"]\n }\n end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"CloudServers Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def headers\n h = {}\n raw.headers_hash.each {|k,v| h[k] = v }\n h\n end",
"def headers\n {:content_type => :json, :accept => :json, :authorization => \"TAuth realm=\\\"https://odg.t-online.de\\\",tauth_token=\\\"#{token}\\\"\"}\n end",
"def headers\n res = parsed_headers\n if has_delta?\n res.concat(delta_headers)\n end\n res\n end",
"def get_headers\n request_object.headers\n end",
"def authentication_headers\n {\n \"authenticate\" => {\n \"username\" => @username,\n \"apiKey\" => @api_key\n }\n }\n end",
"def request_headers\n @request_headers.map do |header, value|\n \"#{header}: #{value}\"\n end.join(\"\\n\")\n end",
"def request_headers\n @agent.request_headers\n end",
"def build_headers(url, key, sig_type = nil, additional_headers = {})\n sig = Signature.new(url, key)\n sig_type ||= 'blob'\n\n # RestClient will set the Content-Type to application/x-www-form-urlencoded.\n # We must override this setting or the request will fail in some cases.\n\n headers = {\n 'Content-Type' => '',\n 'x-ms-date' => Time.now.httpdate,\n 'x-ms-version' => @storage_api_version,\n :auth_string => true\n }\n\n headers.merge!(additional_headers)\n headers['Authorization'] = sig.signature(sig_type, headers)\n\n headers\n end",
"def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end",
"def build_request_headers(request)\n @request_headers.each do |key, value|\n request[key] = value\n end\n request\n end"
] |
[
"0.7886555",
"0.7835401",
"0.7763427",
"0.7763427",
"0.7689034",
"0.7673939",
"0.7669375",
"0.76252156",
"0.76212615",
"0.760028",
"0.7560757",
"0.75551826",
"0.7507351",
"0.7480963",
"0.74709487",
"0.7439533",
"0.7388652",
"0.7386872",
"0.7354329",
"0.734037",
"0.73400825",
"0.72508204",
"0.72306347",
"0.72228134",
"0.7216183",
"0.721212",
"0.7205617",
"0.7187496",
"0.7187476",
"0.7183914",
"0.7177332",
"0.7177214",
"0.71767956",
"0.71758103",
"0.7173476",
"0.71449655",
"0.7134565",
"0.7133117",
"0.7112845",
"0.7103358",
"0.70872337",
"0.7086065",
"0.7082145",
"0.7073572",
"0.7073572",
"0.7067037",
"0.70666",
"0.7065613",
"0.7059385",
"0.70485973",
"0.70396185",
"0.7031737",
"0.70197237",
"0.7017608",
"0.70140225",
"0.70114523",
"0.7002402",
"0.699775",
"0.69961596",
"0.6992663",
"0.6985886",
"0.69834256",
"0.6970727",
"0.693826",
"0.69337267",
"0.6925267",
"0.69251454",
"0.6921479",
"0.69166934",
"0.6908762",
"0.6899898",
"0.689714",
"0.6892892",
"0.6862158",
"0.6852163",
"0.68483233",
"0.6846193",
"0.6846081",
"0.68449384",
"0.6841318",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.6840527",
"0.68370456",
"0.6829111",
"0.682654",
"0.6807067",
"0.6803363",
"0.68010914",
"0.6791729",
"0.67884",
"0.67877793",
"0.6787444",
"0.6762371"
] |
0.0
|
-1
|
Computes the body value for the API request
|
def compute_query_api_pattern_body(query_api_method_name, container, used_query_params, pattern)
if container[:body].nil? && !pattern[:body].nil?
# Make sure body is not left blank when it must be set
fail(Error::new("#{query_api_method_name}: body parameter must be set")) if pattern[:body] == Utils::MUST_BE_SET
container[:body] = compute_query_api_pattern_param(query_api_method_name, pattern[:body], container[:params_with_defaults], used_query_params)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_body\n request_object.body\n end",
"def body\n data[:body]\n end",
"def body\n @body ||= @request.body.read\n end",
"def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end",
"def getBody()\n return @req.body\n end",
"def request_body\n MAPPING.keys.inject({}) do |mem, e|\n next mem unless value = send(e)\n mem.merge!(e.to_s => value.to_json)\n end\n end",
"def calculate_params\n content_type == 'application/json' ? JSON.parse(body) : nil\n end",
"def req_body\n\t\t\t@req_body ||= env['rack.input'].read\n\t\tend",
"def body\n self['body']\n end",
"def body(request)\n request.body.read\n end",
"def body\n fetch\n @body\n end",
"def body\n return @body\n end",
"def request_body\n request_body = {\n :active => 'true',\n :category => 'Other',\n :subcategory => 'Other',\n :u_service_provider => 'Duke University',\n :u_it_service => 'Public Computing Labs',\n :service_offering => 'Public Computing Labs Offering',\n :contact_type => 'email',\n :description => 'This is the lengthier description!',\n :impact => 'Individual',\n :urgency => 'Medium',\n :priority => 'Low',\n :incident_state => 'New',\n :notify => '1',\n :state => '1',\n :assignment_group => 'Service Desk-OIT',\n :short_description => 'This is the title of the the ticket!',\n :caller_id => CALLER\n }\n end",
"def body\n if @http_response != nil \n @body = @http_response.body\n end\n @body\n end",
"def body\n json? ? handle_json : handle_raw\n end",
"def response_body=(_arg0); end",
"def body\n self.read_body\n self.get_body\n end",
"def body\n self[:body]\n end",
"def getBody\n @body\n end",
"def body body=nil\n @response.body = body if body\n @response.body\n end",
"def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end",
"def response_body; end",
"def response_body; end",
"def body\n @body ||= (\n JSON.parse(response.body) if response.body.length > 0\n )\n end",
"def body\n Base64::decode64(self[:body])\n end",
"def raw_body\n @attributes[:raw_body]\n end",
"def json_body\n @json_body ||= Response.prepare_json_object(JSON.parse(body))\n end",
"def request_body_attributes\n return {} unless request.format.json?\n return {} unless request.body.present?\n JSON.parse(request.body.read)\n ensure\n request.body.rewind if request.body.present?\n end",
"def body\n @body ||= begin\n begin\n io = Java.java_to_ruby(\n org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object\n )\n io.read\n rescue Exception => e\n puts \"Error in Response#body: #{e.message}\"\n end\n end\n end",
"def body\n @params.to_json\n end",
"def body\n @body_result ||= JSON.parse(@rest_response.body, symbolize_names: true)\n end",
"def set_request_body!(request); end",
"def request_body(xml); xml; end",
"def body\n response.body || ''\n end",
"def get_body(env)\n Kickbox::HttpClient::ResponseHandler.get_body(env)\n end",
"def request_body required, media_type, data: { }, desc: '', **options\n (self[:requestBody] ||= RequestBodyObj.new(required, desc)).absorb(media_type, { data: data , **options })\n end",
"def body\n @raw\n end",
"def body\n @http_response.body\n end",
"def body_string\n body = request.body\n body.rewind # Since this is a StringIO and we access it twice, rewind it\n body.read\n rescue RuntimeError => exception\n # Rails 4.2 with Ruby 2.3 raises \"RuntimeError: can't modify frozen String\"\n # when trying to access request.body with invalid JSON. Fallback to header.\n request.headers[\"RAW_POST_DATA\"]\n end",
"def body(request_body)\n @params[:body] = request_body\n end",
"def body\n response&.body.to_s\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body(value = nil)\n if value\n @body = value\n else\n @body\n end\n end",
"def getBody(req)\n req.body.rewind\n JSON.parse(req.body.read)\nend",
"def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"def make_request_body(opts, headers); end",
"def response_body\n @response[:body]\n end",
"def body(value = nil)\n if value\n self.body = value\n# add_encoding_to_body\n else\n process_body_raw if @body_raw\n @body\n end\n end",
"def to_body\r\n to_hash\r\n end",
"def body\n @body || \"\"\n end",
"def json_body\n\t\t\t@json_body ||=\n\t\t\t\tbegin\n\t\t\t\t\tJSON.parse(req_body)\n\t\t\t\trescue JSON::ParserError\n\t\t\t\t\tnil\n\t\t\t\tend\n\t\tend",
"def body\r\nif raw_post = @env['RAW_POST_DATA']\r\nraw_post.force_encoding(Encoding::BINARY)\r\nStringIO.new(raw_post)\r\nelse\r\n@env['rack.input']\r\nend\r\nend",
"def body\n response.body\n end",
"def original_body\n @original_body\n end",
"def build_body(body, request_options, method)\n if method == :GET && body.empty?\n return nil\n end\n\n # merge optional special request options to the body when it\n # doesn't have to be in the array format\n body.merge!(request_options.data) if body.is_a?(Hash) && method != :GET\n to_json(body)\n end",
"def body\n @response.body\n end",
"def body\n @response.body\n end",
"def body\n @body ||= process_text(@raw_body)\n end",
"def body\n read_attribute(:body) || ''\n end",
"def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let httparty handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n if header_params['Content-Encoding'] == 'gzip'\n gzip = Zlib::Deflate.new(nil, Zlib::MAX_WBITS + 16)\n data = gzip.deflate(data, Zlib::FINISH)\n gzip.close\n elsif header_params['Content-Encoding'] == 'deflate'\n data = Zlib::deflate(data)\n elsif header_params['Content-Encoding'] == 'zstd1'\n data = Zstandard.deflate(data)\n end\n data\n end",
"def normalize_body(normalized_headers, body)\n case body\n when nil\n return body\n when ::Hash, ::Array\n body_hash = body\n when ::String\n # use unparsed original body to avoid losing information when we are\n # unable to parse or parse a literal JSON string as happens in the case\n # of RightAPI's health-check.\n return @body\n end\n case ct = compute_content_type(normalized_headers)\n when 'application/x-www-form-urlencoded'\n result = build_query_string(body_hash)\n normalize_content_length(normalized_headers, result)\n else\n result = ::JSON.dump(body_hash)\n normalize_content_length(normalized_headers, result)\n end\n result\n end",
"def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end",
"def body_retrieve\n ret = Hash.new\n ret[:access_token] = self.access_token\n ret[:type] = self.institution\n ret[:email] = self.email\n ret.merge(body)\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end"
] |
[
"0.7472376",
"0.7166822",
"0.7087384",
"0.7058858",
"0.7055976",
"0.7036933",
"0.700654",
"0.67885125",
"0.6787934",
"0.67851615",
"0.6771744",
"0.67294073",
"0.6705411",
"0.66983247",
"0.66577965",
"0.66535336",
"0.66465807",
"0.6639614",
"0.6637837",
"0.6611957",
"0.66100013",
"0.66073567",
"0.66073567",
"0.65923333",
"0.6578077",
"0.65479755",
"0.6543669",
"0.6541609",
"0.65355176",
"0.6534476",
"0.6523151",
"0.6521767",
"0.6488563",
"0.648276",
"0.6475635",
"0.6468735",
"0.64509034",
"0.64439857",
"0.642705",
"0.6416934",
"0.63961965",
"0.63957316",
"0.63957316",
"0.63957316",
"0.63957316",
"0.6390244",
"0.6387401",
"0.6377037",
"0.6377037",
"0.6377037",
"0.6377037",
"0.63739175",
"0.6366103",
"0.6366018",
"0.6364993",
"0.63580316",
"0.635008",
"0.63480085",
"0.63219905",
"0.63170236",
"0.6315237",
"0.6312601",
"0.6312601",
"0.6302173",
"0.6301964",
"0.62955844",
"0.6284043",
"0.6273562",
"0.62637657",
"0.62528706",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186",
"0.62514186"
] |
0.0
|
-1
|
Computes single Query API pattern parameter
|
def compute_query_api_pattern_param(query_api_method_name, source, params_with_defaults, used_query_params) # :nodoc:
case
when source.is_a?(Hash) then compute_query_api_pattern_hash_data(query_api_method_name, source, params_with_defaults, used_query_params)
when source.is_a?(Array) then compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)
when source.is_a?(Symbol) then compute_query_api_pattern_symbol_data(query_api_method_name, source, params_with_defaults, used_query_params)
when source.is_a?(String) then compute_query_api_pattern_string_data(query_api_method_name, source, params_with_defaults, used_query_params)
else source
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)\n container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)\n end",
"def compute_query_api_pattern_based_params(query_pattern_name, query_params={})\n # fix a method name\n pattern = query_api_patterns[query_pattern_name.to_s]\n # Complain if we dont know the method\n raise PatternNotFoundError::new(\"#{query_pattern_name.inspect} pattern not found\") unless pattern\n # Make sure we got what we expected\n query_params ||= {}\n raise Error::new(\"Params must be Hash but #{query_params.class.name} received.\") unless query_params.is_a?(Hash)\n # Make a new Hash instance from the incoming Hash.\n # Do not clone because we don't want to have HashWithIndifferentAccess instance or\n # something similar because we need to have Symbols and Strings separated.\n query_params = Hash[query_params]\n opts = {}\n opts[:body] = query_params.delete(:body)\n opts[:headers] = query_params.delete(:headers) || {}\n opts[:options] = query_params.delete(:options) || {}\n opts[:params] = query_params._stringify_keys\n opts[:manager] = self\n request_opts = compute_query_api_pattern_request_data(query_pattern_name, pattern, opts)\n # Try to use custom :process_rest_api_request method first because some auth things\n # may be required.\n # (see OpenStack case) otherwise use standard :process_api_request method\n { :method => respond_to?(:process_rest_api_request) ? :process_rest_api_request : :process_api_request,\n :verb => request_opts.delete(:verb),\n :path => request_opts.delete(:path),\n :opts => request_opts }\n end",
"def compute_query_api_pattern_path(query_api_method_name, container, used_query_params)\n container[:path] = compute_query_api_pattern_param(query_api_method_name, container[:path], container[:params_with_defaults], used_query_params)\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def query_param\n params[:q]\n end",
"def match_query(query); end",
"def compute_query_api_pattern_body(query_api_method_name, container, used_query_params, pattern)\n if container[:body].nil? && !pattern[:body].nil?\n # Make sure body is not left blank when it must be set\n fail(Error::new(\"#{query_api_method_name}: body parameter must be set\")) if pattern[:body] == Utils::MUST_BE_SET\n container[:body] = compute_query_api_pattern_param(query_api_method_name, pattern[:body], container[:params_with_defaults], used_query_params)\n end\n end",
"def to_param\n \"#{self.id}-#{self.match.try(:name)}\".parameterize\n end",
"def query_params=(_arg0); end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def query_parameters; end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def query_param(raw_query_str)\n \"query:(query_string:(analyze_wildcard:\" \\\n \"!t,query:'#{escape(raw_query_str)}'))\"\n end",
"def query_params; end",
"def query_parameters\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def query_string\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def pattern_params\n params[:pattern]\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def query ; @request.params ; end",
"def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end",
"def to_param\n \"#{id} #{full_number}\".parameterize\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, &block)\n self.class.query_api_pattern(method_name, verb, path, opts, @query_api_patterns, &block)\n end",
"def detail_component_param(qryOrPath, name, schema: {\"type\" => \"string\"}, description: \"\")\n case qryOrPath\n when :query then\n name = \"q_\" + name.to_s\n [name, {\n \"name\" => name.to_s,\n \"in\" => 'query',\n \"description\" => description,\n SCHEMA => schema\n }]\n when :path then\n name = name.to_s\n [name, {\n \"name\" => name,\n \"in\" => 'path',\n \"required\" => true,\n \"description\" => description,\n SCHEMA => schema\n }]\n end\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end",
"def params\n split_query_string.flat_map do |keyword|\n [\"%#{keyword}%\".mb_chars.downcase.to_s] * query_for_one_keyword.count('?')\n end\n end",
"def query_param\n {\n query: ::Kahn::JSON.decode(params.fetch('query', '{}')),\n fields: ::Kahn::JSON.decode(params.fetch('fields', '{}')),\n limit: params.fetch(:limit, 10),\n skip: params.fetch(:skip, 0)\n }\n end",
"def local_param_match(query)\n expect(query).to match(/^ *_query_:\\\"\\{([^}]+)\\}(.*)\" *$/)\n query =~ /^ *_query_:\\\"\\{([^}]+)\\}(.*)\" *$/\n expect(param_str = $1).not_to be_nil\n expect(query = $2).not_to be_nil\n\n yield [param_str, query] if block_given?\n end",
"def find_raw_query_param(query, param)\n start = query.index(param)\n finish = (query.index('&', start + param.length + 1) || 0) - 1\n query[start..finish]\n end",
"def term_to_query(term)\n \"%#{term}%\"\nend",
"def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end",
"def method_7(query)\n\t\tquery = [query[0..1] + \"%\" + query[-2..-1]]\n\tend",
"def to_param\n\t \"#{id} #{name}\".parameterize\n\tend",
"def query_def; query.name; end",
"def method_missing(method_name, *args, &block)\n begin\n invoke_query_api_pattern_method(method_name, *args, &block)\n rescue PatternNotFoundError\n super\n end\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def generate_next_url\n if eds_session.has_key? :query_string\n url = HTMLEntities.new.decode eds_session[:query_string]\n\n #blacklight expects the search term to be in the parameter 'q'.\n #q is moved back to 'query-1' in 'generate_api_query'\n #should probably pull from Info method to determine replacement strings\n #i could turn the query into a Hash, but available functions to do so delete duplicated params (Addressable)\n url.gsub!(\"query-1=AND,TI:\", \"q=\")\n url.gsub!(\"query-1=AND,AU:\", \"q=\")\n url.gsub!(\"query-1=AND,SU:\", \"q=\")\n url.gsub!(\"query-1=AND,\", \"q=\")\n\n #Rails framework doesn't allow repeated params. turning these into arrays fixes it.\n url.gsub!(\"facetfilter=\", \"facetfilter[]=\")\n url.gsub!(\"limiter=\", \"limiter[]=\")\n\n #i should probably pull this from the query, not the URL\n if (params[:search_field]).present?\n url << \"&search_field=\" << params[:search_field].to_s\n end\n return url\n else\n return ''\n end\n end",
"def query_api_pattern(method_name, verb, path='', opts={}, storage=nil, &block)\n opts = opts.dup\n method_name = method_name.to_s\n storage ||= query_api_patterns\n before = opts.delete(:before)\n after = opts.delete(:after) || block\n defaults = opts.delete(:defaults) || {}\n params = opts.delete(:params) || {}\n headers = opts.delete(:headers) || {}\n options = opts.delete(:options) || {}\n options[:method_name] = method_name\n body = opts.delete(:body) || nil\n # Complain if there are any unused keys left.\n fail(Error.new(\"#{method_name.inspect} pattern: unsupported key(s): #{opts.keys.map{|k| k.inspect}.join(',')}\")) if opts.any?\n # Store the new pattern.\n storage[method_name] = {\n :verb => verb.to_s.downcase.to_sym,\n :path => path.to_s,\n :before => before,\n :after => after,\n :defaults => defaults,\n :params => params,\n :headers => HTTPHeaders::new(headers),\n :options => options,\n :body => body }\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def to_param\n query_id\n end",
"def period_param\n query_params&.dig(:period)&.downcase\n end",
"def wildcard_search_param(parameter)\n parameter.downcase\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def get_q\n @q = params[:q].to_i if params.has_key?:q\n @q = nil if @q == 0 # avoid q = 0 when there is no filter\n end",
"def dh_api_query(command, params = ''); end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def query_field; end",
"def query_by_name1(name1)\n @PARAM_HASH[\"name1\"] = name1\n end",
"def stringToQuery (val)\n\t\t\n\tend",
"def query_by_name1(name1)\r\n @PARAM_HASH[\"name1\"] = name1\r\n end",
"def query_by_name1(name1)\r\n @PARAM_HASH[\"name1\"] = name1\r\n end",
"def field_query(field, value)\n \"_query_:\\\"{!field f=#{field}}#{value}\\\"\"\n end",
"def compile_query\r\n str = []\r\n\r\n str << \"controller|#{q[:controller]}|\" if q[:controller].present?\r\n str << \"action|#{q[:action]}|\" if q[:action].present?\r\n str << \"format|#{q[:format]}|\" if q[:format].present?\r\n str << \"status|#{q[:status]}|\" if q[:status].present?\r\n\r\n str << \"datetime|#{q[:on].strftime('%Y%m%d')}*|\" if q[:on].present?\r\n\r\n str << \"method|#{q[:method]}|\" if q[:method].present?\r\n str << \"path|#{q[:path]}|\" if q[:path].present?\r\n\r\n str.join(\"*\")\r\n end",
"def magic_params_not_truly_understood\n \"timekey=#{@timekey}&custom_search=0\"\n end",
"def param\n params[0]\n end",
"def random_query\n # Use a fake query\n # TODO: better random queries\n 'query ' + (rand*5000).to_i.to_s\nend",
"def method_6(query)\n\t\tquery = [query[0].chr + \"%\" + query[-1].chr]\n\tend",
"def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end",
"def to_param\n \"#{id} #{nickname}\".parameterize\n end",
"def query_string\n \"#{base_url}dmQuery/#{collection_alias}/#{searchstrings}/#{fields}/\" +\n \"#{sortby}/#{max_recs}/#{start}/#{suppress_pages}/#{docptr}/#{suggest}/\" +\n \"#{facets}/#{showunpub}/#{denormalize_facets}/#{response_format}\"\n end",
"def query_string\n \"#{base_url}dmQuery/#{collection_alias}/#{searchstrings}/#{fields}/\" +\n \"#{sortby}/#{max_recs}/#{start}/#{suppress_pages}/#{docptr}/#{suggest}/\" +\n \"#{facets}/#{showunpub}/#{denormalize_facets}/#{response_format}\"\n end",
"def query_param\n @query_param ||= QueryParamController.new config\n end",
"def query(parameter, url_field_name = 'first_url')\n url = value_for(url_field_name)\n return unless url\n query_hash(url)[parameter.to_s]\n end",
"def _arg( name )\n\t\tname = name.to_sym\n\t\treturn request.request_parameters[name] || request.query_parameters[name]\n\tend",
"def _arg( name )\n\t\tname = name.to_sym\n\t\treturn request.request_parameters[name] || request.query_parameters[name]\n\tend",
"def pattern=(_arg0); end",
"def method_4(query)\n\t\tLog.seg(\"Method 4 given: #{query}\", \"DEBUG\")\n\t\tquery = [\"%\" + query[(query.length/2)..-1]]\n\t\tLog.seg(\"Method 4 yields: #{query}\", \"DEBUG\")\n\t\tquery\n\tend",
"def match(*params)\n query(transform_query_values(params) { |v| \"==#{FmRest::V1.escape_find_operators(v.to_s)}\" })\n end",
"def get_query_params(url)\n url_partitioned_at_question_mark = url.partition(\"?\")\n url_partitioned_at_question_mark[2]\nend",
"def agi; param(6); end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def query_command(template:, yql: false, count: nil, parameters: {}, data: nil)\n url_command(template: template, path: \"/search/?#{yql ? \"yql=\" : \"query=\"}\", count: count, parameters: parameters, data: data)\n end",
"def initial_query=(_arg0); end",
"def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def a_param\n if @params.size > 1\n return @params[1]\n end\n return @params[0]\n end",
"def get_param s\n\t\t\tp = que_qs(s).first\n\t\t\tp = ui_default(s) if p.nil?\n\t\t\tp\n\t\tend"
] |
[
"0.68365395",
"0.64351565",
"0.62785095",
"0.62463754",
"0.61687696",
"0.6143873",
"0.6143873",
"0.6137482",
"0.6137482",
"0.6137482",
"0.61180097",
"0.6101446",
"0.6075014",
"0.60418373",
"0.60298634",
"0.59711194",
"0.59711194",
"0.5954473",
"0.5954473",
"0.59298915",
"0.58799434",
"0.58799434",
"0.58799434",
"0.58558905",
"0.58485335",
"0.58424187",
"0.5838974",
"0.5823631",
"0.582017",
"0.582017",
"0.58142126",
"0.58142126",
"0.58142126",
"0.5775057",
"0.5775002",
"0.5775002",
"0.5775002",
"0.57587355",
"0.57460225",
"0.57359827",
"0.5715676",
"0.57012945",
"0.5682949",
"0.56658876",
"0.56643426",
"0.5619726",
"0.55729026",
"0.5566265",
"0.5561088",
"0.5557193",
"0.5549675",
"0.5523707",
"0.5520896",
"0.55170876",
"0.5512399",
"0.5476272",
"0.5472807",
"0.5468724",
"0.54527485",
"0.5441476",
"0.54394203",
"0.5436485",
"0.5436485",
"0.54252183",
"0.5416366",
"0.5412971",
"0.5403594",
"0.5403594",
"0.5402219",
"0.5397115",
"0.536684",
"0.5342623",
"0.5342623",
"0.5330525",
"0.53243005",
"0.5315344",
"0.53062415",
"0.5305504",
"0.52991724",
"0.52949595",
"0.5279509",
"0.52738535",
"0.52738535",
"0.5269707",
"0.5266723",
"0.5259824",
"0.5259824",
"0.5251707",
"0.5249201",
"0.52421075",
"0.5234903",
"0.5234803",
"0.52242845",
"0.52220136",
"0.52219176",
"0.52157146",
"0.52143484",
"0.5210668",
"0.52061844",
"0.51953197"
] |
0.7036557
|
0
|
Deals with blank values.
|
def parse_query_api_pattern_remove_blank_key( key, value, result)
# 'KeyName{!remove-if-blank}'
blank_key_sign = key[FIND_BLANK_KEYS_TO_REMOVE]
if blank_key_sign
# Delete the original key from the resulting hash.
result.delete(key)
# But if its value is not blank then fix the key name (get rid of {!remove-if-blank}) and
# put it back.
unless value.respond_to?(:_blank?) && value._blank?
key = key.sub(blank_key_sign, '')
result[key] = value
end
end
[key, value]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalize_blank_values\n attributes.each do |column, value|\n self[column].present? || self[column] = nil\n end\n end",
"def skip_blanks?() @skip_blanks end",
"def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end",
"def effectively_empty( value )\n value.nil? || value.to_s.empty?\n end",
"def blank?\n @values.blank?\n end",
"def compact_blank!\n reject! { |_k, v| v.blank? }\n end",
"def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend",
"def compact_blank\n reject { |_k, v| v.blank? }\n end",
"def compact_blank; end",
"def _blank?(value)\n value.nil? || value == ''\n end",
"def skip_include_blank?; end",
"def blank_param?(data)\n data.blank? || data.try(:values).try(:all?, &:blank?)\n end",
"def display_blanks_as=(v) Axlsx.validate_display_blanks_as(v); @display_blanks_as = v; end",
"def compact_blank!; end",
"def assemble(values)\n if allow_blank\n values\n else\n values.delete_if(&:blank?)\n end\n end",
"def blank?\n value.blank?\n end",
"def nil_values(the_input, nil_keys_array = Array.new)\n the_input.select { |_, v| v.blank? }.each_key do |key|\n nil_keys_array << key.to_s\n end\n raise K2EmptyParams.new(nil_keys_array) unless nil_keys_array.blank?\n end",
"def values_blank?(name, values=nil)\n values ||= values_for(name)\n values.blank? || values.first.blank?\n end",
"def not_nil_value\n if @attributes['value'].nil?\n errors.add(:value, ' cannot be nil')\n end\n end",
"def is_empty()\n \n end",
"def check_value_empty(data)\n case @type\n when 'str', 'text', 'password', 'img', 'url'\n data.empty?\n when 'int', 'float', 'enum'\n # These values are always non-empty\n false\n when 'set'\n data == 0\n else\n raise \"Invalid type #{@type.inspect} encountered on attribute #{@name.inspect}\"\n end\n end",
"def missing(obj)\n obj.to_s.strip.empty?\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end",
"def process_value(value)\n if value.nil? || value.text.strip == ''\n nil\n else\n value.text.strip\n end\nend",
"def weed_nils\n subject.reject! { |s| s == \"\" } if subject.present?\n end",
"def clear_value_if_empty\n write_attribute(:value, nil) if self.value.is_a?(String) && self.value.empty?\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n @value == nil\n end",
"def strip_blanks!\n @content.reject! { |item| item[:type] == :blank }\n end",
"def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def blank?\n true\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def value_empty?\n if value === nil or value === \"\"\n return true\n end\n return false\n end",
"def remove_blank_rows\n end",
"def blank?(value)\n value.nil? || value.to_s.empty?\n end",
"def blank?\n true\n end",
"def fix_nil_time_values\n if params[:response] && params[:response][:answers_attributes]\n params[:response][:answers_attributes].each do |key, attribs|\n if attribs[\"time_value(4i)\"].blank? && attribs[\"time_value(5i)\"].blank?\n %w[1 2 3].each { |i| params[:response][:answers_attributes][key][\"time_value(#{i}i)\"] = \"\" }\n end\n end\n end\n end",
"def blank_out\n\t\tself.write_attribute(:value, nil )\n\tend",
"def drop_blanks!\n\t\tdelete_if{|a|a.blank?}\n\tend",
"def blank?\n self.value.blank? || self.deleted?\n end",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end",
"def skipable_empty_value?(_value)\n false\n end",
"def new_val_check(new_val)\n new_val.blank? ? nil : new_val\n end",
"def blank?\n false\n end",
"def blank?\n self.strip.empty?\n end",
"def aggregate_treat_undefined_attributes_as_default_value?; end",
"def empty?\n return false if @opts[:values]\n super\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def immediate?; @unbound_fields.empty?; end",
"def handle_missing_values\n replace_by_most_seen_value!\n end",
"def blank?\n self.nil? || self.empty?\n end",
"def except_empty\n self.reject{|k, v| v.to_s.empty?}\n end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def anything_blank?\n max_payment.blank? || min_payment.blank? || deposit.blank? || term.blank?\n end",
"def nullify_blanks\n self.author = nil if author.blank?\n end",
"def interpret(value)\n value == \"\" ? nil : value\n end",
"def empty_trap_required\n is_human = true\n params.slice(*TheCommentsBase.config.empty_inputs).values.each{|v| is_human = (is_human && v.blank?) }\n\n if !is_human\n k = t('the_comments.trap')\n v = t('the_comments.trap_message')\n @errors[ k ] = [ v ]\n end\n end",
"def handle_blank(value)\n if value.present?\n if block_given?\n yield\n else\n value.to_s\n end\n else\n h.raw('<span class=\"metadata\">not available</span>')\n end\n end",
"def empty?\n @values.values.all?(&:nil?)\n end",
"def missing_initial_values\n @missing_initial_values ||= []\n end",
"def blank?\n self.strip.length === 0\n end",
"def empty?\n value.empty?\n end",
"def blank?\n empty?\n end",
"def blank?\n empty?\n end",
"def blank?(object)\n object.to_s.sub(/\\s+/, '') == ''\n end",
"def cellEmpty?(cell)\n\t\tif @field[cell].value = \" \"\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end",
"def nilOrEmpty(data, alt)\n \t\tif data == nil || data.length == 0\n \t\t\talt\n \t\telse\n \t\t\tdata\n \t\tend\n \tend",
"def blank?\n self.strip.size == 0\n end",
"def missings_to_nil(values)\n values.collect{|v| is_missing?(v) ? nil : v}\n end",
"def blank?\n length == 0\n end",
"def check_for_nulls\n# if self.name.nil? && self.dynamic_type_id.nil?\n# flash[:notice] = \"You must fill in something !\"\n if self.dynamic_type_id.nil?\n self.dynamic_type_id = 3\n end\n if self.name.nil?\n self.name = \"please enter a name\"\n end\n# end\n end",
"def blanks\n self.blank.split('-')\n end",
"def is_blank_space?\n get_type == :empty\n end",
"def empty?\n @value.nil? || @value.empty?\n end",
"def fetched_value_is_empty?\n Array(@fetched_value).reduce(true) do |all_empty, val|\n all_empty &&= ( val.nil? || ( val.respond_to?(:empty?) && val.empty? ) )\n end\n end",
"def strip_empty?\n @strip_empty\n end",
"def blank?\n %w(total_spend average_monthly_spend average_transaction_value breakdown total_received total_received_from_councils).all?{ |a| self.send(a).blank? || (self.send(a) == 0) }\n end"
] |
[
"0.7208345",
"0.70001227",
"0.6798062",
"0.6768922",
"0.67579424",
"0.6656088",
"0.6647025",
"0.6588933",
"0.6574041",
"0.6542165",
"0.6534159",
"0.65135974",
"0.6498591",
"0.6463873",
"0.64541864",
"0.6358975",
"0.63384277",
"0.6334676",
"0.63287187",
"0.6317623",
"0.6315478",
"0.6299511",
"0.6296308",
"0.6296308",
"0.6296308",
"0.62629324",
"0.6255454",
"0.62327766",
"0.62322426",
"0.6221648",
"0.62086374",
"0.62086374",
"0.62086374",
"0.6202875",
"0.62009704",
"0.61748064",
"0.6174146",
"0.6174116",
"0.6169675",
"0.6169675",
"0.6169675",
"0.6169675",
"0.61651796",
"0.6159308",
"0.6153258",
"0.61491513",
"0.6135757",
"0.6124267",
"0.61138695",
"0.6094985",
"0.609119",
"0.6082471",
"0.60824525",
"0.6082125",
"0.606866",
"0.6059042",
"0.6051739",
"0.6045606",
"0.6043703",
"0.6043703",
"0.60338086",
"0.60291684",
"0.60233414",
"0.6020022",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.60093915",
"0.59860766",
"0.5981337",
"0.59734726",
"0.5954166",
"0.5944584",
"0.59230477",
"0.59191346",
"0.5911305",
"0.59032315",
"0.5901651",
"0.5897043",
"0.58965707",
"0.58957267",
"0.58946943",
"0.58912456",
"0.58888394",
"0.5878704",
"0.5874253",
"0.58732945",
"0.5859126",
"0.58555156",
"0.58517754",
"0.5850009",
"0.584685",
"0.58435273"
] |
0.0
|
-1
|
Query API pattern: ARRAY Parses Array objects
|
def compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)
result = source.dup
source.dup.each_with_index do |item, idx|
value = compute_query_api_pattern_param(query_api_method_name, item, params_with_defaults, used_query_params)
value == Utils::NONE ? result.delete_at(idx) : result[idx] = value
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def terms_array_query(field, val, options = {})\n terms_query(field, val, options) if val && (!val.is_a?(Array) || val.any?)\n end",
"def sql_array(array)\n Arel.sql(ActiveRecord::Base.sanitize_sql([\"ARRAY[?]\", array]))\n end",
"def getify_array(array_of_records)\n return array_of_records.map{|r| r.get}\n end",
"def params_array_from(raw_params); end",
"def arrays(args={})\n get(\"/arrays.json\",args)\n end",
"def array_result\n [@result['results']].flatten\n end",
"def to_a\n res = data\n return [] unless data\n res = apply_selects(res, opts[:fast_selects] || [])\n res = strip_unused(res)\n unless opts[:includes].blank?\n res = enrich(res, opts[:includes])\n res = strip_unenriched(res, opts[:includes])\n end\n res = apply_selects(res, opts[:slow_selects] || [])\n res = apply_maps(res, opts[:maps] || [])\n res = wrap(res)\n res\n end",
"def array_query(sql, name, binds)\n query(sql, name, binds)[0]\n end",
"def get_dynamic_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/dynamic'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true,\n 'echo' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body) unless\n _response.raw_body.nil? ||\n _response.raw_body.to_s.strip.empty?\n decoded\n end",
"def fill_query_vars(array)\n array.stringify_keys!\n keys = [\n 'error',\n 'm',\n 'p',\n 'post_parent',\n 'subpost',\n 'subpost_id',\n 'attachment',\n 'attachment_id',\n 'name',\n 'static',\n 'pagename',\n 'page_id',\n 'second',\n 'minute',\n 'hour',\n 'day',\n 'monthnum',\n 'year',\n 'w',\n 'category_name',\n 'tag',\n 'cat',\n 'tag_id',\n 'author',\n 'author_name',\n 'feed',\n 'tb',\n 'paged',\n 'meta_key',\n 'meta_value',\n 'preview',\n 's',\n 'sentence',\n 'title',\n 'fields',\n 'menu_order',\n 'embed',\n ]\n keys.each do |key|\n array[key] ||= ''\n end\n\n array_keys = [\n 'category__in',\n 'category__not_in',\n 'category__and',\n 'post__in',\n 'post__not_in',\n 'post_name__in',\n 'tag__in',\n 'tag__not_in',\n 'tag__and',\n 'tag_slug__in',\n 'tag_slug__and',\n 'post_parent__in',\n 'post_parent__not_in',\n 'author__in',\n 'author__not_in',\n ]\n array_keys.each do |key|\n array[key] ||= []\n end\n array\n end",
"def query\n { :locations => [] }\n end",
"def find_many(array)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id IN (#{array.join(\",\")})\")\n \n results_as_objects(results)\n end",
"def prepare_nested_query(value)\n if value.respond_to?(:iso8601)\n value.iso8601\n else\n case value\n when Array\n value.map { |v| prepare_nested_query(v) }\n when Hash\n value.inject({}) do |memo, (k, v)|\n memo[k] = prepare_nested_query(v)\n memo\n end\n when Integer, TrueClass, FalseClass, NilClass\n value\n else\n value.to_s\n end\n end\n end",
"def to_a\n return @records unless loadable?\n\n @response = cache.get_or_set_query(klass, options) do\n connection.documents({ query: options })\n end\n\n @records = []\n\n if @response.success?\n records = @response.members.attributes[\"query\"]\n\n records.each do |record|\n @records << klass.new(record.merge(persisted: true))\n end\n\n @loaded = true\n end\n\n @records\n end",
"def paramstype\n \"Array\"\n end",
"def query(value)\n value.each do |field, rx|\n @query_rx[field] = rx\n end\n end",
"def array(field_name, opts = {}, &block)\n if opts[:type] == :object\n object(field_name, array: true, &block)\n else\n field(field_name, opts, &block)\n end\n end",
"def get_integer_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/integer'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded\n end",
"def list_arrays_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def query_return_array(sql, *binds)\n mysql.fetch(sql, *binds).all\n end",
"def array()\n\t\t@array\n\tend",
"def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end",
"def process_array response, body\n body.map do |element|\n from_response response, element\n end\n end",
"def test_correct_encoding_for_array_params\n get :some_action, :an_array => [1, 2]\n assert_equal \"http://test.host/test/some_action?an_array[]=1&an_array[]=2\", @response.body\n assert_equal ActionController::Routing::PathSegment::Result, @request.query_parameters[:an_array].class\n end",
"def parse_qsp_array(key, array, key_prefix, found)\n array.each do |item|\n found = parse_qsp(key, item, key_prefix, found)\n end\n found\n end",
"def data_type\n case query.class\n when ActiveRecord::Relation then\n 'ActiveRecord'\n when Array then\n 'Array'\n end\n end",
"def to_a\n fetch(ids)\n end",
"def to_a\n fetch(ids)\n end",
"def parse_array\n obj = [object_ref]\n\n items = @tokens.next\n\n obj << items\n\n items.times do\n obj << parse\n end\n\n obj\n end",
"def to_a\n deserialize(find)\n end",
"def generate_array_query(accessions: [])\n \"SELECT DISTINCT id, name FROM(SELECT id_col AS id, name_col as name FROM #{CellMetadatum::BIGQUERY_TABLE}, \" \\\n \"UNNEST(#{big_query_id_column}) AS id_col WITH OFFSET id_pos, UNNEST(#{big_query_name_column}) AS name_col \" \\\n \"WITH OFFSET name_pos WHERE id_pos = name_pos #{accessions.any? ? \"AND #{format_accession_list(accessions)}\" : nil}) \" \\\n 'WHERE id IS NOT NULL ORDER BY LOWER(name)'\n end",
"def to_a\n array = all\n array.each_with_index do |value, i|\n array[i] = value.to_a if value.is_a?(RedisArray)\n end\n end",
"def apify(array)\n Rails.logger.info(array.class.name)\n if $valid_classes.include?(array.class.name)\n newArr = []\n array.each do |a|\n na = a.attributes\n if a.user\n na[\"user\"] = a.user\n end\n na[\"created_at\"] = \"#{time_ago_in_words(a.created_at)} ago\"\n if a.class.name == \"Question\"\n ur = a.get_user_unread(current_user)\n na[:unread] = ur[:unread]\n na[:unread_status] = ur[:status]\n na[:total_replies] = a.replies.size\n end\n newArr.push(na)\n end\n return newArr\n elsif array.class.name == \"Question\"\n a = array.attributes\n a[:user] = array.user\n a[:total_replies] = array.replies.size\n a[:replies] = apify(array.replies)\n a[:created_at] = \"#{time_ago_in_words(array.created_at)} ago\"\n return a\n end \n end",
"def get_model_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded.map{|element| Employee.from_hash(element)}\n end",
"def items\n # [obj_or_array].flatten makes this always be an array (lastfm gives\n # the single object when it's not an array)\n [main_result[response_type]].flatten.compact rescue []\n end",
"def array(name, options={})\n param(:array, name, options)\n end",
"def isArray _args\n \"isArray _args;\" \n end",
"def get_dynamic_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/dynamic'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body) if not (_response.raw_body.nil? or _response.raw_body.to_s.strip.empty?)\n return decoded\n end",
"def array\n @array\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def to_a; [Array]; end",
"def solr_range_queries_to_a(solr_field)\n @response[:stats][:stats_fields][solr_field][:data] || []\n end",
"def query_multiple_results(query_string, provided_client = nil)\n results = with_client(provided_client) do |client|\n result = []\n result << client.query(query_string)\n result << client.store_result while client.next_result\n result.compact\n end\n\n results.map(&:to_a)\n end",
"def read_many(query)\n adapter.read_many(query)\n end",
"def read_many(query)\n adapter.read_many(query)\n end",
"def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end",
"def array_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageApi.array ...'\n end\n # resource path\n local_var_path = '/array'\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[:'array_alias'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"UsageApi.array\",\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: UsageApi#array\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def mongoize\n ::Array.mongoize(self)\n end",
"def multiple(sql, values = [])\n r = $db.exec_params(sql, values)\n return [] if r.ntuples == 0\n r.map { |row| convert_to_ruby_types(row) }\nend",
"def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: self.big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect {|d| detected_type.match(d).present?}\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def list_arrays_assigned_to_profile(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/arrays\", args)\nend",
"def get_integer_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/integer'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded\n end",
"def Array(p0) end",
"def all_by_name_and_type(name, type)\n where(name: name, array_type: type).order_by(&:array_index).to_a\n end",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect { |d| detected_type.match(d).present? }\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def expect_array(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Array)\n errors.add(field, \"#{subfield} must be an array\")\n false\n end",
"def find_media_sorted_arrays(json)\n\nend",
"def to_a\n array\n end",
"def from_sql_array\n retval = Array.new\n quotes = false\n\n # Chop off the leading and trailing braces...\n str = self[1..-2]\n j = 0\n\n # Scan through the characters, looking for quotes and grabbing Array\n # elements when we find them.\n str.split(//).each_with_index do |c, i|\n if c == '\"' && (i == 0 || str[i - 1].chr != '\\\\')\n quotes = !quotes\n elsif c == ',' && !quotes\n retval << str[j, i - j]\n j = i + 1\n end\n end\n\n # Plop on the rest of the string that wasn't accounted for above.\n retval << str[j..-1]\n\n # Get rid of escapes on quotes and backslashes.\n retval.each_with_index do |v, i|\n retval[i] = v.gsub(/^\\\"(.*)\\\"$/, '\\1').gsub(/\\\\\\\"/, '\"').gsub(/\\\\\\\\/, '\\\\')\n end\n end",
"def to_a; Array(force) end",
"def test_parse_array_of_hashes_starting_with_array\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, and Rover are in a pack, Doggie and Lassie are in a different pack.', last_response.body\n end",
"def to_a\n data.all\n end",
"def schema_array_type(db_type)\n :array\n end",
"def perform_field_query query, response, scope\n if Array === query\n case query.first\n when :method # a method call\n query.shift\n return eval(query.join('.'))\n when :literal # a literal value\n return query.last\n end\n end\n response.scalar_query(query, scope)\n end",
"def array name, **params, &cb\n current = @current # closure scope\n\n nested = begin\n Nested.!(current, &cb)\n rescue Errors::AnonymousTypeDetected => err\n Utils.Type err.type\n end\n\n case\n when !params[:class].nil? # cb.nil?\n type = Utils.Type(params.delete(:class))\n schema { Utils.smart_send(__send__(current, name), *(type ? [:each, type] : [:maybe])) }\n when name.nil? then schema { each(nested) } # FIXME: CAN IT BE NIL?!\n else schema { __send__(current, name).each(nested) }\n end\n\n case\n when params[:discard_empty] then schema.discarded!(name)\n when Nested === self then # do nothing\n else define_method(name) { @inputs[name] }\n end\n end",
"def query(expr=\"\", query_options={})\n result = []\n self.domain.query(query_options.merge({:expr => expr})).each do |i|\n result << self.new(i.key, i.attributes, false)\n end\n return result\n end",
"def array\n raise \"Not implemented\"\n end",
"def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end",
"def read(query)\n return [] unless query.valid?\n query.model.load(adapter.read(query), query)\n end",
"def terms_query(field, val, options = {})\n if val.is_a?(Array)\n {terms: {field => val}.merge!(options)}\n else\n {term: {field => val}}\n end\n end",
"def arrayed(object) # :doc:\n (object.is_a?(Array) ? object : [object])\n end",
"def generate_array_query\n \"SELECT DISTINCT id, name FROM(SELECT id_col AS id, name_col as name \" + \\\n \"FROM #{CellMetadatum::BIGQUERY_TABLE}, UNNEST(#{self.big_query_id_column}) AS id_col WITH OFFSET id_pos, \" + \\\n \"UNNEST(#{self.big_query_name_column}) as name_col WITH OFFSET name_pos WHERE id_pos = name_pos)\"\n end",
"def fetch\n\t\t\t\t[self.[], @args]\n\t\t\tend",
"def array\n self.allObjects\n end",
"def converted_arrays; end",
"def fetch_array\n IBM_DB.fetch_array(@stmt) if @stmt\n end",
"def arrayCommand( command, array_class, good, bad = nil )\n\n # Send the command\n send( command )\n\n # Worked?\n if replyCode( reply = @conn.readline() ) == good\n # Yes, load up the array\n array_class.new( @conn )\n elsif bad and replyCode( reply ) == bad\n # \"Bad\" response, return an empty array\n Array.new()\n else\n # Something else, throw an error.\n raise DictError.new(), reply\n end\n \n end",
"def array(method = nil)\n -> (v) do\n if v\n v.split(',').map{|a| cast(a, method) }\n end\n end\n end",
"def arrayCommand( command, array_class, good, bad = nil )\n\n # Send the command\n send( command )\n\n # Worked?\n if replyCode( reply = @conn.readline() ) == good\n\n # Yes, load up the array\n array_class.new( @conn )\n elsif bad and replyCode( reply ) == bad\n # \"Bad\" response, return an empty array\n Array.new()\n else\n # Something else, throw an error.\n raise DictError.new(), reply\n end\n \n end",
"def dynamicArray(n, queries)\n solver = Solver.new(n, queries)\n solver.execute\nend",
"def query_json\n joined_response_ids = response_ids.join(',')\n query = \"SELECT t1.id, REPLACE(t1.value::text, '\\\"', '') AS choice, COUNT(t1.value) AS total FROM (SELECT key AS id, value->0 AS value FROM thinkspace_readiness_assurance_responses t, jsonb_each((t.answers)::jsonb) WHERE t.id IN (#{joined_response_ids})) t1 GROUP BY t1.id, t1.value;\"\n @assessment.class.connection.select_all(query)\n end",
"def get_date_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Date.iso8601(element) }\n end",
"def array(method = nil)\n -> (v) do\n if v\n v.split(\",\").map{|a| cast(a, method) }\n end\n end\n end",
"def raw_all\n query_all\n end",
"def getDBArray(connection, query, id1, *id2)\r\n dbi_query = connection.prepare(query)\r\n dbi_query.execute(id1, *id2)\r\n #fetch the result\r\n return dbi_query.fetch_all\r\nend",
"def values_array\n @_field_path.map{ |field_| @_values[field_.name] }\n end",
"def array(value)\n value.respond_to?(:to_ary) ? value : [value]\n end",
"def array_term?(data, term)\n data.first&.send(:[], term)&.is_a?(Array)\n end",
"def getArray _args\n \"getArray _args;\" \n end",
"def parse_raw_data\n data_slices.to_a\n end",
"def result_set\n klass.requestor.get(nil, { query: to_s })\n end",
"def all(query); end",
"def make_entity_array x\n retval = Array.new\n case x.class.to_s\n when 'Entity'\n retval.push x\n when 'EntityStruct'\n retval.push x.entity\n when 'Array'\n x.each{|elem|\n if elem.class.to_s == 'Entity'\n retval.push elem\n elsif elem.class.to_s == 'EntityStruct'\n retval.push elem.entity\n else\n puts \"ERROR elem.class invalid, is #{elem.class}\"\n end # if\n } # x.each\n else\n puts \"ERROR: input class invalid, is #{x.class}\"\n exit\n end # case\n return retval\n end",
"def ensure_array(field)\n add_step do |attrs|\n if attrs.has_key?(field) && !attrs[field].is_a?(Array)\n attrs[field] = [attrs[field]]\n end\n attrs\n end\n end",
"def parse_array(parse_scalar_or_range)\n args[:list] = true\n str = clean_param(leave_slashes: true)\n return args[:default] if str.blank?\n\n result = []\n while (match = str.match(/^((\\\\.|[^\\\\,]+)+),/))\n str = match.post_match\n @val = match[1]\n result << send(parse_scalar_or_range)\n end\n @val = str\n result << send(parse_scalar_or_range)\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def multi_get(ids)\n result = CouchRest.post(SERVER.default_database.to_s +\n '/_all_docs?include_docs=true', :keys => ids)\n\n return result['rows'].collect { |row|\n row = row['doc'] if row['couchrest-type'].nil?\n\n if row and (class_name = row['couchrest-type'])\n eval(class_name.to_s).new(row) rescue row\n else\n row\n end\n }\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end"
] |
[
"0.6516067",
"0.6333517",
"0.60201085",
"0.5890065",
"0.5876593",
"0.58045363",
"0.5801883",
"0.5792966",
"0.5740559",
"0.5720513",
"0.57193416",
"0.5711123",
"0.57037103",
"0.5682244",
"0.5675916",
"0.56669843",
"0.5663608",
"0.56556344",
"0.56377596",
"0.5627342",
"0.5584909",
"0.5576353",
"0.5537587",
"0.5531408",
"0.5520265",
"0.5516554",
"0.5510923",
"0.5510923",
"0.5503687",
"0.54855245",
"0.54850775",
"0.5479588",
"0.54711056",
"0.5465655",
"0.5459692",
"0.5453207",
"0.54397446",
"0.54259056",
"0.5413641",
"0.5397302",
"0.53801924",
"0.53726333",
"0.53597265",
"0.5356486",
"0.5356486",
"0.53195995",
"0.5306247",
"0.53024054",
"0.53012824",
"0.52994406",
"0.52965075",
"0.52898705",
"0.52894926",
"0.5284914",
"0.52772033",
"0.5276412",
"0.5275659",
"0.5275409",
"0.5272979",
"0.52718365",
"0.5268738",
"0.52589023",
"0.52587885",
"0.5256374",
"0.5254922",
"0.52473897",
"0.52393806",
"0.52273315",
"0.5216527",
"0.5215274",
"0.52092177",
"0.52075535",
"0.52055085",
"0.5203468",
"0.51957434",
"0.51935446",
"0.51880944",
"0.5187749",
"0.5187634",
"0.51719046",
"0.51680017",
"0.5166702",
"0.51662934",
"0.51637393",
"0.51603",
"0.5153799",
"0.5149297",
"0.5147336",
"0.51460177",
"0.51457006",
"0.51416147",
"0.5136607",
"0.51355743",
"0.5128367",
"0.5126238",
"0.51247174",
"0.51220566",
"0.5113585",
"0.5113585",
"0.5113585"
] |
0.5676126
|
14
|
1. sets all joinable join_requests as member/participant 2. ensure user_id has a join_request for joinable 3. sets user_id as the organizer/creator for joinable 4. create a chat_message to let people know about this new organizer/creator
|
def to user_id, message
return yield false, USER_NOT_FOUND unless user = User.find(user_id)
return yield false, INVALID_JOINABLE unless joinable_is_valid?
owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create
ApplicationRecord.transaction do
creator_join_requests.update_all(role: member_type)
owner_join_request.update(status: :accepted, role: creator_type)
@joinable.update_attribute(:user_id, user_id)
end
if message.present?
ChatServices::ChatMessageBuilder.new(
user: user,
joinable: @joinable,
join_request: owner_join_request,
params: {
message_type: :text,
content: message,
}
).create
end
yield true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end",
"def approve_join_request\n join_request = JoinRequest.find(params[:id])\n team = join_request.team\n # Only authorize the captain to do this\n if current_user.id == team.captain_id\n membership = Membership.create(\n team_id: join_request.team_id,\n user_id: join_request.user_id,\n admin: false\n )\n if membership.valid?\n join_request.destroy\n render json: {\n team: TeamSerializer.new(team),\n user: UserSerializer.new(current_user)\n }, status: :accepted\n else\n # invalid request\n render json: {\n message: \"Invalid request\",\n errors: membership.errors.full_messages\n }, status: :not_acceptable\n end\n else\n render json: { message: \"Only the captain is allowed to accept join requests\"}, status: :not_acceptable\n end\n end",
"def create\n @join_team_request = JoinTeamRequest.new\n @join_team_request.comments = params[:comments]\n @join_team_request.status = 'P'\n @join_team_request.team_id = params[:team_id]\n\n participant = Participant.where(user_id: session[:user][:id], parent_id: params[:assignment_id]).first\n team = Team.find(params[:team_id])\n if team.participants.include? participant\n flash[:error] = 'You already belong to the team'\n redirect_back\n return\n end\n @join_team_request.participant_id = participant.id\n respond_to do |format|\n if @join_team_request.save\n format.html { redirect_to(@join_team_request, notice: 'JoinTeamRequest was successfully created.') }\n format.xml { render xml: @join_team_request, status: :created, location: @join_team_request }\n else\n format.html { render action: 'new' }\n format.xml { render xml: @join_team_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_join(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users[user] = User.new user unless channel.users.key? user\n end",
"def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def join\n @beer_club = BeerClub.find(params[:id])\n if Membership.where(:beer_club_id => @beer_club.id, :user_id => current_user.id).exists?\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are already a member of this club!\" }\n end\n else\n @membership = Membership.create\n @membership.beer_club_id = @beer_club.id\n @membership.user_id = current_user.id\n if @beer_club.memberships.count < 1\n @membership.confirmed = true\n else\n @membership.confirmed = false\n end\n respond_to do |format|\n if @membership.save\n format.html { redirect_to :back, notice: \"You joined #{@beer_club.name}\" }\n else\n format.html { redirect_to :back, notice: \"Something went awry! D:\" }\n end\n end\n end\n end",
"def join\n # Check status first to see if the user can join.\n # Check if the number of users exceed the the size of the room.\n @room = Room.find(params[:id])\n\n # Room is oversize\n if @room.is_full?\n message = \"#{current_user.name} cannot joined the room because the room is full.\"\n result = false\n elsif @room.status != ROOM_STATUS[:open]\n message = \"The room #{params[:id]} is not open!\"\n elsif @room.join?(current_user)\n message = \"#{current_user.name} is already joinned the room\"\n else\n\n result = @room.join(current_user)\n if result\n message = \"#{current_user.name} has joined the room\"\n else\n message = \"#{current_user.name} cannot join the room. Server side error\"\n end\n end\n\n if result\n channel = params[:id].to_s\n respond_message = {\n message: message,\n current_user: current_user,\n room_id: @room.id,\n status: USER_STATUS[:join]\n }\n self.broadcast_message_to_channel(channel, :user_status, respond_message)\n else\n channel = \"server_channel\"\n self.broadcast_message_to_channel(channel, :user_status, respond_message)\n end\n\n respond_to do |format|\n if result\n format.html { redirect_to @room, notice: message }\n format.json { render json: @room.to_hash_with_users(current_user).to_json, status: :created, location: @room }\n else\n format.html { render notice: \"Cannot join the room.\" }\n format.json { render json: {message: message}, status: :unprocessable_entity }\n end\n end\n end",
"def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end",
"def create_authz_object_as(requesting_actor_id)\n logger.debug { \"#{call_info} saving #{join_type} #{self.inspect}\" }\n\n #auth_join_object = join_type.new(Mixlib::Authorization::Config.authorization_service_uri,\"requester_id\" => requesting_actor_id)\n auth_join_object = authz_object_as(requesting_actor_id)\n auth_join_object.save\n logger.debug { \"#{call_info} auth_join_object for #{self.class} (user id: #{id}) saved: #{auth_join_object.identity}\" }\n join_doc = AuthJoin.new({ :user_object_id=>self.id,\n :auth_object_id=>auth_join_object.identity[\"id\"]})\n retval = join_doc.save\n logger.debug { \"#{call_info} return value of save = '#{retval.inspect}'\" }\n unless retval\n raise Mixlib::Authorization::AuthorizationError, \"Failed to save join document for #{self.class} (user id: #{id})\"\n end\n\n logger.debug { \"#{call_info} join doc saved\" }\n\n join_doc\n end",
"def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end",
"def join!(_user_id)\n if !is_private?\n if banned_users.where(user_id: _user_id).any?\n errors.add(:base, 'You were banned from this group.')\n false\n else\n add_participant(_user_id)\n end\n else\n errors.add(:base, 'This is a private group, please contact to administrator.')\n false\n end\n end",
"def create\n # TODO: test if \"user_established_at\" and \"network_established_at\" can be hacked (ie: set) through API calls,\n # thereby creating memberships that are already 'accepted' at creation.\n user = User.find_by_id(params[:membership][:user_id])\n if user.nil?\n render_404(\"User not found.\")\n elsif !Membership.find_by_user_id_and_network_id(params[:membership][:user_id], params[:membership][:network_id]) ||\n Network.find(params[:membership][:network_id]).owner?(user)\n\n @membership = Membership.new(params[:membership])\n\n @membership.user_established_at = nil\n @membership.network_established_at = nil\n if @membership.message.blank?\n @membership.message = nil\n end\n \n respond_to do |format|\n\n if @membership.save\n # Take into account network's new member policy setting\n if (@membership.network.open?)\n @membership.accept!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_auto_join_group(user, network, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue\n logger.error(\"ERROR: failed to send email notification for auto join group. Membership ID: #{@membership.id}\")\n end\n \n flash[:notice] = 'You have successfully joined the Group.'\n elsif (@membership.network.membership_by_request?)\n @membership.user_establish!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_membership_request(user, network, @membership, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue Exception => e\n logger.error(\"ERROR: failed to send Membership Request email notification. Membership ID: #{@membership.id}\")\n logger.error(\"EXCEPTION:\" + e)\n end\n \n flash[:notice] = 'Membership was successfully requested.'\n end\n\n format.html { redirect_to user_membership_path(current_user.id, @membership) }\n else\n format.html { render :action => \"new\" }\n end\n end\n else\n respond_to do |format|\n flash[:error] = \"Membership not created (already exists)\"\n format.html { render :action => \"new\" }\n end\n end\n end",
"def initialize_pending(requestor)\n return false unless setup_group\n return false unless requestor.join_group(self.id)\n requestor.change_role_level(\"adult sponsor\")\n send_notifications(requestor)\n true\n end",
"def create_interaction\n # conversation = Conversation.get_conversation_for(self.operator_id, self.user_id).first\n # if conversation.nil?\n conversation = Conversation.new(:messages_attributes => { \"0\" => { \"body\" => self.request_note, :subject => self.title}})\n # else\n # conversation.messages << Message.new(:subject => self.title, :body => self.request_note)\n # end\n conversation.messages.last.sender = User.find(self.operator_id)\n conversation.messages.last.recipient = User.find(self.user_id)\n if conversation.save\n Interaction.create(:concierge_request_id => self.id, :interactable_id => conversation.messages.last.id, :interactable_type => 'Message', :conversation_id => conversation.id)\n self.submit!(self.user_id)\n self.on_reply!\n end\n end",
"def create\n @collaborator = Listable::Collaborator.new(params[:collaborator])\n \n @collaborator.list = @list\n @collaborator.creator = current_user\n\n unless @user = User.find_by_email(@collaborator.email)\n pw = ('a'..'z').sort_by {rand}[0,15].join # Give new user a crazy random password\n @user = User.new(:password => pw, :password_confirmation => pw, :email => @collaborator.email, :login => @collaborator.email, :creator => current_user)\n end\n \n if @user.save && link = create_user_list_link(@user, :list => @list, :creator => current_user)\n @collaborator.login = @user.login\n \n msg = \"Your list has been shared with #{@collaborator.email}\"\n msg += \" (Listable user #{@collaborator.login})\" unless @collaborator.email == @collaborator.login\n \n Notifier.deliver_new_invitation_notification(current_user, @user, @list)\n\n flash[:notice] = msg\n \n respond_to do |format|\n format.html do\n redirect_to list_collaborators_path(@list)\n end\n \n format.json { render :status => 200, :json => {:message => ''} }\n end\n \n else\n\n respond_to do |format|\n format.html do\n if @list.users.find_by_email(@collaborator.email)\n flash[:error] = \"User #{@collaborator.email} has already been added to this list.\"\n else\n flash[:error] = \"An unknown error has occurred\"\n end\n render :action => :new\n end\n \n format.json { render :status => 400, :json => {:message => 'Unable to subscribe user to list'} }\n end\n\n end\n end",
"def create\n @chatroom = Chatroom.find(params[:chatroom_id])\n unless @chatroom.requests.exists?(user_id: current_user.id)\n request = @chatroom.requests.new(user_id: current_user.id, chatroom_id: @chatroom.id)\n request.user = current_user\n request.save\n end\n redirect_to root_path\n end",
"def create\n user = User.find_user(params[:member][:user_id])\n @board = Board.find_board(params[:member][:board_id])\n @action = 'join'\n if ( !user.nil? && !@board.nil? )\n logger.debug \"----------------Member.new-------------------------------------\"\n @member = Member.new(params[:member])\n @member.user_id = user.id\n if params[:commit] == Member::Commit::FOLLOW\n logger.debug \"----------------Adding a follower #{user.full_name}-------------------------------------\"\n @member.user_id = current_user.id # follower could be only the current user\n @member.member_type = Member::MemberType::FOLLOWER\n # follower? is true if a user is a follower, member or owner\n if !current_user.follower?(@board)\n logger.debug \"----------------Saving follower #{user.full_name}-------------------------------------\"\n @action = 'follow'\n @member.save\n flash.now[:success] = \"Board \\\"#{@board.title}\\\" was linked to your profile.\"\n else\n flash.now[:warning] = \"Your profile already linked to \\\"#{@board.title}\\\".\"\n end\n else\n logger.debug \"----------------Adding a member #{user.full_name}-------------------------------------\"\n if !user.member?(@board)\n logger.debug \"----------------User #{user.full_name} is not a member-------------------------------------\"\n follower = user.follower?(@board)\n if follower\n logger.debug \"----------------Updating follower #{user.full_name} to become a member-------------------------------------\"\n follower.update_attribute(:member_type, Member::MemberType::MEMBER)\n else\n logger.debug \"----------------Saving #{user.full_name} as a member-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n else\n logger.debug \"----------------Saving a follower #{user.full_name}-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n flash.now[:success] = \"#{user.full_name} was added to your Board \\\"#{@board.title}\\\".\"\n end\n end\n\n if params[:commit] == Message::Commit::CONFIRM\n msg_id = params[:member][:message]\n unless ( msg_id.nil? )\n message = Message.find(msg_id)\n unless ( message.nil? )\n message.update_attribute(:msg_state, Message::State::CONFIRMED)\n end\n end\n end\n \n params[:act] = 'board_search'\n params[:search] = params[:member][:search] if !params[:member][:search].nil?\n\n respond_to do |format|\n #if @member.save\n format.html { redirect_to home_path }\n format.js\n format.json { render json: home_path, status: :created, location: home_path }\n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @member.errors, status: :unprocessable_entity }\n #end\n end\n end",
"def join\n if request_valid?\n request_user.online!\n \n msg = message(\"joined\")\n msg = javascript_chat_message(msg)\n \n # Inform all joined channels that the user has joined\n Juggernaut.send_to_channels(msg, params[:channels])\n \n render :nothing => true\n else\n # Prevent the user from joining the channel if the request is not\n # from a valid session/user combination\n render :text => \"403\", :status => 403\n end\n end",
"def match_to_invitation_or_send_email\n if invitation = joinable.membership_invitation_for(user)\n invitation.accept(invitation.user)\n else\n UserMailer.project_membership_request_created_email(joinable.who_can?(:manage), self).deliver\n end\n end",
"def join\n if request.post?\n if !@group.users.include?(current_user)\n @group.users << current_user\n flash[:success] = \"Thanks! Your membership must now be approved by an admin of #{@group.name}.\"\n\n #SEND OUT NOTIFICATION EMAILS\n @group.admins.each do |admin|\n Notifier.pending_user(admin, @group, current_user).deliver\n end\n\n redirect_to @group\n else\n flash[:error] = \"Error requesting to join #{@group.name}. Please try again.\"\n redirect_to @group\n end\n else #it fell back to GET (no js)\n flash[:error] = \"Please enable javascript to join.\"\n redirect_to @group\n end\n end",
"def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end",
"def reply_request(request , assigned_room)\n request.room = assigned_room\n request.done = true\n request.save\n request.needers.each do |needer|\n Notification.send_notification(needer,\n 2,\n 2,\n (\"The Room ( \" << assigned_room << \" ) was Assigned for your Session/Meeting\"))\n end\n end",
"def join\n @club = Club.find(params[:id])\n authorize @club\n @club.club_memberships.create! user_id: current_user.id\n redirect_to action: :show\n end",
"def process_mass_join(message)\n channel = message.channel\n /:(?<user_list>.+)/ =~ message.payload\n user_list.split.each do |user|\n channel.users[user] = User.new user unless channel.users.key? user\n end\n end",
"def create_leader(user)\n participant = Participant.new(school_id: self.id, user_id: user.id)\n participant.role_id = 1\n participant.accepted = 2\n participant.prereq = true\n participant.save\n end",
"def join\n @room = OnlineMeetingRoom.find_by_id(params[:id])\n role = @room.user_role(current_user)\n unless role == :denied\n join_internal(current_user.full_name, role, :join)\n else\n flash[:notice] = \"#{t('access_denied')}\"\n redirect_to :index and return\n end\n end",
"def join_request\n \n end",
"def create\n initiator = self.load_user(params)\n\n if initiator != nil\n new_meeting = Meeting.create\n new_meeting.initiator_id = initiator.id\n new_meeting.location = params[\"meeting\"][\"location\"]\n new_meeting.title = params[\"meeting\"][\"title\"]\n new_meeting.participants << initiator\n new_meeting.save!\n self.send_json(build_custom_meeting_json(meeting: new_meeting))\n else\n self.send_error 401\n end\n end",
"def create\n logged_in_log_in_or_create_user\n @challenge_participant = @challenge.challenge_participants.build(user_id: @user.id)\n respond_to do |format|\n begin\n if @challenge_participant.save\n format.html { redirect_to :root, notice: \"You successfully joined #{@challenge.name}.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n else\n format.html { render :new }\n format.json { render json: @challenge_participant.errors, status: :unprocessable_entity }\n end\n rescue\n @challenge_participant = ChallengeParticipant.where(user_id: @user.id, challenge_id: @challenge.id).first\n format.html { redirect_to :root, notice: \"You have already joined this challenge.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n end\n end\n end",
"def create\n\t\tact_type = params[:offering_type]\n\t\tuser = User.find_by_id(params[:joining_user])\n\t\tact_id = params[:offering_id]\n\n\t\tif !name_is_valid?(user, act_type); raise Errors::FlowError.new(send(\"#{act_type}_path\", offering_id), \"Permission denied.\"); end\n\n\t\tacts_membership = user.send(\"#{act_type}s_membership\")\n\t\tjoining_act = act_type.camelize.constantize.find_by_id(act_id)\n\n\t\tunless joining_act; raise Errors::FlowError.new; end\n\n\t\t# gender\n\t\tif [\"male\", \"female\"].include? joining_act.gender\n\t\t\tunless user.gender == joining_act.gender; raise Errors::FlowError.new(root_path, \"This #{act_type} is #{joining_act.gender} only.\"); end\n\t\tend\n\n\t\tnumber_of_attendings = joining_act.number_of_attendings\n\t\tif acts_membership.count < number_of_attendings or number_of_attendings == 0\n\t\t\tacts_membership << joining_act\n\t\telse\n\t\t\traise Errors::FlowError.new(send(\"#{act_type}_path\", offering_id), \"Permission denied.\")\n\t\tend\n\t\t@offering = joining_act\n\t\t@members = joining_act.members\n\t\tjoining_act.create_activity :create, owner: user\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to joining_act }\n\t\t\tformat.js\n\t\tend\n\tend",
"def join\n if !current_user\n flash[:notice] = t(:join_dream)\n elsif @camp.users.include?(current_user)\n flash[:notice] = t(:join_already_sent)\n else\n flash[:notice] = t(:join_dream)\n @camp.users << @user\n end\n redirect_to @camp\n end",
"def create\n @member = @current_user\n unless params[:organization][:id].blank?\n @organization = Organization.find(params[:organization][:id])\n else\n @organization = Organization.new(params[:organization])\n @phone = Phone.new(params[:phone])\n @phone.phonable_type = 'Organization'\n @phone.tag_for_phone = 'main'\n @organization.phones << @phone\n @organization.created_by = @member.id\n @organization.save!\n end\n exists = Affiliation.find(:first,\n :conditions => \"user_id = #{@current_user.id} and organization_id = #{@organization.id}\")\n if exists\n failure \"Request rejected. #{@current_user.name} already requested affiliation \" +\n \"with #{@organization.name}. You can check the status by asking in \" +\n \"<a href=\\\"http://foodmoves.campfirenow.com/e08e3\\\" \" +\n \"onclick=\\\"window.open(this.href,'Chat','width=650,height=1000');return false;\\\">chat</a>.\"\n else \n @affiliation = Affiliation.new(\n :user_id => @current_user.id,\n :organization_id => @organization.id)\n if @affiliation.save\n begin\n InvitationMailer::deliver_affiliation(@current_user, @organization)\n AdminMailer::deliver_affiliation(@current_user, @organization, @affiliation)\n rescue\n failure \"Affiliation entered but unable to send email notification.\"\n end\n flash[:notice] = \"Within the next business day, our support team will\n contact #{@organization.name} \n to verify that you are authorized to trade.\"\n chat_alert('team', \"#{@current_user.name} wants to get set up for trading\")\n else\n failure \"Unable to submit request for affiliation.\"\n end\n end\n unless @fail\n redirect_to member_url(@member)\n else\n flash[:error] = @err_msg \n redirect_to :back \n end\n end",
"def add_participant\n user = User.find(params[:user_id])\n\n unless user_is_initiator(current_user, @chat)\n return fail_response(['You are not an author of the conversation'], 403)\n end\n\n if user_related_to_chat(@chat, user)\n return fail_response(['User is already in chat'], 403)\n end\n\n @chat.add_participant(user)\n\n render json: { message: 'success' }, status: :ok\n end",
"def create\n @chat_room = ChatRoom.new(chat_room_params)\n respond_to do |format|\n if @chat_room.save\n @chat_room.user_admit_room(current_user)\n format.html { redirect_to @chat_room, notice: 'Chat room was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end",
"def send_email_to_participants(request)\n unless RAILS_ENV == \"test\"\n recipients(last_message.sender).each do |recipient|\n if recipient.settings.email_when_new_comment == 1\n UserMailer.deliver_notification_of_new_message(recipient, last_message, request)\n end \n end\n end\n end",
"def join_group\n @disc_group = DiscussionGroup.find(params[:id])\n @join = DiscussionGroupUser.new(:discussion_group_id => @disc_group.id, :user_id => @login_user.id, :is_member => 1)\n if @join.save\n respond_to do |format|\n format.js\n end\n else\n render :text=>\"Fail\"\n end\n end",
"def join\n if (not @event.users.include? current_user)\n EventUser.create(user: current_user, event: @event)\n redirect_to events_path, notice: \"You are now participating.\"\n else\n ev = EventUser.find_by user: current_user, event: @event\n ev.destroy\n redirect_to events_path, notice: \"Removed you from the event.\"\n end\n end",
"def create\n @request = UserRequest.new(user: current_user, team_id: params[:team_id])\n if @request.save\n redirect_to join_team_users_path, notice: I18n.t('requests.sent_successful')\n else\n redirect_to join_team_users_path, alert: @request.errors.full_messages.first\n end\n end",
"def create\n @mentorship_request = MentorshipRequest.new(mentorship_request_params)\n @mentorship_request.user = current_user\n @mentorship_request.status = 'Waiting'\n\n if @mentorship_request.save\n\n mentor_ids = Set[]\n @mentorship_request.tech.each do |t|\n ns = mentor_notifications_with_tech(t)\n ns.each do |n|\n mentor_ids.add(n.user_id)\n end\n end\n\n MentorshipNotification.where(all: true).each do |n|\n mentor_ids.add(n.user_id)\n end\n\n if HackumassWeb::Application::SLACK_ENABLED\n mentor_ids.each do |user_id|\n slack_notify_user(User.where(id: user_id).first.slack_id, \"New mentorship request: \\n #{@mentorship_request.title} \\n\\nfrom #{@mentorship_request.user.full_name}\\n\\nUrgency: #{@mentorship_request.urgency_str}\\n\\nTechnologies: #{@mentorship_request.tech}\\n\\nSee more details: https://#{HackumassWeb::Application::DASHBOARD_URL}/mentorship_requests/#{@mentorship_request.id}\")\n end\n slack_notify_user(@mentorship_request.user.slack_id, \"You just submitted a mentorship request: #{@mentorship_request.title} \\n\\nA mentor should slack you soon. Wait 15 minutes, and if you don't hear from anyone, go to the mentorship table. Best of luck with your issue!\")\n end\n\n redirect_to mentorship_requests_path, notice: 'Mentorship request successfully created. A mentor should contact you soon.'\n else\n render :new # New mentorship request if previous is unsuccessful\n end\n end",
"def local_join(body)\n room = body.dup\n room[0,1] = '' until room[0,1] != '@'\n return nil unless room.length >= 1\n unless @var[:special_rooms].include?(room)\n room_hash = MD5::digest(room)[0,8]\n room_hash = EMPTY_ROOM if room == 'chat'\n @connection.room_names[room_hash] = room\n @connection.room_ids[room] = room_hash\n _remote_control(@var[:our_name], :invite, body, true)\n _server_control('join', room_hash)\n end\n local_switch(room.dup)\nend",
"def joinGroup\n \tquery = \"SELECT user_id FROM group_meals_participants where group_meal_id = \" + GroupMeal.find_by_meal(params[:meal]).id.to_s\n \n GroupMealsParticipant.connection.select_values(query).each do |u|\n \tif(u!=current_user.id)\n \t\tu=User.find(u)\n \t\tu.alert=true\n \t\tu.alert_location=GroupMeal.find_by_meal(params[:meal]).id.to_s\n \t\tu.save\n \tend\n \tend\n @groupMealParticipant= GroupMealsParticipant.new\n @groupMealParticipant.user_id=current_user.id\n @groupMealParticipant.group_meal_id= GroupMeal.find_by_meal(params[:meal]).id\n @groupMealParticipant.save \n redirect_to(GroupMeal.find_by_meal(params[:meal]))\n end",
"def join\n unless @user && @kroog && @kroog.open? && current_actor.can_follow?\n flash[:warning] = \"Error: The specified circle does not exist or cannot be joined\".t\n respond_to do |format|\n format.html do\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id])\n end\n format.js {render :update do |page|; page << 'document.location.reload(false);'; end}\n end\n return\n end\n\n # Add the relationship directly -- no invite intermediary\n Relationship.create_kroogi_relationship(:followed => @user.id, :follower => current_actor.id, :relationshiptype_id => @kroog.relationshiptype_id, :expires_at => Time.end, :skip_activity_message => true)\n\n flash[:success] = \"You have joined the %s circle of %s\" / [@user.circle_name(params[:circle].to_i), @user.login]\n PublicQuestionHelper::set_question_artist_id(@user, self, :force_show => true)\n respond_to do |wants|\n wants.html do\n redirect_to user_url_for(@user)\n end\n wants.js {}\n end\n end",
"def match_availability_message_to_convo\n if conversation_id.nil? && !availability_id.nil?\n conversation = Conversation.where(availability_id: availability_id).first\n if conversation.nil?\n conversation = Conversation.create(availability_id: availability_id, name: \"Teaching #{availability.start_time.strftime('%H:%M %d/%m/%Y')}\")\n availability.availability_users.each do |join|\n conversation.conversation_members.create!(user: join.user, admin: join.admin)\n end\n end\n self.conversation = conversation\n end\n end",
"def join\n # valid user?\n if !@user\n flash[:notice => \"You must be logged in to join\" ]\n render :action => \"error\"\n return\n end\n if !@note\n flash[:notice] = \"Nothing found by that name\"\n render :action => \"error\"\n return\n end\n # already a member?\n if @note.is_a_member?(@user)\n flash[:notice] = \"You are already a member\"\n render :action => \"error\"\n return\n end\n # join\n @note.join @user\n end",
"def event_join m\n uid = get_uid m\n reward_logic uid, m.channel, m.user.nick\n end",
"def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end",
"def initial_setup\n # Give him friends\n f = [User.least_email(\"upstill\"), User.least_email(\"arrone\"), User.super_id ]\n f << self.invited_by_id if self.invited_by_id\n self.followee_ids = f\n\n # Give him some lists \"Keepers\", \"To Try\", \"Now Cooking\"\n List.assert \"Keepers\", self, create: true\n List.assert \"To Try\", self, create: true\n List.assert \"Now Cooking\", self, create: true\n\n self.save\n\n # Make the inviter follow the newbie.\n if self.invited_by_id\n begin\n invited_by = User.find(self.invited_by_id)\n invited_by.followees << self\n rescue\n end\n end\n end",
"def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end",
"def test_add_communication_with_nil_role\n \n \n #Create a communication but dont save it just yet \n communication = create_communication\n \n #Check that the communication is saved and added to the person - the role is allowed to be nil\n assert(@person.add_communication(communication, nil), \"person communication with nil role should still work\")\n\n \n #Assert that each of communications, roles and the join table are incremented by one\n assert(@number_of_comms+1 == Communication.count)\n assert(@number_of_roles == Role.count)\n assert(@number_of_comm_peeps +1 == CommunicationPerson.count)\n \n \n #Check that the communication has been added\n assert(@person.communications.include?(communication), \"Communication should be associated with person\")\n \n \n #Now check the join table and ensure that only one person is associated with the communication - this is a business logic requirement\n cps = CommunicationPerson.find(:all, :conditions => [\"person_id = ? and communication_id = ?\",@person.person_id, communication.communication_id])\n \n # The business logic is such that a communication can only belong to one person\n assert cps.length == 1\n \n #Now check the role is set properly\n cp = cps[0]\n\n \n # Check that the communication only has one person\n spods = communication.people\n assert spods.length == 1\n \n # and that the person is the original person\n assert spods[0] == @person\n \n \n end",
"def handle_existing_chatroom_member\n validate_ownership_and_membership_status; return if performed?\n @chatroom_member.update(has_left: false)\n save_chatroom_member\n end",
"def create\n @chat_room = ChatRoom.new(params[:chat_room])\n @chat_room.hosted_by_user = current_user\n\n respond_to do |format|\n if @chat_room.save\n format.html { redirect_to chat_rooms_path, notice: 'Chat room was successfully created.' }\n format.json { render json: @chat_room, status: :created, location: @chat_room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chat_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n message = ConversationMessage.new(message_params.merge(conversation_id: @conversation.id))\n message.userable = get_current_user\n if message.save\n # current_conversation = message.conversation\n # @conversations = Conversation.send(current_conversation.topic).all_onversations(current_user).paginate(page: params[:page], per_page: 10)\n # @conversations << current_conversation\n # @conversations = @conversations.uniq\n @conversation.chatable.groupables.each do |gm|\n ActionCable.server.broadcast \"Message_#{gm.groupable_type}_#{gm.groupable_id}\",\n msg_id: message.id,\n # msg: message_content,\n msg: message.body,\n img_alt: \"#{message.userable.first_name[0]&.capitalize || 'N'}.#{message.userable.last_name[0]&.capitalize || 'A'}\",\n sender_name: message.userable.full_name.capitalize,\n file_url: message.file_url || '',\n msg_url: message.userable.photo,\n msg_time: message.created_at.strftime('%l:%M%P'),\n # msg_att: message.attachment_file,\n # msg_att_name: message.file_name,\n usr_typ: message.userable.class.to_s,\n usr: message.userable.id,\n recpt_type: gm.groupable_type,\n recpt_id: gm.groupable_id,\n unread_msg_cnt: 0, # Conversation.joins(:conversation_messages).where(\"(senderable_type = ? AND senderable_id = ? ) OR (recipientable_type = ? AND recipientable_id = ?)\", recipient.class.to_s, recipient.id, recipient.class.to_s, recipient.id).where.not(conversation_messages: {is_read: true, userable: recipient}).uniq.count,\n con_id: @conversation.id,\n chat_typ: 'Group',\n grp_id: @conversation.chatable.id,\n dom: \"#conversation_#{@conversation.id}\"\n end\n end\n head :ok\n end",
"def create\n @join = Join.new(user_id: current_user.id, event_id: params[:event_id])\n if @join.save\n redirect_to \"/events\"\n else\n redirect_to \"/events\"\n end\n end",
"def create\n logger.debug \"print of params test 1: #{params[:contact_group_id]}\"\n logger.debug \"print of params test 2: #{params[:share_id]}\"\n if User.exists?(email: params[:share_id])\n sharee = User.where(email: params[:share_id]).first!\n #Ensure User being shared to does not already have access to the group\n if sharee.contact_groups.where({ id: params[:contact_group_id] }).blank?\n #Check to see if there is already an invite pending in the users invites\n if ShareInvite.where({receiver_id: sharee.id, contact_group_id: params[:contact_group_id], status: \"pending\"}).exists?\n respond_to do |format|\n format.html { flash[:modal_alert] = \"User already has an invite pending for this group\" }\n format.js { flash[:modal_alert] = \"User already has an invite pending for this group\" }\n end\n else\n #create_invite = ShareInvite.create!( sharer_id: current_user.id, receiver_id: User.where( email: params[:contact_groups][:share_id] ).first.id, contact_group_id: @contact_group.id, status: “pending” )\n create_invite = ShareInvite.create!( sharer_id: current_user.id, receiver_id: sharee.id, contact_group_id: params[:contact_group_id], status: \"pending\" )\n\n respond_to do |format|\n format.html { redirect_to homes_url, notice: 'Invite Sent' }\n format.js { redirect_to homes_url, notice: 'Invite Sent' }\n end\n end\n else\n respond_to do |format|\n format.html { flash[:modal_alert] = \"Group has already been shared with user\" }\n format.js { flash[:modal_alert] = \"Group has already been shared with user\" }\n end\n end\n else\n respond_to do |format|\n format.html { flash[:modal_alert] = \"User does not exist\" }\n format.js { flash[:modal_alert] = \"User does not exist\" }\n end\n end\n end",
"def join\n @event = Event.find(params[:event_id])\n if (params[:type] == \"invite\")\n @uids = params[:uids]\n @uid_array = []\n @uid_array = @uids.split(\",\")\n\n @motlee_users = []\n @non_motlee_users = []\n\n @uid_array.each do |uid|\n motlee_user = User.where(:uid => uid).first\n\n if motlee_user.nil?\n token = params[:access_token]\n event_id = params[:event_id]\n Resque.enqueue(ProcessNewUserInvite, token, event_id, uid) \n else\n # User is already a part of Motlee\n # Add user to array of Motlee users\n @motlee_users << uid\n \n # Now we check to see if the user has already been added to the event\n @attendee = Attendee.where(\"user_id = ? AND event_id = ?\", motlee_user.id, params[:event_id]).first\n if @attendee.nil?\n # If user has not been added, create new Attendee object\n @attendee = Attendee.create(:user_id => motlee_user.id, :event_id => params[:event_id], :rsvp_status => 1)\n if (motlee_user.id != current_user.id)\n Resque.enqueue(AddEventNotification, motlee_user.id, params[:event_id], current_user.id)\n end\n end\n end\n end \n else\n @attendee = Attendee.create(:user_id => current_user.id, :event_id => @event.id, :rsvp_status => 1)\n end\n # Render a response so the devices are happy\n @event.update_attributes(:updated_at => Time.now)\n render :json => @event.as_json({:methods => [:owner, :attendee_count], \n :include => {:photos => {:include => {:comments => {}, :likes => {}}}, \n :people_attending => {:only => [:id, :uid, :name, :sign_in_count]}}})\n end",
"def create\n @join = Join.find_by(user_id: current_user.id, hike_id: params[:id])\n if @join\n redirect_to :back\n else\n @join = Join.create(user_id:current_user.id, hike_id:params[:id])\n redirect_to :back\n end\n end",
"def create_group\n name_param = params[:name]\n description_param = params[:description]\n members_param = params[:members] || []\n maillists_param = params[:maillists] || []\n leader_id_param = params[:leader_id]\n join_type_param = params[:join_type]\n\n if name_param.nil? || name_param.blank?\n render json: { field: 'name', error: 'You must provide a name for your space' }, status: :bad_request\n return\n end\n\n unless group_name_is_unique? name_param\n render json: { field: 'name', error: \"A Space named \\\"#{name_param}\\\" already exists\" }, status: :bad_request\n return\n end\n\n if description_param.nil? || description_param.blank?\n render json: { field: 'description', error: 'No description specified' }, status: :bad_request\n return\n end\n\n if join_type_param.nil? || join_type_param.blank?\n render json: { field: 'join_type', error: 'No join_type specified' }, status: :bad_request\n return\n end\n\n if (!params[:maillist].empty? && !maillist_is_valid?(params[:maillist]))\n render json: { field: 'maillist', error: \"\\\"#{params[:maillist]}\\\" is not a valid maillist\" }, status: :bad_request\n return\n end\n\n # concat maillist members into the members array so they get added for the initial load\n members_param.concat maillist_members(params[:maillist]) unless params[:maillist].empty?\n\n # filter out non-canvas users\n members = members_param.map do | member |\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n members.compact.uniq!\n\n if @current_user.account.site_admin?\n if leader_id_param && !leader_id_param.blank?\n leader = User.find_by_id(leader_id_param)\n if leader.nil?\n render json: { error: \"Can't find user specified for leader\" }, status: :bad_request\n return\n end\n else\n leader = @current_user\n end\n else\n # if a non-admin is creating the group then\n # the leader is that user and that id is used to determine who \"owns\"\n # the group and can make changes to it\n leader = @current_user\n end\n\n if join_type_param == 'free_to_join'\n join_type = 'parent_context_auto_join'\n elsif join_type_param == 'request'\n join_type = 'parent_context_request'\n elsif join_type_param == 'invite_only'\n join_type = 'invitation_only'\n else\n render json: { field: 'join_type', error: 'Invalid join_type value. Valid: request, free_to_join, invite_only' }, status: :bad_request\n return\n end\n\n group = @domain_root_account.groups.create( name: name_param,\n group_category: CanvasSpaces.GroupCategory,\n leader: leader,\n join_level: join_type,\n description: description_param )\n group.add_user(leader)\n group.save\n members.each { |member| group.add_user(member) } unless members.empty?\n\n add_maillist = set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].empty?\n\n render json: group.as_json(only: [ :id, :name, :description, :leader_id, :created_at ],\n include_root: false)\n .merge({ size: 0, join_type: join_type_param }), status: :ok\n end",
"def join\n\t\t@classroom = Classroom.find(params[:id])\n\n\t\tparams[:user_id] = current_user.id unless admin? && params[:user_id]\n\n\t\t@membership = Membership.new\n\t\t@membership.classroom_id = @classroom.id\n\t\t@membership.user_id = params[:user_id]\n\t\tif @membership.save\n\t\t\tredirect_to params[:redirect_url] || @classroom, notice: \"Joined!\"\n\t\telse\n\t\t\tredirect_to @classroom, alert: \"You are already a member of this class!\"\n\t\tend\n\tend",
"def do_join\n flash.keep\n begin\n # Use group invitation\n group = Group.find_by(invitation_code: params[:group][:invitation_code])\n # Fall back to normal user invitation\n if group.blank?\n invitation = GroupInvitation.get_by_invitation_code(\n params[:group][:invitation_code]\n )\n invitation.use_invitation\n group = invitation.group\n end\n group.join_group(current_user, 'member')\n flash[:notice] = 'Group joined!'\n redirect_to(action: 'show', id: group.id) && return\n rescue\n flash[:error] = 'The provided invitation code has already been used.'\n redirect_to(action: 'join') && return\n end\n end",
"def accept\n # a notification message will be delivered to the the requestor anyway;\n # it may contain a personal note, if any was supplied\n group = Network.find(@membership.network_id)\n invite = @membership.is_invite?\n \n personal_message = \"NONE\"\n if params[:accept_msg] && !params[:accept_msg].blank?\n personal_message = ae_some_html(params[:accept_msg])\n end\n\n # the messages will appear as 'deleted-by-sender', because the owner of the account effectively didn't send it,\n # so there is no reason for showing this message in their 'sent messages' folder\n\n if invite\n from = User.find(@membership.user_id)\n\n subject = \"Invitation to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted an invitation to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).each {|to| \n send_action_message(from.id, to.id, subject, body)\n }\n else\n from = current_user\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted your request to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %>:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n send_action_message(from.id, @membership.user_id, subject, body)\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :other => @membership.user_id, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted a request by <%= name(other) %> to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %> to user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).select{|admin| admin.id != from.id}.each {|to|\n send_action_message(from.id, to.id, subject, body)\n }\n end\n\n respond_to do |format|\n if @membership.accept!\n flash[:notice] = 'Membership was successfully accepted.'\n format.html { redirect_to network_path(@membership.network_id) }\n else\n flash[:error] = \"Membership already accepted.\"\n end\n format.html { redirect_to network_path(@membership.network_id) }\n end\n end",
"def createDuelRequest\n filteredParams = params.require(:duel_request).permit(:user_id, :room_id, :is_ranked)\n \n @room = Room.find(filteredParams[\"room_id\"]) rescue nil\n return res_with_error(\"Room not found\", :not_found) unless @room\n if @room && RoomMute.where(room: @room, user: current_user).exists?\n res_with_error(\"You're currently muted\", :bad_request)\n return false\n end\n\n @duel_request = RoomMessage.create(message: \"\", user_id: filteredParams[\"user_id\"], room_id: filteredParams[\"room_id\"], is_duel_request: true, is_ranked: filteredParams[\"is_ranked\"])\n respond_to do |format|\n if @duel_request.save\n ActionCable.server.broadcast \"room_channel\", type: \"duel_request\", description: \"create-request\", user: current_user\n format.html { redirect_to @duel_request, notice: 'Duel request was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @duel_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n pids = get_player_list(@match).map{|p| p.try(:id)} # list of player ids\n status = false\n if can_join(pids) #if possible, join\n status = join_now(@match, current_user.id)\n done = [\"joined\", \"success\"]\n elsif pids.include?(current_user.id) #if already joined, then leave\n status = leave_now(@match, current_user.id, @host)\n done = [\"left\", \"warning\"]\n if !get_player_list(@match).any? #if there is no more players in match, then destroy\n destroy\n return\n end\n end\n\n respond_to do |format|\n if status and @match.save\n format.html { redirect_to @match, notice: ['You have succesfully ' + done[0] + ' the match.', \"alert alert-dismissible alert-\" + done[1]] }\n else\n format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', \"alert alert-dismissible alert-danger\"] }\n end\n end\n end",
"def create\n # Create the chat room\n @chat_room = whoami.owned_rooms.build(params[:chat_room])\n\n # Save the chat room\n if @chat_room.save\n flash[:notice] = 'Chat room created'\n redirect_to(@chat_room)\n else\n render :action => \"new\"\n end\n end",
"def create\n @invite = Invite.new(invite_params)\n @invite[:token] = @invite.generate_token\n @invitee = @invite.find_invitee\n\n if @invite.to_existing_user?\n respond_to do |format|\n if @invite.save\n #round out the invites TODO: add these methods to user.rb instead:\n @invitee.memberships << Membership.new(member_id: @invitee.id, list_id: @invite.list_id)\n @invite.sender.memberships << Membership.new(member_id: @invite.sender_id, list_id: @invite.list_id)\n ExistingInviteMailer.existing_invite_mailer(@invite).deliver_now\n\n format.html { redirect_to list_path(@invite.list), notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end #end respond_to\n\n else #exising user?\n\n respond_to do |format|\n if @invite.save\n InviteMailer.new_invite_mailer(@invite).deliver_now\n #assign the sender the membership as well, TODO: move logic to user.rb\n @invite.sender.memberships << Membership.new(member_id: @invite.sender_id, list_id: @invite.list_id)\n format.html { redirect_to list_path(@invite.list), notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end #determining existing user\n end",
"def join\n @user = current_user\n @mess = Mess.find(params[:id])\n @mess_id = @mess.id\n @user.update_attributes(:mess_id => @mess_id)\n redirect_to @mess\n end",
"def membership_invite_request_action_message(approval_allowed, is_invite, username_dropdown)\n if approval_allowed \n if is_invite\n return \"You have received an invitation to become a member of:\"\n else\n return \"#{username_dropdown} has sent you a request to join:\"\n end\n else\n if is_invite\n return \"You have invited #{username_dropdown} to join:\" \n else\n return \"You have requested to become a member of:\"\n end\n end\n end",
"def create_or_join\n res = Conversation.create_or_join(uuid: conversation_params[:uuid])\n serializer = ConversationSerializer.new(res[:conversation])\n render json: serializer.serializable_hash.merge(user_index: res[:user_index])\n end",
"def modify_group\n group = Group.find_by_id params[:group_id]\n current_maillist = get_maillist_for_space(group.id)\n\n if params[:join_type]\n params[:join_level] = convert_join_type_to_join_level(params[:join_type])\n end\n\n if params[:leader_id] && params[:leader_id] != group.leader_id\n membership = group.group_memberships.where(user_id: params[:leader_id]).first\n return render :json => {}, :status => :bad_request unless membership\n params[:leader] = membership.user\n end\n\n if params[:maillist] != current_maillist\n render json: { valid_maillist: false }, status: :ok unless params[:maillist].empty? || maillist_is_valid?(params[:maillist])\n # params[:new_membership] = maillist_members(params[:maillist]).map { |member| Pseudonym.find_by_unique_id(member).user rescue nil}.compact\n params[:new_membership] = maillist_members(params[:maillist]).map do |member|\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n params[:new_membership].compact!\n params[:new_membership].uniq!\n end\n\n if authorized_action(group, @current_user, :update)\n respond_to do |format|\n group.transaction do\n group.update_attributes(params.permit(*SETTABLE_GROUP_ATTRIBUTES))\n if params.has_key?(:leader)\n group.leader = params[:leader]\n end\n if params.has_key?(:new_membership) && params[:new_membership].empty?\n group.group_memberships.where(\"user_id NOT IN (?)\", [group.leader]).destroy_all\n delete_maillist_for_space(group.id)\n end\n group.set_users(params[:new_membership]) if params.has_key?(:new_membership)\n set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].nil? || params[:maillist].empty?\n end\n\n if !group.errors.any?\n format.json { render :json => group_formatter(group, { include: ['users'] }), :status => :ok }\n else\n format.json { render :json => @group.errors, :status => :bad_request }\n end\n end\n end\n end",
"def test_add_communication_to_two_people\n\n # Create a new role to ensure the correct person id\n # Note that from the web interface, the role will already exist\n role = create_role(@person.person_id)\n assert role.save\n \n role2 = create_role(@person2.person_id)\n role2.save\n \n #Create a communication but dont save it just yet \n communication = create_communication\n \n #Check that the communication is saved and added to the person\n assert @person.add_communication(communication, role)\n \n #Try to add the same communication to another person - this should fail\n assert !@person2.add_communication(communication, role2)\n \n assert_increment_of_one\n \n #Check that the communication has been added\n assert(@person.communications.include?(communication), \"Communication should be associated with person\")\n \n #Now check the join table and ensure that only one person is associated with the communication - this is a business logic requirement\n cps = CommunicationPerson.find(:all, :conditions => [\"person_id = ? and communication_id = ?\",@person.person_id, communication.communication_id])\n \n # The business logic is such that a communication can only belong to one person\n assert cps.length == 1\n \n #Now check the role is set properly\n cp = cps[0]\n \n \n # Check the role is correct\n \n puts \"Comm role is \"+cp.role_id.to_s\n puts \"original role id is #{role.role_id}\"\n assert cp.role == role\n \n # Check that the communication only has one person\n spods = communication.people\n assert spods.length == 1\n \n # and that the person is the original person\n assert spods[0] == @person\n \n \n end",
"def on_join(connection, channel, user)\n end",
"def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end",
"def join_plan \n\t\trequire 'fcm'\n\t\tactivities = [\"grab food\", \"hang out\", \"group study\", \"party\"]\n\t\tplan_member = PlanMember.new(\n \tplan_id: params[:plan_id],\n \tuser_id: current_user.id\n )\n\t\tplan = Plan.find_by(id: params[:plan_id])\n\n\t\tif plan_member.save\n\t\t\tPlanMessage.create(\n \tplan_id: params[:plan_id],\n \tuser_id: current_user.id, \n \tcontent: \"#{current_user.fullname} is in!\",\n \tsystem_message: true\n )\t\n\n member_count = PlanMember.where(plan_id: params[:plan_id]).count\n\t\t\tis_happening = false\n\t if member_count > 2 && plan.is_happening == false\n\t \tis_happening = true\n\t \tplan.is_happening = true\n\t \tplan.save \n\n\t \tPlanMessage.create(\n\t \tplan_id: params[:plan_id],\n\t \tuser_id: current_user.id, \n\t \tcontent: \"Woohoo this plan to #{activities[plan.activity]} is happening! 3 or more people are in.\",\n\t \tsystem_message: true\n\t )\t\n\t end\n\t render json: { is_success: true, is_happening: is_happening, name_of_joiner: current_user.fullname}, status: :ok\n\t\t\n\t\telse\n\t\t\trender json: { is_success: false }, status: :ok\n\t\tend\n\tend",
"def initialize_mailing_list_group_with_owner\n initialize_mailing_list_group\n update_ok(!@mailing_list_group.nil? && current_user.id == @mailing_list_group.user_id)\n end",
"def create\n @project = Project.find(collaboration_params[:project_id])\n\n # if(not @project.assignment_id.nil?)\n # render plain: \"Assignments cannot have collaborators. Please contact admin.\" and return\n # end\n authorize @project, :author_access?\n\n already_present = User.where(id: @project.collaborations.pluck(:user_id)).pluck(:email)\n collaboration_emails = collaboration_params[:emails].grep(Devise.email_regexp)\n\n newly_added = collaboration_emails - already_present\n\n newly_added.each do |email|\n email = email.strip\n user = User.find_by(email: email)\n if user.nil?\n # PendingInvitation.where(group_id:@group.id,email:email).first_or_create\n else\n Collaboration.where(project_id: @project.id, user_id: user.id).first_or_create\n end\n end\n\n notice = Utils.mail_notice(collaboration_params[:emails], collaboration_emails, newly_added)\n\n notice = \"You can't invite yourself. #{notice}\" if collaboration_params[:emails].include?(current_user.email)\n\n respond_to do |format|\n format.html { redirect_to user_project_path(@project.author_id, @project.id), notice: notice }\n end\n end",
"def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end",
"def joinRoom(roomname, username)\n room = @chats.fetch roomname #get record of \"chats\"\n #puts(room)\n userID = @users.fetch username\n puts(\"joinroom userID #{userID}\")\n puts(userID)\n room.addUser(userID, username) #add user to that chat\n puts room.printMe\n end",
"def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:change_alliance_auto_join_action].nil? || params[:change_alliance_auto_join_action][:alliance_id].blank? \n\n raise ForbiddenError.new('tried to do a leader action although not even in an alliance') if current_character.alliance_id.blank?\n raise ForbiddenError.new('tried to change setting on wrong alliance') unless current_character.alliance_id == params[:change_alliance_auto_join_action][:alliance_id].to_i\n raise ForbiddenError.new('only leader can change auto join setting') unless current_character.alliance_leader?\n \n alliance = current_character.alliance\n alliance.auto_join_disabled = !((params[:change_alliance_auto_join_action][:auto_join_setting] || \"0\") == \"1\")\n \n raise BadRequestError.new('saving the auto join setting did fail.') unless alliance.save\n\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def show\n # Try to find it and fail if it doesn't exist\n unless @chat_room = ChatRoom.find_by_id(params[:id])\n flash[:notice] = \"Chat room doesn't exist. Maybe the owner deleted it?\"\n return redirect_to(chat_rooms_url)\n end\n\n # If it's archived, redirect them to the transcript URL\n if @chat_room.archived?\n flash[:notice] = \"Chat room is archived, loading transcript\"\n return redirect_to(transcript_url(@chat_room))\n end\n\n # Check to see if the user is already a member of the room\n unless @chat_room.participants.include?(whoami)\n # If it's not locked, create a room membership\n unless @chat_room.locked?\n Membership.create(:participant => whoami, :chat_room => @chat_room)\n else\n # Notify that the room is locked and they can't get in\n flash[:notice] = \"Chat room is locked, you can't join\"\n return redirect_to(chat_rooms_url)\n end\n end\n\n # Mark the current membership as active and all others as inactive\n if @membership = Membership.joining(whoami, @chat_room).first\n @membership.active = true && !whoami.away?\n @membership.save!\n end\n\n # Get all the memberships for listing room members\n @memberships = @chat_room.memberships\n\n # Get messages from the last 3 days for the chat room\n @messages = @chat_room.messages.since(3.days.ago)\n\n # If there's no recent messages, get last 50\n @messages = @chat_room.messages.limit(50).reverse if @messages.blank?\n\n # Get the message ID of the last message in the list. This will be used in\n # the AJAX call to get more messages.\n @current_highest_message = @messages.blank? ? -1 : @messages.last.id\n\n # Get notifications\n @notifications = Notification.for(whoami)\n\n # Get current user's keywords\n @keywords = whoami.keywords\n\n # Get 5 rooms around the current one\n @my_memberships = whoami.rooms_around(@chat_room)\n\n # Get rooms that have notifications waiting\n @chat_rooms_with_notifications = @notifications.collect{|n| n.message.chat_room}.uniq\n\n # Get messages that have triggered notifications\n @messages_with_notifications = @notifications.collect(&:message)\n end",
"def set_form\n # find the maximum number of users possible\n @max_count = User.all.count\n # check if a message already exists\n if !(defined?(@message)).nil?\n @sender = @message.sender\n @reciever = @message.reciever\n else # else the message is then being created\n # set the sender as the user creating the message\n @sender = params[:user_id]\n # let user determine the reciever of his message\n @reciever = nil\n end\n \n end",
"def create_chatroom\n Chatroom.create!(user: self)\n end",
"def invite_only?\n join_rule == :invite\n end",
"def user_joined(liga_user)\n @league = liga_user.league\n @user = liga_user.user\n\n emails = @league.officers.notify_officer_league_membership.map(&:email).join(\",\")\n\n @subject = \"[#{SITE_NAME}] New user joined #{@league.display_name}\"\n mail(to: DEFAULT_FROM_ADDRESS, bcc: emails, subject: @subject)\n end",
"def create\n @membership = Membership.find_or_create_by_user_id_and_group_id(params[:membership][:user_id], params[:group_id])\n\n if params[:autoconfirm]\n @membership.update_attributes(:level => Membership::LEVELS[:regular])\n else\n @membership.update_attributes(:level => Membership::LEVELS[:pending])\n end\n \n auth!\n\n respond_to do |format|\n if @membership.save\n process_notification(@membership, {:level => @membership.level_name, :adder => current_user.id}, :action => 'create', :owner => @membership.user, :recipient => @membership.group)\n format.html { redirect_to(edit_group_path(@group), :notice => t(:membership_created)) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { redirect_to @group }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def join\n if logged_in?\n @group_wanted = Group.find(params[:id]) # later change to params[:name]\n @country_wanted = Country.find(@group_wanted.country_id, :limit => 1)\n #match = current_user.countries.find(@country_wanted.id)\n #unless current_user.has_country?(@country_wanted.id) #countries.find(@country_wanted.id)\n #@matches = current_user.countries\n @match = Country.find_by_sql([\"SELECT * FROM countries_users WHERE user_id = ? AND country_id = ?\", current_user.id, @country_wanted.id])\n if @match.empty? #current_user.countries.find(@country_wanted.id).nil? #current_user.has_country?(@country_wanted.id) \n flash[:notice] = \"Joined!\"\n current_user.groups << @group_wanted # add group\n current_user.countries << @country_wanted # add country\n redirect_to '/perfil'\n else\n flash[:error] = \"You're either already subscribed to a group in the same country or in the same group.\"\n redirect_to :action => 'index'\n end \n end \n end",
"def join\n @event = Event.find(params[:event_id])\n @e = @event.user_to_events.build(:user_id => current_user.id,\n :event_id => \"#{@event.id}\",\n :owner_id => \"#{@event.user_id}\" )\n\n respond_to do |format|\n if @e.save\n @total_attendence = UserToEvent.find(\"#{@e.id}\").event.update_attributes(:no_of_guests_attending => (@event.no_of_guests_attending)+1)\n format.html { redirect_to(@event, :notice => 'Request has been sent to the meal owner.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(event_path(@event), :notice => 'Something has gone wrong , please try again.') }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @user = User.where(firstName: params[:user][:firstName]).first\n @loop = Loop.find(params[:loop_id])\n\n if @user\n lm = @user.loop_memberships.build(loop_id: @loop.id)\n lm.status = \"pending\"\n lm.author_id = current_user.id\n lm.save\n flash[:success] = \"invitation sent\"\n redirect_to loop_path(@loop)\n else \n flash[:error] = \"error with invitation\"\n redirect_to loop_path(@loop)\n end\n\n end",
"def join(user_id,group=nil,role=nil)\n if !is_a_member?(user_id)\n begin\n x = Note_User.new(:user_id => user_id, :note_id => self.id )\n x.group = group.id if group\n x.role = role if role\n x.save\n rescue\n return false\n end\n end\n return true\n end",
"def set_joined\n @joined = Joined.find(params[:id])\n end",
"def test_add_valid_communication\n \n # Create a new role to ensure the correct person id\n # Note that from the web interface, the role will already exist\n role = create_role(@person.person_id)\n assert role.save\n \n \n #Create a communication but dont save it just yet \n communication = create_communication\n \n #Check that the communication is saved and added to the person\n assert @person.add_communication(communication, role)\n \n #Assert that each of communications, roles and the join table are incremented by one\n assert(@number_of_comms+1 == Communication.count)\n assert(@number_of_roles+1 == Role.count)\n assert(@number_of_comm_peeps+1 == CommunicationPerson.count)\n \n \n #Check that the communication has been added\n assert(@person.communications.include?(communication), \"Communication should be associated with person\")\n \n \n #Now check the join table and ensure that only one person is associated with the communication - this is a business logic requirement\n cps = CommunicationPerson.find(:all, :conditions => [\"person_id = ? and communication_id = ?\",@person.person_id, communication.communication_id])\n \n # The business logic is such that a communication can only belong to one person\n assert cps.length == 1\n \n #Now check the role is set properly\n cp = cps[0]\n \n \n # Check the role is correct\n \n puts \"Comm role is \"+cp.role_id.to_s\n puts \"original role id is #{role.role_id}\"\n assert cp.role == role\n \n # Check that the communication only has one person\n spods = communication.people\n assert spods.length == 1\n \n # and that the person is the original person\n assert spods[0] == @person\n \n \n end",
"def followup_send\n @id = params[:id] # Id of original message\n original_message = Message.find @id\n fu_message = Message.create(params[:record].merge(:following_up => @id)) # a new message object to send the follow up\n fu_message.members = original_message.members_not_responding\n fu_message.create_sent_messages # Sigh, we need this because contact list is generated upon _save_, and unless we\n # call create_sent_messages again (or use another tactic), the specified members\n # will not be included\n#puts \"**** fu_message.members =#{fu_message.members[0].last_name}, #{fu_message.members[0].primary_email}\"\n deliver_message(fu_message)\n flash[:notice] = 'Follow up message sent'\n redirect_to messages_path\n end",
"def join(m)\n # self.reset_timer(m)\n if Channel(@channel_name).has_user?(m.user)\n if @game.accepting_players?\n added = @game.add_player(m.user)\n unless added.nil?\n Channel(@channel_name).send \"#{m.user.nick} has joined the game (#{@game.players.count}/#{@game.max_players})\"\n Channel(@channel_name).voice(m.user)\n end\n else\n if @game.started?\n Channel(@channel_name).send \"#{m.user.nick}: Game has already started.\"\n elsif @game.at_max_players?\n Channel(@channel_name).send \"#{m.user.nick}: Game is at max players. Switch to ONUWW to add more players\"\n else\n Channel(@channel_name).send \"#{m.user.nick}: You cannot join.\"\n end\n end\n else\n User(m.user).send \"You need to be in #{@channel_name} to join the game.\"\n end\n end",
"def create_by_tabbie_or_user\n #we may call this from /control/teams or /registration/individual\n \n @tournament = Tournament.find(safe_params[:id]);\n @emails = safe_params[:emails]; #need this incase we render\n @name = safe_params[:name];\n @list = @tournament.get_sorted_teams;\n @msg = SmallNotice.new;\n @user = current_user;\n\n #n will determine how many speakers we are building the team out of\n @n = GlobalConstants::FORMAT[:bp][:num_speakers_per_team];\n \n #check to see if the players existed\n #we have also generalized this accross debating formats\n users = [];\n (1..@n).each { |i|\n users.push(User.where(email: @emails[i-1]).first);\n #u[i] will be nil or a user object\n\n #might as well do error checking immediatley\n if users[i-1].nil?\n @msg.add(:error, \"Could not find member #{i}.\");\n render(render_place());\n return;\n end\n }\n\n #check memebrs are from same institution (in IF one day)\n #first get institution ids\n institution_ids = []\n users.each { |u|\n institution_ids.push(u.institution.id);\n }\n\n #### FOR HYBRID ###\n #@institution_id = GlobalConstants::HYBRID_INSTITUTION;\n #else\n @institution_id = users[0][:institution_id]; #just take it from one of the them\n\n #if this is not from tabbie, \n #if this is a capped/restricted tournament, the members have to be from the user's institution\n #if this is an open tournament, the current user needs to be the president of the team being made\n #if completely open, at least one member needs to be the current_user\n if render_place().split('/').last == \"individual\"\n if @tournament.tournament_setting[:registration] != \n GlobalConstants::SETTINGS_VALUES[:registration][\"Completely open\"]\n institution_ids.each { |i|\n if i != @user.institution_id\n @msg.add(:error, \"You can only make teams for people in your institution.\")\n render(render_place());\n return;\n end\n }\n else #completely open\n foundSelf = false; #assume self not in the list\n users.each { |u|\n if u == current_user\n foundSelf = true;\n end\n }\n if !foundSelf\n @msg.add(:error, \"You must be in the team you register\")\n render(render_place());\n return;\n end\n end\n end\n\n #should only be one unique id if not an open tournament...\n #NEED TO INCORPORATE THE ABILITY TO HAVE PEOPLE FROM DIFF INST IF MANUAL REGO BUT STILL AND OPEN\n if institution_ids.uniq.count != 1\n @msg.add(:error, \"Teams members are not from the same institution.\");\n render(render_place());\n return;\n end\n\n #check users are in no other teams for this tournament\n #we think coming from the user side is better\n i = 1;\n users.each { |u|\n u.teams.each { |w|\n if w.tournament_id == @tournament.id\n @msg.add(:error, \"Member #{i} is already competing in another team.\");\n render(render_place());\n return;\n end\n }\n i = i + 1;\n }\n \n #check the users are not also adjs\n i = 1;\n users.each { |u|\n u.tournament_attendees.each { |w|\n if (w.tournament_id == @tournament.id) && \n (w.role == GlobalConstants::TOURNAMENT_ROLES[:adjudicator])\n \n @msg.add(:error, \"Member #{i} is already an adjudicator.\");\n render(render_place());\n return;\n end\n }\n i = i + 1;\n }\n \n #at this point we will go a head and set up for saving\n @team = Team.new(name: safe_params[:name], institution_id: institution_ids[0],\n tournament_id: @tournament.id, points: 0, total_speaks: 0);\n \n #generalized way to add in users, good for varribale number (2-3) speakers per team\n #which is needed for different formats of debating\n i = 1;\n users.each { |u|\n @team[(\"member_#{i}_id\").to_sym] = u.id;\n i = i + 1;\n }\n\n if @team.save()\n #in this case, we must update the attendees table\n \n #gerenalized adding to tournament attendee\n users.each { |u|\n \tTournamentAttendee.new(user_id: u[:id], tournament_id: @tournament[:id],\n \t\t\t\t\t\t\t\t role: GlobalConstants::TOURNAMENT_ROLES[:debater],\n \t\t\t\t\t\t\t\t institution_id: @institution_id).save();\n }\n \n #@msg.add(:success, \"Team Created!\"); #make sure the flash is below the form\n #redirect needs to use flash\n flash[:success] = \"Team Created.\"\n redirect_to(redirect_place());\n else\n #so we need both flash and normal error rendering thing\n #lets fluralize the flash and then port over the error messages\n #while keeping an eye on what the 'shared/_error_messages' does\n \n load_errors(@team);\n render render_place();\n return;\n end\n end",
"def join_for(user)\n joins.find_by_user_id(user)\n end",
"def test_parse_join\n msg = Message.parse(@join_message)\n assert_equal @join_message, msg.raw_message\n assert_equal CMD_JOIN, msg.message_type\n assert_equal ['#chan'], msg.params\n end",
"def perform(notifiable_id, notifiable_type, prefix)\n title=\"New #{prefix}-#{notifiable_type}\"\n \n if title == 'New Post-Like' || 'New Comment-Like'\n like = Like.find(notifiable_id)\n receiving_user = like.likeable.user\n \n elsif title == 'New Post-Comment'\n comment = Comment.find(notifiable_id)\n receiving_user = comment.post.user\n \n elsif title == 'New Request-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friended\n \n elsif title == 'New Accept-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friender\n end\n \n receiving_user.notifications.create(title: title, user_id: receiving_user.id, \n notifiable_id: notifiable_id, notifiable_type: notifiable_type)\n end",
"def create\n @joined = Joined.new(joined_params)\n\n respond_to do |format|\n if @joined.save\n format.html { redirect_to @joined, notice: 'Joined was successfully created.' }\n format.json { render :show, status: :created, location: @joined }\n else\n format.html { render :new }\n format.json { render json: @joined.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n if params[:group_id]\n @message.owner = Group.find(params[:group_id]) \n else\n @message.owner ||= default_company\n end\n @message.archived = false\n @message.author = current_user\n @message.published_at ||= Time.now\n \n if @message.owner_type == 'Group'\n message = \"You do not have access needed to create the discussion <strong>'#{@message.subject}'</strong> for this working group at this time. If you are still interested in creating this discussion, please let us know.\"\n authorize! :create_in, @message.owner, :message => message.html_safe\n else\n message = \"You do not have access needed to create the discussion <strong>'#{@message.subject}'</strong> at this time. If you are still interested in creating this discussion, please let us know.\"\n authorize! :create, @message, :message => message.html_safe\n end\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to polymorphic_path([@group, @message]) }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # if user/trainer didn't complete the form!!!\n if params[:receiver_id] == \"\" or params[:subject] == \"\" or params[:content] == \"create a message here...\"\n if params[:receiver_id] == \"\"\n flash[:alert_receiver_id] = \"please select an athlete\"\n end\n if params[:subject] == \"\"\n flash[:alert_subject] = \"please input a subject\"\n end\n if params[:content] == \"create a message here...\"\n flash[:alert_content] = \"please input a content\"\n end\n redirect_to \"/mentor_messages/home\"\n # else user/trainer complete the form\n else\n mentor_message = MentorMessage.new(params[:mentor_message])\n mentor_message.content = params[:content]\n # user -> trainer\n if current_user != nil\n mentor_message.message_type = 0\n mentor_message.sender_id = current_user.id\n mentor_message.receiver_id = params[:receiver_id]\n # trainer -> user\n elsif current_trainer != nil\n mentor_message.message_type = 1\n mentor_message.sender_id = current_trainer.id\n mentor_message.receiver_id = params[:receiver_id]\n end\n\n mentor_message.save\n redirect_to '/mentor_messages/home'\n end\n end"
] |
[
"0.668035",
"0.61500156",
"0.60958534",
"0.5935227",
"0.586472",
"0.586472",
"0.5839209",
"0.5829119",
"0.582883",
"0.5818461",
"0.5803809",
"0.57498085",
"0.5695783",
"0.5689204",
"0.5628463",
"0.5624066",
"0.5599365",
"0.5590072",
"0.5586949",
"0.55716646",
"0.5555593",
"0.55543023",
"0.5542028",
"0.5532135",
"0.5512915",
"0.55104655",
"0.5503077",
"0.54947764",
"0.54730505",
"0.5466662",
"0.54473245",
"0.54427415",
"0.54417694",
"0.54326874",
"0.54312783",
"0.5430811",
"0.54216176",
"0.5406787",
"0.5401798",
"0.5373152",
"0.53653806",
"0.5356972",
"0.53360265",
"0.53347254",
"0.533385",
"0.5321806",
"0.5314417",
"0.5300909",
"0.5298878",
"0.5296713",
"0.5292466",
"0.5284516",
"0.52774304",
"0.5269475",
"0.5264464",
"0.52602255",
"0.52590156",
"0.525869",
"0.5253851",
"0.5251471",
"0.52512544",
"0.5242906",
"0.5242345",
"0.5229632",
"0.52270883",
"0.52240217",
"0.52173764",
"0.52128595",
"0.5210787",
"0.52021223",
"0.5198154",
"0.5197872",
"0.5184483",
"0.518386",
"0.51816803",
"0.5178218",
"0.51688087",
"0.5167697",
"0.5162896",
"0.5160632",
"0.51551306",
"0.5148896",
"0.51388127",
"0.5137225",
"0.51350003",
"0.5132683",
"0.51272273",
"0.5123531",
"0.5123257",
"0.51215744",
"0.5120708",
"0.5117361",
"0.51164067",
"0.5114492",
"0.5109761",
"0.5109274",
"0.5106748",
"0.5103025",
"0.51025945",
"0.5102128"
] |
0.6975022
|
0
|
Initialize the directories and the railstoflex class map
|
def initialize(src,trgt,rootpackage,test_url = "http://localhost:3000")
@source,@target,@package_root,@test_base_url = src,trgt,rootpackage,test_url
@typemap = {}
@typemap[:integer] = 'int'
@typemap[:float] = 'Number'
@typemap[:datetime] = 'Date'
@typemap[:date] = 'Day'
@typemap[:time] = 'Time'
@typemap[:string] = 'String'
@typemap[:text] = 'String'
@typemap[:boolean] = 'Boolean'
@defaultvaluemap = {}
@defaultvaluemap[:integer] = '0'
@defaultvaluemap[:float] = '0.0'
@defaultvaluemap[:datetime] = 'new Date()'
@defaultvaluemap[:date] = 'new Day()'
@defaultvaluemap[:time] = 'new Time()'
@defaultvaluemap[:string] = '""'
@defaultvaluemap[:text] = '""'
@defaultvaluemap[:boolean] = 'false'
# template variables hash
@tmap = { 'timestamp' => Time.now.httpdate}
@tmap['testbaseurl'] = test_url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n set_root_path!\n \n self.frameworks = default_frameworks\n self.autoload_paths = default_autoload_paths\n self.autoload_once_paths = default_autoload_once_paths\n self.dependency_loading = default_dependency_loading\n self.eager_load_paths = default_eager_load_paths\n self.log_path = default_log_path\n self.log_level = default_log_level\n self.binder_paths = default_binder_paths\n self.marshal_path = default_marshal_path\n self.cache_classes = default_cache_classes\n self.whiny_nils = default_whiny_nils\n self.database_configuration_file = default_database_configuration_file\n self.app_config_file = default_app_config_file\n self.plugin_glob = default_plugin_glob\n self.helper_glob = default_helper_glob\n self.initializer_glob = default_initalizer_glob\n self.first_run_glob = default_first_run_glob\n self.publisher = default_publisher\n self.copyright = default_copyright\n \n for framework in default_frameworks\n self.send(\"#{framework}=\", Bowline::OrderedOptions.new)\n end\n end",
"def initialize_classes_and_modules\n @classes = {}\n @modules = {}\n end",
"def initialize\n #load_config\n load_routes\n end",
"def create_initialize_files\n\n #todo 扩展根目录,注意后期同样要添加参数配置\n empty_directory 'modules' unless Dir.exist?('modules')\n\n\n empty_directory \"#{module_path}\"\n empty_directory \"#{module_path}/app\"\n empty_directory \"#{module_path}/app/controllers\"\n empty_directory \"#{module_path}/app/helpers\"\n empty_directory \"#{module_path}/app/models\"\n empty_directory \"#{module_path}/app/views\"\n empty_directory \"#{module_path}/config\"\n empty_directory \"#{module_path}/config/initializers\"\n empty_directory \"#{module_path}/config/locales\"\n empty_directory \"#{module_path}/db\"\n empty_directory \"#{module_path}/db/migrate\"\n empty_directory \"#{module_path}/lib\"\n empty_directory \"#{module_path}/lib/menus\"\n\n\n copy_file 'init_.rb', \"#{module_path}/initializers/init_#{module_name}.rb\" # 启用各模块必须的文件\n copy_file 'routes.rb', \"#{module_path}/config/routes.rb\" # 路由文件\n copy_file 'en.yml', \"#{module_path}/config/locales/en.yml\" # en多语言文件\n copy_file 'zh.yml', \"#{module_path}/config/locales/zh.yml\" # zh多语言文件\n copy_file 'init_data.rb', \"#{module_path}/lib/menus/init_data.rb\" # 配置文件,比如:菜单、功能、权限(action)等\n\n\n end",
"def initialize dir\n @ilog = logger\n @controllers = {} # fqname=> instance \n @load_dir = dir\n load_controllers dir if @load_dir\n end",
"def initialize()\n @models = {}\n @path = Settings.get[\"trxml\"][\"path\"]\n @xmls = Settings.get[\"trxml\"][\"xmls\"]\n\n create_models\n end",
"def initialize(folder)\r\n super(File.join(folder, CLASSES))\r\n @root = folder\r\n end",
"def setup_skeleton\n self.destination_root = File.join(path, name)\n @class_name = name.classify\n directory(\"base_app/\", self.destination_root)\n store_component_config('.components')\n end",
"def init_folders(dir)\n\n FOLDER_DEFAULTS.each do |key|\n @folder=dir+\"/\"+key[:dir]\n @folder.gsub!('\\\\','/')\n if not File.directory? @folder\n File.makedirs @folder\n end\n end\n\n end",
"def initialize(base, map={})\n @base = File.expand_path(base)\n @map = {}\n \n map.each_pair {|type, paths| self[type] = paths }\n end",
"def init\n FileUtils.mkdir_p home\n FileUtils.mkdir_p home(\"templates\")\n FileUtils.touch home(\"config.yml\")\n end",
"def initialize root_dir\n find_files root_dir\n end",
"def initialize\n @imgs = {}\n @global_imgs = {}\n @tilesets = {}\n @global_tilesets = {}\n @sounds = {}\n @global_sounds = {}\n @songs = {}\n @global_songs = {}\n @fonts = {}\n @global_fonts = {}\n\n @prefix = File.expand_path(File.dirname($0)) + '/data/'\n @img_dir = 'img/'\n @tileset_dir = 'tileset/'\n @sound_dir = 'sound/'\n @song_dir = 'song/'\n @font_dir = 'font/'\n @separator = '_'\n @retro_images = false\n end",
"def initialize path, base_dir, defines\n @base_dir = base_dir\n source = File::open(path, \"r\") {|f| f.read }\n preprocessed = InnoSetup::preprocess(source, defines)\n sections = InnoSetup::split_into_sections(preprocessed)\n cs = parse_section sections['Components'], Component\n @components = build_hash(cs) {|c| c.name }\n @file_sets = parse_section sections['Files'], FileSet\n end",
"def initialize(site, base, dir, name); end",
"def initial_paths; end",
"def initialize(base_dir)\n @base_dir = base_dir\n end",
"def load\n require_dependencies\n load_directory :lib\n load_directory :models\n load_directory :routes\n self\n end",
"def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\n end",
"def load_classes class_path_list\n class_path_list.each do |path|\n add_class path\n end\n end",
"def initialize_attributes\n @loader_for = 'class'\n @type_path = ''\n @module = ::Interferon\n end",
"def initialize()\n @fan_home = ENV[\"fan_home\"]\n @fan_adm = File.join(@fan_home, \"adm\")\n @fan_bin = File.join(@fan_home, \"bin\")\n @fan_lib = File.join(@fan_home, \"lib\")\n @fan_lib_java = File.join(@fan_lib, \"java\")\n @sys_jar = File.join(@fan_lib_java, \"sys.jar\")\n @fan_lib_fan = File.join(@fan_lib, \"fan\")\n @fan_lib_net = File.join(@fan_lib, \"net\")\n @fan_src = File.join(@fan_home, \"src\")\n @src_jfan = File.join(@fan_src, \"sys\", \"java\")\n @src_nfan = File.join(@fan_src, \"sys\", \"dotnet\")\n @src_compiler = File.join(@fan_src, \"compiler\")\n\n @java_home = ENV[\"java_home\"]\n @javac = File.join(@java_home, \"bin\", \"javac.exe\")\n @jar = File.join(@java_home, \"bin\", \"jar.exe\")\n end",
"def initialize(*dirs)\n @dirs = dirs.flatten.map{|dir| dir.to_s}\n @known_files = []\n @last_mtime = {}\n end",
"def setup()\n create_directories\n end",
"def initialize\n @allocations = {}\n @http_server = BeEF::Core::Server.instance\n @root_dir = File.expand_path('../../../../', __FILE__)\n end",
"def setup_skeleton\r\n self.destination_root = File.join(path, name)\r\n @class_name = name.classify\r\n @guid = UUIDTools::UUID.timestamp_create.to_s\r\n directory(\"base_app/\", self.destination_root)\r\n copy_file File.join(self.destination_root, \"blend_solution.sln\"), File.join(self.destination_root, \"#{@class_name}.sln\")\r\n copy_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\"), File.join(self.destination_root, \"src\", \"#{@class_name}.Controls.csproj\")\r\n remove_file File.join(self.destination_root, \"blend_solution.sln\")\r\n remove_file File.join(self.destination_root, \"src\", \"ironnails_controls.csproj\")\r\n\r\n store_component_config('.components')\r\n end",
"def initialize(res='', classes=[], subsets=[], preproc=[],\n trans=[], classifs=[])\n\n super()\n @logger.info('Generate all the necessary paths for data files and models')\n\n @res = res\n @classes = classes.map(&:to_sym)\n @subsets = subsets.map(&:to_sym)\n @preproc = preproc.map(&:to_sym)\n @trans = trans.map(&:to_sym)\n @classifs = classifs.map(&:to_sym)\n\n @paths = {}\n\n # data files\n @paths[:data] = generate_data_files()\n\n @logger.info(\"The generated paths:\\n#{PP.pp(@paths, '')}\")\n end",
"def set_up!\n return if set_up?\n settings.namespaces.each do |ns|\n path = make_path(ns)\n if !Dir.exists?(path) then\n settings.logger.debug(\"Creating dir #{path}\")\n FileUtils.mkdir_p(path)\n end\n end\n end",
"def initialize\n require 'java'\n \n naether_jar = Naether::Configuration.naether_jar\n \n @loaded_paths = []\n \n load_paths(naether_jar) \n @class_loader = com.tobedevoured.naether.PathClassLoader.new()\n internal_load_paths(naether_jar) \n end",
"def initialize\n self.base_dir = BASE_DIR\n self.version_pattern = VERSION_PATTERN\n self.class_prefix = CLASS_PREFIX\n end",
"def initialize(dir)\n\t\t@dir = dir\n\tend",
"def initialize(dir)\n\t\t@dir = dir\n\tend",
"def initialize\n\t\t@classes = Array.new\n\t\t# A set instead of the hashes would be a nicer choice, but \n\t\t# RubyToDot should not depend on any library to allow more complete graphs.\n\t\t@modules = Hash.new\n\t\t@ignored = Hash.new\n\t\t@ignored_tree = Hash.new\n\t\tset_defaults\n\tend",
"def load_wizards\n lib = ()\n wizdirs = []\n singletons = {}\n move_tos = {}\n Dir[\"./wizards/*\"].each { |filename|\n f = File.new(filename)\n if File.directory?(f)\n if File.basename(f) == \"lib\"\n lib = f\n else\n wizdirs.push(f)\n end\n end\n }\n wizdirs = [lib] + wizdirs\n wizdirs.each { |dir|\n load_wizard(dir, singletons)\n }\n singletons.each { |tc, destination|\n obj = tc.instantiate\n @singletons.push(obj)\n @all_things.push(obj)\n if destination; move_tos[obj] = dest(tc.wizard, destination) end\n }\n move_tos.each { |obj,dest|\n obj.move_to(find_singleton(dest))\n }\n end",
"def setup_default_structure!\n self.push_app_path(:root, Merb.root / 'slices' / self.identifier)\n \n self.push_path(:application, root_path('app'))\n self.push_app_path(:application, app_dir_for(:root) / 'app')\n \n app_components.each do |component|\n self.push_path(component, dir_for(:application) / \"#{component}s\")\n self.push_app_path(component, app_dir_for(:application) / \"#{component}s\")\n end\n \n self.push_path(:public, root_path('public'), nil)\n self.push_app_path(:public, Merb.dir_for(:public) / 'slices' / self.identifier, nil)\n \n public_components.each do |component|\n self.push_path(component, dir_for(:public) / \"#{component}s\", nil)\n self.push_app_path(component, app_dir_for(:public) / \"#{component}s\", nil)\n end\n end",
"def initialize(base)\n self.count = 0\n self.boards = []\n self.maxvalue = 0\n # base directory/path where images are stored\n self.base = base\n %x{mkdir -p #{base}}\n %x{mkdir -p #{File.join(base, \"data\")}}\n end",
"def initialize \n # Create a class variable to hold an instance of each command classes\n @ls_exe = LsExe.new\n @mkdir_exe = MkdirExe.new\n @touch_exe = TouchExe.new\n @exit_exe = ExitExe.new\n\n # Hash to hold each of the supporting classes\n @command_map = {\n 'ls' => @ls_exe,\n 'mkdir' => @mkdir_exe,\n 'touch' => @touch_exe,\n 'exit' => @exit_exe\n }\n\n end",
"def initialize(*paths)\n @configuration = {}\n paths.each { |f| load f }\n end",
"def initialize\n define_os\n define_path\n read_settings\n end",
"def init(filepath)\n\t\tsuper # This loads the parent's init method (which stores self.root)\n\tend",
"def initialize(root_dir, module_set, data)\n @module_set = module_set\n @name = data[:name]\n @root = FilePath.new(root_dir, @name).canonicalize\n @compiler_version = data[:compiler_version] \n @aspectj = data[:aspectj] || false\n @dependencies = data[:dependencies] || [ ]\n\n assert(\"Root ('#{@root.to_s}') must be an absolute path\") { @root.absolute? }\n assert(\"Root ('#{@root.to_s}') must exist, and be a directory\") { FileTest.directory?(@root.to_s) }\n assert(\"Compiler version must be specified.\") { ! @compiler_version.nil? }\n \n @subtrees = [ ]\n # Run through all the factories and add a new subtree for each one.\n BuildSubtreeFactory::ALL_BUILD_SUBTREE_FACTORIES.each { |factory| @subtrees << factory.create(self) }\n end",
"def init_all_paths_liby\n\t\tcv_set(Liby, :path_lily_file \t => nil)\n\t\tcv_set(Liby, :path_pdf_file \t => nil)\n\t\tcv_set(Liby, :path_ruby_score => nil)\t\t\t\n\t\tcv_set(Liby, :path_affixe_file => nil)\t\t\t\n end",
"def initialize_directories_and_directories_records(directories)\n @directories = directories.map { |d| Pathname.new(d).realpath.to_s }\n @directories_records = directories.map { |d| DirectoryRecord.new(d) }\n end",
"def initialize_root\n Utils.create_directory(@cache_root)\n Utils.clear_directory(@cache_root)\n end",
"def initialize\n envConfigFile = \"#{$ROOT}/../config/envConfig.yml\"\n @envConfig = loadYAMLFile(envConfigFile)\n stepsFile = \"#{$ROOT}/../config/steps.csv\"\n @steps = loadCSVFile(stepsFile)\n pageObjectsFile = \"#{$ROOT}/../config/pageObjects.csv\"\n @pageObjects = loadCSVFile(pageObjectsFile)\n @reportFolder = generatedReportFolder\n @isProcess = true\n @skipCurrentStep = false\n @report = []\n end",
"def initialize(path)\n @path = File.expand_path(path)\n\n @directories = []\n @files = {}\n @templates = {}\n @includes = Hash.new { |hash,key| hash[key] = {} }\n\n @disable = []\n @enable = []\n\n @ignore = []\n @dependencies = {}\n @development_dependencies = {}\n @variables = {}\n\n load!\n scan!\n end",
"def setup_dir_structure\n # insure that database dir exists so that a new db can be created if necessary\n if $config[\"database\"][\"adapter\"] == \"sqlite3\"\n FileUtils.mkpath(File.dirname($config[\"database\"][\"database\"]))\n end\n # ensure that log dirs exists and last $config[\"clamscan_log\"] is cleared before use\n FileUtils.mkpath(File.dirname($config[\"run_log\"]))\n FileUtils.mkpath(File.dirname($config[\"clamscan_log\"]))\nend",
"def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end",
"def initialize(base_dir)\r\n read_config(base_dir)\r\n end",
"def initialize(dir_or_config_hash)\n build_config(dir_or_config_hash)\n\n @code_snippets_loaded = false\n @items_loaded = false\n @layouts_loaded = false\n end",
"def initialize(dir_or_config_hash)\n build_config(dir_or_config_hash)\n\n @code_snippets_loaded = false\n @items_loaded = false\n @layouts_loaded = false\n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables = LOADABLE_KINDS)\n super\n @path_index = Set.new\n end",
"def load_paths\n @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }\n @_load_paths ||= @_load_paths_was\n end",
"def initialize current_dir,configuration\n @current_dir=current_dir\n @configuration=configuration\n @base_dir=File.expand_path(@configuration['base_dir'])\n @base_src=File.join(@base_dir,'src')\n end",
"def initialize \n @dirpath = self.class.dirname\n\n if Dir.exist? @dirpath\n raise \"Directory is not readable\" unless File.readable? @dirpath\n raise \"Directory is not writable\" unless File.writable? @dirpath\n else \n Dir.mdkir @dirpath\n raise \"Directory does not exist and could not be created\" unlesss Dir.exist? @dirpath\n end \n\n refresh_cached_files\n end",
"def initialize\n super\n\n @in_files = []\n\n @name ||= \"unknown\"\n @parent = nil\n @visibility = :public\n\n @current_section = Section.new self, nil, nil\n @sections = { nil => @current_section }\n @temporary_section = nil\n\n @classes = {}\n @modules = {}\n\n initialize_methods_etc\n end",
"def load(cfg)\n @cfg = cfg\n @routes = {}\n #get a logger..\n # log to specified dir\n @logger = TileLumber.new(cfg[\"log\"])\n @logger.logstatus(\"Starting.\")\n \n #mount up the /benchmark area..\n reg( cfg[\"http\"][\"base\"] + \"/benchmark\", BenchmarkHandler.new(@logger))\n \n path = cfg[\"http\"][\"base\"] + cfg[\"controller\"][\"base_url\"]\n @logger.msginfo(\"Main:Setting up the controller at '#{path}''\")\n reg( path , ControllerHandler.new(@logger,cfg, self ))\n \n #loop though the tile engines in the config file, and fire up and mount each..\n configs(cfg) do |tcfg|\n path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/tile/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, TileHandler.new(tcfg, @logger, cfg[\"http\"]))\n path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/bbox/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, BBoxTileHandler.new(tcfg, @logger, cfg[\"http\"]))\n path = cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/services/\" + tcfg[\"title\"] + \"/MapServer/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, ESRIRestTileHandler.new(tcfg, @logger, cfg[\"http\"]))\n if ( tcfg[\"kml\"])\n\t path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/kml/\"\n\t reg(path,KMLHandler.new(@logger, cfg[\"http\"], tcfg[\"title\"]))\n end\n end\n \n ##\n # ESRI TOC serving gadget..\n reg(cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/services\", ESRI_Service_Fooler.new(@logger, cfg[\"esri\"]))\n reg(cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/info\", ESRI_Service_Fooler_Info.new(@logger, cfg[\"esri\"]))\n @logger.logstatus(\"Up.\")\n end",
"def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end",
"def initialize\n @helpers_path = nil\n @views_path = nil\n end",
"def initialize processor = nil\n @processor = processor\n @config = {}\n @templates = {}\n @controllers = {}\n #Initialize models with the unknown model so\n #we can match models later without knowing precisely what\n #class they are.\n @models = { UNKNOWN_MODEL => { :name => UNKNOWN_MODEL,\n :parent => nil,\n :includes => [],\n :attributes => [],\n :public => {},\n :private => {},\n :protected => {},\n :options => {} } }\n @routes = {}\n @initializers = {}\n @errors = []\n @libs = {}\n @checks = nil\n @processed = nil\n @template_cache = Set.new\n end",
"def initialize(env, root_dir)\n super(env)\n @root_dir = root_dir\n end",
"def init\t\n\tenable :static\n\tset :statics_folder, 'statics'\n\tset :deep_or_flat_structure, 'flat'\n\n\tset :public_folder, settings.statics_folder\n\n\tset :page_pool, page_pool()\nend",
"def initialize(*args, &block)\n @options = _init_options(args.last.is_a?(Hash) ? args.pop : {})\n @directories = args.flatten.map { |path| Pathname.new(path).realpath }\n @changes = []\n @block = block\n @registry = Celluloid::Registry.new\n _init_debug\n end",
"def initialize(dir)\n @dir = dir\n end",
"def initialize path\n # make menu instance accessible by the class\n @@menu = self\n @rolls = {}\n @sources = []\n\n # load a yaml file\n load_from_file path\n\n # create objects from the menu\n set_sources\n set_roll_models\n set_rolls\n end",
"def initialize(path); end",
"def init_gd_module()\n # Metadata packages, such as report.rb, require this to be loaded first\n require_relative 'models/metadata.rb'\n\n # Load models from models folder\n Dir[File.dirname(__FILE__) + '/models/*.rb'].each { |file| require file }\n\n # Load collections\n Dir[File.dirname(__FILE__) + '/collections/*.rb'].each { |file| require file }\nend",
"def initialize(site, base, dir, name, collection = T.unsafe(nil)); end",
"def directories\n @@directories ||= default_directories\n end",
"def init\n if @dir_path\n @gen = Resource[@dir_path].entries.to_enum\n else\n @gen = [].each\n end\n end",
"def load_paths\n @load_paths ||= Config::LoadPaths.new\n end",
"def generate_all_classes(site)\n puts \"222222222222222222222222222222222222222222222222222222222222\"\n if Dir.exists?('src/_classes')\n puts \"3333333333\"\n Dir.chdir('src/_classes')\n\n Dir[\"*.yml\"].each do |path|\n puts \"444444444 \" + path\n name = File.basename(path, '.yml')\n self.generate_class_index(site, site.source, \"/pages/classes/\" + name, name, 'el')\n self.generate_class_index(site, site.source, \"/en/pages/classes/\" + name, name, 'en')\n end\n\n Dir.chdir(site.source)\n self.generate_all_classes_index(site)\n end\n end",
"def initialize(path)\n @path = Pathname.new(path).tap{ |check| check.stat }\n @namespace = @path.parent.basename.to_s\n @name = @path.basename.to_s\n initialize_specfile\n initialize_options\n initialize_directories\n initialize_models\n rescue Errno::ENOENT => error\n raise RuntimeError, error.message\n end",
"def create_dirs(klass)\n class << klass\n Array(LIBRARY_DIRS).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir, dir)\n end\n module_eval(%(def #{dir}_require(&block); lib_require('#{dir}', &block); end), __FILE__, __LINE__)\n end\n end\n end",
"def initialize(args)\n @mapping = parse_mapping(args[:mapping])\n\n @include_custom = args[:include_custom]\n @zip_output = args[:zip_output]\n\n SUPPORTED_HSDS_MODELS.each do |model|\n var_name = \"@\" + model\n instance_variable_set(var_name, [])\n end\n\n set_file_paths(args)\n end",
"def initialize(root_folder)\n @root_folder = root_folder\n end",
"def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"def class_init\n @environments_by_name = {}\n @environments = []\n end",
"def initialize(root)\n @root = File.expand_path(root)\n end",
"def terminus_classes(indirection_name)\n setup_instance_loading indirection_name\n instance_loader(indirection_name).files_to_load.map do |file|\n File.basename(file).chomp(\".rb\").intern\n end\n end",
"def initialize(files, adapter_name, identifier, options={}, path=\"\")\n @global_root_concepts, @global_finders = [], []\n @mappings = {}\n @prefixes = java.util.HashMap.new\n i = 0\n files.each do |file|\n Adapter.purge(identifier, path)\n adapter = Adapter.new(identifier,\n [file],\n adapter_name,\n path)\n @prefixes.putAll(adapter.prefixes)\n \n begin\n maps = MapsAnalyzer.new({ :report => options[:report],\n :id => identifier ,\n :patterns_file => options[:patterns_file],\n :analysis_file => options[:analysis_file],\n :counter => i} )\n maps.root_concepts_list.each do |r_concepts|\n @global_root_concepts << r_concepts\n @mappings[r_concepts[0]] = [r_concepts[1], i]\n i = i.next\n end\n maps.finders.each do |finder|\n @global_finders << finder\n end \n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect\n ensure\n adapter.close\n end\n end\n if options[:report]\n m = { options[:mappings_file] => @mappings}\n YamlWriter.store_reports(m, identifier)\n end\n end",
"def initialize\n @relative_location = '.'\n end",
"def autoload_paths=(_arg0); end",
"def initialize( *args )\n\t\t@template = nil\n\t\t@template_dir = GENERATOR_DIR + 'template/darkfish'\n\t\t\n\t\t@files = []\n\t\t@classes = []\n\t\t@hyperlinks = {}\n\n\t\t@basedir = Pathname.pwd.expand_path\n\n\t\tsuper\n\tend",
"def initialize()\n original_dir = Dir.pwd\n Dir.chdir(__dir__)\n\n classes_before = ObjectSpace.each_object(Class).to_a\n Dir[\"../model/game/*\"].each {|file|\n require_relative file\n }\n Dir.chdir(original_dir)\n\n classes_after = ObjectSpace.each_object(Class).to_a\n @modes_loaded = classes_after - classes_before\n\n @game_started = false\n @observer_views = []\n @players = []\n @clients_players = Hash.new\n @board = nil\n @clients_board = nil\n @player_playing = nil\n @clients_player_playing_index = nil\n @AI_players = 0\n # http://docs.ruby-lang.org/en/2.0.0/Hash.html\n @game_history = Hash.new(-1)\n @turn = 1\n @online_mode = false\n @player_name = nil\n @player_id = 1\n @save_requests_received = Hash.new(0)\n @turn_which_save_was_requested = -1\n @continuing_game = false\n end",
"def initialize(root = Dir.pwd)\n @root = Pathname.new(root)\n end",
"def load_app_classes\n @@load_paths.each do |name, path|\n log.debug \"Loading #{name} classes...\"\n\n Dir[\"#{self.app_path}/#{path}\"].each do |f|\n log.debug \"Loading: #{f}\"\n load(f)\n end\n end\n end",
"def initialize(dir)\n @dir = Pathname.new(dir)\n end",
"def try_folders\n folders = Folders.new(application_root, config, settings)\n folders.configure\n end",
"def create_dirs(klass)\n class << klass\n Array(yield).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir,dir)\n end\n module_eval(%Q(def #{dir}_require(&block); lib_require('#{dir}', &block); end))\n end\n end\n end",
"def initialize defines, undefines\n @undefines = undefines\n\t\t\tos = Cfruby::OS.get_os()\n\t\t\t@hostname = os.hostname\n\t\t\t# init_classlist --- don't do this, it is a circular \n\t\t\tadd('any',@hostname)\n\t\t\tadd(os['name'].downcase,@hostname) if os['name']\n\t\t\tadd(os['distribution'].downcase,@hostname) if os['distribution']\n\t\t\tusermanager = os.get_user_manager()\n\t\t\tadd(usermanager.get_name(Process.euid()),@hostname)\n group = usermanager.get_group(Process.egid())\n add(group,@hostname) if group\n # ---- add classes passed through command line\n defines.each do | d |\n add(d,@hostname)\n end\n\t\tend",
"def setup\n mutex.synchronize do\n break if @setup\n\n actual_root_dirs.each do |root_dir, namespace|\n set_autoloads_in_dir(root_dir, namespace)\n end\n\n on_setup_callbacks.each(&:call)\n\n @setup = true\n end\n end",
"def initialize( directory = TyrantManager.default_directory )\n self.home_dir = File.expand_path( directory )\n if File.exist?( self.config_file ) then\n configuration # force a load\n else\n raise Error, \"#{home_dir} is not a valid TyrantManager home. #{self.config_file} does not exist\"\n end\n end",
"def setup\r\n setup_wiki\r\n setup_host_map\r\n setup_host\r\n end",
"def bootstrap\n puts \"Creating folder for project at #{folder}\"\n mkdir_p folder\n default_attributes\n save\n end",
"def initialize_generate\n super\n add_accessors\n declare_chefignore\n declare_gitignore\n end",
"def initialize(root = Dir.pwd)\n @root = root\n super()\n end",
"def init_setup(adapter)\n Namespace.register :skos, SKOS\n Namespace.register :aeria, AERIA\n load_namespaces(adapter)\n ObjectManager.construct_classes\n @model = adapter.model\n @prefixes = Adapter.get_prefixes(adapter)\n end",
"def init_all(glob)\n\t\tDir[glob].each { |file| init(file) }\n\tend",
"def initialize_generate\n super\n add_accessors\n declare_guardfile\n declare_chefignore_patterns\n end",
"def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end"
] |
[
"0.67733794",
"0.6733427",
"0.6622824",
"0.6516375",
"0.6503654",
"0.643286",
"0.6418493",
"0.64173424",
"0.6368886",
"0.6366727",
"0.6310562",
"0.6295939",
"0.62547314",
"0.6253043",
"0.6236144",
"0.6235043",
"0.6221744",
"0.6212774",
"0.6192451",
"0.61827946",
"0.617857",
"0.61716247",
"0.6155468",
"0.6136367",
"0.612596",
"0.6122188",
"0.61060387",
"0.60961634",
"0.60835534",
"0.6072518",
"0.6052341",
"0.6052341",
"0.6051554",
"0.6033977",
"0.6016373",
"0.601484",
"0.6013352",
"0.60061884",
"0.60012084",
"0.6000969",
"0.59885305",
"0.59811",
"0.59808207",
"0.59748083",
"0.5970954",
"0.5965852",
"0.5946232",
"0.59461296",
"0.59411544",
"0.59408337",
"0.59408337",
"0.593677",
"0.5932497",
"0.59312904",
"0.59054124",
"0.59026635",
"0.59009963",
"0.5898041",
"0.589702",
"0.5896196",
"0.58763903",
"0.5869732",
"0.58617043",
"0.58568066",
"0.58546925",
"0.584809",
"0.5844072",
"0.5836411",
"0.583579",
"0.58341867",
"0.58310723",
"0.5828287",
"0.58240753",
"0.5818512",
"0.5817061",
"0.5803872",
"0.5799706",
"0.57895976",
"0.57889694",
"0.57853544",
"0.5782581",
"0.5775266",
"0.576704",
"0.57563937",
"0.5733232",
"0.5732328",
"0.5719453",
"0.5714715",
"0.5711283",
"0.57035524",
"0.57019895",
"0.56987435",
"0.5697917",
"0.5695814",
"0.5695293",
"0.5694801",
"0.5684408",
"0.5678795",
"0.5676498",
"0.5671758",
"0.5659277"
] |
0.0
|
-1
|
Read and transform a template using a map of keyvalue pairs template must refer to a relative filename (without extension ".st") that uses the syntax: $var$ (StringTemplate lib for Java)
|
def process_template(template_name,map)
template = File.dirname(__FILE__) + "/../templates/#{template_name}.st"
map['timestamp']=Time.now.httpdate
File.open(template,'r') do | f |
# detect words inside dollar sign pairs
replaced = f.read.gsub(/(\$\w*\$)/) do | match |
key = match[1..match.size-2]
(map.has_key? key) ? map[key] : 'MISSING:'+key
end
return replaced
end # file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def template_replace template, myhash\n #tmpltext=File::read(template);\n\n t = template.dup\n t.gsub!( /##(.*?)##/ ) {\n #raise \"Key '#{$1}' found in template but the value has not been set\" unless ( myhash.has_key?( $1 ) )\n myhash[ $1 ].to_s\n }\n t\n end",
"def template(file, template)\n config = Environment.load(source: file)\n template = File.read(template)\n result = template.gsub(/{{([^}:]+)(:([^}]+))?}}/) do |_|\n key = $1\n default_value = ENV[key] || $3\n if default_value\n config.fetch(key, default_value)\n else\n config.fetch(key)\n end\n end\n puts result\n end",
"def load_template(filename)\n\t\t\t@filename = filename\n\t\t\t@contents = []\n\t\t\t#@valid_keys = []\n\t\t\t#@dirty_mappings = {}\n\t\t\t#@replacements = {}\n\t\t\ti=0\n\t\t\n\t\t\t#If the file name is invalid, exit prematurely\n\t\t\tif filename == nil || filename == \"\" then\n\t\t\t\tputs \"Invalid filename provided.\"\n\t\t\t\treturn 0\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\t\tif File.exists? filename then\n\t\t\t\t\tputs \"Loading Template: \" + filename\n\t\t\t\t\tfile = File.open(filename, \"r\").each_line do |line|\n\t\t\t\t\t\t@contents.push line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@section_tree = SectionTree.new @contents\n\t\t\t\n\t\t\t\t#size = line_count\n\t\t\t\n\t\t\t\t#Iterates over each line, remembering the line number\n\t\t\t\t#for i in 0..size-1\n\t\t\t\t\t#Extracts the keys from each line\n\t\t\t\t\t#matchdata = get_line_matchdata i\n\t\t\t\t\t#if !matchdata.nil? then\n\t\t\t\t\t\t#Accounts for all keys found in the template file\n\t\t\t\t\t\n\t\t\t\t\t\t#keys = matchdata.captures\n\t\t\t\t\t\t#if !keys.nil? && keys.size > 0 then\n\t\t\t\t\t\t\t#keys.each do |key|\n\t\t\t\t\t\t\t\t#@valid_keys.push(key.strip)\n\t\t\t\t\t\t\t\t#@dirty_mappings[matchdata.to_s] = key.strip\n\t\t\t\t\t\t\t\t#@replacements[key.strip] = matchdata.to_s\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\t#end\n\t\t\t\t\t#end\n\t\t\t\t#end\n\t\t\tensure\n\t\t\t\tputs \"Closing Template File: \" + filename\n\t\t\t\tfile.close unless file.nil?\n\t\t\tend\n\t\t\n\t\t\tputs ''\n\t\tend",
"def process_template(template_path)\n if @processed_templates[template_path]\n return @processed_templates[template_path]\n end\n\n unprocessed_template = read_template(template_path)\n @processed_templates[template_path] = unprocessed_template.gsub(/{{[^{}()\\[\\]]+}}/) do |to_replace|\n replacement_path = to_replace.gsub(/[{}]/, '')\n process_template(replacement_path)\n end.strip\n end",
"def load_template(template)\n IO.read(template).chomp\n end",
"def template(value)\n keys = map.split('/')\n raise \"Cannot deal with an empty map!\" if keys.empty?\n res = value\n while !keys.empty? do\n res = {keys.pop => res}\n end\n res\n end",
"def get_template(file) #this is our template, defined as a single string\n s = \"\"\n File.open(file) do |f|\n f.each_line do |line|\n s.concat(line)\n end\n end\n s\nend",
"def get_template(filename)\n File.read(filename)\nend",
"def read_file(template)\r\n File.read(template)\r\nend",
"def read_file(template)\n File.read(template)\nend",
"def read_template(template)\n File.read(template_path(template))\n end",
"def evaluate(tmap)\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n \n @tmap = tmap\n tsub = ERB.new(@template).result(binding) \n tsub\n end",
"def templates_for(file); end",
"def load_template(name)\n filename = locate_template(name)\n File.read(filename)\n end",
"def read_template(template)\n File.open(File.join(templates_path, template), 'r').read\n end",
"def template_for(file); end",
"def modify_template\n template = File.read(@template_filename)\n template.gsub!(/\\[\\[s[un]\\d+:p\\d:type\\]\\]/, 'topic')\n StringIO.new(string=template, 'r')\n end",
"def template(template_name = 'template.txt')\n File.read([File.dirname(__FILE__), template_name].join('/'))\n end",
"def parse_template(path)\n render(File.read(path))\n end",
"def load_source(template)\n filename = File.join(path, template)\n\n return unless File.file?(filename)\n\n File.read filename\n end",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def interpolate(path, template_name = nil)\n path.gsub!('%e', Tiller::config[:environment])\n path.gsub!('%t', template_name) if template_name\n path\n end",
"def load_templates\n templates = {}\n file = __FILE__\n\n begin\n io = ::IO.respond_to?(:binread) ? ::IO.binread(file) : ::IO.read(file)\n app, data = io.gsub(\"\\r\\n\", \"\\n\").split(/^__END__$/, 2)\n rescue Errno::ENOENT\n app, data = nil\n end\n\n if data\n lines = app.count(\"\\n\") + 1\n template = nil\n data.each_line do |line|\n lines += 1\n if line =~ /^@@\\s*(.*\\S)\\s*$/\n template = ''\n templates[$1.to_sym] = template\n elsif template\n template << line\n end\n end\n end\n\n templates\nend",
"def render_external_template(template_file, locals={})\n template = URI.parse(template_url(template_file)).read\n apply_hash_to_template(template, locals)\n end",
"def process_string(tmpl, fname='(bibout)', hash=nil)\n bind = ErbBinding.new(@bib, @root_dir, hash).get_binding()\n erb = ERB.new(tmpl)\n erb.filename = fname\n erb.result(bind)\n end",
"def from_template(template_file, **template_values)\n namespace = OpenStruct.new(template_values)\n template = ERB.new(File.read(template_file))\n new_contents = template.result(namespace.instance_eval { binding })\n\n @unwritten_contents = new_contents\n end",
"def install_template(file_parts, dest, subs = {})\n content = String.new\n file_parts.each do |file_part|\n full_path = File.join(File.dirname(__FILE__), file_part)\n begin\n content += File.open(full_path).read\n rescue\n end\n end\n subs.keys.each do |k|\n content.gsub!(/#{k}/, subs[k])\n end\n File.open(dest, 'w') {|file| file.write(content)}\n end",
"def read_template(file)\n File.read(get_template_file(file))\n end",
"def template(from, to)\n erb = File.read(from)\n put ERB.new(erb).result(binding), to\nend",
"def template_content(template_file)\n File.read(File.expand_path(find_in_source_paths(template_file)))\n end",
"def template(data = {})\n str = dup\n\n data.each do |key, value|\n str.gsub!(\":#{key}\", value.to_s)\n end\n\n str\n end",
"def add_template(filepath)\n # templates must be strings for ERB\n @template = File.read(filepath)\n end",
"def load_template_io(path)\n File.open(path, \"r\")\n end",
"def process_template(tmpl, vars)\n require \"erb\"\n\n ERB\n .new(tmpl, trim_mode: \"%\")\n .public_send(vars.is_a?(Binding) ? :result : :result_with_hash, vars)\n end",
"def template!(path, full_paths = T.unsafe(nil)); end",
"def template(*path); end",
"def file_from(path_name, binding_var, filename=nil, from_repo = false, github_user = nil, custom_url = nil)\n filename=File.basename(path_name) if filename==nil\n filePath = File.join(TEMPLATE_PATH,filename)\n puts filePath.inspect\n puts File.exist? filePath\n #str=IO.read(filePath).gsub('\"','\\\\\"')\n str = eval('\"'+IO.read(filePath).gsub('\"','\\\\\"')+'\"',binding_var)\n file path_name, str\nend",
"def load_template(template_path)\n if ! File.exist?(template_path)\n return nil\n end\n\n return File.read(template_path)\nend",
"def get_template(template); end",
"def provider_template(template, options)\n require 'erb'\n require 'ostruct'\n ERB.new(File.read(template)).result(\n OpenStruct.new(options).instance_eval {binding}\n )\n end",
"def template_content(template_name)\n File.read(File.join(@options[:templates], template_name))\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def get_template_from_file(file_path)\n template_text = nil\n\n File.open(file_path, 'r') do |f_in|\n template_text = f_in.read\n end\n\n return template_text\n end",
"def template(filename)\n File.binread(File.join(__dir__, 'templates', filename))\n end",
"def read_template(name)\n File.open(\"#{resource_template_dir}/#{name}.yaml\").read\n end",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def read(path)\n @template.class.new(path, localized_look_in).read.strip\n end",
"def read_template_file(filename, _context)\n return File.read(filename) if !@preprocess\n _context ||= {}\n _context = hook_context(_context) if _context.is_a?(Hash) || _context._engine.nil?\n _buf = _context._buf\n _context._buf = \"\"\n begin\n return Preprocessor.new(filename).render(_context)\n ensure\n _context._buf = _buf\n end\n end",
"def read_template_file(template_path)\n File.read(@path + '/' + template_path + '.liquid')\n end",
"def template_to_s(template_name, locals = {})\n config_file = \"#{fetch(:templates_path)}/#{template_name}\"\n # if no customized file, proceed with default\n unless File.exists?(config_file)\n config_file = File.join(File.dirname(__FILE__), \"../../generators/capistrano/delayed_job/templates/#{template_name}\")\n end\n\n ERB.new(File.read(config_file), nil, '-').result(ERBNamespace.new(locals).get_binding)\n end",
"def erubis_template template_filename, *args\n require 'erubis'\n template = Erubis::Eruby.new File.read(template_filename)\n text = template.result *args\n text\nend",
"def to_loc(src)\n src = Util.hh(src)\n\n src.merge(TEMPLATES.inject({}) do |r, a| \n r[a[0]] = Util.template(a[1], src); r\n end)\n end",
"def expand_template_name(template, state)\n eval '\"' + template + '\"'\n end",
"def load_template( templatepath )\n\t\treturn ERB.new( templatepath.read, nil, '%<>' ).freeze\n\tend",
"def substitute_template results\n content = File.read(File.join('test/report_template.html'))\n\n # Round time to seconds + 2 decimal places\n results[:time] = results[:time].round(2)\n\n results.each_key do |k|\n content.sub!(\"{{#{k.to_s}}}\", results[k].to_s)\n end\n content\n end",
"def template_map\n return TEMPLATE_MAP\n end",
"def setup_template_details\n template_extension = @template_path.scan(/\\.(\\w+)\\.?(.*)?/)[0][0]\n get_extension_and_name_from_file(@template_path).merge(\n template_extension: template_extension\n )\n end",
"def render_template_with_locals(abs_name, locals = {})\r\n template = File.read(File.join( abs_name) )\r\n ERB.new(template, nil, \"-\").result(OpenStruct.new(locals).send(:binding))\r\nend",
"def render_to_string(template, locals = {})\n read_template(lookup_template(template), locals)\n end",
"def get_template(params)\n if params[:file_path]\n return get_template_from_file(params[:file_path])\n elsif params[:template]\n return params[:template]\n else\n raise 'A valid template file path or template text is required.'\n end\n end",
"def eval_file\n @file || '(__TEMPLATE__)'\n end",
"def tpl(str)\n eval(\"\\\"#{str}\\\"\")\n end",
"def deal_template_2(_template='')\n\t\ttemplate = _template\n\t\twhile template[/\\{\\?.*?\\?([\\n\\r]*.*?)\\}/] != nil\n\t\t\ttemplate[/\\{\\?.*?\\?([\\n\\r]*.*?)\\}/]= $1\n\t\tend\n\t\ttemplate\n\tend",
"def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend",
"def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend",
"def load_template(name)\r\n f = lam_path(name)\r\n if File.exist?(f)\r\n File.open(f).read\r\n else\r\n raise \"Missing template file #{f}\"\r\n end\r\n end",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def template_for(filename, opts = {})\n # A bunch of potential matches in order of preference.\n candidates = if Gluttonberg.localized?\n # Locale and dialect\n # Locale only\n # Default\n [\n \"#{filename}.#{opts[:locale].slug}.#{opts[:dialect].code}\",\n \"#{filename}.#{opts[:locale].slug}\",\n \"#{filename}\"\n ]\n elsif Gluttonberg.translated?\n # Dialect\n # Default\n [\n \"#{filename}.#{opts[:dialect].code}\",\n \"#{filename}\"\n ]\n else\n [\"#{filename}.*\"]\n end\n # Loop through them and return the first match\n for candidate in candidates \n path = template_dir / candidate + \".*\"\n matches = Dir.glob(path)\n return candidate unless matches.empty?\n end\n # This nil has to be here, otherwise the last evaluated object is \n # returned, in this case the candidates hash.\n nil\n end",
"def template\n @template ||= File.read(template_full_path)\n end",
"def render_template(file, variables)\n template = load_template(file) or raise \"template not found: #{path}\"\n template.render(variables)\n end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def load_template!\n feed = self\n eval(File.read(@file))\n end",
"def template(template_name)\n @attributes.store(template_name)\n end",
"def read_template( name )\n\t\tname = \"%s.erb\" % [ name ] unless name.to_s.end_with?( '.erb' )\n\t\ttemplate_path = DEVEIATE_DATADIR + name\n\t\ttemplate_src = template_path.read( encoding: 'utf-8' )\n\n\t\treturn ERB.new( template_src, trim_mode: '-' )\n\tend",
"def render_template(file, locals = {})\n ERB.new(File.read(file)).result OpenStruct.new(locals).instance_eval{ binding }\n end",
"def load_template( key )\n\t\ttname = @signature.templates[key] or\n\t\t\traise Arrow::AppletError, \n\t\t\t\t\"No such template %p defined in the signature for %s (%s)\" %\n\t\t\t\t[ key, self.signature.name, self.class.filename ]\n\n\t\ttname.untaint\n\n\t\treturn @template_factory.get_template( tname )\n\tend",
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end",
"def dereference_template(t_key, template, parameters, flagged = [])\n template = template.to_smash\n translator = translator_for(t_key, template, parameters)\n flagged.each do |item|\n translator.flag_ref(item)\n end\n template.keys.each do |t_key|\n next if [\"Outputs\", \"Resources\"].include?(t_key)\n template[t_key] = translator.dereference_processor(\n template[t_key], [\"DEREF\"]\n )\n end\n translator.original.replace(template)\n [\"Outputs\", \"Resources\"].each do |t_key|\n if template[t_key]\n template[t_key] = translator.dereference_processor(\n template[t_key], [\"DEREF\", :all]\n )\n end\n end\n if template[\"Resources\"]\n valid_resources = template[\"Resources\"].map do |resource_name, resource_value|\n if resource_value[\"OnCondition\"]\n if translator.apply_condition(resource_value[\"OnCondition\"])\n resource_name\n end\n else\n resource_name\n end\n end.compact\n (template[\"Resources\"].keys - valid_resources).each do |resource_to_remove|\n template[\"Resources\"].delete(resource_to_remove)\n end\n end\n translator.original.replace({})\n template\n end",
"def process_template(template)\n @dlogger.debug \"Processing template #{template} for file #{@file}\"\n # The '-' arg allows folks to use <% -%> or <%- -%> to instruct ERB to\n # not insert a newline for that line, which helps avoid a bunch of blank\n # lines in the processed file where there was code in the template.\n erb = ERB.new(IO.read(template), nil, '-')\n # The binding arg ties the template's namespace to this point in the\n # code, thus ensuring that all of the variables above (@file, etc.)\n # are visible to the template code.\n begin\n erb.result(binding)\n rescue Exception => e\n # Help the user figure out where the exception occurred, otherwise they\n # just get told it happened here, which isn't very helpful.\n raise Etch.wrap_exception(e, \"Exception while processing template #{template} for file #{@file}:\\n\" + e.message)\n ensure\n restore_globals\n end\n end",
"def load_and_render_template( template_path, target_filename )\n\t\ttemplate = self.read_template( template_path )\n\t\theader_char = self.header_char_for( target_filename )\n\n\t\treturn template.result_with_hash(\n\t\t\theader_char: header_char,\n\t\t\tproject: self\n\t\t)\n\tend",
"def load_template(template)\n begin\n template = File.join(File.dirname(__FILE__), \"/recipes/#{template}\")\n code = open(template).read\n in_root { self.instance_eval(code) }\n rescue LoadError, Errno::ENOENT => e\n raise \"The template [#{template}] could not be loaded. Error: #{e}\"\n end\nend",
"def get_template(data)\n return data if data.is_a?(String)\n\n data.fetch('conf', nil)\nend",
"def customizeTemplate( \n _displayFormat = \"points\" # specify the type {values, points}\n )\n\n template = File.read(@filename)\n\n\n template.sub!('*****DETAIL*****', @dailyActivity.to_s)\n template.sub!('*****BADGES*****', [].to_s) # empty for now.\n template.sub!('*****FORMAT*****', \"\\\"#{_displayFormat}\\\"\")\n\n template.sub!('*****TOTAL*****', @dailyTotals.to_s)\n template.sub!('*****TARGET*****', @goalTarget.to_s)\n template.sub!('*****START*****', \"\\\"#{@startDate}\\\"\")\n template.sub!('*****END*****', \"\\\"#{@endDate}\\\"\")\n template.sub!('*****NAME*****', \"\\\"#{@name}\\\"\")\n\n return template\n end",
"def export_to_template template, file\n renderer = ERB.new(File.read(template))\n output = renderer.result binding\n output_file = File.open file, 'w'\n output_file << output\n output_file.close\n end",
"def interpolate(string, vars)\n string.gsub(/{{ (\\w+) }}/) { vars[$1] }\nend",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def convert_template!\n tag! \"template\" do\n convert_s! \"name?\"\n if @version >= 119\n convert_id!\n end\n\n convert_array! \"subtemplates\" do\n convert_subtemplate!\n end\n\n convert_array! \"children\" do\n convert_uientry_gen2!\n end\n\n out_ofs! \"end of template?\"\n end\n end",
"def rewrite_template\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 40)\n return_value = RewriteTemplateReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n str = nil\n char_literal177 = nil\n __ACTION180__ = nil\n id175 = nil\n rewrite_template_args176 = nil\n rewrite_template_ref178 = nil\n rewrite_indirect_template_head179 = nil\n\n tree_for_lp = nil\n tree_for_str = nil\n tree_for_char_literal177 = nil\n tree_for_ACTION180 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_DOUBLE_QUOTE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOUBLE_QUOTE_STRING_LITERAL\")\n stream_DOUBLE_ANGLE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOUBLE_ANGLE_STRING_LITERAL\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_rewrite_template_args = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_template_args\")\n begin\n # at line 423:2: ( id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str) | rewrite_template_ref | rewrite_indirect_template_head | ACTION )\n alt_81 = 4\n alt_81 = @dfa81.predict(@input)\n case alt_81\n when 1\n # at line 424:3: id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n @state.following.push(TOKENS_FOLLOWING_id_IN_rewrite_template_2910)\n id175 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id175.tree)\n end\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_template_2914) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n @state.following.push(TOKENS_FOLLOWING_rewrite_template_args_IN_rewrite_template_2916)\n rewrite_template_args176 = rewrite_template_args\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_template_args.add(rewrite_template_args176.tree)\n end\n char_literal177 = match(T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_template_2918) \n if @state.backtracking == 0\n stream_T__83.add(char_literal177)\n end\n # at line 425:3: (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n alt_80 = 2\n look_80_0 = @input.peek(1)\n\n if (look_80_0 == DOUBLE_QUOTE_STRING_LITERAL) \n alt_80 = 1\n elsif (look_80_0 == DOUBLE_ANGLE_STRING_LITERAL) \n alt_80 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 80, 0)\n raise nvae\n end\n case alt_80\n when 1\n # at line 425:5: str= DOUBLE_QUOTE_STRING_LITERAL\n str = match(DOUBLE_QUOTE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_QUOTE_STRING_LITERAL_IN_rewrite_template_2926) \n if @state.backtracking == 0\n stream_DOUBLE_QUOTE_STRING_LITERAL.add(str)\n end\n\n when 2\n # at line 425:39: str= DOUBLE_ANGLE_STRING_LITERAL\n str = match(DOUBLE_ANGLE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_ANGLE_STRING_LITERAL_IN_rewrite_template_2932) \n if @state.backtracking == 0\n stream_DOUBLE_ANGLE_STRING_LITERAL.add(str)\n end\n\n end\n # AST Rewrite\n # elements: str, rewrite_template_args, id\n # token labels: str\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_str = token_stream(\"token str\", str)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 426:3: -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n # at line 426:6: ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(TEMPLATE, lp, \"TEMPLATE\"), root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_rewrite_template_args.next_tree)\n @adaptor.add_child(root_1, stream_str.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 429:3: rewrite_template_ref\n @state.following.push(TOKENS_FOLLOWING_rewrite_template_ref_IN_rewrite_template_2959)\n rewrite_template_ref178 = rewrite_template_ref\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_template_ref178.tree)\n end\n\n when 3\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 432:3: rewrite_indirect_template_head\n @state.following.push(TOKENS_FOLLOWING_rewrite_indirect_template_head_IN_rewrite_template_2968)\n rewrite_indirect_template_head179 = rewrite_indirect_template_head\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_indirect_template_head179.tree)\n end\n\n when 4\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 435:3: ACTION\n __ACTION180__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_template_2977)\n if @state.backtracking == 0\n\n tree_for_ACTION180 = @adaptor.create_with_payload!(__ACTION180__)\n @adaptor.add_child(root_0, tree_for_ACTION180)\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 40)\n\n end\n \n return return_value\n end",
"def template(pathname, b = binding)\n pathname = Pathname.new(pathname) unless pathname.kind_of?(Pathname)\n\n template_contents = if pathname.exist?\n template_contents = pathname.read\n else\n raise LoadError, \"Can't find template #{pathname}\"\n end\n ERB.new(template_contents).result(b)\n end",
"def template_for file, page = true, klass = ERB\n template = @template_cache[file]\n\n return template if template\n\n if page then\n template = assemble_template file\n erbout = 'io'\n else\n template = file.read\n template = template.encode @options.encoding\n\n file_var = File.basename(file).sub(/\\..*/, '')\n\n erbout = \"_erbout_#{file_var}\"\n end\n\n if RUBY_VERSION >= '2.6'\n template = klass.new template, trim_mode: '-', eoutvar: erbout\n else\n template = klass.new template, nil, '-', erbout\n end\n @template_cache[file] = template\n template\n end",
"def generate_report(filename, template)\n file = File.read(filename)\n data_hash = JSON.parse(file)\n rpt_data = transform(data_hash)\n\n # Re http://stackoverflow.com/questions/1887845/add-method-to-an-instanced-object\n d = TemplateSource.new(rpt_data)\n\n template = File.read(template) if File.exist?(template)\n renderer = ERB.new(template, nil, '<>')\n renderer.result(d.get_binding)\nend",
"def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"def read_template_file\n raise 'This is a generic store. Please use a subclass.'\n end",
"def rewrite_template\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n return_value = RewriteTemplateReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n str = nil\n char_literal177 = nil\n __ACTION180__ = nil\n id175 = nil\n rewrite_template_args176 = nil\n rewrite_template_ref178 = nil\n rewrite_indirect_template_head179 = nil\n\n tree_for_lp = nil\n tree_for_str = nil\n tree_for_char_literal177 = nil\n tree_for_ACTION180 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_DOUBLE_QUOTE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DOUBLE_QUOTE_STRING_LITERAL\" )\n stream_DOUBLE_ANGLE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DOUBLE_ANGLE_STRING_LITERAL\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n stream_rewrite_template_args = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_template_args\" )\n begin\n # at line 414:2: ( id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str) | rewrite_template_ref | rewrite_indirect_template_head | ACTION )\n alt_81 = 4\n alt_81 = @dfa81.predict( @input )\n case alt_81\n when 1\n # at line 415:3: id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n @state.following.push( TOKENS_FOLLOWING_id_IN_rewrite_template_2905 )\n id175 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id175.tree )\n end\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_template_2909 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n @state.following.push( TOKENS_FOLLOWING_rewrite_template_args_IN_rewrite_template_2911 )\n rewrite_template_args176 = rewrite_template_args\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_template_args.add( rewrite_template_args176.tree )\n end\n char_literal177 = match( T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_template_2913 )\n if @state.backtracking == 0\n stream_T__83.add( char_literal177 )\n end\n # at line 416:3: (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n alt_80 = 2\n look_80_0 = @input.peek( 1 )\n\n if ( look_80_0 == DOUBLE_QUOTE_STRING_LITERAL )\n alt_80 = 1\n elsif ( look_80_0 == DOUBLE_ANGLE_STRING_LITERAL )\n alt_80 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 80, 0 )\n end\n case alt_80\n when 1\n # at line 416:5: str= DOUBLE_QUOTE_STRING_LITERAL\n str = match( DOUBLE_QUOTE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_QUOTE_STRING_LITERAL_IN_rewrite_template_2921 )\n if @state.backtracking == 0\n stream_DOUBLE_QUOTE_STRING_LITERAL.add( str )\n end\n\n when 2\n # at line 416:39: str= DOUBLE_ANGLE_STRING_LITERAL\n str = match( DOUBLE_ANGLE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_ANGLE_STRING_LITERAL_IN_rewrite_template_2927 )\n if @state.backtracking == 0\n stream_DOUBLE_ANGLE_STRING_LITERAL.add( str )\n end\n\n end\n # AST Rewrite\n # elements: id, rewrite_template_args, str\n # token labels: str\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_str = token_stream( \"token str\", str )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 417:3: -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n # at line 417:6: ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( TEMPLATE, lp, \"TEMPLATE\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_rewrite_template_args.next_tree )\n @adaptor.add_child( root_1, stream_str.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 420:3: rewrite_template_ref\n @state.following.push( TOKENS_FOLLOWING_rewrite_template_ref_IN_rewrite_template_2954 )\n rewrite_template_ref178 = rewrite_template_ref\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_template_ref178.tree )\n end\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 423:3: rewrite_indirect_template_head\n @state.following.push( TOKENS_FOLLOWING_rewrite_indirect_template_head_IN_rewrite_template_2963 )\n rewrite_indirect_template_head179 = rewrite_indirect_template_head\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_indirect_template_head179.tree )\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 426:3: ACTION\n __ACTION180__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_template_2972 )\n if @state.backtracking == 0\n\n tree_for_ACTION180 = @adaptor.create_with_payload( __ACTION180__ )\n @adaptor.add_child( root_0, tree_for_ACTION180 )\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 40 )\n\n end\n \n return return_value\n end",
"def template_source\n @template_source ||= @options[:template_content] || read_file(template_file)\n end",
"def fill_template\n @log.debug(\"Reading erb template from file: '#{@template}'.\")\n erb = ERB.new(File.read(@template), nil, '-')\n erb.filename = @template\n erb.result(binding)\n end",
"def generate template, file\n if file.kind_of? String then # one file\n write_template(file, ERB.new(load_template(template)).result(binding))\n else # multiple files\n file.each do |f|\n write_template(f, ERB.new(load_template(template)).result(binding))\n end\n end\n end"
] |
[
"0.7095161",
"0.6911082",
"0.6651287",
"0.64512587",
"0.6411285",
"0.640328",
"0.6368353",
"0.6345529",
"0.6284182",
"0.62681",
"0.61360824",
"0.61357534",
"0.6080982",
"0.6074778",
"0.60469043",
"0.6046569",
"0.60050505",
"0.599368",
"0.5984869",
"0.5967799",
"0.59600604",
"0.59600604",
"0.5942959",
"0.5933765",
"0.59035933",
"0.5898586",
"0.58896214",
"0.5889289",
"0.58743274",
"0.58741283",
"0.5866075",
"0.58636266",
"0.582791",
"0.578243",
"0.5782092",
"0.57775825",
"0.5765212",
"0.576367",
"0.5760267",
"0.57545006",
"0.57542473",
"0.5744388",
"0.5741336",
"0.5736564",
"0.5719906",
"0.5714645",
"0.5688202",
"0.5688202",
"0.5677967",
"0.5660097",
"0.56521225",
"0.5651735",
"0.5643606",
"0.5642562",
"0.5639483",
"0.5630775",
"0.56078124",
"0.5591087",
"0.557815",
"0.5553006",
"0.55472094",
"0.55344784",
"0.55102664",
"0.54891133",
"0.5481791",
"0.54688495",
"0.54688495",
"0.5468241",
"0.54615384",
"0.54615384",
"0.5461511",
"0.54582626",
"0.5456912",
"0.5453383",
"0.54520553",
"0.5451054",
"0.5446612",
"0.5432654",
"0.54250616",
"0.54238135",
"0.5423178",
"0.5420589",
"0.54202056",
"0.54111004",
"0.54110384",
"0.539599",
"0.53932726",
"0.53910667",
"0.5390957",
"0.5390291",
"0.5387175",
"0.5385069",
"0.5376909",
"0.5366687",
"0.53525",
"0.5351887",
"0.5345236",
"0.5344004",
"0.5340894",
"0.5337168"
] |
0.7969874
|
0
|
def Lookup the Ruby class refered to by a model name
|
def to_class(model_name)
Kernel.const_get(model_name.to_s.camelize)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def class_from_name\n if model_name.to_s.include? \"_\"\n ns, *klass = model_name.to_s.split(\"_\").collect(&:camelize)\n begin\n \"#{ns}::#{klass.join(\"\")}\".constantize\n rescue NameError\n \"#{ns}#{klass.join(\"\")}\".constantize\n end\n else\n model_name.to_s.camelize.constantize\n end\n end",
"def model(name)\n name.gsub(/\\W+/, '_').classify.constantize\n end",
"def model_class\n @class_name.constantize\n end",
"def model_class\n @model_class ||= model_name.camelize.constantize\n end",
"def find_model(name)\n @models[name.to_s.downcase.to_sym]\n end",
"def model_class\n class_name.constantize\n end",
"def dynamic_model_class_name\n dynamic_model.implementation_class.name\n end",
"def model_class_for_sym(model_sym)\n begin\n model_sym.to_s.classify.constantize\n rescue NameError\n raise NameError, \"Cannot convert :#{model_sym} to a valid model class\"\n end\n end",
"def model_class\n @model_class ||= derived_model_class_name.constantize\n end",
"def model_class_name\n implementation_model_name.ns_camelize\n end",
"def fetch_model\n model_name.camelize.constantize.find( params[:id] )\n end",
"def lookup(name)\n if @map[name]\n @map[name]\n else\n # Descendant classes should be loaded for this to work\n @klass.descendants.each do |klass|\n proto_model = klass.factory.lookup(name)\n return proto_model if proto_model\n end\n \n nil\n end\n end",
"def model_class\n self.class_name.constantize\n end",
"def model_class\n self.class.const_get('MODEL')\n end",
"def model_class\n self.class.models[implementation_model_name]\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def model_class\n @model_class ||= controller_path.classify.constantize\n end",
"def model\n @type.constantize\n end",
"def model\n @type.constantize\n end",
"def model\n self.klass.constantize.name.demodulize.tableize.singularize.downcase\n end",
"def class_at_path(path)\n if path\n begin\n # remove the _ and then singularize\n if path.last == :[]\n index = -2\n else\n index = -1\n end\n\n klass_name = path[index].singularize.camelize\n\n klass = $page.model_classes[klass_name] || Model\n rescue NameError => e\n # Ignore exception, just means the model isn't defined\n klass = Model\n end\n else\n klass = Model\n end\n\n return klass\n end",
"def model_class_name(name=nil)\n @model_class_name = name if name\n @model_class_name ||= guess_model_class_name\n end",
"def model_class(model_or_controller_name)\n # site settings isn't a model so it isn't defined\n @model_class = model_or_controller_name.singular.camelcase.constantize rescue nil\n end",
"def model_class(model_or_controller_name)\n # site settings isn't a model so it isn't defined\n @model_class = model_or_controller_name.singular.camelcase.constantize rescue nil\n end",
"def model_class\n table_name.classify.constantize\n end",
"def model_name(model)\n model.class.to_s.downcase\n end",
"def current_model\n Object.const_get(params[:model].classify)\n end",
"def determine_model_name(path)\n path =~ /(.*)\\/(.*).rb/\n begin\n $2.camelize.constantize \n $2\n rescue Exception # it happends\n nil\n end\nend",
"def model_name\n self.class\n end",
"def model(table)\n table.classify.constantize\n end",
"def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end",
"def model_class\n @model_class ||= mapping.to\n end",
"def class_with_model_name # :nodoc:\n self.class_without_model_name.tap do |c|\n c.instance_variable_set('@_model_name', @model_name)\n (class << c; self; end).send(:define_method,:model_name) do\n model_namer = Struct.new(:name).new(self.instance_variable_get('@_model_name'))\n ActiveModel::Name.new(model_namer)\n end\n end\n end",
"def model_name\n self.class.name.underscore.split('_').first.singularize\n end",
"def model_name\n self.class\n end",
"def get_model_class(file); end",
"def to_model_class\n to_model_name.classify.constantize\n end",
"def friendly_model_reader(name_or_klass)\n name_or_klass = friendly_model_name(name_or_klass) if name_or_klass.is_a?(Class)\n :\"load_#{name_or_klass}\"\n end",
"def invoke_model(type)\n model_path = File.join(File.dirname(__FILE__),\"models/#{type}.rb\")\n require model_path\n type.to_s.split(\"_\").collect(&:capitalize).join.constantize\n end",
"def get_content_model(model_name)\n model_hash = content_types.select{|x| x[:name] == model_name}.first\n return model_hash[:class_name].nil? ? model_name.constantize : model_hash[:class_name].constantize\n end",
"def klass\n object_name.classify.constantize\n end",
"def model\n self.class.const_get(:MODEL)\n end",
"def model\n if object[inheritance_column]\n object[inheritance_column].constantize\n else\n original_class\n end\n end",
"def find_model(name)\n ole = ole_obj.Models(name)\n model_from_ole(ole)\n rescue\n puts \"model #{name} not found\"\n nil\n end",
"def class_for assoc_name\n @model_class.reflect_on_association(assoc_name.to_sym).klass\n end",
"def sanitize_model_class( model )\n model.name.split(\"::\").last\n end",
"def model_class\n self.name.gsub(/Test$/, '').constantize\n end",
"def model_class\n resource_class = @options[:resource]\n if resource_class.nil?\n @name.to_s.camelize.constantize\n elsif resource_class.kind_of? String\n resource_class.constantize\n else\n resource_class # could be a symbol\n end\n end",
"def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end",
"def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end",
"def model\n controller_name.classify.constantize\n end",
"def polymorphic_class_for(name)\n if store_full_class_name\n name.constantize\n else\n compute_type(name)\n end\n end",
"def model_name(object)\n object.present? ? object.class.name : object.to_s.classify\n end",
"def class\n @model.class\n end",
"def get_class type\n case type\n when Class\n type\n when BaseModel\n type.my_class\n when String, Symbol\n return get_class send(\"#{type}_model\") if [:subject, :object, :join].include?(type.to_sym)\n type.to_s.constantize\n else\n raise \"Can't determine a class from: #{type}\"\n end \n end",
"def model_class\n return @model_class || self.class.model_class\n end",
"def model_name\n self.class.model_name\n end",
"def get_model\n self.class.name.gsub(/Test/, \"\").constantize\n end",
"def object_class(klass)\n @object_classes[klass.to_s.tr('-', '_').downcase]\n end",
"def model; eval model_name; end",
"def model; eval model_name; end",
"def get_model(model_type, name)\n klass = class_for_type(model_type)\n result = model_store.get(klass, name) || Backyard.global_store.model_store.get(klass, name)\n if result.nil? && Backyard.name_based_database_lookup\n result = find_model_from_database(klass, name)\n put_model(result, name) if result\n result\n else\n reload_model(result)\n end\n end",
"def get_model_name\n @model_name ||= self.class_simple_name.underscore[0..-12].singularize\n end",
"def find( model, name )\n model( model )[name ] rescue nil\n end",
"def base\n @parent ? @parent.model_instance.send(@name.to_s.pluralize) : model_class\n end",
"def const_get(model_key)\n klass = connection.define_openerp_model(model: model_key, scope_prefix: self.scope_prefix)\n klass_name = connection.class_name_from_model_key(model_key)\n klass = (self.scope_prefix ? Object.const_get(self.scope_prefix) : Object).const_defined?(klass_name) ? (self.scope_prefix ? Object.const_get(self.scope_prefix) : Object).const_get(klass_name) : connection.define_openerp_model(model: model_key, scope_prefix: self.scope_prefix)\n klass\n end",
"def model name, **params\n # <<- CLOSURE_SCOPE\n current = @current # closure scope\n params = @environs.merge params if @environs\n filled_or_maybe = optionality(params)\n params[:class] ||= name.to_s.gsub(/(?:\\A|_)./) { |m| m[-1].upcase }\n # CLOSURE_SCOPE\n\n schema do\n __send__(current, name).__send__(filled_or_maybe, model?: params[:class])\n end\n\n define_helper_methods name\n end",
"def model_klass\n controller_name.classify.constantize\n end",
"def model_name_to_constant(name)\n name = name.gsub(/_/,' ') if name =~ /_/ # convert <underscore> to <space>\n name.singularize.split(/ |_/).collect(&:capitalize).join.constantize\n end",
"def class_name\n table.model.name\n end",
"def findClassModelByPluginName(plugName)\n for cls in @classes\n if cls.plugName == plugName\n return cls\n end\n end\n\n return nil\n end",
"def model_from_options #nodoc\n @options[:class_name].nil? ? nil : @options[:class_name].constantize\n end",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def model_from_worker id\n find_worker(id)[:model].to_s.safe_constantize if worker_exists?(id)\n end",
"def lookup_class\r\n ObjectSpace.each_object(Class) do |obj|\r\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\r\n obj.name.split('::').last == class_name\r\n end\r\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\r\n end",
"def model_class=(_arg0); end",
"def concrete_model\n self.class\n end",
"def constantize_model(model_name)\n eval(model_name.to_s.camelize)\n end",
"def obj\n return if obj_type.blank?\n return obj_type.constantize.find(obj_id) if obj_id.present?\n obj_type[/[A-Z]/] ? obj_type.constantize : obj_type.to_sym\n end",
"def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end",
"def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end",
"def model(name=nil)\n @model ||= VCAP::CloudController.const_get(model_class_name(name))\n end",
"def model_path\n @model_class.to_s.underscore.split('/').last.pluralize\n end",
"def find_class_named name\n @classes_hash[name]\n end",
"def model_name\n if defined?(ActiveSupport::ModelName)\n ActiveSupport::ModelName.new(name)\n else\n ActiveModel::Name.new(self)\n end\n end",
"def find_mti_class(record)\n record['tableoid'].classify.constantize\n rescue NameError => e\n descendants.find(Proc.new{ self }) { |d| d.table_name == record['tableoid'] }\n end",
"def klass\n @object.name if (defined? @object.class.name)\n end",
"def resource_model\n \"::#{resource_name}\".constantize\n end",
"def resource_klass(name)\n eval('RedboothRuby::' + camelize(name)) rescue nil\n end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def get_mobj(mname=nil) @model_class.instance; end",
"def lookup_model_names; end",
"def model( resource = nil )\n resource ||= self.class.basename.snake_case\n app::Models[ resource ]\n end",
"def method_missing msg, *args, &block\n model = begin;\n Object.const_get msg\n rescue NameError\n end\n \n if model and model.respond_to?(:descends_from_active_record?) and model.descends_from_active_record?\n model.find args.first\n else\n super\n end\nend",
"def override_class_model\n unless File.exists?(\"app/models/#{@name}.rb\")\n run \"rake refinery:override model=#{@name}\"\n end\n end",
"def resolve_model(a_name)\n name = a_name.to_s.singularize.to_sym\n if m = find_model(name)\n return m\n end\n model(name) { no_controller }\n end",
"def base_class\n S::Model\n end",
"def model\n self.controller_name.classify.constantize\n end",
"def csharp_model_fqn( model )\n [ sanitize_model_namespace(model), sanitize_model_class(model) ].compact.join(\".\")\n end"
] |
[
"0.7741191",
"0.7725917",
"0.77190685",
"0.7625627",
"0.7589509",
"0.7567288",
"0.7484071",
"0.74534875",
"0.7410137",
"0.73734826",
"0.7340206",
"0.7282993",
"0.72777945",
"0.7259289",
"0.7258466",
"0.72416747",
"0.7139413",
"0.71297276",
"0.71297276",
"0.71224797",
"0.70982426",
"0.7090953",
"0.7081344",
"0.70803314",
"0.70481586",
"0.7007633",
"0.6998888",
"0.6990933",
"0.6990933",
"0.6981192",
"0.69785726",
"0.696404",
"0.6959179",
"0.6951653",
"0.6950177",
"0.6948781",
"0.6941992",
"0.6938789",
"0.6929848",
"0.69287586",
"0.69275194",
"0.692413",
"0.69059086",
"0.6891657",
"0.68819124",
"0.6880278",
"0.68604803",
"0.6850331",
"0.68248934",
"0.68248934",
"0.6810193",
"0.68031824",
"0.67942166",
"0.6777522",
"0.67386883",
"0.6736163",
"0.6734842",
"0.66868675",
"0.66846365",
"0.66803926",
"0.66803926",
"0.66771567",
"0.66767114",
"0.66689825",
"0.66686755",
"0.6654515",
"0.6600249",
"0.65942216",
"0.65872043",
"0.65866095",
"0.6567223",
"0.6554062",
"0.65520084",
"0.6542024",
"0.65241635",
"0.6520573",
"0.65193874",
"0.6513291",
"0.6509199",
"0.6506579",
"0.6506579",
"0.649313",
"0.64870495",
"0.6468741",
"0.6458009",
"0.6455257",
"0.64505136",
"0.64331007",
"0.64317954",
"0.64306164",
"0.64306164",
"0.6424592",
"0.64222",
"0.64131755",
"0.6404555",
"0.6402088",
"0.6400081",
"0.63937837",
"0.63930714",
"0.6388655"
] |
0.7933407
|
0
|
Create a new file using a template name and a hash with value for all template variables
|
def generate(file_name,template,map, overwrite = true)
# make sure the package folder exists
pkg_path = (map['package'] || '').gsub('.','/')
FileUtils.makedirs "#{target}/#{pkg_path}"
File.open("#{target}/#{pkg_path}/#{file_name}",'w') do |f|
f << self.process_template(template,map)
log ">> writing #{f.path}"
end #file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def buildup_template_file(basename, header, hash)\n type = hash[:type] || :script\n filename = filename_for(basename, type)\n\n if File.exist? filename\n exit 0 unless prompt(\"* '#{filename}' already exists, overwrite it? (y/n): \") =~ /^y$/i\n end\n File.open(filename, \"w\") {|file|\n file << \"#!/usr/bin/env ruby\"\n file << \"\\n\"\n file << \"# coding: #{get_encoding}\"\n file << \"\\n\" * 2\n file << get_commented_text(header)\n file << \"\\n\" * 2\n\n case type\n when :script\n file << TEMPLATE_SCRIPT\n when :test\n file << TEMPLATE_TEST_UNIT\n when :rspec\n file << TEMPLATE_RSPEC\n end\n\n file.chmod SCRIPT_MOD\n\n puts \"* Successfully generated: #{filename}\"\n }\n end",
"def file(name, template_name=nil, params=nil)\n @fileutils.touch(name)\n @file.open(name, 'w') do |f|\n f.puts write_contents(@templates.fetch(template_name), params) \n end unless template_name.nil? \n @output.write(\"created #{name}\")\n end",
"def new_template_file(template_file, template_data_hash)\n TemplateFile.new(template_file, template_data_hash)\n end",
"def write_temp_file(name_template, contents)\n to = File.join(\n BUILDDIR,\n name_template.gsub('RAND') {rand(10000)}\n )\n File.open(to, 'w') {|fp| fp.print contents}\n\n to\n end",
"def create_from_task_template\n File.open(file_path, 'w') do |f|\n f.puts build_task_template\n end\n end",
"def template_replace template, myhash\n #tmpltext=File::read(template);\n\n t = template.dup\n t.gsub!( /##(.*?)##/ ) {\n #raise \"Key '#{$1}' found in template but the value has not been set\" unless ( myhash.has_key?( $1 ) )\n myhash[ $1 ].to_s\n }\n t\n end",
"def create_html_file(filename, template, data)\n File.open(filename, \"w+:utf-8\") do |file|\n file << ERB.new(File.read(template)).result(data.to_binding)\n end\n end",
"def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end",
"def generate_template()\n\n file_name = @hostname + '.tf'\n check_file_exists(file_name)\n template_path = determine_role()\n\n template = File.read(template_path)\n renderer = ERB.new(template, nil, '-')\n open(file_name, 'w') { |f|\n \tf.puts renderer.result(self.get_binding)\n f.close\n }\n\n end",
"def template(template_name)\n @attributes.store(template_name)\n end",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def store_cachefile(cache_filename, template)\n s = template.script\n s = \"\\#@ARGS #{template.args.join(',')}\\n#{s}\" if template.args\n tmp_filename = \"#{cache_filename}.#{rand()}\"\n File.open(tmp_filename, 'w') {|f| f.write(s) }\n File.rename(tmp_filename, cache_filename)\n end",
"def install_template(file_parts, dest, subs = {})\n content = String.new\n file_parts.each do |file_part|\n full_path = File.join(File.dirname(__FILE__), file_part)\n begin\n content += File.open(full_path).read\n rescue\n end\n end\n subs.keys.each do |k|\n content.gsub!(/#{k}/, subs[k])\n end\n File.open(dest, 'w') {|file| file.write(content)}\n end",
"def create_template(test_info)\n File.open(test_info.template_file_path, 'w') do |file|\n case\n when test_info.file_stem == :nothing\n file.puts 'This file includes nothing.'\n else\n # Inspect, in case it's a symbol, and remove double quotes after inspection.\n treatment_for_include = test_info.treatment.inspect.gsub('\"','')\n include_line = \"@[#{treatment_for_include}](#{test_info.include_file_path})\"\n file.puts(include_line)\n end\n end\n end",
"def unique_template(name)\n File.read(unique_filename(name))\n end",
"def template_for(file); end",
"def export_to_template template, file\n renderer = ERB.new(File.read(template))\n output = renderer.result binding\n output_file = File.open file, 'w'\n output_file << output\n output_file.close\n end",
"def create_into(directory)\n build_file\n Pathname.new(directory).join(@file).open 'w+' do |file|\n post = self\n file << ERB.new(load_template).result(binding)\n end\n end",
"def appendTemplate2file(file, name, template)\n\t_block_start = \"# #{name} added by chef {\"\n\t_block_end = \"# }\\n\"\n\n\tbash \"Remove #{name} from #{file}\" do\n\t\tcode <<-EOC\n\t\t\tperl -0777 -pi -e 's/\\n*#{_block_start}.*?#{_block_end}//gs' #{file}\n\t\tEOC\n\t\tonly_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\n\tbash \"Add #{name} to #{file}\" do\n\t\tcode <<-EOC\n\t\t\techo '' >> #{file}\n\t\t\techo '#{_block_start}' >> #{file}\n\t\t\tcat #{template} >> #{file}\n\t\t\techo '#{_block_end}' >> #{file}\n\t\tEOC\n\t\tnot_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\nend",
"def write_template(template, target, config)\n\n File.write(\n\n target,\n ERB.new(File.read(template)).result(binding)\n )\nend",
"def create_template_dot_rb\n\tsystem('touch template.rb')\n\tfile = File.open('template.rb', 'w')\n\tfile.puts(\"require 'pry'\")\n\tfile.puts(\"require 'dotenv'\")\n\tfile.puts('')\n\tfile.puts(\"Dotenv.load('.env')\")\n\tfile.close\nend",
"def process_template(template_name,map)\r\n template = File.dirname(__FILE__) + \"/../templates/#{template_name}.st\"\r\n map['timestamp']=Time.now.httpdate\r\n File.open(template,'r') do | f | \r\n # detect words inside dollar sign pairs\r\n replaced = f.read.gsub(/(\\$\\w*\\$)/) do | match |\r\n key = match[1..match.size-2]\r\n (map.has_key? key) ? map[key] : 'MISSING:'+key\r\n end \r\n return replaced\r\n end # file\r\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def append_template(filepath, template, tokens = {})\n # TODO: ensure template exists\n # TODO: is \\n included with STDIN?\n _template = template\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n template = get_template_location << template\n puts \"... Adding template '#{_template}' to '#{filepath}'\"\n contents = File.read(template)\n tokens.each_pair do |token, value|\n if value.class == String && contents.include?(\"[#{token}]\")\n contents.gsub!(/\\[#{token}\\]/, value)\n end\n end\n File.open(filepath, 'a') do |f|\n f.write contents\n end\n end",
"def generate template, file\n if file.kind_of? String then # one file\n write_template(file, ERB.new(load_template(template)).result(binding))\n else # multiple files\n file.each do |f|\n write_template(f, ERB.new(load_template(template)).result(binding))\n end\n end\n end",
"def backup_template( template )\n filename = \"./templates/#{template['id']}.json\"\n file = File.new(filename, \"w\")\n puts \"Backing up #{filename} ...\"\n file.write( template )\n file.close\n end",
"def generate\n Zip::File.open(@template_path) do |template_zip|\n buffer = Zip::OutputStream.write_buffer do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n source = entry.get_input_stream.read.sub(/(<w:body>)(.*?)(<w:sectPr)/, \"\\\\1#{@replaceable_files[entry.name]}\\\\3\")\n out.write(source)\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n buffer.string\n end\n end",
"def template(from, to)\n erb = File.read(from)\n put ERB.new(erb).result(binding), to\nend",
"def create_def_file(tlm_def_filename, tlm_def_template_file)\n\n #\n # Create combo packet substitution strings \n #\n HkJsonDefFile::HK_COMBO_PKT_MID_STR.each do |combo_pkt|\n \n @hk_json_def_file.process_combo_pkt(combo_pkt) do |hk_combo_mid_str, src_data_array|\n \n src_data_array.each do |src_data|\n \n src_item = @hk_json_def_file.get_src_tlm_item(src_data) # Index: 0=MID, 1=Name, 2=Offset, 3=Size, 4=Data Type\n \n if (src_item[1] != nil and src_item[2] != 0 and src_item[3] != 0)\n @combo_pkt_str[combo_pkt] << \" APPEND_ITEM #{src_item[1]} #{src_item[3]*8} #{src_item[4]}\\n\" \n else\n raise IndexError.new(\"JSON definition file contains an ivalid entry #{src_item}\\n\")\n end\n \n end # src_data loop\n end # Combo pkt tlm item loop\n \n end # JSON combo pkt loop\n \n tlm_def_str = File.read(tlm_def_template_file)\n \n HkJsonDefFile::HK_COMBO_PKT_MID_STR.each do |combo_pkt|\n tlm_def_str = tlm_def_str.sub(\"@#{combo_pkt}@\",@combo_pkt_str[combo_pkt])\n end\n tlm_def_str = tlm_def_str.sub(\"@src-file@\",@hk_json_def_file.filename)\n \n File.open(tlm_def_filename, 'w') do |tlm_def_file|\n tlm_def_file << tlm_def_str.sub(\"@date-time@\",Time.now.to_s)\n end # tlm_def_file\n \n end",
"def quick_make_file(local_file, tpl_file)\n current_file = local_file(local_file)\n template_file = @template.real_path(tpl_file)\n @template.make_file(\n template_file,\n current_file,\n @args.all.dup,\n make_data_files_array(current_file),\n method(:update_latest_options)\n )\n end",
"def create_source(name, destination)\n template = File.read(\"#{template_path(name)}/easy_type/templates/#{name}\")\n content = ERB.new(template, nil, '-').result(binding)\n write_file(destination, content)\n rescue SyntaxError\n fail \"Error in erb template #{name}\"\n end",
"def template(name, params: {})\n source_file = template_path(name)\n header_for(source_file, params.fetch(:header, true)) +\n ERB.new(File.read(source_file), trim_mode: '<>').result(binding).strip +\n \"\\n\"\n end",
"def create_template_spec_dot_rb\n\tsystem('touch template_spec.rb')\n\tfile = File.open('template_spec.rb', 'w')\n\tfile.puts(\"require_relative '../lib/template'\")\n\tfile.puts('')\n\tfile.puts('')\n\tfile.puts(\"describe 'the /name/ method' do\")\n\tfile.puts(\"\tit 'should /action/' do\")\n\tfile.puts(\"\t\texpect(/name/(/argument/)).to eq(/result/)\")\n\tfile.puts(\"\tend\")\n\tfile.puts(\"end\")\n\tfile.close\nend",
"def template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/#{TEMPLATE_EXTNAME}$/, \"\")\n\n source = File.expand_path(find_in_source_paths(source.to_s))\n context = config.delete(:context) || instance_eval(\"binding\")\n\n create_file destination, nil, config do\n content = CapturableERB.new(::File.binread(source), nil, \"-\", \"@output_buffer\").result(context)\n content = yield(content) if block\n content\n end\n end",
"def create_file\n file = \"#{@parameters['id']}_#{@parameters['updated_at']}_for_calc.txt\"\n File.open(DIR + file, 'w') do |f|\n f.write(\"Calculate with following variables:\")\n f.write(@parameters.inspect)\n end\n end",
"def generate_report(filename, template)\n file = File.read(filename)\n data_hash = JSON.parse(file)\n rpt_data = transform(data_hash)\n\n # Re http://stackoverflow.com/questions/1887845/add-method-to-an-instanced-object\n d = TemplateSource.new(rpt_data)\n\n template = File.read(template) if File.exist?(template)\n renderer = ERB.new(template, nil, '<>')\n renderer.result(d.get_binding)\nend",
"def create\n file = Tempfile.new(\"onetemplate-#{resource[:name]}\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.MEMORY resource[:memory]\n xml.CPU resource[:cpu]\n xml.VCPU resource[:vcpu]\n xml.DESCRIPTION do\n resource[:description]\n end if resource[:description]\n xml.OS do\n resource[:os].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:os]\n resource[:disks].each do |disk|\n xml.DISK do\n disk.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:disks]\n resource[:nics].each do |nic|\n xml.NIC do\n nic.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:nics]\n xml.GRAPHICS do\n resource[:graphics].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:graphics]\n xml.FEATURES do\n resource[:features].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:features]\n xml.CONTEXT do\n resource[:context].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:context]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating template using #{tempfile}\"\n onetemplate('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end",
"def default_data_for_template(name)\n {\n :name => name,\n :version => '0.0.1',\n :summary => \"A short description of #{name}.\",\n :homepage => \"http://EXAMPLE/#{name}\",\n :author_name => Executable.capture_command('git', %w(config --get user.name), :capture => :out).first.strip,\n :author_email => Executable.capture_command('git', %w(config --get user.email), :capture => :out).first.strip,\n :source_url => \"http://EXAMPLE/#{name}.git\",\n :ref_type => ':tag',\n :ref => '#{spec.version}',\n }\n end",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end",
"def generate_template(datestamp, entrytext, starred, uuid)\n ERB.new <<-XMLTEMPLATE\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>Creation Date</key>\n <date><%= datestamp %></date>\n <key>Entry Text</key>\n <string><%= entrytext %></string>\n <key>Starred</key>\n <<%= starred %>/>\n <key>Tags</key>\n <array>\n <string>daily logs</string>\n </array>\n <key>UUID</key>\n <string><%= uuid %></string>\n </dict>\n </plist>\n XMLTEMPLATE\n end",
"def create_tempfile(output = render_template)\n tempfile = Tempfile.new([SecureRandom.uuid, \".#{@template_details[:template_extension]}\"], encoding: 'utf-8')\n tempfile.write(output)\n ObjectSpace.undefine_finalizer(tempfile) # force garbage collector not to remove automatically the file\n tempfile.close\n tempfile_details(tempfile).slice(:filename, :path).values\n end",
"def template_create(path, section_name, section_id, system_name, title, layout_name, type, filename, liquid)\n check_path_or_raise path\n check_section_name_or_raise section_name\n check_id_or_raise section_id\n check_title_or_raise title\n check_layout_name_or_raise layout_name\n check_template_type_or_raise type\n check_filename_or_raise filename\n\n params = { :provider_key => @provider_key,\n :type => type,\n :title => title,\n :section_name => section_name,\n :section_id => section_id,\n :layout_name => layout_name,\n :path => path,\n :liquid_enabled => liquid,\n :draft => File.read(filename),\n :multipart => true }\n\n unless type == 'page'\n check_system_name_or_raise system_name\n params[:system_name] = system_name\n end\n\n response = http_request_multipart :post, @base_url + '/templates.xml', 201, params\n\n parse_response response, type\n end",
"def template(name); end",
"def create_template(template_name, disk_file)\n disk_file_type = FileUtils.archive_type disk_file\n # TODO such hardcoded paths have to be moved out to some configuration files\n template_file = File.join(\"/\", \"vz\", \"template\", \"cache\", \"#{template_name}.#{disk_file_type}\")\n File.symlink disk_file, template_file\n template_file\n end",
"def create_file_config\n # template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end",
"def setup_template_details\n template_extension = @template_path.scan(/\\.(\\w+)\\.?(.*)?/)[0][0]\n get_extension_and_name_from_file(@template_path).merge(\n template_extension: template_extension\n )\n end",
"def render_template_with_locals(abs_name, locals = {})\r\n template = File.read(File.join( abs_name) )\r\n ERB.new(template, nil, \"-\").result(OpenStruct.new(locals).send(:binding))\r\nend",
"def templates_for(file); end",
"def add_template(filepath)\n # templates must be strings for ERB\n @template = File.read(filepath)\n end",
"def file_from(path_name, binding_var, filename=nil, from_repo = false, github_user = nil, custom_url = nil)\n filename=File.basename(path_name) if filename==nil\n filePath = File.join(TEMPLATE_PATH,filename)\n puts filePath.inspect\n puts File.exist? filePath\n #str=IO.read(filePath).gsub('\"','\\\\\"')\n str = eval('\"'+IO.read(filePath).gsub('\"','\\\\\"')+'\"',binding_var)\n file path_name, str\nend",
"def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"def render_template_to_file(template, file, context)\n t = File.read(File.join(template))\n File.open(file, \"w\") do |f|\n f << ERB.new(t, nil, \"-\").result(context)\n end\n end",
"def init\n File.open(TEMPLATABLE_FILE, 'w') { |f|f.puts TEMPLATABLE_TEMPLATE }\n end",
"def default_data_for_template(name)\n data = {}\n data[:name] = name\n data[:version] = '0.0.1'\n data[:summary] = \"A short description of #{name}.\"\n data[:homepage] = \"http://EXAMPLE/#{name}\"\n data[:author_name] = `git config --get user.name`.strip\n data[:author_email] = `git config --get user.email`.strip\n data[:source_url] = \"http://EXAMPLE/#{name}.git\"\n data[:ref_type] = ':tag'\n data[:ref] = '0.0.1'\n data\n end",
"def default_data_for_template(name)\n data = {}\n data[:name] = name\n data[:version] = '0.0.1'\n data[:summary] = \"A short description of #{name}.\"\n data[:homepage] = \"http://EXAMPLE/#{name}\"\n data[:author_name] = `git config --get user.name`.strip\n data[:author_email] = `git config --get user.email`.strip\n data[:source_url] = \"http://EXAMPLE/#{name}.git\"\n data[:ref_type] = ':tag'\n data[:ref] = '0.0.1'\n data\n end",
"def template(file, template)\n config = Environment.load(source: file)\n template = File.read(template)\n result = template.gsub(/{{([^}:]+)(:([^}]+))?}}/) do |_|\n key = $1\n default_value = ENV[key] || $3\n if default_value\n config.fetch(key, default_value)\n else\n config.fetch(key)\n end\n end\n puts result\n end",
"def create_user(user)\n user.downcase!\n hash = Hash.new\n hash[:name] = \"#{user}\"\n hash[:balance] = 0\n puts \"Please create a password: \"\n hash[:password] = gets.chomp\n write_to_file(\"userdata/#{user}.txt\",hash)\n write_to_file(\"userdata/#{user}_history.txt\", nil)\nend",
"def generate name, file\n require 'erb'\n template = File.read(File.join(File.dirname(__FILE__), \"class_template.erb\"))\n erb = ERB.new(template)\n code = erb.result(binding)\n Dir.mkdir(@basedir) unless File.directory?(@basedir)\n file = File.join(@basedir, name + \".rb\")\n File.open(file, \"w+\") do |f|\n f.puts code\n end\n end",
"def createFile (pathFile,extension,nameFile, erb)\r\n FileUtils.mkdir_p(pathFile)\r\n fileName = pathFile+nameFile+extension\r\n newFile = File.open(fileName,\"w\")\r\n newFile.print erb\r\n newFile.close\r\n end",
"def generate_file_from_template(template_path, file_path, options)\n write_content_to_file(file_path, render_erb_template(template_path, options))\n end",
"def template(*path); end",
"def create_puppetfile(puppetfile_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write puppetfile_contents\n end\n end",
"def create(filename, text); end",
"def create_temp_file\n copy_to_temp_file full_filename\n end",
"def template!(path, full_paths = T.unsafe(nil)); end",
"def init\n File.open(ISSTEMPL_FILE, 'w') do |f|\n f.puts ISSTEMPL_TEMPLATE\n end\n end",
"def template(relative_source, relative_destination, template_options = {})\n create_file(relative_source, relative_destination, template_options) do |file|\n # Evaluate any assignments in a temporary, throwaway binding.\n vars = template_options[:assigns] || {}\n b = template_options[:binding] || binding\n vars.each { |k,v| eval \"#{k} = vars[:#{k}] || vars['#{k}']\", b }\n\n # Render the source file with the temporary binding.\n ERB.new(file.read, nil, '-').result(b)\n end\n end",
"def build(attrs=nil, filename=nil)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value)\n end if attrs\n \n @template.filename = filename\n @template.result(binding)\n @_erbout\n end",
"def template\n @template ||= Template.new name: script_name, out_file: root_ruby_file, type: type\n end",
"def fixture_hash(filename, data: {})\n file = File.read fixture_file(filename)\n YAML.load render_erb(file, data)\n end",
"def create(filename)\n input = self.read('templates/codeml.ctl.erb')\n\n # Using ERB templates\n output = ERB.new(input).result(binding)\n\n # Create a blank file then put the contents of the output in\n self.create_file(\"#{filename}\", output)\n end",
"def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end",
"def create_template(filename, _context=nil)\n template = @templateclass.new(nil, @init_opts_for_template)\n template.timestamp = Time.now()\n cache_filename = cachename(filename)\n _context = hook_context(Context.new) if _context.nil?\n if !@cache\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n elsif !test(?f, cache_filename) || File.mtime(cache_filename) < File.mtime(filename)\n #$stderr.puts \"*** debug: load original\"\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n store_cachefile(cache_filename, template)\n else\n #$stderr.puts \"*** debug: load cache\"\n template.filename = filename\n load_cachefile(cache_filename, template)\n end\n return template\n end",
"def generate\n template = Template.new\n template.add('timestamp', Time.now.to_s)\n template.add('lib_dir', @lib_dir)\n template.add('bin_dir', @bin_dir)\n template.parse(TEMPLATE)\n end",
"def create_file(type, resource)\n Chef::Log.info(\"date : #{resource.date}\")\n\n date = ''\n temporary_filename = ''\n\n if platform_family?('windows')\n temporary_filename = \"C:/Windows/Temp/#{resource.reference}\"\n\n # Formatted date for the request\"\n ruby_block 'date-windows' do\n block do\n # Get date\n date = powershell_out('get-date -Format \"yyyy/%M/%d HHHH:mmmm:ssss\"').stdout.chop\n end\n action :create\n end\n\n else\n temporary_filename = \"/tmp/#{resource.reference}\"\n\n # Formatted date for the request\"\n ruby_block 'date-linux' do\n block do\n # Get date\n date = shell_out('date +\"%Y/%m/%d %T\"').stdout.chop\n end\n action :create\n end\n end\n\n Chef::Log.debug(\"temporary_filename : #{temporary_filename}\")\n\n template temporary_filename.to_s do\n source 'cyberark_request.erb'\n variables(\n version: resource.version,\n date: resource.date,\n type: type.to_s,\n reference: resource.reference,\n hostname: resource.hostname,\n ip: resource.ip,\n fqdn: resource.fqdn,\n platform: resource.platform,\n location: resource.location,\n geographic_code: resource.geographic_code,\n username: resource.username,\n password: resource.password\n )\n end\n\n ruby_block 'create-file' do\n block do\n if platform_family?('windows')\n hash = powershell_out(\"$(Get-FileHash #{temporary_filename} -Algorithm MD5).hash\").stdout.chop\n date_short = powershell_out('get-date -Format \"yyyyMMddHHmmss\"').stdout.chop\n else\n hash = shell_out(\"md5sum #{temporary_filename} | cut -f1 -d ' '\").stdout.chop\n date_short = shell_out('date +\"%Y%m%d%H%M\"').stdout.chop\n end\n\n filename = \"#{date_short}_#{type}_#{resource.reference}_#{hash}\"\n Chef::Log.debug(\"date_short : #{date_short}\")\n Chef::Log.debug(\"filename : #{filename}\")\n Chef::Log.debug(\"mv #{temporary_filename} /tmp/#{filename}.tmp\")\n node.default['cyberark']['filename'] = filename.to_s\n\n if platform_family?('windows')\n powershell_out(\"mv #{temporary_filename} C:/Windows/Temp/#{filename}.tmp\")\n else\n shell_out(\"mv #{temporary_filename} /opt/IBM/#{filename}.tmp\")\n end\n end\n action :create\n end\nend",
"def erb(file_name, template_name)\n template = ERB.new(File.open(template_name, \"r:UTF-8\", &:read), nil, \"-\")\n File.open(file_name, \"w:UTF-8\") { |file| file.write(template.result(binding)) }\nend",
"def create_temp_file\n write_to_temp_file current_data\n end",
"def template_path(template_name, target_name=template_name.chomp('.erb'), mode=0600, locals={'attrs' => attrs})\r\n _package_.build_template(target_name, template_name, mode, locals)\r\n target_path target_name\r\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def build template\n erb = File.read(File.join(VIEWS_DIR, template + \".erb\"))\n content = ERB.new(erb).result(binding)\n File.open(template, 'w') do |f|\n f.write content.gsub(/\\n\\n\\n+/, \"\\n\\n\")\n end\n end",
"def template(target, options={})\n template_name = options[:source] || File.basename(target)\n locals = options[:locals] || {}\n \n source = template_path(template_name, locals)\n install(source, target, options)\nend",
"def copy_template(input, output)\n file = File.open(input, \"r\")\n f = File.open(output,\"w\")\n while (line = file.gets)\n f.write(line)\n end\n f.close\n file.close\n end",
"def template(template_name = 'template.txt')\n File.read([File.dirname(__FILE__), template_name].join('/'))\n end",
"def create_file(type)\n cb_file, source_file = get_locations(type)\n\n File.open(cb_file, 'w') { |f| f.write(process_template(source_file)) }\n\n if @opts[:verbose]\n Souschef::Print.info \"Creating Testkitchen #{type} configuration\"\n end\n rescue TypeError\n Souschef::Print.error 'SKipping'\n end",
"def template(name, &b)\n @app.templates[name] = b\n end",
"def init\n File.open(WASHER_FILE, 'w') { |f|f.puts WASHER_TEMPLATE }\n end",
"def from_template(template_file, **template_values)\n namespace = OpenStruct.new(template_values)\n template = ERB.new(File.read(template_file))\n new_contents = template.result(namespace.instance_eval { binding })\n\n @unwritten_contents = new_contents\n end",
"def buildup_template_header(basename, hash)\n header = []\n type = hash[:type] || :script\n header << filename_for(basename, type)\n header << \"\"\n description = hash[:description] || \"no description\"\n header << teardown_to_oneline(description)\n header << \"\"\n date = hash[:date] || Time.now\n header << \"created on : %04d.%02d.%02d\" % [date.year, date.month, date.day]\n header << \"last update: %04d.%02d.%02d\" % [date.year, date.month, date.day]\n header << \"\"\n author = hash[:author] || AUTHOR_NAME\n header << teardown_to_oneline(\"by \" + author)\n return header.flatten\n end",
"def create_template( template_name )\n puts \"Creating new template #{template_name} at #{@secondary_username}...\"\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )\n request.basic_auth(@secondary_username, @secondary_password)\n\n payload = {:name => \"#{template_name}\"}.to_json\n request.body = payload\n\n response = http.request( request )\n new_template_info = JSON.parse( response.body )\n new_template_id = new_template_info['id']\n\n return new_template_id\n end",
"def create_generic_file(resource_id)\n filename = Faker::File.file_name(dir: '', directory_separator: '')\n StashEngine::GenericFile.create(\n {\n original_filename: filename,\n upload_file_name: filename,\n resource_id: resource_id,\n upload_content_type: 'text/plain',\n upload_file_size: 31_726,\n status_code: 200,\n file_state: 'created',\n type: %w[StashEngine::DataFile StashEngine::SoftwareFile StashEngine::SuppFile][rand(3)]\n }\n )\n end",
"def manage_file(file_name, contents, path)\n if contents.class == Hash && contents.empty? == false\n file = Chef::Resource::Template.new(\"#{path}/#{file_name}\", run_context)\n file.cookbook('cerner_splunk')\n file.source('generic.conf.erb')\n file.variables(stanzas: contents)\n else\n file = Chef::Resource::File.new(\"#{path}/#{file_name}\", run_context)\n file.content(contents)\n end\n file.path(\"#{path}/#{file_name}\")\n file.owner(node[:splunk][:user])\n file.group(node[:splunk][:group])\n file.mode('0600')\n if contents.empty?\n file.run_action(:delete)\n else\n file.run_action(:create)\n end\n new_resource.updated_by_last_action(file.updated_by_last_action?)\n end",
"def make_file_package(path, content, options = {})\n path.dirname.mkpath\n\n path.open('w') do |f|\n if options.any?\n f.puts stringify_hash_keys(options).to_yaml\n f.puts '---'\n end\n\n f.puts content\n end\nend",
"def template(data = {})\n str = dup\n\n data.each do |key, value|\n str.gsub!(\":#{key}\", value.to_s)\n end\n\n str\n end",
"def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end",
"def execute\n Services::Slog.debug({:message => \"File write for #{@template[:identifier]}\", :module => \"FileTemplate\", :task => \"execute\", :extra => {:template => @template[:identifier], :payload => @template[:payload]}})\n case @template[:payload][:method]\n when 'create'\n begin\n\n @template.users.each do |user|\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(\"\\n\") }\n response = { :status => \"200\", :message => \"File created.\", :id => @template[:payload][:uri]}\n\n unless @template[:payload][:content].nil? then\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n rescue Exception => e\n Services::Slog.exception e\n response = { :status => \"400\", :message => \"Method not is unsupported, #{e}\" }\n end\n when 'append'\n begin\n @template.users.each do |user|\n unless @template[:payload][:content].nil? then\n File.open(Dir.pwd + \"/data/users/#{user.id}/#{@template[:payload][:uri]}\", \"a+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n response = { :status => \"200\", :message => \"Content appended to file\", :id => @template[:payload][:uri]}\n rescue Exception => e\n response = { :status => \"403\", :message => \"Error processing file, #{e}\" }\n Services::Slog.exception e\n end\n end\n\n response\n end"
] |
[
"0.71314526",
"0.70949185",
"0.7052817",
"0.6523122",
"0.65225816",
"0.6518813",
"0.6487467",
"0.6463251",
"0.6304741",
"0.62920666",
"0.6267362",
"0.621183",
"0.621183",
"0.618955",
"0.61689293",
"0.61512595",
"0.6140747",
"0.61276853",
"0.61258334",
"0.61191213",
"0.6095173",
"0.6082279",
"0.6078832",
"0.6061409",
"0.60573125",
"0.6054002",
"0.6049673",
"0.60495895",
"0.60426915",
"0.6038047",
"0.6036954",
"0.59686905",
"0.59682757",
"0.5953443",
"0.595309",
"0.59391594",
"0.593161",
"0.5926481",
"0.5913544",
"0.59132814",
"0.59112364",
"0.5890701",
"0.5890701",
"0.58828413",
"0.5880872",
"0.5873466",
"0.5872631",
"0.58675694",
"0.58643806",
"0.5855388",
"0.58443946",
"0.582486",
"0.5780097",
"0.5758488",
"0.57559156",
"0.5754994",
"0.5754009",
"0.57514334",
"0.5740553",
"0.5740553",
"0.5739394",
"0.57328147",
"0.572814",
"0.5714534",
"0.5714197",
"0.5708716",
"0.569982",
"0.5698526",
"0.569555",
"0.5686845",
"0.56843525",
"0.567269",
"0.5661152",
"0.56601816",
"0.56482434",
"0.56466",
"0.56361157",
"0.5634486",
"0.56247437",
"0.56202453",
"0.56158996",
"0.5613775",
"0.56076163",
"0.5607515",
"0.5607174",
"0.56001675",
"0.55918455",
"0.55908",
"0.5575531",
"0.5572982",
"0.55727506",
"0.5551433",
"0.5534708",
"0.55337054",
"0.55315435",
"0.5528354",
"0.5527713",
"0.55269825",
"0.55252963",
"0.55136263"
] |
0.6203255
|
13
|
Map a ActiveRecord column type of a ActionScript Class name. Returns "missing_type" is no mapping was found.
|
def flex_type_from(column_type)
@typemap[column_type] ||= "MISSING in template_processor.rb=#{column_type}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def column_type\n class_name.columns_hash[@column.to_s].type\n end",
"def map_types!(column_mapping)\n\t\tself.column_mapping = column_mapping\n\t\tself\n\tend",
"def type(column); self[column]['type']; end",
"def sql_type_for_class(klass)\n @typemap[klass]\n end",
"def scaffold_table_column_type(c)\n column = self.properties[c]\n if column then\n if column.type == DataMapper::Property::Text\n :text\n else\n column.class.to_s.split(\"::\").last.downcase.intern\n end\n else\n nil\n end\n end",
"def type(column_name)\n self.class.type(column_name)\n end",
"def map_value(column_type)\n case column_type\n when :datetime then :timestamp\n when :json then :string\n else column_type\n end\n end",
"def map_type type\n type\n end",
"def map_type type\n type\n end",
"def type(column)\n column_named(column).type || nil\n end",
"def schema_type_class(column)\n if (sch = db_schema[column]) && (type = sch[:type])\n db.schema_type_class(type)\n end\n end",
"def schema_type_class(column)\n if (sch = db_schema[column]) && (type = sch[:type])\n db.schema_type_class(type)\n end\n end",
"def type_from_database(attribute)\n col = @object.column_for_attribute(attribute)\n\n unless col.nil?\n col.type.to_s.downcase\n else\n nil\n end\n end",
"def column_type_of(attribute)\n column = @ar_class.columns_hash[attribute.to_s]\n return :string unless column\n return :numeric if column.number? or [:datetime,:time,:date,:timestamp].include?(column.type)\n return :string\n end",
"def java_type\n Jrodb::Model.type_map[self]\n end",
"def column_type\n return @column_type if defined?(@column_type)\n ind = index\n table[1..500].each do |row|\n if row[ind]&.cell_type\n cel_column_type = row[ind].cell_type\n if !defined?(@column_type) || @column_type.nil?\n @column_type = cel_column_type\n elsif (cel_column_type == @column_type) || (cel_column_type == :nil)\n else\n @column_type = :string\n break\n end\n end\n end\n @column_type\n end",
"def scaffold_column_type(column_name)\n @scaffold_column_types ||= scaffold_column_types\n if @scaffold_column_types[column_name]\n @scaffold_column_types[column_name]\n elsif columns_hash.include?(column_name)\n type = columns_hash[column_name].type\n (scaffold_convert_text_to_string and type == :text) ? :string : type\n end\n end",
"def column_type(type)\n case type\n when :integer then Integer\n when :float, :decimal then Float\n when :string, :text, :uuid then String\n when :datetime, :timestamp, :time then DateTime\n when :date then Date\n when :boolean then Virtus::Attribute::Boolean # Boolean is not a standard Ruby class\n else\n raise \"Could not match column type '#{type}' for #{model_name}\"\n end\n end",
"def sql_type(name)\n name = (name.kind_of?(String) ? name.split('.').first : name.to_s)\n\n return :belongs_to if belongs_to(name)\n\n # Skip using columns() cause we dont need to check for belongs_to\n column = columns.find { |col| col.name == name }\n\n if column.present?\n column.type\n elsif has_many(name)\n :has_many\n elsif has_one(name)\n :has_one\n elsif belongs_to_polymorphic(name)\n :belongs_to_polymorphic\n elsif has_and_belongs_to_many(name)\n :has_and_belongs_to_many\n elsif active_storage(name)\n :active_storage\n elsif name == 'id' && defined?(EffectiveObfuscation) && klass.respond_to?(:deobfuscate)\n :effective_obfuscation\n elsif name == 'roles' && defined?(EffectiveRoles) && klass.respond_to?(:with_role)\n :effective_roles\n elsif (name.ends_with?('_address') || name.ends_with?('_addresses')) && defined?(EffectiveAddresses) && (klass.new rescue nil).respond_to?(name)\n :effective_addresses\n elsif name.ends_with?('_id')\n :integer\n else\n :string\n end\n end",
"def get_type_for_sql(name, code)\n case code\n when JTypes::VARCHAR\n \"string\"\n when JTypes::INTEGER\n \"int\"\n when JTypes::TIME\n \"java.sql.Time\"\n when JTypes::DATE\n \"java.sql.Date\"\n when JTypes::TIMESTAMP\n \"java.sql.Timestamp\"\n when JTypes::BLOB\n \"java.sql.Blob\"\n when JTypes::CLOB\n \"java.sql.Clob\"\n when JTypes::DOUBLE\n \"double\"\n when JTypes::SMALLINT\n \"boolean\"\n when JTypes::DECIMAL\n \"java.math.BigDecimal\"\n else\n $stderr.puts [name, code].inspect\n nil\n end\n end",
"def column_type\n object.class.scaffold_column_type(@method_name)\n end",
"def get_as_class_name ruby_class_name\n mapping = @ruby_mappings[ruby_class_name]\n return mapping.nil? ? nil : mapping.as\n end",
"def column_type\r\n @type\r\n end",
"def column_class(type)\n if @numeric_types.include?(type) then NumericColumn\n elsif @enumerated_types.include?(type) then EnumeratedColumn\n elsif @textual_types.include?(type) then TextualColumn\n else\n Column\n end\n end",
"def cast(data_type)\n case data_type\n when String\n new_jcolumn = jcolumn.cast(data_type)\n when DataType\n jdata_type = JDataType.fromJson(data_type.json)\n new_jcolumn = jcolumn.cast(jdata_type)\n else\n raise ArgumentError, \"Unsupported type: #{data_type.class}\"\n end\n\n Column.new(new_jcolumn)\n end",
"def column_type(column)\n (sch = model.db_schema[column]) && sch[:type]\n end",
"def scaffold_column_type(column_name)\n @scaffold_column_types ||= {}\n @scaffold_column_types[column_name] ||= if type = SCAFFOLD_OPTIONS[:column_types][column_name]\n type\n elsif scaffold_association(column_name)\n :association\n elsif type = scaffold_table_column_type(column_name)\n (scaffold_convert_text_to_string && (type == :text)) ? :string : type\n else\n :string\n end\n end",
"def type(method)\n if @object.respond_to?(:has_attribute?) && @object.has_attribute?(method)\n column = @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n return column.type if column\n end\n end",
"def stradivari_type(column_name)\n raise NotImplementedError\n end",
"def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\n end\n end",
"def finalize_datatypes_for_csv\n csv_column_datatypes.map { |column_name, possible_datatypes|\n #If there is string type even atleast 1 there is no other option but to set the datatype to string => varchar\n if possible_datatypes.has_key?(:string)\n csv_column_datatypes[column_name] = :string\n else\n #set the max occurance datatype as the datatype of column\n csv_column_datatypes[column_name] = possible_datatypes.key(possible_datatypes.values.max)\n end\n }\n end",
"def ensure_proper_type\n unless self.class.descends_from_active_record?\n write_attribute(self.class.inheritance_column, Inflector.demodulize(self.class.name))\n end\n end",
"def column_type(col)\n column(col).type || nil\n end",
"def set_type_for_columns(table_name, column_type, *args)\n @table_column_type ||= {}\n @table_column_type[table_name] ||= {}\n args.each do |col|\n @table_column_type[table_name][col.to_s.downcase] = column_type\n end\n end",
"def type(key)\n column(key).type\n end",
"def column_type(col)\n self.class.column_type(col)\n end",
"def input_type_to_class(input_type)\n class_mappings = { :text_field => 'text', :password_field => 'text' }\n class_mappings[input_type.to_sym] || nil\n end",
"def type_of_field_in_database(class_name, field_name)\n all_fields = class_name.get_table_info\n all_fields.each do |field|\n if field[\"name\"] == field_name\n return field[\"type\"]\n end\n end\n false\n end",
"def get_property_type column\n column.type\n end",
"def get_property_type column\n column.type\n end",
"def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end",
"def get_ruby_class_name as_class_name\n mapping = @as_mappings[as_class_name]\n return mapping.nil? ? nil : mapping.ruby\n end",
"def convert_to_type(val)\n case type\n when 'NilClass'\n if val != false && val.blank?\n # Leave the type of the Column open. Unfortunately, false counts as\n # blank and we don't want it to. It should be classified as a boolean.\n new_val = nil\n else\n # Only non-blank values are allowed to set the type of the Column\n bool_val = convert_to_boolean(val)\n new_val =\n if bool_val.nil?\n convert_to_date_time(val) ||\n convert_to_numeric(val) ||\n convert_to_string(val)\n else\n bool_val\n end\n @type =\n if [true, false].include?(new_val)\n 'Boolean'\n elsif new_val.is_a?(Date) || new_val.is_a?(DateTime)\n 'DateTime'\n elsif new_val.is_a?(Numeric)\n 'Numeric'\n elsif new_val.is_a?(String)\n 'String'\n else\n msg = \"can't add #{val} of type #{new_val.class.name} to a column\"\n raise UserError, msg\n end\n end\n new_val\n when 'Boolean'\n if val.is_a?(String) && val.blank? || val.nil?\n nil\n else\n new_val = convert_to_boolean(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'DateTime'\n if val.blank?\n nil\n else\n new_val = convert_to_date_time(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'Numeric'\n if val.blank?\n nil\n else\n new_val = convert_to_numeric(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'String'\n if val.nil?\n nil\n else\n new_val = convert_to_string(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n else\n raise UserError, \"Mysteriously, column has unknown type '#{type}'\"\n end\n end",
"def type_method_from_database(attribute)\n type = type_from_database(attribute)\n\n unless type.nil?\n \"#{type}_field\"\n else\n nil\n end\n end",
"def fields_to_classify\n columns = klass.columns_hash\n columns.select { |key| columns[key].type == :string }.keys\n end",
"def ensure_mappings_define_klass\n klassless_mappings = @columns.\n select { |mapping| mapping.nil? || mapping['klass'].nil? }.\n reject { |mapping| mapping['do_not_capture'] }.\n map { |mapping| mapping['column'] || mapping['standard_mapping'] }\n\n return if klassless_mappings.empty?\n\n # All column mappings for the single item file require a klass definition.\n fail \"Missing klass for column(s): #{klassless_mappings.to_sentence}\"\n end",
"def get_as_class_name obj\n # Get class name\n if obj.is_a?(String)\n ruby_class_name = obj\n elsif obj.is_a?(RocketAMF::Values::TypedHash)\n ruby_class_name = obj.type\n elsif obj.is_a?(Hash)\n return nil\n elsif obj.is_a?(RubyAMF::IntermediateObject)\n ruby_class_name = obj.object.class.name\n else\n ruby_class_name = obj.class.name\n end\n\n # Get AS class name\n as_class_name = @mappings.get_as_class_name ruby_class_name\n\n # Auto-map if necessary, removing namespacing to create mapped class name\n if RubyAMF.configuration.auto_class_mapping && ruby_class_name && as_class_name.nil?\n as_class_name = ruby_class_name.split('::').pop\n @mappings.map :as => as_class_name, :ruby => ruby_class_name\n end\n\n as_class_name\n end",
"def cast_type(name)\n sphinx_attribute(name).type\n end",
"def column_name_for(class_type)\n if class_type == \"User\"\n return \"task_owners.user_id\"\n elsif class_type == \"Project\"\n return \"tasks.project_id\"\n elsif class_type == \"Task\"\n return \"tasks.id\"\n elsif class_type == \"Customer\"\n return \"projects.customer_id\"\n elsif class_type == \"Company\"\n return \"tasks.company_id\"\n elsif class_type == \"Milestone\"\n return \"tasks.milestone_id\"\n elsif class_type == \"Tag\"\n return \"task_tags.tag_id\"\n else\n return \"#{ class_type.downcase }_id\"\n end\n end",
"def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end",
"def find_column(column_name)\n return create_temporary_fake_column(column_name) if (! @model_class.table_exists?)\n out = model_class.columns.detect { |c| c.name.to_s == column_name.to_s }\n return create_temporary_fake_column(column_name) if (! out)\n\n unless is_acceptable_column_type?(out)\n raise FlexColumns::Errors::InvalidColumnTypeError, %{You're trying to define a flex column #{column_name.inspect}, but\nthat column (on model #{model_class.name}) isn't of a type that accepts text.\nThat column is of type: #{out.type.inspect}.}\n end\n\n out\n end",
"def mapping\n {\n type.to_sym => {\n properties: self.type_mapping\n }\n }\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\A(int(eger)?|bigint|smallint)\\z/\n :integer\n when /\\A(character( varying)?|varchar|text)\\z/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when /\\A(boolean|tinyint)\\z/\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric|decimal|money)\\z/\n :decimal\n end\n end",
"def database_column_type\n :string\n end",
"def inheritance_column\n \"type\"\n end",
"def type_column\n arel_table[polymorphic_type.to_sym] if polymorphic_type\n end",
"def map_data_types(hsh)\n hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) }\n end",
"def type_code\n type.try(:code)\n end",
"def change\n change_column(:table_name, :column_name, :new_type)\nend",
"def schema_column_type(db_type)\n case db_type\n when /\\Atinyint/\n Sequel.convert_tinyint_to_bool ? :boolean : :integer\n when /\\A(int(eger)?|bigint|smallint)/\n :integer\n when /\\A(character( varying)?|varchar|text)/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when \"boolean\"\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric(\\(\\d+,\\d+\\))?|decimal|money)\\z/\n :decimal\n when \"bytea\"\n :blob\n end\n end",
"def sql_type\n self['sql_type']\n end",
"def java_types(params)\n return nil if params.nil?\n\n params.map {|e| e.class.java_class.name }.to_java(:string)\n end",
"def java_type\n Jrodb::Type.java_type_for(type)\n end",
"def type_map\n @type_map ||= PG::BasicTypeMapForResults.new(connection.raw_connection)\n end",
"def lookup_cpptype(t) t = @@typemap[t] and return t end",
"def sql_type=(val)\n self['sql_type'] = val\n end",
"def klass\n case type\n when :integer, :long then Fixnum\n when :float then Float\n when :double then BigDecimal\n when :timestamp, :time, :datetime then Time\n when :date then Date\n when :text, :string, :binary, :ascii then String\n when :boolean then Object\n when :uuid then ::Cql::TimeUuid\n when :list then DatastaxRails::Types::DynamicList\n when :set then DatastaxRails::Types::DynamicSet\n when :map then DatastaxRails::Types::DynamicMap\n end\n end",
"def setup_type_convertor_map\n super\n @type_convertor_map[Java::JavaSQL::Types::INTEGER] = @type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @basic_type_convertor_map[Java::JavaSQL::Types::INTEGER] = @basic_type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @type_convertor_map[Java::JavaSQL::Types::DATE] = lambda do |r, i|\n if v = r.getString(i)\n Sequel.string_to_date(v)\n end\n end\n @type_convertor_map[Java::JavaSQL::Types::BLOB] = lambda do |r, i|\n if v = r.getBytes(i)\n Sequel::SQL::Blob.new(String.from_java_bytes(v))\n elsif !r.wasNull\n Sequel::SQL::Blob.new('')\n end\n end\n end",
"def default_input_type(attribute_name, column, options); end",
"def find_type(record)\n klass = OBSERVE_CLASSES.find{|k| record.kind_of?(k)}\n return unless klass\n klass.name.underscore\n end",
"def column(name, type)\n @fields.merge!(name => type.to_s)\n end",
"def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n super\n end\n end",
"def type\n @ar_column_info.type\n end",
"def mapping_class=(mapping_class)\n @mapping_class = mapping_class \n end",
"def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end",
"def identifier_type_mapping_obj\n return nil if identifier_type.blank?\n\n IdentifierTypesToMapping[identifier_type]\n end",
"def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end",
"def default_input_type(method) #:nodoc:\n column = column_info(method)\n\n if column\n # handle the special cases where the column type doesn't map to an input method\n return :time_zone if column.type == :string && method.to_s =~ /time_zone/\n return :select if column.type == :integer && method.to_s =~ /_id$/\n return :datetime if column.type == :timestamp\n return :numeric if [:integer, :float, :decimal].include?(column.type)\n return :password if column.type == :string && method.to_s =~ /password/\n #return :country if column.type == :string && method.to_s =~ /country/\n\n # otherwise assume the input name will be the same as the column type (eg string_input)\n return column.type\n else\n if @object\n #return :select if find_reflection(method)\n \n file = @object.send(method) if @object.respond_to?(method)\n if file && @@file_methods.any? { |m| file.respond_to?(m) }\n if file.styles.keys.empty?\n return :file\n else\n return :image_file\n end\n end\n end\n\n return :password if method.to_s =~ /password/\n return :string\n end\n end",
"def mapper #:nodoc:\n @mapper.mapper_type\n end",
"def ensure_proper_type\n klass = self.class\n if klass.finder_needs_type_condition?\n _write_attribute(klass.inheritance_column, klass.sti_name)\n end\n end",
"def ensure_proper_type\n klass = self.class\n if klass.finder_needs_type_condition?\n _write_attribute(klass.inheritance_column, klass.sti_name)\n end\n end",
"def find_globalized_column_class_for(record, attribute)\n if record.respond_to?(:translation_class) && record.translated_attribute_names.include?(attribute)\n record.translation_class\n else\n nil\n end\n end",
"def getCSharpType( type )\n\n entry = $typeTable.select{ |a| a.first == type }\n if( entry.empty? )\n return nil\n end\n return entry[0]\nend",
"def as_sql_type\n case @type\n when '01'\n \"#{@name} INT NULL, INDEX(#{@name})\"\n when '1'\n \"#{@name} INT NOT NULL, INDEX(#{@name})\"\n end\n end",
"def type_name\n self['type_name']\n end",
"def column\n cast_type = ActiveRecord::Base.connection.send(:lookup_cast_type, definition)\n metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(\n type: cast_type.type,\n sql_type: definition,\n limit: cast_type.limit\n )\n mysql_metadata = ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata.new(metadata)\n @column ||= self.class.column_factory.new(\n name,\n default_value,\n mysql_metadata,\n null_value\n )\n end",
"def get_has_property_data_type(name)\n \"HasProperty::DataTypes::#{name.to_s.camelize}\".constantize\n end",
"def map_datapackage_column_types(datapackage_json, csv_name)\n csv_dp_detail = datapackage_json[\"resources\"].detect{ |a| a[\"path\"] == csv_name }\n dp_column_types = {}\n csv_dp_detail[\"schema\"][\"fields\"].each do |sf|\n dp_column_types[sf[\"name\"]] = DATAPACKAGE_TYPE_MAP[sf[\"type\"]]\n end\n dp_column_types\n end",
"def initialize_type_map(m)\n m.register_type %r{.*}, SQLServer::Type::UnicodeString.new\n # Exact Numerics\n register_class_with_limit m, 'bigint(8)', SQLServer::Type::BigInteger\n m.alias_type 'bigint', 'bigint(8)'\n register_class_with_limit m, 'int(4)', SQLServer::Type::Integer\n m.alias_type 'integer', 'int(4)'\n m.alias_type 'int', 'int(4)'\n register_class_with_limit m, 'smallint(2)', SQLServer::Type::SmallInteger\n m.alias_type 'smallint', 'smallint(2)'\n register_class_with_limit m, 'tinyint(1)', SQLServer::Type::TinyInteger\n m.alias_type 'tinyint', 'tinyint(1)'\n m.register_type 'bit', SQLServer::Type::Boolean.new\n m.register_type %r{\\Adecimal}i do |sql_type|\n scale = extract_scale(sql_type)\n precision = extract_precision(sql_type)\n SQLServer::Type::Decimal.new precision: precision, scale: scale\n end\n m.alias_type %r{\\Anumeric}i, 'decimal'\n m.register_type 'money', SQLServer::Type::Money.new\n m.register_type 'smallmoney', SQLServer::Type::SmallMoney.new\n # Approximate Numerics\n m.register_type 'float', SQLServer::Type::Float.new\n m.register_type 'real', SQLServer::Type::Real.new\n # Date and Time\n m.register_type 'date', SQLServer::Type::Date.new\n m.register_type 'datetime', SQLServer::Type::DateTime.new\n m.register_type %r{\\Adatetime2}i do |sql_type|\n precision = extract_precision(sql_type)\n SQLServer::Type::DateTime2.new precision: precision\n end\n m.register_type %r{\\Adatetimeoffset}i do |sql_type|\n precision = extract_precision(sql_type)\n SQLServer::Type::DateTimeOffset.new precision: precision\n end\n m.register_type 'smalldatetime', SQLServer::Type::SmallDateTime.new\n m.register_type %r{\\Atime}i do |sql_type|\n scale = extract_scale(sql_type)\n precision = extract_precision(sql_type)\n SQLServer::Type::Time.new precision: precision\n end\n # Character Strings\n register_class_with_limit m, %r{\\Achar}i, SQLServer::Type::Char\n register_class_with_limit m, %r{\\Avarchar}i, SQLServer::Type::Varchar\n m.register_type 'varchar(max)', SQLServer::Type::VarcharMax.new\n m.register_type 'text', SQLServer::Type::Text.new\n # Unicode Character Strings\n register_class_with_limit m, %r{\\Anchar}i, SQLServer::Type::UnicodeChar\n register_class_with_limit m, %r{\\Anvarchar}i, SQLServer::Type::UnicodeVarchar\n m.alias_type 'string', 'nvarchar(4000)'\n m.register_type 'nvarchar(max)', SQLServer::Type::UnicodeVarcharMax.new\n m.register_type 'ntext', SQLServer::Type::UnicodeText.new\n # Binary Strings\n register_class_with_limit m, %r{\\Abinary}i, SQLServer::Type::Binary\n register_class_with_limit m, %r{\\Avarbinary}i, SQLServer::Type::Varbinary\n m.register_type 'varbinary(max)', SQLServer::Type::VarbinaryMax.new\n # Other Data Types\n m.register_type 'uniqueidentifier', SQLServer::Type::Uuid.new\n m.register_type 'timestamp', SQLServer::Type::Timestamp.new\n end",
"def jonize(name, clazz, options = {})\n name = name.to_sym\n name_before_type_cast = \"#{name}_before_type_cast\"\n\n options[:name] = name\n options[:class] ||= clazz\n\n alias_name = options[:alias]\n\n attribute_meta = meta.attributes[name]\n\n # In case we override the attribute.\n if attribute_meta\n attribute_meta.merge!(options)\n else\n attribute_meta = meta.attributes[name] = Jo::Meta.new(options)\n\n inheritance_column = if attribute_meta.polymorphism?\n options[:inheritance_column] || \"#{name}_type_id\"\n end\n\n instance = \"@#{name}\"\n instance_before_type_cast = \"@#{name}_before_type_cast\"\n\n class_eval do\n validate_jo_family(name, attribute_meta)\n\n define_method(name) do\n if instance_variable_defined?(instance)\n instance_variable_get(instance)\n else\n type_casted_object = Jo::Helper.type_cast(send(name_before_type_cast), attribute_meta)\n type_casted_object = Jo::Helper.bind(type_casted_object, attribute_meta, self, name)\n\n instance_variable_set(instance, type_casted_object)\n end\n end\n\n define_method(\"#{name}=\") do |object|\n object = Jo::Helper.to_jo(object, attribute_meta)\n type_casted_object = Jo::Helper.type_cast(object, attribute_meta)\n\n if type_casted_object != send(name)\n send(\"#{name}_will_change!\")\n\n type_casted_object = Jo::Helper.bind(type_casted_object, attribute_meta, self, name)\n\n instance_variable_set(instance, type_casted_object)\n instance_variable_set(instance_before_type_cast, object)\n end\n end\n\n define_method(name_before_type_cast) do\n if instance_variable_defined?(instance_before_type_cast)\n instance_variable_get(instance_before_type_cast)\n else\n object = read_attribute(name)\n\n object = nil if object.is_a?(String) && object.blank?\n\n object = Jo::Helper.to_jo(object, attribute_meta)\n\n object = attribute_meta.class.new if object.nil?\n\n instance_variable_set(instance_before_type_cast, object)\n end\n end\n\n define_method(\"type_cast_#{name}_object\") do |object|\n Jo::Helper.type_cast_object(object, attribute_meta)\n end\n\n # Write the jo to column before save if there are changes.\n before_save :if => \"#{name}_changed?\" do |model|\n object = send(name)\n\n if attribute_meta.polymorphism?\n object.type_id = object.class.type_ids[object.class] if object\n\n write_attribute(\"#{inheritance_column}\", object && object.type_id)\n end\n\n object = Jo::Helper.to_serialized_jo(object, attribute_meta)\n\n write_attribute(name, object.present? ? object.to_json : nil)\n\n true\n end\n\n after_save :if => \"#{name}_changed?\" do |model|\n object = send(name)\n\n if object\n object.saved! if attribute_meta.base?\n object.map_values(&:saved!) if (attribute_meta.array? || attribute_meta.hash?) && attribute_meta.object_base?\n end\n\n true\n end\n end\n end\n\n\n class_eval do\n if alias_name && alias_name != name\n alias_method alias_name, name\n alias_method \"#{alias_name}=\", \"#{name}=\"\n end\n end\n\n end",
"def builtin_inheritance_column # :nodoc:\n # Can this be made less brittle?\n if self == ActiveRecord::Base\n 'type'\n else\n (@builtin_inheritance_column ||= nil) || superclass.builtin_inheritance_column\n end\n end",
"def datatype\n @options[:datatype] || (@column ? @column.type : nil)\n end",
"def add_type_validation(column_name, options)\n return unless options[:validate_type]\n\n type = options[:type]\n class_eval { validates column_name, :\"#{type.to_s.underscore}_format\" => true, allow_blank: true }\n end",
"def creature_type(name)\n puts \"Looking for name #{name}\"\n org.bukkit.entity.EntityType.from_name(name.to_s)\n end",
"def compute_type(type_name)\n type_name.constantize\n end",
"def as_java_type(string)\n type = primitive? string\n return type if type\n\n if string.is_a?(Java::OrgJrubyAstJava_signature::ReferenceTypeNode)\n return eval make_class_jiable(string.getFullyTypedName())\n end\n\n # If annotation makes it in strip @ before we try and match it.\n string = string[1..-1] if string.start_with? '@'\n\n eval make_class_jiable(string)\n end",
"def choose_sql_type(type_name, value_constraint, component, options)\n case MM::DataType.intrinsic_type(type_name)\n when MM::DataType::TYPE_Boolean\n data_type_context.boolean_type\n\n when MM::DataType::TYPE_Integer\n # The :auto_assign key is set for auto-assigned types, but with a nil value in foreign keys\n length = options[:length]\n if options.has_key?(:auto_assign)\n options[:default] ||= ' GENERATED ALWAYS AS IDENTITY' if options[:auto_assign]\n length = data_type_context.default_autoincrement_length\n type_name = 'int'\n end\n if chosen = MM::DataType.choose_integer(type_name, length, value_constraint, data_type_context)\n options.delete(:length)\n chosen\n else # No available integer seems to suit. Use the defined type and length\n type_name\n end\n\n when MM::DataType::TYPE_Real\n 'Double'\n\n when MM::DataType::TYPE_Decimal\n 'Decimal'\n\n when MM::DataType::TYPE_Money\n 'Currency'\n\n when MM::DataType::TYPE_Char\n data_type_context.default_char_type\n\n when MM::DataType::TYPE_String\n data_type_context.default_varchar_type\n\n when MM::DataType::TYPE_Text\n options[:length] ||= 'MAX'\n data_type_context.default_text_type\n\n when MM::DataType::TYPE_Date\n 'Date'\n\n when MM::DataType::TYPE_Time\n 'Time'\n\n when MM::DataType::TYPE_DateTime\n 'DateTime'\n\n when MM::DataType::TYPE_Timestamp\n 'Binary'\n\n when MM::DataType::TYPE_Binary\n # If it's a surrogate, that might change the length we use\n binary_surrogate(type_name, value_constraint, options)\n if options[:length]\n 'Binary' # Fixed length\n else\n 'Binary'\n end\n else\n type_name\n end\n end",
"def initialize_type_map(m = type_map) # :nodoc:\n register_class_with_limit m, 'int2', Type::Integer\n register_class_with_limit m, 'int4', Type::Integer\n register_class_with_limit m, 'int8', Type::Integer\n m.alias_type 'oid', 'int2'\n m.register_type 'float4', Type::Float.new\n m.alias_type 'float8', 'float4'\n m.register_type 'text', Type::Text.new\n register_class_with_limit m, 'varchar', Type::String\n m.alias_type 'char', 'varchar'\n m.alias_type 'name', 'varchar'\n m.alias_type 'bpchar', 'varchar'\n m.register_type 'bool', Type::Boolean.new\n m.alias_type 'timestamptz', 'timestamp'\n m.register_type 'date', Type::Date.new\n\n m.register_type 'timestamp' do |_, _, sql_type|\n precision = extract_precision(sql_type)\n OID::DateTime.new(precision: precision)\n end\n\n m.register_type 'numeric' do |_, fmod, sql_type|\n precision = extract_precision(sql_type)\n scale = extract_scale(sql_type)\n\n # The type for the numeric depends on the width of the field,\n # so we'll do something special here.\n #\n # When dealing with decimal columns:\n #\n # places after decimal = fmod - 4 & 0xffff\n # places before decimal = (fmod - 4) >> 16 & 0xffff\n if fmod && (fmod - 4 & 0xffff).zero?\n # Remove this class, and the second argument to lookups on PG\n Type::DecimalWithoutScale.new(precision: precision)\n else\n OID::Decimal.new(precision: precision, scale: scale)\n end\n end\n end",
"def type_literal_generic_falseclass(column)\n type_literal_generic_trueclass(column)\n end"
] |
[
"0.68826586",
"0.6616182",
"0.65956",
"0.6566813",
"0.6552976",
"0.64582145",
"0.64322907",
"0.6280331",
"0.6280331",
"0.61629206",
"0.61547333",
"0.61547333",
"0.6148046",
"0.611967",
"0.6104372",
"0.6080398",
"0.5972758",
"0.597159",
"0.59491104",
"0.5920291",
"0.5864119",
"0.5861115",
"0.58557826",
"0.5835379",
"0.5814402",
"0.58125204",
"0.5811386",
"0.5804072",
"0.5799628",
"0.5798321",
"0.5761695",
"0.574492",
"0.57311016",
"0.5713876",
"0.5713603",
"0.5711677",
"0.57083946",
"0.5656653",
"0.56356037",
"0.56356037",
"0.5635209",
"0.5613528",
"0.56090313",
"0.5583674",
"0.5581719",
"0.55756456",
"0.55718035",
"0.55621797",
"0.5558671",
"0.5555288",
"0.5553969",
"0.553346",
"0.5533007",
"0.55154675",
"0.55013704",
"0.54979694",
"0.547842",
"0.5465809",
"0.5457906",
"0.5457406",
"0.5427673",
"0.5424422",
"0.5417821",
"0.541186",
"0.5408193",
"0.5403836",
"0.54018074",
"0.5388025",
"0.53840595",
"0.53750026",
"0.53748906",
"0.5371744",
"0.5360561",
"0.53498495",
"0.5346446",
"0.53440374",
"0.5343925",
"0.53336143",
"0.5330956",
"0.53300226",
"0.53293824",
"0.5329372",
"0.53184414",
"0.5312328",
"0.5311029",
"0.53068435",
"0.5298803",
"0.5291991",
"0.5287084",
"0.5282369",
"0.52817804",
"0.5269341",
"0.5261484",
"0.5256283",
"0.5246677",
"0.5240179",
"0.5233205",
"0.52241814",
"0.5221068",
"0.5215086"
] |
0.6414151
|
7
|
Return a source snippet for initializing a Flex variable
|
def flex_default_from(column_type)
@defaultvaluemap[column_type] ||= "MISSING in template_processor.rb=#{column_type}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend",
"def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend",
"def lex_en_expr_variable=(_arg0); end",
"def lex_en_expr_variable=(_arg0); end",
"def lex_en_expr_variable=(_arg0); end",
"def initialize variable_name, layout\n @variable = variable_name\n @layout = layout\n end",
"def vardecl \n\t\n\t$cst.add_branch(\"VarDecl\")\n\t\n\ttype\n\tid\n\t\n\t$cst.ascend\n\nend",
"def variable\n @variable ||= \"@#{@name}\"\n end",
"def compilevardec\n\n end",
"def init_var(var, value)\n # instance_var_name starts with @, var_name doesn't.\n var = var.to_s\n var_name = (var.start_with?('@') ? var[1..-1] : var).to_sym\n instance_var_name = \"@#{var_name}\".to_sym\n\n instance_variable_set(instance_var_name, value)\n\n Document.send(:define_method, var_name) do\n instance_variable_get(instance_var_name)\n end\n end",
"def lex_en_expr_variable; end",
"def lex_en_expr_variable; end",
"def lex_en_expr_variable; end",
"def initvars\n @lexer = Puppet::Parser::Lexer.new\n end",
"def gen_lenptr var, ptr, len\n name = $namespace.new var\n name.declaration = \"static sourcecode_t #{name}\"\n name.definition = sprintf '%s = { %#05x, %s, };',\n name.declaration, len, ptr\n name\n end",
"def from &code\n @vars = Variabler.new\n sexp = code.to_sexp(strip_enclosure: true)\n sourcecode = statements(sexp)\n pp sexp\n return @vars.sourcecode + NL + sourcecode\n end",
"def variable; end",
"def variable; end",
"def declare_init(variable, name)\r\n @init << variable.declare(name)\r\n end",
"def compile_falluto_var_decl_node node\n v = Falluto::NuSMV::Variable.new node.name, node.vartype\n @context.current_module.add_variable v\n compile_treetop_runtime_syntax_node node\n end",
"def compile_var_declaration\n write_tag '<varDec>'\n consume(TokenType::VAR)\n compile_type\n consume(TokenType::IDENTIFIER)\n while check?(',')\n consume(',')\n consume(TokenType::IDENTIFIER)\n break if check?(';')\n end\n consume(';')\n write_tag '</varDec>'\n end",
"def full_source=(_arg0); end",
"def _reduce_542(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def get_assign_variable(code)\n return code[1][1]\n end",
"def render_variable(context); end",
"def variable_node; end",
"def main_variable ; end",
"def init_vars\r\n @page = Application.current.root_visual\r\n @functions = @page.find_name('Functions')\r\n @definitions = @page.find_name('FunctionDefinitions')\r\n @valid = \"def foo(x):\\n return x + 2\\n\\ndef baz(x):\\n return x + 4\\n\\n\"\r\n @invalid = \"def foo(x)\"\r\n class << @functions\r\n def update_text(val)\r\n self.text = val\r\n Application.current.root_visual.Functions_TextChanged nil, nil\r\n end\r\n end\r\nend",
"def compile_falluto_assignment_node node\n variable = node.variable\n value = node.value\n @context.variable = variable\n %Q| next(#{@context.variable}) := #{compile value};\\n|\n end",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_541(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_603(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def set_ivar\n <<-CODE\n next_literal;\n t2 = stack_pop();\n object_set_ivar(state, c->self, _lit, t2);\n stack_push(t2);\n CODE\n end",
"def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end",
"def assemble\n # var a, b, c;\n \"var \" + @locals.join(\", \") + \";\\n\" +\n @code.join\n end",
"def var\n @_var ||= MXNet::Symbol.var(@name, shape: shape, dtype: dtype,\n lr_mult: lr_mult, wd_mult: wd_mult,\n init: @init) # FIXME: init -> initializer\n end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def get_declaration(varSec, bld)\n if varSec.elementId == CodeElem::ELEM_VARIABLE && varSec.genSet == true\n funName = Utils.instance.getStyledFunctionName(\"get \" + varSec.name)\n varName = Utils.instance.getStyledVariableName(varSec)\n bld.add(\"const \" + Utils.instance.getTypeName(varSec) + \"& \" + funName)\n bld.sameLine(\"() const\\t{ return(\" + varName + \"); };\")\n end\n end",
"def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_610(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def source_helper(source_location, name = T.unsafe(nil)); end",
"def initialize\n @ivar = \"ivar\"\n end",
"def variable_name; end",
"def variable_name; end",
"def literal; end",
"def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 196:7: 'var'\n match( \"var\" )\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__, 75 )\n\n end",
"def init_variable(hash)\n @distance = hash[:distance].nil? ? 1 : hash[:distance]\n @variable = hash[:var]\n @need_popup = hash[:open_popup]\n @popup = eval(hash[:popup]) if hash[:popup]\n @default = 0 if @default.nil?\n if hash[:values].nil?\n @values = []\n @max = hash[:max]\n for i in 0..@max\n @values.push(i)\n end\n else\n @values = hash[:values]\n @max = @values.size\n end\n end",
"def build_var *args\n line = \"#{args[0]}\"\n # bracket [] any additional arguments\n line << \" [#{args[1...args.length].join('] [')}]\" if args.length > 1\n line\n end",
"def k_var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = K_VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 357:4: 'var'\n match( \"var\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n\n end",
"def createVarFor(cls, plugName)\r\n plugClass = cls.model.findClassModel(plugName)\r\n plug = XCTEPlugin::findClassPlugin(@langProfile.name, plugName)\r\n\r\n if (plugClass == nil)\r\n Log.debug(\"Class not found for \" + plugName)\r\n return nil\r\n end\r\n if (plug == nil)\r\n Log.debug(\"Plugin not found for \" + plugName)\r\n return nil\r\n end\r\n\r\n newVar = CodeStructure::CodeElemVariable.new(nil)\r\n newVar.utype = plug.getUnformattedClassName(plugClass)\r\n newVar.name = newVar.utype\r\n\r\n return newVar\r\n end",
"def set_variable\n var_name=EvalBlock.lasgn(expression)\n self.variable=var_name.present? ? Variable.find_or_create_by(game: game, name: var_name) : nil\n end",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def precompiled_template(locals = {})\n @src\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end",
"def declaration=(_arg0); end",
"def var name\n Symbolic.check_name name\n var = VarExpr.new(name)\n meta_def name do\n var\n end\n var\n end",
"def local_variables() end",
"def initialize(source_string='')\n @source = source_string\n end",
"def variable(string)\n init\n\n email_domain = \"spriteymail.net\"\n if has_env_or_config?(\"email_domain\")\n email_domain = env_or_config(\"email_domain\")\n end\n random_uuid = SecureRandom.hex\n\n # Prepare current values.\n values = {}\n LapisLazuli::PLACEHOLDERS.each do |placeholder, value|\n values[placeholder] = eval value[0]\n end\n\n return string % values\n end",
"def get_definition(codeClass, cfg)\n conDef = String.new\n indent = \" \"\n\n conDef << indent << \"# Constructor\\n\"\n\n conDef << indent << \"def initialize()\\n\"\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if var.defaultValue != nil\n conDef << indent << \" @\" << var.name << \" = \"\n\n if var.vtype == \"String\"\n conDef << \"\\\"\" << var.defaultValue << \"\\\"\"\n else\n conDef << var.defaultValue << \"\"\n end\n\n if var.comment != nil\n conDef << \"\\t# \" << var.comment\n end\n\n conDef << \"\\n\"\n end\n end\n end\n\n conDef << indent << \"end # initialize\\n\\n\";\n\n return(conDef);\n end",
"def _reduce_587(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_601(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end",
"def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def _reduce_609(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def initialize\n @instr_type = MACRO\n @sym_name = UNINITIALIZED\n @args = UNINITIALIZED\n \n @addr = UNINITIALIZED\n end",
"def source_location=(_arg0); end",
"def var\n @var_helper ||= SimpleTk::GetSetHelper.new(self, :@stkw_var_list, true, :value, :value=)\n end",
"def getVarDec(var, varPrefix = \"\")\n vDec = String.new\n\n vDec << \"[\" + CodeNameStyling.getStyled(varPrefix + var.name, @langProfile.variableNameStyle) + \"]\"\n\n tName = getTypeName(var)\n\n if tName != var.vtype\n vDec << \" \" + tName\n if (var.identity)\n vDec << \" IDENTITY\" << var.identity\n end\n else\n vDec << \"TEXT\"\n end\n\n return vDec\n end",
"def variable_name_expr; end",
"def a\r\n test = 123\r\nend",
"def initialize(source, namespace = T.unsafe(nil)); end",
"def getVarDec(var)\n vDec = String.new\n typeName = String.new\n\n if var.isConst\n vDec << \"const \"\n end\n\n if var.isStatic\n vDec << \"static \"\n end\n\n vDec << getStyledVariableName(var)\n vDec << \": \" + getTypeName(var)\n\n if (var.defaultValue != nil)\n vDec << \" = \" << var.defaultValue\n end\n\n vDec << \";\"\n\n if var.comment != nil\n vDec << \"\\t/** \" << var.comment << \" */\"\n end\n\n return vDec\n end",
"def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end",
"def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end",
"def variable_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n return_value = VariableStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal38 = nil\n variable_declaration39 = nil\n\n tree_for_string_literal38 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 70:5: ^( 'var' ( variable_declaration )+ )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal38 = match( VAR, TOKENS_FOLLOWING_VAR_IN_variable_statement_326 )\n\n tree_for_string_literal38 = @adaptor.copy_node( string_literal38 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal38, root_1 )\n\n\n\n match( DOWN, nil )\n # at file 70:14: ( variable_declaration )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == ASGN || look_8_0 == ID )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 70:14: variable_declaration\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_declaration_IN_variable_statement_328 )\n variable_declaration39 = variable_declaration\n @state.following.pop\n\n @adaptor.add_child( root_1, variable_declaration39.tree )\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 11 )\n\n end\n \n return return_value\n end",
"def init_variable(hash)\n @distance = hash[:distance].nil? ? 1 : hash[:distance]\n @variable = hash[:var]\n @need_popup = hash[:open_popup]\n @popup = eval(hash[:popup]) if hash[:popup]\n @default = 0 if @default.nil? && !hash[:not_initialize]\n if hash[:values].nil?\n @values = []\n @max = hash[:max]\n @min = hash[:min] if hash[:min]\n (@min..@max).each { |i|\n @values.push(i)\n }\n else\n @values = hash[:values]\n @max = @values.size - 1\n end\n end",
"def intro_to_variables\n expression = \"Ruby is Elegant.\" #Local Varible\n puts expression\nend",
"def type\n :variable\n end",
"def gen_get_variable(code_array, name)\n if name.kind_of?(JSValue)\n assert(name.type == :identifier)\n name = name.value\n end\n\n res = resolve_variable(name)\n if res\n type, link, idx = res\n if link == 0\n code_array.push(type == :formal ? :INSN_GETFORMAL : :INSN_GETLVAR)\n code_array.push(idx)\n else\n code_array.push(type == :formal ? :INSN_GETFORMALEX : :INSN_GETLVAREX)\n code_array.push(link)\n code_array.push(idx)\n end\n else\n # global variable\n code_array.push(:INSN_GETGLOBAL)\n code_array.push(:INSN_CONST)\n code_array.push(JSValue.new_string(name))\n code_array.push(:INSN_GETPROP)\n end\n end",
"def generate_source\n b = binding\n @generated_code = ERB.new(@artifact.code).result(b)\n end",
"def compile_script_string\n @sources.string\n end",
"def getVarDec(var)\n vDec = String.new\n typeName = String.new\n\n if var.isConst\n vDec += \"const \"\n end\n\n if var.isStatic\n vDec += \"static \"\n end\n\n vDec += getTypeName(var)\n\n if var.isPointer\n vDec += \"*\"\n end\n\n if var.passBy.upcase == \"REFERENCE\"\n vDec += \"&\"\n end\n\n vDec += \" \" + getStyledVariableName(var)\n\n if var.arrayElemCount.to_i > 0\n vDec += \"[\" + getSizeConst(var) + \"]\"\n end\n\n vDec += \";\"\n\n if var.comment != nil\n vDec += \"\\t/** \" + var.comment + \" */\"\n end\n\n return vDec\n end",
"def _reduce_712(val, _values, result)\n _, (id, line) = val\n identifier = id.to_sym\n\n self.env[identifier] = :lvar\n result = [\"&#{identifier}\".to_sym, line]\n\n result\nend"
] |
[
"0.6435515",
"0.6435515",
"0.6079845",
"0.6079845",
"0.6079845",
"0.6007315",
"0.5888799",
"0.5875815",
"0.57994664",
"0.57475376",
"0.57456684",
"0.57456684",
"0.57456684",
"0.571577",
"0.5713784",
"0.5645336",
"0.56447864",
"0.56447864",
"0.564044",
"0.55978996",
"0.5594771",
"0.55904764",
"0.5575747",
"0.55740356",
"0.5567061",
"0.5565947",
"0.55610174",
"0.5542376",
"0.5518966",
"0.5515069",
"0.5515069",
"0.5515069",
"0.5514363",
"0.55119324",
"0.55119324",
"0.55119324",
"0.5484007",
"0.5484007",
"0.5484007",
"0.5482404",
"0.54784346",
"0.5471562",
"0.5461694",
"0.54383147",
"0.5419267",
"0.5419267",
"0.5419267",
"0.5419267",
"0.5419267",
"0.5417854",
"0.54114276",
"0.54114276",
"0.54025495",
"0.53972477",
"0.5396144",
"0.53931636",
"0.53931636",
"0.539244",
"0.5383477",
"0.53833365",
"0.53770405",
"0.537257",
"0.5371475",
"0.5360596",
"0.53601825",
"0.53601825",
"0.53601825",
"0.534694",
"0.5344429",
"0.53425515",
"0.5341006",
"0.5339724",
"0.5335558",
"0.5334697",
"0.5333451",
"0.53314424",
"0.53214306",
"0.53150177",
"0.5307829",
"0.5306794",
"0.5306794",
"0.5306665",
"0.52956116",
"0.529514",
"0.5295029",
"0.52927023",
"0.52921647",
"0.52820003",
"0.5269688",
"0.5269117",
"0.5267906",
"0.5267906",
"0.5265062",
"0.52641124",
"0.5253964",
"0.5245419",
"0.52407455",
"0.5239799",
"0.5239335",
"0.5231406",
"0.52219254"
] |
0.0
|
-1
|
what kind of thing a variable is before using it.
|
def setup
size 200, 200
count = 0 # count gets assigned 0, an integer (Fixnum)
letter = 'a' # letter gets the letter 'a', a String
d = 132.32 # d gets the decimal 132.32, a Float (floating-point number)
happy = false # happy gets false, a Boolean (true or false)
x = 4.0 # x gets 4.0, another Float
y = nil # y gets nil, which stands for nothing
y = x + 5.2 # assign the value of x plus 5.2 to y
z = x * y + 15.0 # z gets the value of x times y plus 15.0 (or 51.8)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def type\n :variable\n end",
"def kind_of(kind)\n case kind\n when 'var'\n 'local'\n when 'field'\n 'this'\n else\n kind\n end\n end",
"def kind\n parser_for(:variable_kind, variable_attributes) || \"secret\"\n end",
"def variable; end",
"def variable; end",
"def variable_name; end",
"def variable_name; end",
"def my_var\n\ta = 10\n\tb = \"10\"\n\tc = \"dix\"\n\td = 10.0\n\tputs \"mes variables :\"\n\tputs \"\\ta contient : #{a} et est de type: #{a.class}\"\n\tputs \"\\tb contient : #{b} et est de type: #{b.class}\"\n\tputs \"\\tc contient : #{c} et est de type: #{c.class}\"\n\tputs \"\\td contient : #{d} et est de type: #{d.class}\"\nend",
"def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"def var_type(klass=self, var, typ)\n raise RuntimeError, \"Variable cannot begin with capital\" if var.to_s =~ /^[A-Z]/\n return if var.to_s =~ /^[a-z]/ # local variables handled specially, inside type checker\n raise RuntimeError, \"Global variables can't be typed in a class\" unless klass = self\n klass = RDL::Util::GLOBAL_NAME if var.to_s =~ /^\\$/\n unless RDL.info.set(klass, var, :type, RDL.parser.scan_str(\"#T #{typ}\"))\n raise RuntimeError, \"Type already declared for #{var}\"\n end\n nil\n end",
"def check_superclass(var)\n puts \"#{var} --> #{var.superclass}\"\nend",
"def variable_type\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 60:3: ( (a= ( TYPE_FLOAT | TYPE_INT | TYPE_BOOL | TYPE_STRING ) ) | (a= ( TYPE_VOID | IDENT ) ) )\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0.between?( TYPE_BOOL, TYPE_STRING ) )\n alt_20 = 1\n elsif ( look_20_0 == IDENT || look_20_0 == TYPE_VOID )\n alt_20 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 20, 0 )\n\n end\n case alt_20\n when 1\n # at line 60:5: (a= ( TYPE_FLOAT | TYPE_INT | TYPE_BOOL | TYPE_STRING ) )\n # at line 60:5: (a= ( TYPE_FLOAT | TYPE_INT | TYPE_BOOL | TYPE_STRING ) )\n # at line 60:7: a= ( TYPE_FLOAT | TYPE_INT | TYPE_BOOL | TYPE_STRING )\n a = @input.look\n\n if @input.peek( 1 ).between?( TYPE_BOOL, TYPE_STRING )\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a.text.capitalize \n # <-- action\n end\n\n\n\n when 2\n # at line 66:5: (a= ( TYPE_VOID | IDENT ) )\n # at line 66:5: (a= ( TYPE_VOID | IDENT ) )\n # at line 66:7: a= ( TYPE_VOID | IDENT )\n a = @input.look\n\n if @input.peek(1) == IDENT || @input.peek(1) == TYPE_VOID\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a.text \n # <-- action\n end\n\n\n\n end\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__, 9 )\n\n\n end\n\n return value\n end",
"def print var_name\n v = @var_table[var_name]\n if v.class == Array\n @upstream.info \"Array: #{v.length}: #{@var_table[var_name].inspect}\"\n elsif v.class == Fixnum\n @upstream.info \"Integer: #{v}\"\n elsif v.nil?\n @upstream.info \"nil\"\n end\n end",
"def type\n @@type\n end",
"def type\n @@type\n end",
"def what_is thing\n $things[thing] && $things[thing].map{|t| what_is(t)}.flatten || [thing]\nend",
"def type() end",
"def [](var)\n return @env[var][:type]\n end",
"def kind_of\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n if(ISA(t1, t2)) {\n stack_push(Qtrue);\n } else {\n stack_push(Qfalse);\n }\n CODE\n end",
"def get_variable(type, value)\n # initialize\n var = 0\n # branch handling based on variable type\n case type\n when VARGame # game variable\n # variable is the game variable\n var = $game_variables[value]\n when VARCombo # combo variable\n # variable is the combo variable\n var = @variables[value]\n when VARCharacter # character variable\n # branch handling based on value type\n case value\n when VALHp # battler hp\n # variable is the battler's hp\n var = @ch.battler.hp\n when VALSp # battler sp\n # variable is the battler's hp\n var = @ch.battler.sp\n when VALMaxHp # battler max hp\n # variable is the battler's max hp\n var = @ch.battler.maxhp\n when VALMaxSp # battler max sp\n # variable is the battler's max sp\n var = @ch.battler.maxsp\n when VALState # battler states\n # variable is the amount of states on battler\n var = @ch.battler.states.size\n when VALExp # battler exp\n # variable is the battler's exp\n var = @ch.battler.exp\n when VALLevel # battler level\n # variable is the battler's level\n var = @ch.battler.level\n when VALTile # tile id\n # variable is the character's current tile\n var = @ch.tile_id\n when VALDirection # battler direction\n # variable is the character's current direction\n var = @ch.direction\n end\n when VARInput # input\n # variable is input success\n var = @inputs[value][3]\n when VARConstant # constant\n # variable is just the value given\n var = value\n when VARScript # script\n # variable is just the script given\n var = eval(value)\n end\n return var\n end",
"def typeOf _args\n \"typeOf _args;\" \n end",
"def internal_object_get_typeword\n raise \"failed init for #{self.class}\" unless @memory\n @memory[0]\n end",
"def get_variabletype(name, attribute)\n Object.const_get(name).new.get_variabletype(attribute)\n end",
"def say_my_name\n\t# my_name is a local variable\n\t# variable is not initialized!\n\t# doesn't have any value!\n\t# And doesn't have a type \n\tputs my_name\nend",
"def variable?\n not constant?\n end",
"def fetch_upstream_primitive(attr)\n registered_properties[attr].type\n end",
"def variable\n @variable ||= \"@#{@name}\"\n end",
"def refurbish variable_name\n Value.typed @vars[variable_name], variable_name.to_s.sub(/^\\@/, '') #.sub(/^\\$/, '')\n end",
"def my_var()\n hash = { a: 10, b: 10.to_s, c: nil, d: 10.0 }\n puts \"my variables :\"\n hash.each { |key, val| \n puts \"\\t #{key} contains: #{val.nil? ? val.inspect : val.to_s} and is a type : #{val.class}\"\n }\nend",
"def whatami( obj )\n\tputs \"#{obj.to_s} is a #{obj.class}\"\nend",
"def instance_variable_name; end",
"def variable_type(tentative_ok = false)\n return @vartype if @vartype\n\n @logger.debug(\"Starting var query on #{@name}...\")\n\n if not @value or @value.empty?\n if @known.empty?\n\t# Need at least one known point or a value expression...\n\t@logger.debug(\n\t \"Variable #{@name} is empty with no known points.\")\n\treturn set_vartype(:NoInfo)\n end\n\n deriv_var_type = nil # in case var is undefined\n deriv_name = Variable.derivative_of_name(@name)\n deriv_var = parent.variable_by_name(deriv_name)\n\n # Set to :Searching to avoid circular reference...\n @vartype = :Searching\n deriv_var_type = deriv_var.variable_type(tentative_ok) if deriv_var\n @vartype = nil\n\n if not deriv_var_type\n\t@logger.debug(\"Variable #{@name}'s derivative is undefined.\")\n\treturn set_vartype(:NoInfo)\n end\n\n if deriv_var_type == :NoInfo\n\t@logger.debug(\"Variable #{@name}'s derivative is unspecified.\")\n\treturn set_vartype(:NoInfo)\n end\n\n # If the deriv is anything other than \"no info\", we're a DiffEQ.\n # If it's :Searching, then there's info but there's also a\n # circular dependency, which is actually fine for a DiffEQ --\n # the next timestep's value depends on the current timestep, so\n # it only looks circular.\n if [:Simple, :DiffEQ, :Derived, :Searching].include?(deriv_var_type)\n\t@logger.debug(\n \"Variable #{@name} has simple, diffeq or derived derivative.\")\n\treturn set_vartype(:DiffEQ)\n end\n\n raise \"Logic isn't complete in variable_type! Bad var type?\"\n end\n\n if @value.constant?\n @logger.debug(\"Variable #{@name} is constant.\")\n return set_vartype(:Simple)\n end\n\n depends_on() # make sure it's calculated\n\n # Set type to :Searching here so that circular dependencies don't kill us\n @vartype = :Searching\n vartypes = @depends_on.collect { |var| var.variable_type(tentative_ok) }\n @vartype = nil\n\n if vartypes.include?(:NoInfo)\n @logger.debug(\"Variable #{@name} depends on a :NoInfo.\")\n return set_vartype(:NoInfo)\n end\n\n if vartypes.include?(:DiffEQ)\n @logger.debug(\"Variable #{@name} depends on a DiffEQ.\")\n return set_vartype(:Derived)\n end\n\n if vartypes.include?(:Derived)\n @logger.debug(\"Variable #{@name} depends on a Derived.\")\n return set_vartype(:Derived)\n end\n\n if vartypes.include?(:Searching)\n @logger.debug(\"Variable #{@name} depends on a Searching!\")\n return :Searching if tentative_ok\n raise \"Variable #{@name} depends on unresolved variable!\"\n end\n\n unless vartypes.all? { |type| type == :Simple }\n raise \"Not all dependent types are simple! Internal logic error!\"\n end\n\n @logger.debug(\"Variable #{@name} defaults to :Simple.\")\n return set_vartype(:Simple)\n end",
"def nature; end",
"def digest_type(type, var) #method\n if type == 'nocortable'\n 'Fixnum'\n elsif type == 'estado'\n var.downcase!\n if var == 'verdadero'\n 'TrueClass'\n elsif var == 'falso'\n 'FalseClass'\n end\n else\n type\n end\n end",
"def variable?\n any? {|op| op.respond_to?(:variable?) && op.variable?}\n end",
"def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end",
"def ref_type\n # numeral, boolean, closure, atom, pair, handle, string, environment, or rail\n return quoted.struc_type if handle? \n return :NUMBER if instance_of?(Fixnum) || instance_of?(Bignum)\n return :\"TRUTH-VALUE\" if instance_of?(TrueClass) || instance_of?(FalseClass)\n return :FUNCTION if instance_of?(Closure)\n return :SEQUENCE if instance_of?(Rail)\n return :BINDINGS if instance_of?(Environment)\n\n raise_error(self, \"atom #{self.to_s} has no referential type\") if atom?\n raise_error(self, \"pair #{self.to_s} has no referential type\") if pair?\n raise_error(self, \"ref_type : #{self.to_s} is ill-structured\") \n end",
"def variable_definition?\n @variable\n end",
"def check_type var\n if channel_format? var then\n return 'channel'\n elsif nick_format? var then\n return 'nick'\n else\n return 'nil'\n end\n end",
"def type(type); end",
"def type\n\t\t@type\n\tend",
"def get_variable(var_name)\n return nil unless @type_library\n self.classes.each do |class_name|\n found = self.constant_for(class_name.name).variables.find {|var| var.name == var_name}\n return found if found\n end\n end",
"def type\n memoized_info[:type]\n end",
"def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend",
"def what_is\n end",
"def get_var_type(var)\n className = var.class.name\n if className == \"Array\"\n classNames = var.collect{|x| \n if x.class.name == \"Hash\"\n vnames = x.collect{|k2,v2| v2.class.name}.uniq.join(\",\")\n \"Hash:'#{vnames}'\"\n else\n x.class.name \n end\n }.uniq.join(\",\")\n className = \"Array[#{classNames}]\"\n elsif className == \"Hash\"\n var.each do |key, val|\n val_class = val.class.name\n if val_class == \"Array\"\n val_class = val.collect{|x| x.class.name }.uniq.join(\",\")\n val_class = \"Array[#{val_class}]\"\n end\n className = \"Hash:[#{val_class}]\"\n end\n end\n className\n end",
"def type; Common.type(@handle); end",
"def type\n return @type\n end",
"def type\n _type\n end",
"def variety(type: T.unsafe(nil)); end",
"def get_it\n @myvar\n end",
"def type_helper \n self.type \n end",
"def get_value(value) #method\n if is_memory(value)\n @current_context[value]\n else\n digested_value = digest_constant(value)\n if is_number(digested_value)\n get_type(digested_value)\n elsif is_bool(digested_value)\n get_type(digested_value)\n else\n digested_value\n end\n end\n end",
"def type\n _type rescue nil\n end",
"def variables; end",
"def variables; end",
"def variable\n return 0 if @variable == 0\n if @variable.is_a?(Integer)\n $game_variables[@variable]\n else\n $game_settings[@variable]\n end\n end",
"def raw_var var, type=nil\n @types[var.keys[0]] = type if type\n @variables.merge! var\n end",
"def reading(var, var_type) #method\n user_input = $stdin.gets.chomp\n user_input_type = get_type(user_input)\n user_input_class = user_input_type.class\n type = digest_type(var_type, user_input)\n if user_input_class.to_s == type\n @current_context[var] = user_input_type\n else\n puts \"Fatal Error: semantic cube error, expected #{var_type} and got #{user_input_class}.\"\n exit\n end\n end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def local_variables() end",
"def \tmy_fonction()\n\ta = 10\n\tb = \"10\"\n\tc = \"dix\"\n\td = 10.0\n\tputs \"mes variables :\"\n\tputs \" a contient #{a} et est de type: #{a.class}\"\n\tputs \" b contient #{b} et est de type: #{b.class}\"\n\tputs \" c contient #{c} et est de type: #{c.class}\"\n\tputs \" d contient #{d} et est de type: #{d.class}\"\nend",
"def is_datatype?(); @type == GRT_DATATYPE; end",
"def type ; metadata[:type] ; end",
"def type_name\n @_type_name ||= begin\n error_check(INVALID_OPERATION) if @kernel.context.platform.version_number < 1.2\n ptr1 = MemoryPointer::new( :size_t, 1)\n error = OpenCL.clGetKernelArgInfo(@kernel, @index, TYPE_NAME, 0, nil, ptr1)\n error_check(error)\n ptr2 = MemoryPointer::new( ptr1.read_size_t )\n error = OpenCL.clGetKernelArgInfo(@kernel, @index, TYPE_NAME, ptr1.read_size_t, ptr2, nil)\n error_check(error)\n ptr2.read_string\n end\n end",
"def type\n 'it'\n end",
"def read; @my_var; end",
"def display_type\n \"I am a #{@type}\"\n end",
"def variable\n return 0 if @variable == 0\n if @variable.is_a?(Integer)\n return $game_variables[@variable]\n else\n return $game_settings[@variable]\n end\n end",
"def type\n @type ||= calculate_type\n end",
"def type_of_input(x)\n\n # Remember that the .class method tells you the type of a variable.\n if (x.class == Fixnum) then\n return \"number\"\n # elsif (x.class == ** fill in something here **) then\n # To make this work, you have to figure out what Ruby type is a string, just as it calls numbers Fixnum\n # return \"string\"\n end\nend",
"def know_it_all(object)\n object.class\nend",
"def instance_var\r\n @@class_variable\r\n end",
"def explain_types; end",
"def reflect_field_type\n caller[0] =~ /`([^']*)'/ and $1\n end",
"def instance_variable_ged name\n var = get_instance_variable name.to_s[1 .. -1].to_sym\n #puts \"getting #{name} #{var}\"\n var\n end",
"def get(x)\n if x.is_a?(String)\n x\n elsif x.is_a?(Identifier)\n raise \"Variable not bound #{x}\" unless @vars.key?(x.name)\n @vars[x.name]\n elsif x.is_a?(Str)\n x.contents.map{|e| get(e) }.join('')\n else\n raise \"Invalid Type\"\n end\n end",
"def kind\n # returns nil, overridden and returning :question, :problem, etc. in sublcass\n end",
"def get_type\n\n end",
"def get_kind\n\t\tend",
"def identify\n\n return \"I am a #{self.class}\"\n\n end",
"def variables?\n subject.is_a?(Variable) ||\n predicate.is_a?(Variable) ||\n object.is_a?(Variable)\n end",
"def hasVariableType(vt)\n return hasVariableTypeinGroup(@varGroup, vt)\n end",
"def kind \n return @raw.kind \n end",
"def know_it_all(object)\n if object.class == String\n String\n elsif object.class == Fixnum\n Fixnum\n elsif object.class == Array\n Array\n elsif object.class == Hash\n Hash\n end\nend",
"def peek \n return @ivar[0]\n end",
"def variable_count\n variables.size\n end"
] |
[
"0.66155005",
"0.65988743",
"0.63557374",
"0.633887",
"0.633887",
"0.6273676",
"0.6273676",
"0.603618",
"0.5998714",
"0.59018505",
"0.58339095",
"0.5777365",
"0.5767829",
"0.5745168",
"0.5745168",
"0.566444",
"0.56605226",
"0.56477165",
"0.5618115",
"0.56177866",
"0.560092",
"0.55997074",
"0.5596159",
"0.5580196",
"0.55384207",
"0.55035836",
"0.5497186",
"0.54904777",
"0.5488621",
"0.5485716",
"0.54832405",
"0.5478716",
"0.5458621",
"0.5448721",
"0.543241",
"0.54210013",
"0.5406967",
"0.53966725",
"0.5394244",
"0.53772163",
"0.5372021",
"0.5365006",
"0.5359849",
"0.5358243",
"0.5357679",
"0.53192437",
"0.5317408",
"0.530568",
"0.5295263",
"0.52929103",
"0.52925324",
"0.5291888",
"0.5282844",
"0.52777165",
"0.52725816",
"0.52725816",
"0.5266664",
"0.526565",
"0.52653104",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.52628964",
"0.5257559",
"0.5255817",
"0.52412665",
"0.5230429",
"0.5222538",
"0.52208805",
"0.52183026",
"0.5214354",
"0.52082396",
"0.52029896",
"0.52028817",
"0.520279",
"0.5187993",
"0.51845247",
"0.5179808",
"0.5166629",
"0.5164647",
"0.5151387",
"0.51480687",
"0.51426506",
"0.513771",
"0.51372135",
"0.5132055",
"0.51269764",
"0.51237047",
"0.5123636",
"0.5123012"
] |
0.0
|
-1
|
Creates a new Config. The configuration is loaded from the file 'hiera.yaml' which is expected to be found in the given module_dir.
|
def initialize(module_dir, diagnostics)
@module_dir = module_dir
config_file = File.join(module_dir, 'hiera.yaml')
validator = ConfigChecker.new(diagnostics)
begin
data = YAML.load_file(config_file)
validator.validate(data, config_file)
unless diagnostics.errors?
# if these are missing the result is nil, and they get default values later
@hierarchy = data['hierarchy']
@backends = data['backends']
end
rescue Errno::ENOENT
diagnostics.accept(Issues::CONFIG_FILE_NOT_FOUND, config_file)
rescue Errno::ENOTDIR
diagnostics.accept(Issues::CONFIG_FILE_NOT_FOUND, config_file)
rescue ::SyntaxError => e
diagnostics.accept(Issues::CONFIG_FILE_SYNTAX_ERROR, e)
rescue *YamlLoadExceptions => e
diagnostics.accept(Issues::CONFIG_FILE_SYNTAX_ERROR, e)
end
@hierarchy ||= DEFAULT_HIERARCHY
@backends ||= DEFAULT_BACKENDS
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(options={})\n config = options[:config]\n if config.nil?\n # Look in codedir first, then confdir\n config = File.join(Util.code_dir, 'hiera.yaml')\n config = File.join(Util.config_dir, 'hiera.yaml') unless File.exist?(config)\n end\n @config = Config.load(config)\n\n Config.load_backends\n end",
"def load_config\n file = root+CONFIG_FILE_NAME\n @config = file.file? ? YAML.load_file(file) : { :shared_directories => [], :core_modules => [] }\n end",
"def initialize\n @tree = YAML::parse(File.open(CONFIG_FILE))\n end",
"def load_config()\n Kitchenplan::Log.debug \"Loading configs from #{self.options[:config_dir]} ...\"\n #Kitchenplan::Log.debug self.platform.ohai.inspect\n self.config = Kitchenplan::Config.new(self.platform.ohai, parse_configs=true,config_path=self.options[:config_dir]).config()\n end",
"def hiera_configpath(hiera)\n File.join('config', 'hieras', hiera, 'hiera.yaml')\nend",
"def load_config\n conf = YAML.load_file(File.expand_path('../config.yml', File.dirname(__FILE__)))\n\n unless %w[basedir master filesync_cert filesync_cert_key filesync_ca_cert].all? { |s| conf.key?(s) && !conf[s].nil? }\n Pem.log_error('Missing required settings in config.yml', @logger)\n raise\n end\n\n conf['envdir'] = \"#{conf['basedir']}/environments\"\n conf['mod_dir'] = \"#{conf['basedir']}/modules\"\n\n return conf\n rescue StandardError\n err = 'Missing config file, or required configuration values - check config.yml'\n Pem.log_error(err, @logger)\n raise(err)\n end",
"def load_config\n YAML::load_file(File.join(__dir__, '../config/config.yml'))\n end",
"def load_config\n create_yolo_dir\n unless File.exist?(yaml_path)\n @formatter.config_created(yaml_path)\n FileUtils.cp_r(File.dirname(__FILE__) + \"/config.yml\", yaml_path)\n end\n end",
"def install_hiera_config(logger, options)\n # Validate hiera config file\n hiera_config = options[:hiera_config]\n unless hiera_config.is_a?(String)\n raise ArgumentError, \"Called install_hiera_config with a #{hiera_config.class} argument\"\n end\n file_src = if hiera_config.start_with? '/'\n hiera_config\n elsif hiera_config =~ %r{^environments/#{Regexp.escape(environment)}/}\n File.join(@tempdir, hiera_config)\n else\n File.join(@tempdir, 'environments', environment, hiera_config)\n end\n raise Errno::ENOENT, \"hiera.yaml (#{file_src}) wasn't found\" unless File.file?(file_src)\n\n # Munge datadir in hiera config file\n obj = YAML.load_file(file_src)\n (obj[:backends] || %w(yaml json)).each do |key|\n next unless obj.key?(key.to_sym)\n if options[:hiera_path_strip].is_a?(String)\n next if obj[key.to_sym][:datadir].nil?\n rexp1 = Regexp.new('^' + options[:hiera_path_strip])\n obj[key.to_sym][:datadir].sub!(rexp1, @tempdir)\n elsif options[:hiera_path].is_a?(String)\n obj[key.to_sym][:datadir] = File.join(@tempdir, 'environments', environment, options[:hiera_path])\n end\n rexp2 = Regexp.new('%{(::)?environment}')\n obj[key.to_sym][:datadir].sub!(rexp2, environment)\n\n # Make sure the dirctory exists. If not, log a warning. This is *probably* a setup error, but we don't\n # want it to be fatal in case (for example) someone is doing an octocatalog-diff to verify moving this\n # directory around or even setting up Hiera for the very first time.\n unless File.directory?(obj[key.to_sym][:datadir])\n message = \"WARNING: Hiera datadir for #{key} doesn't seem to exist at #{obj[key.to_sym][:datadir]}\"\n logger.warn message\n end\n end\n\n # Write properly formatted hiera config file into temporary directory\n File.open(File.join(@tempdir, 'hiera.yaml'), 'w') { |f| f.write(obj.to_yaml.gsub('!ruby/sym ', ':')) }\n logger.debug(\"Installed hiera.yaml from #{file_src} to #{File.join(@tempdir, 'hiera.yaml')}\")\n end",
"def config\n @config ||= begin\n conf = Bolt::Config.new(Bolt::Boltdir.new('.'), {})\n conf.modulepath = [modulepath].flatten\n conf\n end\n end",
"def build_config(dir_or_config_hash)\n if dir_or_config_hash.is_a? String\n # Check whether it is supported\n if dir_or_config_hash != '.'\n warn 'WARNING: Calling Nanoc3::Site.new with a directory that is not the current working directory is not supported. It is recommended to change the directory before calling Nanoc3::Site.new. For example, instead of Nanoc3::Site.new(\\'abc\\'), use Dir.chdir(\\'abc\\') { Nanoc3::Site.new(\\'.\\') }.'\n end\n\n # Read config from config.yaml in given dir\n config_path = File.join(dir_or_config_hash, 'config.yaml')\n @config = DEFAULT_CONFIG.merge(YAML.load_file(config_path).symbolize_keys)\n @config[:data_sources].map! { |ds| ds.symbolize_keys }\n @config_mtime = File.stat(config_path).mtime\n else\n # Use passed config hash\n @config = DEFAULT_CONFIG.merge(dir_or_config_hash)\n @config_mtime = nil\n end\n\n # Merge data sources with default data source config\n @config[:data_sources].map! { |ds| DEFAULT_DATA_SOURCE_CONFIG.merge(ds) }\n end",
"def load_config\n project = if ENV['BOLT_PROJECT']\n Bolt::Project.create_project(ENV['BOLT_PROJECT'], 'environment')\n elsif options[:project]\n dir = Pathname.new(options[:project])\n if (dir + Bolt::Project::BOLTDIR_NAME).directory?\n Bolt::Project.create_project(dir + Bolt::Project::BOLTDIR_NAME)\n else\n Bolt::Project.create_project(dir)\n end\n else\n Bolt::Project.find_boltdir(Dir.pwd)\n end\n @config = Bolt::Config.from_project(project, options)\n rescue Bolt::Error => e\n fatal_error(e)\n raise e\n end",
"def initialize\n @path = File.join(File.expand_path('.'), FILE_NAME)\n unless File.exist?(@path)\n @path = (ENV['ASPELLBEE_CONFIG_PATH'] || File.join(File.expand_path('~'), FILE_NAME))\n end\n @data = load_config_file\n end",
"def from_config\n config ||= YAML::load(File.open((File.join(File.dirname(__FILE__), 'config.yml'))))\nend",
"def load_configuration\n @config = {\n :start_date => Date.today - 1,\n :data_dir => default_data_dir\n }\n\n if File.exist?(config_file)\n @config = YAML.load_file(config_file)\n end\n\n @config\n end",
"def config\n @config ||= begin\n conf = Bolt::Config.new(Bolt::Project.default_project, config_data)\n conf.modulepath = [modulepath].flatten\n conf\n end\n end",
"def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end",
"def load_config\n config_file = File.join(Dir.home, \".assemblotron\")\n if File.exists? config_file\n @log.debug \"config file found at #{config_file}\"\n config = YAML::load_file(config_file)\n if config.nil?\n @log.warn \"config file malformed or empty\"\n return\n end\n @config = config.deep_symbolize\n end\n end",
"def create_hiera_template\n options = {ssh_key: Bebox::Project.public_ssh_key_from_file(project_root, environment), project_name: Bebox::Project.shortname_from_file(project_root)}\n Bebox::Provision.generate_hiera_for_steps(self.project_root, \"node.yaml.erb\", self.hostname, options)\n end",
"def load_config(config_file)\n @config = YAML.load_file config_file\n @config = Hashie::Mash.new(@config) if @config\n\n Booru.import_config @config.booru\n end",
"def setup( dir = default_directory )\n unless File.directory?( dir )\n logger.info \"Creating directory #{dir}\"\n FileUtils.mkdir_p( dir )\n end\n\n cfg = File.join( dir, config_file_basename )\n\n unless File.exist?( cfg )\n template = TyrantManager::Paths.data_path( config_file_basename )\n logger.info \"Creating default config file #{cfg}\"\n FileUtils.cp( template, dir )\n end\n\n %w[ instances log tmp ].each do |subdir|\n subdir = File.join( dir, subdir )\n unless File.directory?( subdir ) then\n logger.info \"Creating directory #{subdir}\"\n FileUtils.mkdir subdir \n end\n end\n return TyrantManager.new( dir )\n end",
"def initialize(config_file = nil, meta_tree = nil)\n @meta = meta_tree || { :dir => true }\n begin\n if config_file: load(config_file)\n else @cfg = {} end\n rescue StandardError => e\n $log.puts \"Exception loading ConfigSpace: #{e.inspect}\"\n raise e\n end\n end",
"def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end",
"def load_config\n BeEF::Core::Configuration.new(\"#{$root_dir}/config.yaml\")\n BeEF::Core::Configuration.instance.load_extensions_config\n @config = BeEF::Core::Configuration.instance.get('beef.extension.metasploit')\n end",
"def load_config(config_file)\n DeliveryGolang::Helpers.load_config(config_file, node)\n end",
"def initialize(name, basedir, dirname, options = {})\n @name = name\n @basedir = basedir\n @dirname = dirname\n @options = options\n @puppetfile_name = options.delete(:puppetfile_name)\n @overrides = options.delete(:overrides) || {}\n\n @full_path = File.join(@basedir, @dirname)\n @path = Pathname.new(File.join(@basedir, @dirname))\n\n @puppetfile = R10K::Puppetfile.new(@full_path,\n {overrides: @overrides,\n force: @overrides.dig(:modules, :force),\n puppetfile_name: @puppetfile_name})\n @puppetfile.environment = self\n\n loader_options = { basedir: @full_path, overrides: @overrides, environment: self }\n loader_options[:puppetfile] = @puppetfile_name if @puppetfile_name\n\n @loader = R10K::ModuleLoader::Puppetfile.new(**loader_options)\n\n if @overrides.dig(:environments, :incremental)\n @loader.load_metadata\n end\n\n @base_modules = nil\n @purge_exclusions = nil\n @managed_directories = [ @full_path ]\n @desired_contents = []\n end",
"def build_config(dir_or_config_hash)\n if dir_or_config_hash.is_a? String\n # Read config from config.yaml in given dir\n config_path = File.join(dir_or_config_hash, 'config.yaml')\n @config = DEFAULT_CONFIG.merge(YAML.load_file(config_path).symbolize_keys)\n @config[:data_sources].map! { |ds| ds.symbolize_keys }\n @config_mtime = File.stat(config_path).mtime\n else\n # Use passed config hash\n @config = DEFAULT_CONFIG.merge(dir_or_config_hash)\n @config_mtime = nil\n end\n\n # Merge data sources with default data source config\n @config[:data_sources].map! { |ds| DEFAULT_DATA_SOURCE_CONFIG.merge(ds) }\n end",
"def load_config\n if @configfile.nil?\n loader = R10K::Deployment::Config::Loader.new\n @configfile = loader.search\n if @configfile.nil?\n raise ConfigError, \"No configuration file given, no config file found in parent directory, and no global config present\"\n end\n end\n begin\n @config = YAML.load_file(@configfile)\n apply_config_settings\n rescue => e\n raise ConfigError, \"Couldn't load config file: #{e.message}\"\n end\n end",
"def load_config!\n return unless options.empty?\n\n data = ::YAML.load_file(File.open(\"#{directory.path}/supernova.yml\", \"r\"))\n load_paths.push(*data.fetch(\"load_paths\", []))\n\n load_paths.map! do |path|\n File.absolute_path(path, directory.path)\n end\n\n @options = data\n end",
"def create_config\n FileUtils.touch(config_file)\n \n @settings = {\n 'username' => 'username@loopiaapi',\n 'password' => 'password',\n 'remote' => 'https://api.loopia.se/RPCSERV',\n 'default_domain' => 'example.com',\n 'verbose' => 'true' \n }\n\n File.open(config_file, 'w' ) { |f| YAML.dump(@settings, f) }\n end",
"def config_from_yaml(file)\n build_data = Pkg::Util::Serialization.load_yaml(file)\n config_from_hash(build_data)\n end",
"def load_config(file_path)\n config = OpenStruct.new\n YAML.load_file(file_path).each do |k,v|\n config.send(\"#{k}=\", v)\n end\n return config\n end",
"def with_config\n config = Hoe::DEFAULT_CONFIG\n\n rc = File.expand_path(\"~/.hoerc\")\n homeconfig = maybe_load_yaml rc\n\n config = config.merge homeconfig\n\n localrc = File.join Dir.pwd, \".hoerc\"\n localconfig = maybe_load_yaml(localrc)\n\n config = config.merge localconfig\n\n yield config, rc\n end",
"def load_config!\n\n # Read the config\n @config.load_mccloud_config()\n\n # Read the templates in the template sub-dir\n @config.templates.load!\n @config.definitions.load!\n\n # Read the vms specified inthe vm sub-dir\n @config.vms.load!\n\n ui.info \"Loaded providers[#{@config.providers.length}]\"+\" vms[#{@config.vms.length}]\"+\" ips[#{@config.ips.length}]\"+\" lbs[#{@config.lbs.length}]\"+\" stacks[#{@config.stacks.length}]\"+\" templates[#{@config.templates.length}] keypairs[#{@config.keypairs.length}] keystores[#{@config.keystores.length}]\"\n\n return self\n end",
"def load_configuration(conf_file)\n @conf_file = conf_file || CONF_FILE\n @config = YAML.load(File.read(@conf_file))\n @origin_config = @config.dup\n\n @app_root = @config['app_root'] || File.dirname(@conf_file)\n @app_root = File.expand_path(@app_root)\n @stack_dir = @config['stack_dir'] || '../stack_apps'\n @stack_dir = File.expand_path(@app_root + '/' +\n @stack_dir) if @stack_dir.match(/^\\.\\.?\\//)\n\n # default values\n @verbose = @config['verbose'] || 1\n @verbose = @verbose.to_i\n\n @config['tpl_ext'] ||= '.erb'\n raise ArgumentError, 'ERROR: `include` key depriciated, ' +\n 'please update your yml file' if @config['include']\n @config['include'] = []\n @config['exclude'] ||= []\n @config['export'] ||= [] # even export can be blank\n @config['stack'] ||= []\n @config['files'] ||= {}\n\n # attrs to assigned into template\n @attrs = {}\n # file list under the app_root\n @self_files = []\n\n @files = @config['files']\n end",
"def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end",
"def load config\n \n # TODO better place for this?\n if config['log4r_config']\n ycfg = Log4r::YamlConfigurator\n # ycfg['foo'] = bar # replaces instances of #{foo} in the YAML with bar\n ycfg.load_yaml_string(YAML.dump(config))\n end\n \n # gah - log4r expects strings, so only convert to symbols here\n config.keys_to_symbols!\n \n # load all scrapers, and mix all shared fields into them\n config[:scrapers].each_pair do |group, included|\n \n shared_setup = {}\n scraper_setups = {}\n \n # load setups\n included.each_pair do |key, value|\n target = if is_scraper?(key)\n logger.info \"Loading scraper #{group}::#{key}\"\n scraper_setups\n else\n shared_setup\n end\n\n target[key] = value\n end\n \n # create each scraper when whole setup is present\n scrapers[group] = setup_scrapers(scraper_setups, shared_setup);\n end if config[:scrapers]\n end",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def load_config!\n cfg_data = begin\n YAML.load(File.open(CONFIG_DIR + GLOBAL_CONFIG))\n rescue Errno::ENOENT\n Hash.new\n end\n __load_config(DEFAULTS.merge(cfg_data))\n end",
"def yaml_config\n IceNine.deep_freeze(YAML.load_file(config_file)) if config_file.file?\n end",
"def yaml_config\n IceNine.deep_freeze(YAML.load_file(config_file)) if config_file.file?\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end",
"def initialize dir = nil # yield loader, o\n @root = (dir && Pathname(dir)) || ROOT\n @logs = @root + LOGS\n \n CliConfig::DIR_CONFIG.unshift @root\n @conf = CliConfig.new\n @conf[:plugins_path] = [@root + PLUGINS, SYSTEM_PLUGINS]\n @conf.load do |o|\n yield self, o if block_given?\n o.on('-I DIR', 'Include DIR in search for plugins.') {|i|\n @conf[:plugins_path] << Pathname.new(i) if File.directory?(i)\n }\n o.on('--plugins-path', 'Print all searchable directories.') {\n print_plugins_path\n exit EX_OK\n }\n end\n \n print_env\n FileUtils.mkdir_p [@conf[:plugins_path], @logs]\n end",
"def initialize(yaml_path = YAML_PATH)\n @_configuration = if File.exist?(yaml_path)\n YAML.load_file(yaml_path)\n else\n {}\n end.freeze\n end",
"def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end",
"def load_from(path)\n self.configure(Halcyon::Config::File.load(path))\n self\n end",
"def config\n @config ||= YAML.load_file(@config_file_path)\n end",
"def load\n $LOG.debug \"Config::load\"\n\n filepath = cfgFilePath(\"pdconfig.yml\")\n if(!File.exists?( filepath )) # TODO: This needs to be moved into KtCfg.\n $LOG.debug \"Config file does not exist. Returning default config obj.\"\n return @cfg\n end\n\n @cfg = read(\"pdconfig.yml\")\n end",
"def load\n unless File.exist?(config_file)\n fail \"YAML file #{config_file} does not exist. Try 'bento-qemu init'.\"\n end\n @config = YAML.load_file(config_file)\n end",
"def load_module_yaml(file_name)\n\t\tFile.open(file_name) { |file| YAML.load(file) }\n\tend",
"def load_config\n if ::File.file?(CONFIG_PATH)\n config = ::OpenStruct.new\n config.reflected_validations = @@reflected_validations\n silence_warnings do\n eval(::IO.read(CONFIG_PATH), binding, CONFIG_PATH)\n end\n end\n end",
"def load_config(config_file)\n YAML.load(File.open(config_file))\nend",
"def initialize()\n @config_file=\"projects.yml\"\n @config = YAML.load_file(@config_file)\n end",
"def for_file(file_path)\n directory = File.dirname(file_path)\n @dir_to_config ||= {}\n @dir_to_config[directory] ||=\n begin\n config_file = possible_config_files(directory).find { |path| path.file? }\n Config.load(config_file.to_s) if config_file\n end\n end",
"def initialize(config_dir: nil, path: nil, env: ENV, data: nil)\n super(\n self.class.namespaces.map do |name, namespace|\n config = data || begin\n path ||= File.expand_path('%s.yml' % namespace.config_name, config_dir || self.class.config_dir)\n\n Configature::Support.yaml_if_exist(path)\n end\n\n [\n name,\n Configature::Support.convert_hashes(\n Configature::Data,\n namespace.__instantiate(source: config, env: env)\n )\n ]\n end.to_h\n )\n end",
"def load_config(file)\n @config = YAML.load_file(file)\n end",
"def load_config(filename)\n yml = YAML.load_file(filename)\n yml.each do |key, value| \n next if key == 'Templates'\n\n if key == 'PackageDirs'\n # PackageDirs.register value\n elsif key == 'AppDirs' \n # ApplicationDirMatcher.register value\n else\n app_matcher.register value\n end \n end\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def config_load(config); end",
"def config\n\t\t\t@config ||= begin\n\t\t\t\tfile = File.join(self.location, \"config.yaml\")\n\t\t\t\tif File.exists?(file)\n\t\t\t\t\tYAML::load_file(file)\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def config_file\n File.join(root, 'config.yml')\n end",
"def load_config()\n self.config = Kitchenplan::Config.new().config\n end",
"def load_config(file)\n file = file + '.rb' if File.extname(file) == ''\n\n if chdir\n file = File.join(chdir, file)\n else\n file = File.join('.', file)\n end\n\n if File.exist?(file)\n return require(file)\n else\n raise \"config file not found -- `#{file}'\"\n end\n end",
"def bootstrap\n return if File.exist?(yaml_file)\n\n FileUtils.mkdir_p(File.split(yaml_file).first)\n FileUtils.cp(example_config, yaml_file)\n end",
"def config\n @config ||= YAML.load File.read(@config_file)\n end",
"def create_configuration_files\n copy_file \"config/blacklight_config.rb\", \"config/initializers/blacklight_config.rb\"\n copy_file \"config/solr.yml\", \"config/solr.yml\"\n directory(\"config/SolrMarc\")\n end",
"def load_config\n config_data = File.read(app_config_file)\n YAML.load(config_data) || {}\n end",
"def initialize(options = {})\n @directory = options[:dir] || Dir.pwd\n @config = Config.new(:dir => @directory)\n end",
"def load(name)\n config_file \"#{name}\"\n end",
"def create_module\n puts \"\\n... Creating module '#{@module}' in '#{@dir}'\"\n # Base directory\n create_dir(\"#{@module}\")\n self.create_module_dirs\n self.create_module_files\n self.create_module_file\n self.create_module_database_files\n self.create_module_info_file\n puts 'Module created :)'\n end",
"def generate_hiera_template\n ssh_key = Bebox::Project.public_ssh_key_from_file(self.project_root, self.name)\n project_name = Bebox::Project.shortname_from_file(self.project_root)\n Bebox::PROVISION_STEPS.each do |step|\n step_dir = Bebox::Provision.step_name(step)\n generate_file_from_template(\"#{Bebox::FilesHelper.templates_path}/puppet/#{step}/hiera/data/environment.yaml.erb\", \"#{self.project_root}/puppet/steps/#{step_dir}/hiera/data/#{self.name}.yaml\", {step_dir: step_dir, ssh_key: ssh_key, project_name: project_name})\n end\n end",
"def yml_config\n return @yml_config if @yml_config\n\n require 'yaml'\n data = File.open(options[:config_path]).read\n\n require 'erb'\n data = ERB.new(data).result(binding)\n\n @yml_config ||= YAML.load(data)\n end",
"def initialize\n @config = config_from_file || empty_config\n end",
"def initialize\n create_config unless File.exists?(config_file)\n load_settings\n set_domain\n end",
"def assign_hiera_to_roles\n return @assign_hiera_to_roles if @assign_hiera_to_roles\n @assign_hiera_to_roles = {}\n hiera_file_names.each do |hiera_file|\n begin\n data = YAML.load_file(Noop::Config.dir_path_hiera + hiera_file)\n next unless data.is_a? Hash\n fqdn = data['fqdn']\n next unless fqdn\n nodes = data.fetch('network_metadata', {}).fetch('nodes', nil)\n next unless nodes\n this_node = nodes.find do |node|\n node.last['fqdn'] == fqdn\n end\n node_roles = this_node.last['node_roles']\n roles = Set.new\n roles.merge node_roles if node_roles.is_a? Array\n role = data['role']\n roles.add role if role\n @assign_hiera_to_roles[hiera_file] = roles\n rescue\n next\n end\n end\n @assign_hiera_to_roles\n end",
"def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end",
"def initialize\n @main = {}\n @config_directory = File.expand_path \"~/.config/next_background\"\n @file = \"#{@config_directory}/config.yaml\"\n self.load\n end",
"def add_config_folder\n directory 'templates/dry/config', \"#{name}/config\", recursive: true\n end",
"def load_config\n file = config_file\n unless file\n if chdir\n file = Dir.glob(File.join(chdir, GLOB_CONFIG)).first\n else\n file = Dir.glob(GLOB_CONFIG).first\n end\n end\n load file if file\n end",
"def configure(root_config)\n late_config_merge(root_config)\n\n unless File.directory? work_dir\n FileUtils.mkdir_p work_dir\n end\n end",
"def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end",
"def load(path, app)\n Dir.chdir(Hardwired::Paths.root || '.') do\n Dir.glob(path) do |file|\n $stderr.puts \"loading config file '#{file}'\" if app.logging?\n document = IO.read(file)\n @@config = RecursiveOpenStruct.new(config_for_env(YAML.load(document),app.environment) || {})\n return @@config \n end\n \n end\n end",
"def load_config\n if @configfile.nil?\n loader = R10K::Deployment::Config::Loader.new\n @configfile = loader.search\n if @configfile.nil?\n raise ConfigError, \"No configuration file given, no config file found in current directory, and no global config present\"\n end\n end\n begin\n @config = ::YAML.load_file(@configfile)\n apply_config_settings\n rescue => e\n raise ConfigError, \"Couldn't load config file: #{e.message}\"\n end\n end",
"def initialize(config_file=nil)\n @config_file = config_file\n @params = {}\n @groups = []\n \n if(self.config_file)\n self.validate_config()\n self.import_config()\n end\n end",
"def initialize(dir = '_site', config = '_config.yml')\n @dir = dir\n @config = config\n end",
"def initialize(base_dir)\r\n read_config(base_dir)\r\n end",
"def generate_configuration\n template \"mebla.yml\", \"config/mebla.yml\"\n end",
"def load_config\n # Nothing in base class. This should be used to load the configuration from\n # disk if saved to a file.\n configuration || {}\n end",
"def load_config\n\t\t\t\tif defined? RAILS_ROOT\n\t\t\t\t\tconfig_path = File.join(RAILS_ROOT,\"config\",\"label_service.yml\")\n\t\t\t\t\t#warn \"We're riding on Rails, expecting LabelService config file to be located at: #{config_path}\"\n\t\t\t\telse\n\t\t\t\t\tconfig_path = File.join(LABEL_SERVICE_ROOT,\"../\",\"label_service.yml\")\n\t\t\t\t\twarn \"We're not riding on Rails, expecting LabelService config file to be located at: #{config_path}\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif File.exists?(config_path)\n\t\t\t\t\tconfig_hash = YAML.load_file(config_path)\n\t\t\t\t\tself.config = OpenStruct.new(config_hash)\n\t\t\t\telse\n\t\t\t\t\traise LabelServiceError, \"No LabelService config file found!\"\n\t\t\t\tend\n\t\t\tend",
"def configure_manifest\n @configuration = YAML.load_file(manifest.to_s) if exist?\n end",
"def update_config\n if File.exist?(config_file) then\n puts \"updating #{config_file}\"\n config = YAML.load_file(config_file)\n else\n puts \"generating #{config_file}\"\n config = {}\n end\n\n files = Dir.glob(File.join(libdir, '**', \"rbconfig.rb\")).sort\n\n files.each do |rbconfig|\n version = rbconfig.match(/.*-(\\d.\\d.\\d)/)[1]\n config[\"rbconfig-#{version}\"] = rbconfig\n puts \"Found Ruby version #{version} (#{rbconfig})\"\n end\n\n mkdir_p(File.dirname(config_file))\n\n File.open(config_file, 'w') do |f|\n f.puts(config.to_yaml)\n end\n end",
"def initialize(config_yaml = File.join(File.expand_path(\"~\"), \".rest_connection\", \"rest_api_config.yaml\"))\n @@logger = nil\n etc_config = File.join(\"#{File::SEPARATOR}etc\", \"rest_connection\", \"rest_api_config.yaml\")\n if File.exists?(config_yaml)\n @settings = YAML::load(IO.read(config_yaml))\n elsif File.exists?(etc_config)\n @settings = YAML::load(IO.read(etc_config))\n else\n logger(\"\\nWARNING: you must setup config file rest_api_config.yaml in #{config_yaml} or #{etc_config}\")\n logger(\"WARNING: see GEM_HOME/rest_connection/config/rest_api_config.yaml for example config\")\n @settings = {}\n end\n @settings[:extension] = \".js\"\n @settings[:api_href] = @settings[:api_url] unless @settings[:api_href]\n end",
"def load\n @provider_dir = Path.provider\n\n # load base\n base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base))\n base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base))\n base_common = load_json(Path.named_path(:common_config, Path.provider_base))\n base_provider = load_json(Path.named_path(:provider_config, Path.provider_base))\n\n # load provider\n provider_path = Path.named_path(:provider_config, @provider_dir)\n common_path = Path.named_path(:common_config, @provider_dir)\n Util::assert_files_exist!(provider_path, common_path)\n @services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir))\n @tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir))\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir))\n @common = load_json(common_path)\n @provider = load_json(provider_path)\n @secrets = load_json(Path.named_path(:secrets_config, @provider_dir))\n\n # inherit\n @services.inherit_from! base_services\n @tags.inherit_from! base_tags\n @common.inherit_from! base_common\n @provider.inherit_from! base_provider\n @nodes.each do |name, node|\n @nodes[name] = apply_inheritance(node)\n end\n\n # validate\n validate_provider(@provider)\n end",
"def load_config(config_file)\n begin\n $test_config=YAML::load(YAML::load_file(config_file))\n rescue Exception => e\n puts \"Error: #{e} while loading the configuration file, please specify valid yaml file\"\n end\n end",
"def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end",
"def config_for(dest_path, sync_config_path = nil)\n module_root = PDK::Util.module_root\n sync_config_path ||= File.join(module_root, '.sync.yml') unless module_root.nil?\n config_path = File.join(@path, 'config_defaults.yml')\n\n if @config.nil?\n conf_defaults = read_config(config_path)\n sync_config = read_config(sync_config_path) unless sync_config_path.nil?\n @config = conf_defaults\n @config.deep_merge!(sync_config, knockout_prefix: '---') unless sync_config.nil?\n end\n file_config = @config.fetch(:global, {})\n file_config['module_metadata'] = @module_metadata\n file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil?\n file_config.merge!(@config)\n end",
"def hiera_stub\n config = Hiera::Config.load(hiera_config)\n config[:logger] = 'puppet'\n Hiera.new(:config => config)\nend",
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__test').stdout.strip.lines\n puppet_config_check = run_shell('puppet agent --configprint manifest').stdout\n\n if puppet_config_check.nil? || puppet_config_check.empty?\n fail(\"No output returned from `puppet config print manifest`\")\n end\n\n puppet_env_path = File.dirname(puppet_config_check)\n\n # We'll just take the first match since Hiera will find things there\n puppet_lookup_info = puppet_lookup_info.grep(/Path \"/).grep(Regexp.new(puppet_env_path))\n\n # Grep always returns an Array\n if puppet_lookup_info.empty?\n fail(\"Could not determine hiera data directory under #{puppet_env_path}\")\n end\n\n # Snag the actual path without the extra bits\n puppet_lookup_info = puppet_lookup_info.first.strip.split('\"').last\n\n # Make the parent directories exist\n run_shell(\"mkdir -p #{File.dirname(puppet_lookup_info)}\", acceptable_exit_codes: [0])\n\n # We just want the data directory name\n datadir_name = puppet_lookup_info.split(puppet_env_path).last\n\n # Grab the file separator to add back later\n file_sep = datadir_name[0]\n\n # Snag the first entry (this is the data directory)\n datadir_name = datadir_name.split(file_sep)[1]\n\n # Constitute the full path to the data directory\n datadir_path = puppet_env_path + file_sep + datadir_name\n\n # Return the path to the data directory\n return datadir_path\nend",
"def base_config\n if engine_config.config\n ::HamlLint::ConfigurationLoader.load_file(engine_config.config)\n else\n ::HamlLint::ConfigurationLoader.load_applicable_config\n end\n end",
"def hiera_plugins\n return @hiera_plugins if @hiera_plugins\n @hiera_plugins = {}\n return @hiera_plugins unless Noop::Config.file_path_hiera_plugins.directory?\n Noop::Config.file_path_hiera_plugins.children.each do |hiera|\n next unless hiera.directory?\n hiera_name = hiera.basename.to_s\n hiera.children.each do |file|\n next unless file.file?\n next unless file.to_s.end_with? '.yaml'\n file = file.relative_path_from Noop::Config.dir_path_hiera\n @hiera_plugins[hiera_name] = [] unless @hiera_plugins[hiera_name]\n @hiera_plugins[hiera_name] << file\n end\n end\n @hiera_plugins\n end"
] |
[
"0.66142774",
"0.6323906",
"0.6308874",
"0.6004687",
"0.5995144",
"0.595492",
"0.5898234",
"0.5880586",
"0.5851178",
"0.58310044",
"0.5776565",
"0.5755142",
"0.572212",
"0.57084197",
"0.56564426",
"0.56489426",
"0.5616188",
"0.561147",
"0.56078607",
"0.559351",
"0.55861735",
"0.55858713",
"0.55085",
"0.549954",
"0.5491144",
"0.547164",
"0.5459854",
"0.54480684",
"0.5431517",
"0.5426642",
"0.5424102",
"0.54153025",
"0.5410343",
"0.53992033",
"0.538977",
"0.53658825",
"0.535144",
"0.53493905",
"0.53268385",
"0.5326318",
"0.53232455",
"0.53208405",
"0.53126305",
"0.53119165",
"0.5292103",
"0.5288388",
"0.52867025",
"0.5278483",
"0.52707773",
"0.5259642",
"0.52595943",
"0.5255137",
"0.5254296",
"0.52494186",
"0.5243123",
"0.5230942",
"0.5216415",
"0.5200226",
"0.51986617",
"0.5195095",
"0.51939654",
"0.51912564",
"0.5183052",
"0.517444",
"0.517401",
"0.5171317",
"0.51612294",
"0.5160928",
"0.5158232",
"0.51414657",
"0.5138169",
"0.51366705",
"0.5132138",
"0.51301223",
"0.5122178",
"0.5120525",
"0.5106646",
"0.5105889",
"0.51029694",
"0.51007134",
"0.5097556",
"0.50960857",
"0.5095012",
"0.5093172",
"0.50878197",
"0.50877494",
"0.5076786",
"0.5075374",
"0.50708586",
"0.50695246",
"0.5059444",
"0.5057815",
"0.50559735",
"0.50538033",
"0.50510013",
"0.50459254",
"0.5042148",
"0.5032129",
"0.50301987",
"0.50296485"
] |
0.7328607
|
0
|
GET /organizations GET /organizations.json
|
def index
if search_params
logger.debug "Got params: #{search_params}"
@organization = Organization.find(search_params)
else
logger.debug "No params!"
end
# @organizations = Organization.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end",
"def GetOrgs params = {}\n\n params = params.merge(path: 'organizations.json')\n APICall(params)\n\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def orgs\n client.organizations\n end",
"def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n @organizations = Organization.all\n respond_with(@organizations)\n end",
"def index\n @organizations = Organization.all\n respond_with @organizations\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\t@organizations.each do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end",
"def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end",
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def list \n @organizations = Organization.all\n \n render \"list\"\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def find_organizations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationsApi#find_organizations ...\"\n end\n \n # resource path\n path = \"/organizations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'attribute'] = opts[:'attribute'] if opts[:'attribute']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<OrganizationComposite>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationsApi#find_organizations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n render json: Organization.all\n end",
"def account_organization\n get('account/organization')\n end",
"def index\n @organizations = Organization.page(params[:page]).per_page(9).order(\"name DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def find_organizations\n Organization.all\n end",
"def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user organizations (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def index\n @orgs = Org.all\n end",
"def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend",
"def organizations\r\n OrganizationsController.instance\r\n end",
"def index\n @organizations = Spree::Organization.all\n end",
"def get_organisations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_organisations ...'\n end\n # resource path\n local_var_path = '/blue/rest/organizations/'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\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 => 'Organisations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_organisations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @user_organizations = UserOrganization.all\n end",
"def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end",
"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",
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def orgs(params = {})\n params.merge!(key: 'orgs')\n objects_from_response(Code42::Org, :get, 'org', params)\n end",
"def organizations\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n respond_to do |format|\n format.html {\n render partial: 'organization'\n }\n end\n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def show\n cf_get(path: \"/organizations/#{org_id}\")\n end",
"def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end",
"def index\n @organization_accounts = OrganizationAccount.all.sort_by(&:organization_name).reverse\n \n if user_signed_in? && current_user.admin?\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_accounts }\n end\n else\n redirect_to root_path\n end\n end",
"def orgs\n @orgs ||= begin\n client.organizations.map(&:login)\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n []\n end\n end",
"def index\n @clients_organizations = ClientsOrganization.all\n end",
"def list\n @connection.get('/user/orgs').map do |org_data|\n GitHubApi::Org.new(self, org_data)\n end\n end",
"def index\n @admins_organizations = Organization.all\n end",
"def get(*args)\n arguments(args, required: [:org_name])\n\n get_request(\"/orgs/#{arguments.org_name}\", arguments.params)\n end",
"def org_dashboard\n respond_to do |format|\n format.html { @organization = Organization.first }\n format.json { render json: Organization.first }\n end\n end",
"def get_organizations\n org_references =\n locations.each_with_object({}) do |loc, acc|\n reference = loc.resource.managingOrganization.reference\n org_id = reference.match(ID_MATCHER)[1]\n\n acc[org_id] ||= []\n acc[org_id] << loc\n end\n\n facility_identifiers = org_references&.keys&.join(',')\n org_response = organization_service.search(_id: facility_identifiers, _count: '100')\n\n org_response&.resource&.entry\n end",
"def index\n @organization = Organization.find_by_id(params[:organization_id])\n if @organization\n @users = @organization.users\n else\n @status = :fail\n @data = {organization: \"Organization #{params[:organization_id]} not found.\"}\n render status: :not_found, json: json_response(:fail, data: @data)\n end\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end",
"def get_user_organizations(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n\n get \"#{users_path}/#{user_id}/organizations\"\n end",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :key => HttpClient::Preconditions.assert_class_or_nil('key', opts.delete(:key), String),\n :name => HttpClient::Preconditions.assert_class_or_nil('name', opts.delete(:name), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/organizations\").with_query(query).get.map { |hash| Apidoc::Models::Organization.new(hash) }\n end",
"def index\n @orgs ||= Github::Org.orgs(\n current_user_github_access_token,\n current_github_username\n )\n end",
"def find_organizations(opts = {})\n data, status_code, headers = find_organizations_with_http_info(opts)\n return data\n end",
"def get_user_github_organizations(github_orgs_url)\n uri = URI.parse(github_orgs_url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n user_organizations = JSON.parse(response.body)\n user_organizations.map { |o| o['login'] }\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def orgs(enterprise = 'default')\n @api.orgs enterprise\n end",
"def org_show_data\n org = Organization.find(params[:org])\n\n @data = {\n name: org.name,\n website: org.website,\n logo_link: org.logo_link,\n users: user_names_and_emails_from_org(org)\n }\n\n render json: @data\n end",
"def index\n @people = current_organization.people.all\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def index\n @organizations = Organization.order(sort_column + \" \" + sort_direction).page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @organizations }\n end\n end",
"def show\n authorize @organization_membership\n render json: @organization_membership\n end",
"def index\n # Get page number\n page = params[:page].nil? ? 1 : params[:page]\n\n if current_user.admin?\n @organizations = Organization.all.paginate(page: page, per_page: PAGE_COUNT)\n else\n if current_user.organization\n redirect_to current_user.organization\n else\n redirect_to new_organization_path\n end\n end\n end",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n _do_request(grafana_options)\n rescue BackendError\n nil\n end",
"def show\n @organization_profile = OrganizationProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n end",
"def index\n @search = params[:search] || Hash.new\n @search[:name_contains] = params[:term] if params[:term]\n @search.each do |k,v|\n if !v.blank? && Organization::SEARCHABLE.include?( k.to_sym )\n @organizations = @organizations.send k, v\n end\n end\n @organizations = @organizations.page(params[:page])\n\n\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json { render json: @organizations.map { |o| { id: o.id, label: o.name, value: o.name(:last_first) } } }\n format.xml { render :xml => @organizations }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n respond_with @organization\n end",
"def index\n @group_organizations = GroupOrganization.all\n end",
"def retrieve_organization(name = nil)\n name ||= organization_name\n org = Organization.find_by(name: name)\n halt_with_json_response(404, INVALID_ORG, 'organization does not exist') \\\n if org.nil?\n return org\n end",
"def get_by_key(key)\n HttpClient::Preconditions.assert_class('key', key, String)\n @client.request(\"/organizations/#{CGI.escape(key)}\").get { |hash| Apidoc::Models::Organization.new(hash) }\n end",
"def all_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper(false)).flatten\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end",
"def index\n render json: current_org.users\n end",
"def active_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper).flatten\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def org(id = \"my\", params = {})\n object_from_response(Code42::Org, :get, \"org/#{id}\", params)\n end",
"def show\n case current_user.role.name\n when \"Viewer\", \"User\"\n head :no_content\n return\n when \"Manager\", \"Admin\", \"SuperAdmin\"\n else\n raise \"User with email = \\\"#{current_user.email}\\\" has an invalid role!\"\n end\n render json: @organisation.as_json(\n only: [:id, :name],\n include: {\n organisation_units: {\n only: [:id, :name],\n include: {\n users: {\n only: [:id, :name],\n include: {\n role: { only: [:name] }\n }\n }\n }\n },\n }\n )\n end",
"def get_organization_by_id(id)\n require_relative 'telerivet/organization'\n Organization.new(self, self.do_request(\"GET\", get_base_api_path() + \"/organizations/#{id}\"))\n end",
"def index\n @sourcing_orgs = SourcingOrg.all\n end",
"def organizations \n puts \"List of organizations:\"\nend",
"def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend",
"def show\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_organization }\n end\n end",
"def index\n @organization = current_user.organization\n @merits = @organization.merits\n end"
] |
[
"0.80765116",
"0.80071",
"0.78597564",
"0.78338337",
"0.78312206",
"0.7745588",
"0.7691283",
"0.7672265",
"0.76290935",
"0.7590858",
"0.7536119",
"0.7533662",
"0.7521284",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75003576",
"0.7459552",
"0.74238825",
"0.7423191",
"0.74064505",
"0.74064505",
"0.7357264",
"0.7353553",
"0.7341248",
"0.73080254",
"0.73058045",
"0.72576714",
"0.72547036",
"0.7234301",
"0.7142644",
"0.71310985",
"0.71163946",
"0.7108704",
"0.7107696",
"0.70913565",
"0.70783454",
"0.707133",
"0.7065519",
"0.70442355",
"0.7034759",
"0.7028269",
"0.70132995",
"0.70132995",
"0.7013245",
"0.6974229",
"0.69214576",
"0.68938667",
"0.6885557",
"0.68472105",
"0.68455255",
"0.68368435",
"0.6836245",
"0.6833144",
"0.68022317",
"0.6798124",
"0.6792869",
"0.6792308",
"0.6789671",
"0.6787703",
"0.6787543",
"0.6781702",
"0.67770505",
"0.6767805",
"0.6752179",
"0.67115045",
"0.6705219",
"0.6704132",
"0.66987795",
"0.66933274",
"0.6674487",
"0.6657487",
"0.66493815",
"0.66468114",
"0.6620185",
"0.661743",
"0.6609138",
"0.65819615",
"0.65304035",
"0.6525404",
"0.6518936",
"0.6513303",
"0.65101445",
"0.6500153",
"0.64931446",
"0.64931446",
"0.64766717",
"0.64659196",
"0.6454719",
"0.64336836",
"0.6418678",
"0.6411601",
"0.6403693",
"0.6392693"
] |
0.6490563
|
92
|
GET /organizations/1 GET /organizations/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end",
"def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end",
"def GetOrgs params = {}\n\n params = params.merge(path: 'organizations.json')\n APICall(params)\n\n end",
"def index\n @organizations = Organization.all\n respond_with(@organizations)\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n respond_with @organizations\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def index\n @organizations = Organization.all\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def index\n render json: Organization.all\n end",
"def index\n @organizations = Organization.page(params[:page]).per_page(9).order(\"name DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def list \n @organizations = Organization.all\n \n render \"list\"\n end",
"def find_organizations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationsApi#find_organizations ...\"\n end\n \n # resource path\n path = \"/organizations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'attribute'] = opts[:'attribute'] if opts[:'attribute']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<OrganizationComposite>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationsApi#find_organizations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n cf_get(path: \"/organizations/#{org_id}\")\n end",
"def orgs\n client.organizations\n end",
"def index\n @orgs = Org.all\n end",
"def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\t@organizations.each do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end",
"def org_dashboard\n respond_to do |format|\n format.html { @organization = Organization.first }\n format.json { render json: Organization.first }\n end\n end",
"def account_organization\n get('account/organization')\n end",
"def show\n @organization = Organization.find(params[:id])\n end",
"def organizations\r\n OrganizationsController.instance\r\n end",
"def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend",
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def show\n @organization_profile = OrganizationProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n respond_with @organization\n end",
"def retrieve_organization(name = nil)\n name ||= organization_name\n org = Organization.find_by(name: name)\n halt_with_json_response(404, INVALID_ORG, 'organization does not exist') \\\n if org.nil?\n return org\n end",
"def index\n @organizations = Spree::Organization.all\n end",
"def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end",
"def find_organizations\n Organization.all\n end",
"def index\n @user_organizations = UserOrganization.all\n end",
"def index\n @organization = Organization.find_by_id(params[:organization_id])\n if @organization\n @users = @organization.users\n else\n @status = :fail\n @data = {organization: \"Organization #{params[:organization_id]} not found.\"}\n render status: :not_found, json: json_response(:fail, data: @data)\n end\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"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",
"def organizations\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n respond_to do |format|\n format.html {\n render partial: 'organization'\n }\n end\n end",
"def get(*args)\n arguments(args, required: [:org_name])\n\n get_request(\"/orgs/#{arguments.org_name}\", arguments.params)\n end",
"def org(id = \"my\", params = {})\n object_from_response(Code42::Org, :get, \"org/#{id}\", params)\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :key => HttpClient::Preconditions.assert_class_or_nil('key', opts.delete(:key), String),\n :name => HttpClient::Preconditions.assert_class_or_nil('name', opts.delete(:name), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/organizations\").with_query(query).get.map { |hash| Apidoc::Models::Organization.new(hash) }\n end",
"def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user organizations (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end",
"def get_organization_by_id(id)\n require_relative 'telerivet/organization'\n Organization.new(self, self.do_request(\"GET\", get_base_api_path() + \"/organizations/#{id}\"))\n end",
"def show\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_organization }\n end\n end",
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def get_by_key(key)\n HttpClient::Preconditions.assert_class('key', key, String)\n @client.request(\"/organizations/#{CGI.escape(key)}\").get { |hash| Apidoc::Models::Organization.new(hash) }\n end",
"def get_organisations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_organisations ...'\n end\n # resource path\n local_var_path = '/blue/rest/organizations/'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\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 => 'Organisations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_organisations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @clients_organizations = ClientsOrganization.all\n end",
"def show\n @environment = current_user.organization.environments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end",
"def index\n @organization_accounts = OrganizationAccount.all.sort_by(&:organization_name).reverse\n \n if user_signed_in? && current_user.admin?\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_accounts }\n end\n else\n redirect_to root_path\n end\n end",
"def show\n authorize @organization_membership\n render json: @organization_membership\n end",
"def index\n @admins_organizations = Organization.all\n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end",
"def org_show_data\n org = Organization.find(params[:org])\n\n @data = {\n name: org.name,\n website: org.website,\n logo_link: org.logo_link,\n users: user_names_and_emails_from_org(org)\n }\n\n render json: @data\n end",
"def index\n @organizations = Organization.order(sort_column + \" \" + sort_direction).page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @organizations }\n end\n end",
"def index\n @orgs ||= Github::Org.orgs(\n current_user_github_access_token,\n current_github_username\n )\n end",
"def index\n @people = current_organization.people.all\n end",
"def orgs(params = {})\n params.merge!(key: 'orgs')\n objects_from_response(Code42::Org, :get, 'org', params)\n end",
"def organization organization_id, cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/organizations/#{organization_id}\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def show\r\n @org = Org.from_param(params[:abbr])\r\n # @jobs = Job.find(Curation.where(:org_id => @org.id).pluck(:job_id))\r\n @jobs = @org.jobs\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @org }\r\n end\r\n end",
"def index\n # Get page number\n page = params[:page].nil? ? 1 : params[:page]\n\n if current_user.admin?\n @organizations = Organization.all.paginate(page: page, per_page: PAGE_COUNT)\n else\n if current_user.organization\n redirect_to current_user.organization\n else\n redirect_to new_organization_path\n end\n end\n end",
"def get_user_github_organizations(github_orgs_url)\n uri = URI.parse(github_orgs_url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n user_organizations = JSON.parse(response.body)\n user_organizations.map { |o| o['login'] }\n end",
"def get_user_organizations(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n\n get \"#{users_path}/#{user_id}/organizations\"\n end",
"def get_organizations\n org_references =\n locations.each_with_object({}) do |loc, acc|\n reference = loc.resource.managingOrganization.reference\n org_id = reference.match(ID_MATCHER)[1]\n\n acc[org_id] ||= []\n acc[org_id] << loc\n end\n\n facility_identifiers = org_references&.keys&.join(',')\n org_response = organization_service.search(_id: facility_identifiers, _count: '100')\n\n org_response&.resource&.entry\n end",
"def show\n @organ = Organ.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organ }\n end\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def index\n render json: current_org.users\n end",
"def show\n case current_user.role.name\n when \"Viewer\", \"User\"\n head :no_content\n return\n when \"Manager\", \"Admin\", \"SuperAdmin\"\n else\n raise \"User with email = \\\"#{current_user.email}\\\" has an invalid role!\"\n end\n render json: @organisation.as_json(\n only: [:id, :name],\n include: {\n organisation_units: {\n only: [:id, :name],\n include: {\n users: {\n only: [:id, :name],\n include: {\n role: { only: [:name] }\n }\n }\n }\n },\n }\n )\n end",
"def index\n @group_organizations = GroupOrganization.all\n end",
"def find_organization\n @organization = Organization.find(params[:organization_id])\n end",
"def index\n @search = params[:search] || Hash.new\n @search[:name_contains] = params[:term] if params[:term]\n @search.each do |k,v|\n if !v.blank? && Organization::SEARCHABLE.include?( k.to_sym )\n @organizations = @organizations.send k, v\n end\n end\n @organizations = @organizations.page(params[:page])\n\n\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json { render json: @organizations.map { |o| { id: o.id, label: o.name, value: o.name(:last_first) } } }\n format.xml { render :xml => @organizations }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end",
"def index\n if search_params \n logger.debug \"Got params: #{search_params}\"\n @organization = Organization.find(search_params)\n else\n logger.debug \"No params!\"\n end\n # @organizations = Organization.all\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def show\n @organization = Organization.find(params[:id])\n @address = @organization.address\n @member = Member.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"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",
"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",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def list\n @connection.get('/user/orgs').map do |org_data|\n GitHubApi::Org.new(self, org_data)\n end\n end",
"def show\n @organization = current_user.organization\n end"
] |
[
"0.7965355",
"0.7789723",
"0.7624976",
"0.76014984",
"0.75791377",
"0.75791377",
"0.75518954",
"0.7519814",
"0.74602246",
"0.74229765",
"0.7412952",
"0.7383728",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.73825437",
"0.73576486",
"0.73490685",
"0.7316738",
"0.7316738",
"0.72754604",
"0.72455674",
"0.7211236",
"0.7186702",
"0.7161037",
"0.7154822",
"0.7125796",
"0.7124134",
"0.70706636",
"0.70245826",
"0.7014641",
"0.7011128",
"0.69999534",
"0.69630075",
"0.6957113",
"0.69350725",
"0.69199747",
"0.68781155",
"0.68747586",
"0.68743825",
"0.6853471",
"0.6851181",
"0.68506324",
"0.68443793",
"0.68412125",
"0.6808725",
"0.67993337",
"0.67981666",
"0.6772103",
"0.67623574",
"0.6758727",
"0.67547286",
"0.67540437",
"0.6732849",
"0.6729809",
"0.67246115",
"0.6689021",
"0.66730356",
"0.6672913",
"0.6647419",
"0.66281456",
"0.66230065",
"0.6617488",
"0.6606483",
"0.6603194",
"0.65953904",
"0.6561981",
"0.65604",
"0.6555643",
"0.65367585",
"0.65364915",
"0.65364915",
"0.65260214",
"0.6500989",
"0.64982224",
"0.649001",
"0.64874667",
"0.6487327",
"0.6475932",
"0.6464521",
"0.6452377",
"0.64430994",
"0.6432239",
"0.64304185",
"0.6414206",
"0.63979995",
"0.6393904",
"0.6387008",
"0.6369483",
"0.6352581",
"0.6352581",
"0.6348649",
"0.6348477",
"0.6331517",
"0.6318389"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_organization
@organization = Organization.find(params[:name])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_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",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"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",
"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",
"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",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"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",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"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",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"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",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"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",
"def determine_valid_action\n\n end",
"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",
"def startcompany(action)\n @done = true\n action.setup\n end",
"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",
"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",
"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",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"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",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"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",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"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",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"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",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"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",
"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",
"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",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"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",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"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",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"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"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def search_params
params[:name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
GET /tunning_diagrams GET /tunning_diagrams.json GET /tunning_diagrams.xml
|
def index
@tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tunning_diagrams }
format.xml { render xml: @tunning_diagrams }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def index\n @diagrams = Diagram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @diagrams }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def index\n @tunings = Tuning.all\n end",
"def index\n @chord_diagrams = ChordDiagram.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end",
"def index\n @tunes = Tune.all\n end",
"def stod2gull\n Apis.client.get('/tv/stod2gull')\n end",
"def show\n @diagram = Diagram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def index \n render json: Tuning.all\n end",
"def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end",
"def show\n tune_includes = [:users_that_have_starred, :lyric, :charts, :genres,\n :sources, :instruments]\n @q = @tuning.tunes.ransack(params[:q])\n @q.sorts = 'updated_at desc' if @q.sorts.empty?\n @tunes = @q.result.includes(tune_includes).page(params[:page]).per(100)\n @current_user_tunes = Tune.user_tunes(current_user)\n @user = current_user\n end",
"def show\n graph = GraphViz.new(:G, type: :digraph)\n competency = Competency.find(params[:id])\n graphviz(graph, competency)\n @file = Tempfile.new(['foo', '.png'], \"#{Rails.root}/public/images\")\n graph.output(png: @file.path)\n end",
"def index\n @loveinstagrams = Loveinstagram.all\n end",
"def visualize\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n add_breadcrumb \"visualizing\", [:visualize, @server]\n\n wp_service = VisualizationService.new(@server, :wordpress)\n dp_service = VisualizationService.new(@server, :drupal)\n @wordpress_data = wp_service.gather\n @drupal_data = dp_service.gather\n\n respond_to do |format|\n format.html\n format.json { render json: { server: @server,\n wp_data: @wordpress_data, dp_data: @drupal_data} }\n end\n end",
"def index\n @trayectoria = Trayectorium.all\n end",
"def show\n @kanji = Kanji.find(params[:id])\n @kanji_obj = KLookup::Lookup::Kanji.new(@kanji.kanji)\n @radicals = kanji_radicals(@kanji_obj)\n @examples = @kanji.words\n end",
"def get_graphviz\n handle_graphviz_setup\n @file_name = build_graphviz_restfulpath(params, @output_format)\n # @file_name = get_graph_dir(\"#{@graph_path}#{params[:program]}.#{@output_format}\")\n \n render :layout=>false\n end",
"def show\n @workflow = Workflow.find(params[:id])\n \n default_graph_settings = \"node [shape=box,style=filled];\\n\"\n \n @processed_graph = default_graph_settings + @workflow.graph + process_graph(@workflow)\n \n gv = IO.popen(\"/usr/local/bin/dot -q -Tpng\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvpng = gv.read\n\n\n gv = IO.popen(\"/usr/local/bin/dot -q -Tcmapx\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvmap = gv.read\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def index\n @protocol_drugs = ProtocolDrug.all\n end",
"def index\n @grams = Gram.all # added 12 jul 17 for uploading images (lesson/challenge 16)\n end",
"def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end",
"def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end",
"def views()\n return uri(\"api/views/\")\n end",
"def show\n @denuncium = Denuncium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncium }\n end\n end",
"def show\n @inference_clarification_weight = InferenceClarificationWeight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inference_clarification_weight }\n end\n end",
"def show\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def show\n @lun_disk = LunDisk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lun_disk }\n end\n end",
"def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"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",
"def show\n @grammar = Grammar.find(params[:id]) \n @vocs = Voc.find_grm(@grammar.grm)\n @vocs = Functions.disparse_all_a(@vocs)\n @num_rows = @vocs.length\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @grammar }\n end\n end",
"def index\n # Get all registered ControlledVocabularies\n @controlled_vocabularies = ControlledVocabulary.all.order(:string_key)\n\n # Also get additional controlled vocabularies from UriService that haven't been registered\n controlled_vocabulary_string_keys = @controlled_vocabularies.map(&:string_key)\n @additional_uri_service_controlled_vocabularies = UriService.client.list_vocabularies(1000) # Ridiculously high limit to show all\n @additional_uri_service_controlled_vocabularies.delete_if { |uri_service_vocabulary| controlled_vocabulary_string_keys.include?(uri_service_vocabulary['string_key']) }\n end",
"def view_kit(id)\n resp = @api.kit_info(id)\n @io.display_kit_info resp\n # return the id so a queued operation can continue operating on this kit\n id\n end",
"def show\n @dog_walk = DogWalk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dog_walk }\n end\n end",
"def index\n @trivia = Trivium.all\n end",
"def draw_tactic_overview\n end",
"def show\n @admin_hotspot = Admin::Hotspot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_hotspot }\n end\n end",
"def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end",
"def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end",
"def gererateLacpLearnedInfoView ( viewName )\r\n viewCaption = viewName\r\n protocol = 'LACP'\r\n drillDownType = 'Global Learned Info'\r\n root = @ixNet.getRoot()\r\n statistics = root + '/statistics'\r\n statsViewList = @ixNet.getList(statistics, 'view')\r\n\r\n # Add a StatsView\r\n view = @ixNet.add(statistics, 'view')\r\n @ixNet.setAttribute(view, '-caption', viewCaption)\r\n @ixNet.setAttribute(view, '-type', 'layer23NextGenProtocol')\r\n @ixNet.setAttribute(view, '-visible', 'true')\r\n @ixNet.commit()\r\n view = @ixNet.remapIds(view)[0]\r\n\r\n # Set Filters\r\n trackingFilter = @ixNet.add(view, 'advancedCVFilters')\r\n @ixNet.setAttribute(trackingFilter, '-protocol', protocol)\r\n @ixNet.commit()\r\n #ixNet getAttr $trackingFilter -availableGroupingOptions\r\n @ixNet.setAttribute(trackingFilter, '-grouping', drillDownType)\r\n @ixNet.commit()\r\n layer23NextGenProtocolFilter = view + '/' + 'layer23NextGenProtocolFilter'\r\n @ixNet.setAttribute(layer23NextGenProtocolFilter, '-advancedCVFilter', trackingFilter)\r\n @ixNet.commit()\r\n\r\n # Enable Stats Columns to be displayed\r\n statsList = @ixNet.getList(view, 'statistic')\r\n for stat in statsList\r\n @ixNet.setAttribute(stat, '-enabled', 'true')\r\n end\r\n @ixNet.commit()\r\n\r\n # Enable Statsview\r\n @ixNet.setAttribute(view, '-enabled', 'true')\r\n @ixNet.commit()\r\nend",
"def index\n @graphium_configurations = Graphium::Configuration.all\n end",
"def show\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kit }\n end\n end",
"def index\n @learners = Learner.all\n end",
"def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end",
"def tunning_diagram_params\n params.require(:tunning_diagram).permit()\n end",
"def get_negotiations(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/conversation_proxies/:uid/negotiations(.:format)',:get,params,add_params)\n end",
"def show\n allow :get\n expires_in 60.seconds\n\n result = @kavlan.vlan(params[:id])\n result.delete('links')\n result['links'] = links_for_item(result)\n replace_kavlan_remote(result)\n\n render_result(result)\n end",
"def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end",
"def show\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\n end\n end",
"def index\n @naps = Nap.all\n end",
"def usage\n\t#puts \"\\nUsage: #{$0} operation [vapp-name] [snap-name]\\n\"\n\t#puts \"\\n\\toperation: list|get|poweron|poweroff|shutdown|reset|suspend|createsnapshot|removesnapshot\"\n\tputs \"\\te.g. vcaexplorer token\".green\n\tputs \"\\te.g. vcaexplorer plans\".green\n\tputs \"\\te.g. vcaexplorer instances\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta \n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vms\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\te.g. vcaexplorer users\".green\n\tputs \"\\te.g. vcaexplorer servicegroups\".green\n\tputs \"\\te.g. vcaexplorer billedcosts\".green\n\tputs \"\\te.g. vcaexplorer billablecosts\".green\n\tputs \"\\te.g. vcaexplorer customquery\".green + \" <REST GET query>\".magenta + \" <ContentType>\".magenta\n\tputs \"\\n\"\n\nend",
"def index\n @mnemonics = @word.mnemonics.all\n end",
"def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end",
"def show\n @diagnoz = Diagnoz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diagnoz }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def show\n @reflection = Reflection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reflection }\n end\n end",
"def show\n @galactic_arm = Galacticarm.find(params[:id])\n end",
"def views(repo, options = {})\n opts = ensure_api_media_type(:traffic, options)\n get \"#{Repository.path repo}/traffic/views\", opts\n end",
"def show\n @installation = Installation.find(params[:installation_id]) \n @offpost = Offpost.find(params[:id])\n @learn = @offpost.learns\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offpost }\n end\n end",
"def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"def show\n @mirror = Mirror.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mirror }\n end\n end",
"def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end",
"def download_image\n Net::HTTP.start(\"yuml.me\", 80) do |http|\n http.get(URI.escape(@diagram.get_uri))\n end\n end",
"def virtual_disk_views\n client.enumerate(\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/DCIM/DCIM_VirtualDiskView\")\n end",
"def index\n @network_dvrs = NetworkDvr.all\n end",
"def show_qa_analist\n screen_name(\"Inicial-Analista-QA\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_qa_analist\" }\n format.json { head :ok }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auditorium }\n end\n end",
"def controller_views\n client.enumerate(\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/DCIM/DCIM_ControllerView\")\n end",
"def show\n @nlp = Nlp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nlp }\n end\n end",
"def index\n @syndics = Syndic.all\n end",
"def index\n @drug_interactions = DrugInteraction.all\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def index\n @dramas = Drama.all\n end",
"def show\n @meanings = Meaning.where(word_id: @word.id)\n @synonymous = Synonymou.all\n end",
"def show\n @wifi = Wifi.find(params[:id])\n @reviews = @wifi.reviews\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wifi }\n end\n end",
"def show\n @neighborhood_topic = NeighborhoodTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood_topic }\n end\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def show\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term }\n end\n end",
"def show\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def show\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mugshot }\n end\n end",
"def strategies\n arrayCommand( \"show strat\", DictItemArray, RESPONSE_STRATEGIES_FOLLOW, RESPONSE_NO_STRATEGIES )\n end",
"def strategies\n arrayCommand( \"show strat\", DictItemArray, RESPONSE_STRATEGIES_FOLLOW, RESPONSE_NO_STRATEGIES )\n end",
"def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def show\n @alternativa = Alternativa.find(params[:id])\n @caracteristica = @alternativa.caracteristica\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alternativa }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @ideium = Ideium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ideium }\n end\n end",
"def show\n @mallet_command = MalletCommand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mallet_command }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def show\n @medium_dungeon = MediumDungeon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_dungeon }\n end\n end",
"def stod2\n Apis.client.get('/tv/stod2')\n end",
"def visibilities; end",
"def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end",
"def votd\n require 'rss'\n\n votd = RSS::Parser.parse('https://www.biblegateway.com/usage/votd/rss/votd.rdf?31', false)\n\n render json: votd\n end"
] |
[
"0.64302707",
"0.6269652",
"0.5962418",
"0.56608623",
"0.55094826",
"0.54959035",
"0.5261463",
"0.52576977",
"0.5217472",
"0.5156205",
"0.5143938",
"0.51160264",
"0.5092586",
"0.50656277",
"0.5062149",
"0.5048742",
"0.49743572",
"0.49710086",
"0.4951045",
"0.49499214",
"0.49447197",
"0.49320996",
"0.4926198",
"0.4920034",
"0.4916619",
"0.48913994",
"0.48787862",
"0.48595265",
"0.48583925",
"0.48398536",
"0.48331988",
"0.4826101",
"0.4815734",
"0.48150095",
"0.4808342",
"0.47984886",
"0.47874787",
"0.4778872",
"0.4775323",
"0.47715178",
"0.47688508",
"0.47683707",
"0.47575364",
"0.4743697",
"0.4740796",
"0.47384742",
"0.4737322",
"0.47337294",
"0.47275245",
"0.47242856",
"0.47239995",
"0.4721142",
"0.47210896",
"0.4717257",
"0.47081363",
"0.4706468",
"0.46973896",
"0.469197",
"0.4691279",
"0.46871296",
"0.46844932",
"0.46796015",
"0.46750775",
"0.46720907",
"0.46701744",
"0.46659005",
"0.46658632",
"0.46657923",
"0.46654928",
"0.46641475",
"0.46603048",
"0.46584684",
"0.46580532",
"0.46557617",
"0.46538216",
"0.4653209",
"0.46491587",
"0.46464688",
"0.46428764",
"0.4637706",
"0.46339113",
"0.46314156",
"0.46294808",
"0.46292162",
"0.4627567",
"0.4627316",
"0.4627316",
"0.46267444",
"0.46251634",
"0.46207753",
"0.4619856",
"0.46193185",
"0.46184793",
"0.46155804",
"0.46150804",
"0.461405",
"0.46137524",
"0.461367",
"0.46111575",
"0.4610224"
] |
0.7052123
|
0
|
GET /tunning_diagrams/1 GET /tunning_diagrams/1.json GET /tunning_diagrams/1.xml
|
def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tunning_diagram }
format.xml { render xml: @tunning_diagram }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def index\n @diagrams = Diagram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @diagrams }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def show\n @diagram = Diagram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def show\n graph = GraphViz.new(:G, type: :digraph)\n competency = Competency.find(params[:id])\n graphviz(graph, competency)\n @file = Tempfile.new(['foo', '.png'], \"#{Rails.root}/public/images\")\n graph.output(png: @file.path)\n end",
"def index\n @tunings = Tuning.all\n end",
"def index\n @chord_diagrams = ChordDiagram.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def visualize\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n add_breadcrumb \"visualizing\", [:visualize, @server]\n\n wp_service = VisualizationService.new(@server, :wordpress)\n dp_service = VisualizationService.new(@server, :drupal)\n @wordpress_data = wp_service.gather\n @drupal_data = dp_service.gather\n\n respond_to do |format|\n format.html\n format.json { render json: { server: @server,\n wp_data: @wordpress_data, dp_data: @drupal_data} }\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n \n default_graph_settings = \"node [shape=box,style=filled];\\n\"\n \n @processed_graph = default_graph_settings + @workflow.graph + process_graph(@workflow)\n \n gv = IO.popen(\"/usr/local/bin/dot -q -Tpng\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvpng = gv.read\n\n\n gv = IO.popen(\"/usr/local/bin/dot -q -Tcmapx\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvmap = gv.read\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end",
"def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end",
"def show\n @inference_clarification_weight = InferenceClarificationWeight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inference_clarification_weight }\n end\n end",
"def show\n @lun_disk = LunDisk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lun_disk }\n end\n end",
"def get_graphviz\n handle_graphviz_setup\n @file_name = build_graphviz_restfulpath(params, @output_format)\n # @file_name = get_graph_dir(\"#{@graph_path}#{params[:program]}.#{@output_format}\")\n \n render :layout=>false\n end",
"def index \n render json: Tuning.all\n end",
"def stod2gull\n Apis.client.get('/tv/stod2gull')\n end",
"def show\n @reflection = Reflection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reflection }\n end\n end",
"def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end",
"def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end",
"def download_image\n Net::HTTP.start(\"yuml.me\", 80) do |http|\n http.get(URI.escape(@diagram.get_uri))\n end\n end",
"def show\n @mirror = Mirror.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mirror }\n end\n end",
"def index\n @tunes = Tune.all\n end",
"def view_kit(id)\n resp = @api.kit_info(id)\n @io.display_kit_info resp\n # return the id so a queued operation can continue operating on this kit\n id\n end",
"def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\n end\n end",
"def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end",
"def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end",
"def show\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def show\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kit }\n end\n end",
"def show\n @denuncium = Denuncium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncium }\n end\n end",
"def show\n @memory = Memory.find(params[:id])\n \n Spira.add_repository! :hardware, RDF::Mongo::Repository.new\n @memory_rdf = SPARQL.execute(\"SELECT * WHERE { <#{MemoryRdf.for(@memory.item).subject.to_s}> ?p ?o }\", MemoryRdf.repository)\n \n @recommendations = Semantics::Recommendations.new.for_memory(@memory)\n\n @computer = Semantics::Recommendations.new.build_computer(@memory)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @memory }\n end\n end",
"def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end",
"def views()\n return uri(\"api/views/\")\n end",
"def show\n @admin_hotspot = Admin::Hotspot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_hotspot }\n end\n end",
"def show\n tune_includes = [:users_that_have_starred, :lyric, :charts, :genres,\n :sources, :instruments]\n @q = @tuning.tunes.ransack(params[:q])\n @q.sorts = 'updated_at desc' if @q.sorts.empty?\n @tunes = @q.result.includes(tune_includes).page(params[:page]).per(100)\n @current_user_tunes = Tune.user_tunes(current_user)\n @user = current_user\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def show\n allow :get\n expires_in 60.seconds\n\n result = @kavlan.vlan(params[:id])\n result.delete('links')\n result['links'] = links_for_item(result)\n replace_kavlan_remote(result)\n\n render_result(result)\n end",
"def show\n @kanji = Kanji.find(params[:id])\n @kanji_obj = KLookup::Lookup::Kanji.new(@kanji.kanji)\n @radicals = kanji_radicals(@kanji_obj)\n @examples = @kanji.words\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n @path = params[:path] ? params[:path].split(\"/\") : []\n puts @theorem.id\n @display_object = @theorem\n if @path.last\n type = @path.last.split(\":\").first\n id = @path.last.split(\":\").last\n @display_object = type.constantize.find(id)\n end\n puts @theorem.id\n\n respond_to do |f|\n f.html do\n @theorem.viewed! unless (current_user && @theorem.user_id == current_user.id) || @path.count > 0\n render\n end\n f.json {render json: @theorem }\n end\n end",
"def show\n @medium = OnlineResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @online_resource }\n format.ris\n end\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def show\n @dog_walk = DogWalk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dog_walk }\n end\n end",
"def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"def views(repo, options = {})\n opts = ensure_api_media_type(:traffic, options)\n get \"#{Repository.path repo}/traffic/views\", opts\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def show\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mugshot }\n end\n end",
"def show\n @grammar = Grammar.find(params[:id]) \n @vocs = Voc.find_grm(@grammar.grm)\n @vocs = Functions.disparse_all_a(@vocs)\n @num_rows = @vocs.length\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @grammar }\n end\n end",
"def show\n @diagnoz = Diagnoz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diagnoz }\n end\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @ideium = Ideium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ideium }\n end\n end",
"def usage\n\t#puts \"\\nUsage: #{$0} operation [vapp-name] [snap-name]\\n\"\n\t#puts \"\\n\\toperation: list|get|poweron|poweroff|shutdown|reset|suspend|createsnapshot|removesnapshot\"\n\tputs \"\\te.g. vcaexplorer token\".green\n\tputs \"\\te.g. vcaexplorer plans\".green\n\tputs \"\\te.g. vcaexplorer instances\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta \n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vms\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\te.g. vcaexplorer users\".green\n\tputs \"\\te.g. vcaexplorer servicegroups\".green\n\tputs \"\\te.g. vcaexplorer billedcosts\".green\n\tputs \"\\te.g. vcaexplorer billablecosts\".green\n\tputs \"\\te.g. vcaexplorer customquery\".green + \" <REST GET query>\".magenta + \" <ContentType>\".magenta\n\tputs \"\\n\"\n\nend",
"def show\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term }\n end\n end",
"def show\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def show\n @core_termo_vistorium = Core::TermoVistorium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_termo_vistorium }\n end\n end",
"def show\n @mallet_command = MalletCommand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mallet_command }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def show\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actuator }\n end\n end",
"def index\n @trayectoria = Trayectorium.all\n end",
"def show\n @vdisk = Vdisk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vdisk }\n end\n end",
"def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end",
"def show\n @drone_attack = DroneAttack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :layout => 'blank' }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json {}\n format.rdf { render rdf: @paper }\n end\n end",
"def show\n # Hack to make ontologyid and conceptid work in addition to id and ontology params\n params[:id] = params[:id].nil? ? params[:ontologyid] : params[:id]\n params[:ontology] = params[:ontology].nil? ? params[:id] : params[:ontology]\n\n # PURL-specific redirect to handle /ontologies/{ACR}/{CLASS_ID} paths\n if params[:purl_conceptid]\n params[:purl_conceptid] = \"root\" if params[:purl_conceptid].eql?(\"classes\")\n if params[:conceptid]\n params.delete(:purl_conceptid)\n else\n params[:conceptid] = params.delete(:purl_conceptid)\n end\n redirect_to \"/ontologies/#{params[:acronym]}?p=classes#{params_string_for_redirect(params, prefix: \"&\")}\", :status => :moved_permanently\n return\n end\n\n if params[:ontology].to_i > 0\n acronym = BPIDResolver.id_to_acronym(params[:ontology])\n if acronym\n redirect_new_api\n return\n end\n end\n\n # Note: find_by_acronym includes ontology views\n @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first\n not_found if @ontology.nil?\n \n # Handle the case where an ontology is converted to summary only. \n # See: https://github.com/ncbo/bioportal_web_ui/issues/133.\n if @ontology.summaryOnly && params[:p].present?\n pages = KNOWN_PAGES - [\"summary\", \"notes\"]\n if pages.include?(params[:p])\n redirect_to(ontology_path(params[:ontology]), status: :temporary_redirect) and return\n end\n end\n\n @ob_instructions = helpers.ontolobridge_instructions_template(@ontology)\n\n # Retrieve submissions in descending submissionId order (should be reverse chronological order)\n @submissions = @ontology.explore.submissions.sort {|a,b| b.submissionId.to_i <=> a.submissionId.to_i } || []\n LOG.add :error, \"No submissions for ontology: #{@ontology.id}\" if @submissions.empty?\n\n # Get the latest submission (not necessarily the latest 'ready' submission)\n @submission_latest = @ontology.explore.latest_submission rescue @ontology.explore.latest_submission(include: \"\")\n\n # Is the ontology downloadable?\n restrict_downloads = $NOT_DOWNLOADABLE\n @ont_restricted = restrict_downloads.include? @ontology.acronym\n\n # Fix parameters to only use known pages\n params[:p] = nil unless KNOWN_PAGES.include?(params[:p])\n\n # This action is now a router using the 'p' parameter as the page to show\n case params[:p]\n when \"terms\"\n params[:p] = 'classes'\n redirect_to \"/ontologies/#{params[:ontology]}#{params_string_for_redirect(params)}\", :status => :moved_permanently\n return\n when \"classes\"\n self.classes #rescue self.summary\n return\n when \"mappings\"\n self.mappings #rescue self.summary\n return\n when \"notes\"\n self.notes #rescue self.summary\n return\n when \"widgets\"\n self.widgets #rescue self.summary\n return\n when \"properties\"\n self.properties #rescue self.summary\n return\n when \"summary\"\n self.summary\n return\n else\n self.summary\n return\n end\n end",
"def show\n\n @object_type = ObjectType.includes(items: [{ locator: :wizard }, :sample]).find(params[:id])\n @handler = view_context.make_handler @object_type\n\n @sample_type = SampleType.find(@object_type.sample_type_id) if @object_type.sample?\n\n @image_url = \"#{Bioturk::Application.config.image_server_interface}#{@object_type.image}\"\n\n respond_to do |format|\n format.html { render layout: 'aq2' } # show.html.erb\n format.json { render json: @object_type }\n end\n\n end",
"def show\n @control_point = ControlPoint.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_point }\n format.json { render :json => @control_point }\n format.rdf { render :rdf => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n format.ttl { render :ttl => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n format.nt { render :nt => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n end\n end",
"def show\n respond_with DisGenericMonograph.find(params[:id])\n end",
"def show\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end",
"def show\n @wifi = Wifi.find(params[:id])\n @reviews = @wifi.reviews\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wifi }\n end\n end",
"def dashboard\n\n\tparams[:id] = session[:id] if params[:id].nil?\n\t@user = User.find_by_authentication_id(params[:id])\n\n\tif not @user.nil?\n\t\t@username = @user.name\n\t\t@company = @user.company\n\telse\n\t\t@username = \"Demo\"\n\t\t@company = \"Clicktree\"\n\tend\n\n\tdomain = params[:api_domain]\n\tif domain == \"picturegram\"\n\t\t@api_domain = \"Picturegram\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns pictures which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\n\t\t@api_title2 = \"Specific Picture\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific picture given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=picture\\&path=695948427283543832_2003724'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 1}, \"objects\": [{\"authorlink\": \"! purposeofenvy Cincinnati @purposeofenvy\", \"comments\": \"182 Comments\", \"fillWidth_src\": \"http://distilleryimage8.s3.amazonaws.com/80252edcc12111e3b5450002c9c70a44_8.jpg\", \"index\": 0, \"likes\": \"15889 Likes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:authorlink => \"Username of author who posted the picture\", :comments => \"The amount of comments the picture has.\", :likes => \"The amount of likes the picture has.\", :fillWidth_src => \"The source of the picture so that it can be saved.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc = \"This API call returns pictures found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=music'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\t\n\n\telse\n\t\t@api_domain = \"Listnerd\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns lists which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 20}, \"objects\": [{\"index\": 0, \"meta\": \"2.601 views\\n 26 votes\", \"name\": \"Best Office Chairs\", \"resource_uri\": \"\"}, {\"index\": 1, \"meta\": \"4.898 views\\n 2.208 votes\", \"name\": \"Top 10 Video Game Developers\", \"resource_uri\": \"\"}, {\"index\": 2, \"meta\": \"1.825 views\\n 54 votes\", \"name\": \"Best Horror Shows for Kids\", \"resource_uri\": \"\"}, {\"index\": 3, \"meta\": \"2.333 views\\n 122 votes\", \"name\": \"Best Pink Floyd Album\", \"resource_uri\": \"\"}, {\"index\": 4, \"meta\": \"65.276 views\\n 1.316 votes\", \"name\": \"Top Video Games\", \"resource_uri\": \"\"}, {\"index\": 5, \"meta\": \"5.451 views\\n 1.457 votes\", \"name\": \"TOP 100 TV Series\", \"resource_uri\": \"\"}, {\"index\": 6, \"meta\": \"6.373 views\\n 182 votes\", \"name\": \"Top 10 3D Printers for consumers\", \"resource_uri\": \"\"}, {\"index\": 7, \"meta\": \"2.063 views\\n 22 votes\", \"name\": \"Watch: Funniest Japanese TV Pranks\", \"resource_uri\": \"\"}, {\"index\": 8, \"meta\": \"6.979 views\\n 1.063 votes\", \"name\": \"Greatest Presidents of the USA\", \"resource_uri\": \"\"}, {\"index\": 9, \"meta\": \"9.529 views\\n 134 votes\", \"name\": \"TOP 100 Clothing Brands\", \"resource_uri\": \"\"}, {\"index\": 10, \"meta\": \"14.767 views\\n 93 votes\", \"name\": \"Books You Have To Read Before You Die\", \"resource_uri\": \"\"}, {\"index\": 11, \"meta\": \"10.231 views\\n 414 votes\", \"name\": \"Awesome fantasy fiction books and series\", \"resource_uri\": \"\"}, {\"index\": 12, \"meta\": \"3.734 views\\n 280 votes\", \"name\": \"Actors Who Should Have Won Oscars But Have Not\", \"resource_uri\": \"\"}, {\"index\": 13, \"meta\": \"16.430 views\\n 142 votes\", \"name\": \"Best Beatles Album\", \"resource_uri\": \"\"}, {\"index\": 14, \"meta\": \"3.627 views\\n 155 votes\", \"name\": \"Best Character in Arrested Development TV-series\", \"resource_uri\": \"\"}, {\"index\": 15, \"meta\": \"3.333 views\\n 77 votes\", \"name\": \"Best Series on Netflix\", \"resource_uri\": \"\"}, {\"index\": 16, \"meta\": \"4.653 views\\n 68 votes\", \"name\": \"Best 90s Toy\", \"resource_uri\": \"\"}, {\"index\": 17, \"meta\": \"11.571 views\\n 767 votes\", \"name\": \"Top 100 Animated Movies\", \"resource_uri\": \"\"}, {\"index\": 18, \"meta\": \"10.922 views\\n 73 votes\", \"name\": \"Best Internet Video Series of All Time\", \"resource_uri\": \"\"}, {\"index\": 19, \"meta\": \"43.949 views\\n 7.461 votes\", \"name\": \"Best Birds of Angry Birds\", \"resource_uri\": \"\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:name => \"The name of the list.\", :meta => \"Displays the number of votes and views for the list.\"}\n\n\t\t@api_title2 = \"Specific List\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific list given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=list\\&path=top-10-songs-by-savant'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 88}, \"objects\": [{\"index\": 0, \"position\": \"1\", \"title\": \"Bananonymous\", \"vote\": \"Rate\\n\\n\\n7.92\\n\\n\\n\\n\\n\\n36 votes\"}, {\"index\": 1, \"position\": \"2\", \"title\": \"SPLINTER\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n26 votes\"}, {\"index\": 2, \"position\": \"3\", \"title\": \"Melody Circus\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n24 votes\"}, {\"index\": 3, \"position\": \"4\", \"title\": \"FUCK NEXUS\", \"vote\": \"Rate\\n\\n\\n8.76\\n\\n\\n\\n\\n\\n21 votes\"}, {\"index\": 4, \"position\": \"5\", \"title\": \"LIVING IPOD\", \"vote\": \"Rate\\n\\n\\n8.15\\n\\n\\n\\n\\n\\n20 votes\"}, {\"index\": 5, \"position\": \"6\", \"title\": \"STARFISH\", \"vote\": \"Rate\\n\\n\\n8.63\\n\\n\\n\\n\\n\\n19 votes\"}, {\"index\": 6, \"position\": \"7\", \"title\": \"Sledgehammer\", \"vote\": \"Rate\\n\\n\\n9.06\\n\\n\\n\\n\\n\\n17 votes\"}, {\"index\": 7, \"position\": \"8\", \"title\": \"Ghetto Blastah\", \"vote\": \"Rate\\n\\n\\n8.39\\n\\n\\n\\n\\n\\n18 votes\"}, {\"index\": 8, \"position\": \"9\", \"title\": \"ISM\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 9, \"position\": \"10\", \"title\": \"Pirate bay\", \"vote\": \"Rate\\n\\n\\n8.44\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 10, \"position\": \"11\", \"title\": \"Black Magic\", \"vote\": \"Rate\\n\\n\\n8.31\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 11, \"position\": \"12\", \"title\": \"The Horror\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 12, \"position\": \"13\", \"title\": \"Nightmare Adventures\", \"vote\": \"Rate\\n\\n\\n7.94\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 13, \"position\": \"14\", \"title\": \"BREAKDOWN\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 14, \"position\": \"15\", \"title\": \"Sayonara\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 15, \"position\": \"16\", \"title\": \"Alchemist (feat. Gyno Sydal)\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 16, \"position\": \"17\", \"title\": \"CHAMPAGNE\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 17, \"position\": \"18\", \"title\": \"The Beginning Is Near\", \"vote\": \"Rate\\n\\n\\n8.86\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 18, \"position\": \"19\", \"title\": \"NINUR\", \"vote\": \"Rate\\n\\n\\n7.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 19, \"position\": \"20\", \"title\": \"OVERWORLD\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n13 votes\"}, {\"index\": 20, \"position\": \"21\", \"title\": \"STARSCREAM FOREVER\", \"vote\": \"Rate\\n\\n\\n9.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 21, \"position\": \"22\", \"title\": \"BURGERTIME (SAVANT THEME)\", \"vote\": \"Rate\\n\\n\\n9.17\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 22, \"position\": \"23\", \"title\": \"FIRECLOUD\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 23, \"position\": \"24\", \"title\": \"Sustainer\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 24, \"position\": \"25\", \"title\": \"TRUST ISSUES\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 25, \"position\": \"26\", \"title\": \"DIRTY MARY\", \"vote\": \"Rate\\n\\n\\n9.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 26, \"position\": \"27\", \"title\": \"YOU CAN PLAY\", \"vote\": \"Rate\\n\\n\\n9.36\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 27, \"position\": \"28\", \"title\": \"FLASHBACH\", \"vote\": \"Rate\\n\\n\\n8.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 28, \"position\": \"29\", \"title\": \"The Beat\", \"vote\": \"Rate\\n\\n\\n9.09\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 29, \"position\": \"30\", \"title\": \"Face Off\", \"vote\": \"Rate\\n\\n\\n8.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 30, \"position\": \"31\", \"title\": \"Dancer in the Dark\", \"vote\": \"Rate\\n\\n\\n8.45\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 31, \"position\": \"32\", \"title\": \"BAD BAWS\", \"vote\": \"Rate\\n\\n\\n9.20\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 32, \"position\": \"33\", \"title\": \"Prelude\", \"vote\": \"Rate\\n\\n\\n9.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 33, \"position\": \"34\", \"title\": \"HERO FROM THE PAST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 34, \"position\": \"35\", \"title\": \"HOLY GHOST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 35, \"position\": \"36\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.22\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 36, \"position\": \"37\", \"title\": \"VINTER\", \"vote\": \"Rate\\n\\n\\n9.11\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 37, \"position\": \"38\", \"title\": \"8-BIT LIGHTSABER\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 38, \"position\": \"39\", \"title\": \"Redemption\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 39, \"position\": \"40\", \"title\": \"Mother Earth\", \"vote\": \"Rate\\n\\n\\n8.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 40, \"position\": \"41\", \"title\": \"Paradisco\", \"vote\": \"Rate\\n\\n\\n8.78\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 41, \"position\": \"42\", \"title\": \"Fat Cat Shuffle\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 42, \"position\": \"43\", \"title\": \"MYSTERY\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 43, \"position\": \"44\", \"title\": \"MEGABOY\", \"vote\": \"Rate\\n\\n\\n9.63\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 44, \"position\": \"45\", \"title\": \"THUNDERCLOUT\", \"vote\": \"Rate\\n\\n\\n9.50\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 45, \"position\": \"46\", \"title\": \"VARIO\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 46, \"position\": \"47\", \"title\": \"THE THIRD EYE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 47, \"position\": \"48\", \"title\": \"ARCADE NIGHT CRUISE\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 48, \"position\": \"49\", \"title\": \"NO SHIT SHERLOCK\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 49, \"position\": \"50\", \"title\": \"SHADOW\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 50, \"position\": \"51\", \"title\": \"STORMTROOPER\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 51, \"position\": \"52\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 52, \"position\": \"53\", \"title\": \"DESTROY THE DRAGON\", \"vote\": \"Rate\\n\\n\\n8.75\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 53, \"position\": \"54\", \"title\": \"BA-DA BING!\", \"vote\": \"Rate\\n\\n\\n9.43\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 54, \"position\": \"55\", \"title\": \"No Time For Pussy\", \"vote\": \"Rate\\n\\n\\n8.38\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 55, \"position\": \"56\", \"title\": \"DIAMOND BLUSH\", \"vote\": \"Rate\\n\\n\\n9.29\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 56, \"position\": \"57\", \"title\": \"OUTFOX\", \"vote\": \"Rate\\n\\n\\n8.25\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 57, \"position\": \"58\", \"title\": \"ANTIPIXEL\", \"vote\": \"Rate\\n\\n\\n8.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 58, \"position\": \"59\", \"title\": \"RIDE LIKE THE WIND\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 59, \"position\": \"60\", \"title\": \"Sky is the Limit (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 60, \"position\": \"61\", \"title\": \"CRY FOR LOVE\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 61, \"position\": \"62\", \"title\": \"MECHA BLECKA\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 62, \"position\": \"63\", \"title\": \"ROBOT PEOPLE MONSTER\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 63, \"position\": \"64\", \"title\": \"ZEITGEIST\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 64, \"position\": \"65\", \"title\": \"Konami Kode (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 65, \"position\": \"66\", \"title\": \"ROLLERCOASTER\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 66, \"position\": \"67\", \"title\": \"OCARINE\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 67, \"position\": \"68\", \"title\": \"BACH TO THE PHUTURE\", \"vote\": \"Rate\\n\\n\\n7.57\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 68, \"position\": \"69\", \"title\": \"PARTY MACHINE\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 69, \"position\": \"70\", \"title\": \"EGGS\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 70, \"position\": \"71\", \"title\": \"GUNSLINGER JONES\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 71, \"position\": \"72\", \"title\": \"Hungry Eyes (feat. Qwentalis)\", \"vote\": \"Rate\\n\\n\\n7.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 72, \"position\": \"73\", \"title\": \"Light Years (feat. Razihel)\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 73, \"position\": \"74\", \"title\": \"RABBIT WHORE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 74, \"position\": \"75\", \"title\": \"Manslaughter (feat Svanur Papparazzi)\", \"vote\": \"Rate\\n\\n\\n7.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 75, \"position\": \"76\", \"title\": \"HEART-SHAPED MUSHROOM CLOUD\", \"vote\": \"Rate\\n\\n\\n8.40\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 76, \"position\": \"77\", \"title\": \"OMNI\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 77, \"position\": \"78\", \"title\": \"SYKO\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 78, \"position\": \"79\", \"title\": \"THE A TEAM\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 79, \"position\": \"80\", \"title\": \"Witchcraft\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 80, \"position\": \"81\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n9.25\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 81, \"position\": \"82\", \"title\": \"QUANTUM MECHANICS\", \"vote\": \"Rate\\n\\n\\n7.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 82, \"position\": \"83\", \"title\": \"I WANT YOU\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 83, \"position\": \"84\", \"title\": \"MAKE YOU DREAM\", \"vote\": \"Rate\\n\\n\\n7.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 84, \"position\": \"85\", \"title\": \"SLAUGHTERFACE\", \"vote\": \"Rate\\n\\n\\n5.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 85, \"position\": \"86\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 86, \"position\": \"87\", \"title\": \"Wade in the Water\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 87, \"position\": \"88\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:position => \"Position of the item in the list.\", :title => \"Title of the item on the list.\", :vote => \"Number of votes for the specific item in the list.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc3 = \"This API call returns lists found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=fun'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 12}, \"objects\": [{\"description\": \"A venture funded company is any company which has received funding from a venture capital investor.\", \"index\": 0, \"meta\": \"1.188 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best Venture Funded Company of All Time\"}, {\"description\": \"Fan of Knock Knock jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Knock Knock jokes! Find your favorite? Then vote on the best Knock Knock jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Knock Knock jokes.\", \"index\": 1, \"meta\": \"142 views\\n 623 votes\\n 16.09.13\", \"name\": \"Funny Knock Knock jokes\"}, {\"description\": \"\", \"index\": 2, \"meta\": \"133 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best fun of All Time\"}, {\"description\": \"A defunct sports team is a sports team that no longer exists.\", \"index\": 3, \"meta\": \"98 views\\n 621 votes\\n 27.11.12\", \"name\": \"Best Defunct Sports Team of All Time\"}, {\"description\": \"A defunct organization is an organization that no longer operates.\", \"index\": 4, \"meta\": \"530 views\\n 619 votes\\n 27.11.12\", \"name\": \"Best Defunct Organization of All Time\"}, {\"description\": \"Fan of Dog jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dog jokes! Find your favorite? Then vote on the best Dog jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dog jokes.\", \"index\": 5, \"meta\": \"70 views\\n 574 votes\\n 16.09.13\", \"name\": \"Funny Dog jokes\"}, {\"description\": \"the general reason, purpose for the building at any time. Usually, it is why it was built.\", \"index\": 6, \"meta\": \"179 views\\n 516 votes\\n 27.11.12\", \"name\": \"Best Building function of All Time\"}, {\"description\": \"Fan of Blonde jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Blonde jokes! Find your favorite? Then vote on the best Blonde jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Blonde jokes.\", \"index\": 7, \"meta\": \"37 views\\n 501 votes\\n 16.09.13\", \"name\": \"Funny Blonde jokes\"}, {\"description\": \"Fan of Yo momma jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Yo momma jokes! Find your favorite? Then vote on the best Yo momma jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Yo momma jokes.\", \"index\": 8, \"meta\": \"46 views\\n 480 votes\\n 16.09.13\", \"name\": \"Funny Yo momma jokes\"}, {\"description\": \"Fan of School jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best School jokes! Find your favorite? Then vote on the best School jokes below. If your favorite isnt listed, you can also add a new joke to our selection of School jokes.\", \"index\": 9, \"meta\": \"49 views\\n 465 votes\\n 16.09.13\", \"name\": \"Funny School jokes\"}, {\"description\": \"Fan of Insect jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Insect jokes! Find your favorite? Then vote on the best Insect jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Insect jokes.\", \"index\": 10, \"meta\": \"48 views\\n 443 votes\\n 16.09.13\", \"name\": \"Funny Insect jokes\"}, {\"description\": \"Fan of Dirty jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dirty jokes! Find your favorite? Then vote on the best Dirty jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dirty jokes.\", \"index\": 11, \"meta\": \"53 views\\n 435 votes\\n 16.09.13\", \"name\": \"Funny Dirty jokes\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:name => \"The name of the specific list.\", :description => \"The description of the specific list.\", :meta => \"Displays the number of votes and views for the specific list.\"}\n\tend\n\nend",
"def GetView id\n\n APICall(path: \"views/#{id}.json\")\n\n end",
"def stod2\n Apis.client.get('/tv/stod2')\n end",
"def show\n @nlp = Nlp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nlp }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def new\n @diagram = Diagram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end",
"def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end",
"def show\n @neighborhood_topic = NeighborhoodTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood_topic }\n end\n end",
"def show \n @doc = \"Nothing\"\n @scenario = Scenario.find(params[:id])\n\tdir_name = \"#{Rails.root}/data/#{session[:session_id]}\"\n\tDir.mkdir(dir_name) unless File.exists?(dir_name)\n\n\tbuild_xml()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scenario }\n end\n end",
"def show\n @lifestyle_subgenre_inference_clarification_connector = LifestyleSubgenreInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_subgenre_inference_clarification_connector }\n end\n end",
"def skjar1\n Apis.client.get('/tv/skjar1')\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auditorium }\n end\n end",
"def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end",
"def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end",
"def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def index\n @loveinstagrams = Loveinstagram.all\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end",
"def show\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hydraulic_system }\n end\n end",
"def show\n @vswitch = Vswitch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vswitch }\n end\n end",
"def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend",
"def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend",
"def show\n @drives = Drives.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drives }\n end\n end"
] |
[
"0.7020619",
"0.63848007",
"0.6086284",
"0.6053616",
"0.5594579",
"0.54399014",
"0.5396608",
"0.5376734",
"0.5370773",
"0.53577954",
"0.53278077",
"0.5285031",
"0.52596384",
"0.52386945",
"0.52247274",
"0.5216956",
"0.5213363",
"0.51792276",
"0.51583666",
"0.5145195",
"0.5141815",
"0.5132504",
"0.51307774",
"0.51182103",
"0.51155126",
"0.51131415",
"0.51031065",
"0.5097748",
"0.5091821",
"0.50876135",
"0.50871485",
"0.5083947",
"0.5083442",
"0.50819016",
"0.50808626",
"0.50648844",
"0.50606847",
"0.50412315",
"0.5031684",
"0.50256616",
"0.50223947",
"0.5013849",
"0.501251",
"0.50084496",
"0.50005674",
"0.4996949",
"0.49909696",
"0.49845436",
"0.49839297",
"0.49810824",
"0.49748382",
"0.4967178",
"0.49628666",
"0.49614364",
"0.49588606",
"0.4952197",
"0.49509814",
"0.494783",
"0.4947803",
"0.4946468",
"0.49462822",
"0.49458054",
"0.49438024",
"0.49428648",
"0.49413002",
"0.49394226",
"0.49382198",
"0.49379766",
"0.49333093",
"0.49332583",
"0.4931353",
"0.4929832",
"0.49285114",
"0.49280062",
"0.4923394",
"0.4919304",
"0.4917562",
"0.49154657",
"0.4906538",
"0.49049726",
"0.48919258",
"0.48878407",
"0.4884198",
"0.48772332",
"0.48661217",
"0.48640513",
"0.4863871",
"0.48635063",
"0.48624307",
"0.48567638",
"0.48553",
"0.48531228",
"0.4847455",
"0.48465928",
"0.4844777",
"0.48372298",
"0.48359415",
"0.48358175",
"0.48358175",
"0.4834835"
] |
0.6766607
|
1
|
GET /tunning_diagrams/new GET /tunning_diagrams/new.json GET /tunning_diagrams/new.xml
|
def new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tunning_diagram }
format.xml { render xml: @tunning_diagram }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @diagram = Diagram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def new\n @diagramm = Diagramm.new\n init_diaquenauswahl\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagramm }\n end\n end",
"def new\n @wiki_page = WikiPage.find(params[:wiki_page_id])\n new_name = params[:diagram_name] || 'New Diagram'\n new_diagram = self.gliffy_handle.document_create(new_name,APP_CONFIG['gliffy_folder'])\n redirect_to edit_url(@wiki_page,new_diagram.document_id)\n end",
"def new\n @drawable = Drawable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drawable }\n end\n end",
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end",
"def new\n @lun_disk = LunDisk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lun_disk }\n end\n end",
"def new\n @reflection = Reflection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reflection }\n end\n end",
"def new\n @mirror = Mirror.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mirror }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end",
"def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end",
"def new\n @antler = Antler.new(side: params[:side], animal_id: params[:animal_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @antler }\n end\n end",
"def new\n @gymnasium = Gymnasium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gymnasium }\n end\n end",
"def new\n @object = @hq_vlan = HqVlan.new\n respond_to do |format|\n format.html { render :template => 'reflected/new' }\n format.xml { render :xml => @hq_vlan }\n end\n end",
"def new\n @neighborhood_topic = NeighborhoodTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood_topic }\n end\n end",
"def new\n @inference_clarification_weight = InferenceClarificationWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inference_clarification_weight }\n end\n end",
"def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end",
"def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new\n @talktype = Talktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talktype }\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def create\n @diagram = Diagram.new(params[:diagram])\n\n respond_to do |format|\n if @diagram.save\n flash[:notice] = 'Diagram was successfully created.'\n format.html { redirect_to(@diagram) }\n format.xml { render :xml => @diagram, :status => :created, :location => @diagram }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diagram.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @quest_tree = QuestTree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @intelligence = Intelligence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def new\n @konfig = Konfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @konfig }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @talk }\n end\n end",
"def new\n @kit = Kit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kit }\n end\n end",
"def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vlan }\n end\n end",
"def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @vlan }\n end\n end",
"def new\n @tape = Tape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tape }\n end\n end",
"def new\n @therapist = Therapist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @therapist }\n end\n end",
"def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def new\n @aspect = Aspect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aspect }\n end\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @showdown = Showdown.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @showdown }\n end\n end",
"def new\n @admin_hotspot = Admin::Hotspot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_hotspot }\n end\n end",
"def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end",
"def new\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end",
"def new\n @bottling = Bottling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bottling }\n end\n end",
"def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end",
"def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv }\n end\n end",
"def new\n @ideium = Ideium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ideium }\n end\n end",
"def new\n @nasp_rail = NaspRail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @nasp_rail }\n end\n end",
"def new\n @mallet_command = MalletCommand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mallet_command }\n end\n end",
"def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end",
"def new\n @scraping_algorithm = ScrapingAlgorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def new\n @wikipage = Wikipage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wikipage }\n end\n end",
"def new\n @showdown = Showdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @showdown }\n end\n end",
"def new\n @snap = Snap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snap }\n end\n end",
"def new\n @scan_path = ScanPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scan_path }\n end\n end",
"def new\n @tape_type = TapeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tape_type }\n end\n end",
"def new\n @vdisk = Vdisk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vdisk }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @talk_type = TalkType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_type }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @trivia = Trivia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trivia }\n end\n end",
"def new\n @vocabtype = Vocabtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end",
"def new\n @noticium = Noticium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noticium }\n end\n end",
"def new\n @network = Network.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @network }\n end\n end",
"def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @talk }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end",
"def new\n @knowledge = Knowledge.new\n @identities=Identity.all\n @identities_choose=[]\n @timelines_choose=[]\n @timelines=[]\n @categories_choose=[]\n @categories=[]\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_knowledge_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @kitty = Kitty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kitty }\n end\n end",
"def new\n @portion = Portion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portion }\n end\n end",
"def new\n @webling = Webling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @webling }\n end\n end",
"def new\n @microplst = Microplst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @microplst }\n end\n end",
"def new\n @klassplan = Klassplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klassplan }\n end\n end",
"def new\n @precious_metal = PreciousMetal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @precious_metal }\n end\n end",
"def new\n @klass = Klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @klass }\n end\n end",
"def new\n @hackplatformrelation = Hackplatformrelation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end",
"def new\n @drives = Drives.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drives }\n end\n end",
"def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @neuron = Neuron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neuron }\n end\n end",
"def new\n @server_node = ServerNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_node }\n end\n end",
"def new\n @storage_lun = StorageLun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storage_lun }\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n @breadcrumb = 'create'\n @tariff_type = TariffType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tariff_type }\n end\n end",
"def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end",
"def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end",
"def new\n @object = @hq_san = HqSan.new\n respond_to do |format|\n format.html { render :template => 'reflected/new' }\n format.xml { render :xml => @hq_san }\n end\n end",
"def new\n @vswitch = Vswitch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vswitch }\n end\n end",
"def new\n @rayon = Rayon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rayon }\n end\n end",
"def new\n @virtualmachines = Virtualmachine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @virtualmachines }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end"
] |
[
"0.6363906",
"0.60876155",
"0.60338914",
"0.6027419",
"0.60028416",
"0.59563315",
"0.59469086",
"0.59221077",
"0.59199166",
"0.59083074",
"0.58987087",
"0.58923894",
"0.5888841",
"0.5875507",
"0.5871645",
"0.5839852",
"0.5836289",
"0.5830615",
"0.5829557",
"0.5827808",
"0.58233774",
"0.5797164",
"0.5783816",
"0.5781874",
"0.57714015",
"0.5764256",
"0.5751724",
"0.57338625",
"0.57297677",
"0.5723789",
"0.57206416",
"0.57155025",
"0.57153416",
"0.5705232",
"0.5681794",
"0.5678324",
"0.5670316",
"0.5669012",
"0.5666967",
"0.56626767",
"0.56620634",
"0.5661721",
"0.56603885",
"0.5657112",
"0.5654857",
"0.56523013",
"0.56503546",
"0.5644337",
"0.5643996",
"0.5636994",
"0.56355137",
"0.5631684",
"0.56273335",
"0.5627216",
"0.5627196",
"0.5624526",
"0.5621172",
"0.56163114",
"0.56126404",
"0.5611252",
"0.561059",
"0.5609659",
"0.5609659",
"0.5609659",
"0.5609659",
"0.56087357",
"0.5607013",
"0.5607013",
"0.5605993",
"0.56041676",
"0.56032413",
"0.5596219",
"0.55904317",
"0.5590325",
"0.5590288",
"0.5590288",
"0.5586905",
"0.5581464",
"0.5574436",
"0.5574067",
"0.5574019",
"0.5572989",
"0.5572167",
"0.55674773",
"0.55631995",
"0.55629003",
"0.5562598",
"0.55608004",
"0.5559475",
"0.5555887",
"0.55533195",
"0.5553211",
"0.55430275",
"0.55430275",
"0.55400884",
"0.5539422",
"0.55370396",
"0.5534752",
"0.55324817",
"0.55324817"
] |
0.75504357
|
0
|
POST /tunning_diagrams POST /tunning_diagrams.json POST /tunning_diagrams.xml
|
def create
all_saved = false
if params[:tunning_diagram] && file = params[:tunning_diagram][:archive]
if file.original_filename =~ /\.zip$/i
require 'zip/zipfilesystem'
extract_path = Rails.root.join('public', 'tmp', Digest::MD5.hexdigest(file.original_filename))
FileUtils.rm_rf(extract_path)
FileUtils.mkdir_p(extract_path)
Zip::ZipFile.open(file.tempfile) do |zip|
all_saved = zip.select{|zipfile| zipfile.name =~ /\.(jpg|jpeg)$/i}.map do |zipfile|
f_path = File.join(extract_path, zipfile.name)
zipfile.extract(f_path)
File.open(f_path = File.join(extract_path, zipfile.name), 'r+') do |f|
f_name = zipfile.name.split('.')[0].upcase
td = TunningDiagram.where(hilt_no: f_name).first || TunningDiagram.new(hilt_no: f_name)
td.archive = f
td.save
end
end
end
FileUtils.rm_rf(extract_path)
elsif file.original_filename =~ /\.(jpg|jpeg)$/i
f_name = file.original_filename.split('.')[0]
td = TunningDiagram.where(hilt_no: f_name).first || TunningDiagram.new(hilt_no: f_name)
td.archive = file
all_saved = td.save
end
end
respond_to do |format|
if all_saved
format.html { redirect_to @tunning_diagram, notice: I18n.t('controllers.create_success', name: @tunning_diagram.class.model_name.human) }
format.json { render json: @tunning_diagram, status: :created, location: @tunning_diagram }
format.xml { render xml: @tunning_diagram, status: :created, location: @tunning_diagram }
else
format.html { render action: "new" }
format.json { render json: @tunning_diagram.errors, status: :unprocessable_entity }
format.xml { render xml: @tunning_diagram.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tunning_diagram_params\n params.require(:tunning_diagram).permit()\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def create\n @tuning = Tuning.new(tuning_params)\n\n respond_to do |format|\n if @tuning.save\n format.html { redirect_to @tuning, notice: 'Tuning was successfully created.' }\n format.json { render :show, status: :created, location: @tuning }\n else\n format.html { render :new }\n format.json { render json: @tuning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def create\n @diagram = Diagram.new(params[:diagram])\n\n respond_to do |format|\n if @diagram.save\n flash[:notice] = 'Diagram was successfully created.'\n format.html { redirect_to(@diagram) }\n format.xml { render :xml => @diagram, :status => :created, :location => @diagram }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diagram.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tunning_diagram.update_attributes(params[:tunning_diagram])\n format.html { redirect_to @tunning_diagram, notice: I18n.t('controllers.update_success', name: @tunning_diagram.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tunning_diagram.errors, status: :unprocessable_entity }\n format.xml { render xml: @tunning_diagram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trayectorium = Trayectorium.new(trayectorium_params)\n\n respond_to do |format|\n if @trayectorium.save\n format.html { redirect_to edit_trayectorium_path(@trayectorium.id), notice: 'Trayectorium was successfully created.' }\n format.json { render :show, status: :created, location: @trayectorium }\n else\n format.html { render :new }\n format.json { render json: @trayectorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @interactivekit = Interactivekit.new(interactivekit_params)\n\n respond_to do |format|\n if @interactivekit.save\n format.html { redirect_to @interactivekit, notice: 'Interactivekit was successfully created.' }\n format.json { render :show, status: :created, location: @interactivekit }\n else\n format.html { render :new }\n format.json { render json: @interactivekit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tune = Tune.new(parse_tune)\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to @tune, notice: 'Tune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tune }\n else\n format.html { render action: 'new' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tune = Tune.new(params[:tune])\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to root_path notice: 'Tune was successfully created.' }\n format.json { render json: @tune, status: :created, location: @tune }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diagramm = Diagramm.new(params[:diagramm])\n\n respond_to do |format|\n if @diagramm.save\n flash[:notice] = 'Diagramm wurde erstellt.'\n format.html { redirect_to(edit_diagramm_path(@diagramm)) }\n format.xml { render :xml => @diagramm, :status => :created, :location => @diagramm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diagramm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trivium = Trivia.new(trivium_params)\n\n respond_to do |format|\n if @trivium.save\n format.html { redirect_to @trivium, notice: 'Trivia was successfully created.' }\n format.json { render :show, status: :created, location: @trivium }\n else\n format.html { render :new }\n format.json { render json: @trivium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end",
"def create\n @chord_diagram = ChordDiagram.new(chord_diagram_params)\n\n respond_to do |format|\n if @chord_diagram.save\n format.html { redirect_to new_chord_diagram_url, notice: 'Chord Diagram was successfully created.' }\n format.json { render :show, status: :created, location: @chord_diagram }\n else\n format.html { render :new }\n format.json { render json: @chord_diagram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gymnasium = Gymnasium.new(params[:gymnasium])\n\n respond_to do |format|\n if @gymnasium.save\n format.html { redirect_to @gymnasium, notice: 'Gymnasium was successfully created.' }\n format.json { render json: @gymnasium, status: :created, location: @gymnasium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gymnasium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @denuncium = Denuncium.new(params[:denuncium])\n\n respond_to do |format|\n if @denuncium.save\n format.html { redirect_to @denuncium, notice: 'Denuncium was successfully created.' }\n format.json { render json: @denuncium, status: :created, location: @denuncium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @denuncium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end",
"def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n #@tunning_diagram = TunningDiagram.find(params[:id])\n if @tunning_diagram.destroy && @tunning_diagram.destroy\n respond_to do |format|\n format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_success', name: @tunning_diagram.class.model_name.human) } \n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_fail', name: @tunning_diagram.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @skin_diet = SkinDiet.new(skin_diet_params)\n\n respond_to do |format|\n if @skin_diet.save\n format.html { redirect_to @skin_diet, notice: 'Skin diet was successfully created.' }\n format.json { render :show, status: :created, location: @skin_diet }\n else\n format.html { render :new }\n format.json { render json: @skin_diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tunings_index\n @malone_tuning_builders = vehicle_tunings\n session[:malone_tuning_builders] = @malone_tuning_builders \n end",
"def create\n @dictionary = @language.dictionaries.new(dictionary_params)\n\n respond_to do |format|\n if @dictionary.save\n #binding.pry\n #@dictionary.word_tag_relation_ships.create(params[:dictionaris][:tag_id])\n format.html { redirect_to user_language_dictionary_path(@user, @language, @dictionary), notice: 'Dictionary was successfully created.' }\n format.json { render :show, status: :created, location: @dictionary }\n else\n format.html { render :new }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:deployment_id] = Deployment.find_key(params[:deployment]).id if params.has_key? :deployment\n params[:deployment_id] ||= Deployment.system\n params.require(:name)\n params.require(:deployment_id)\n default_net = nil\n Node.transaction do\n @node = Node.create!(params.permit(:name,\n :description,\n :admin,\n :deployment_id,\n :allocated,\n :alive,\n :system,\n :available,\n :bootenv))\n # Keep suport for mac and ip hints in short form around for legacy Sledgehammer purposes\n if params[:ip]\n default_net = Network.lookup_network(params[:ip]) ||\n Network.find_by_name(\"unmanaged\")\n Attrib.set(\"hint-#{default_net.name}-v4addr\",@node,params[:ip]) if default_net\n Attrib.set(\"hint-admin-macs\", @node, [params[:mac]]) if params[:mac]\n end\n end\n default_net.make_node_role(@node) if default_net\n render api_show @node\n end",
"def create\n @tiponovedad = Tiponovedad.new(tiponovedad_params)\n\n respond_to do |format|\n if @tiponovedad.save\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully created.' }\n format.json { render :show, status: :created, location: @tiponovedad }\n else\n format.html { render :new }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quest_tree = QuestTree.new(params[:quest_tree])\n\n respond_to do |format|\n if @quest_tree.save\n format.html { redirect_to @quest_tree, notice: 'Quest tree was successfully created.' }\n format.json { render json: @quest_tree, status: :created, location: @quest_tree }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hq_san = HqSan.new(params[:hq_san])\n params[:hq_san][:new_hq_diskarray_attributes] ||= {}\n params[:hq_san][:new_hq_slice_attributes] ||= {}\n \n respond_to do |format|\n if @hq_san.save\n flash[:notice] = 'SAN was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @hq_san, :status => :created, :location => @hq_san }\n else\n messages = '<ul>Error:'\n @hq_san.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @hq_san.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @terminal = Terminal.new(terminal_params)\n\n respond_to do |format|\n if @terminal.save\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @terminal }\n else\n format.html { render action: 'new' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ideium = Ideium.new(params[:ideium])\n\n respond_to do |format|\n if @ideium.save\n format.html { redirect_to @ideium, notice: 'Ideium was successfully created.' }\n format.json { render json: @ideium, status: :created, location: @ideium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ideium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nap = Nap.new(nap_params)\n\n respond_to do |format|\n if @nap.save\n format.html { redirect_to @nap, notice: 'Nap was successfully created.' }\n format.json { render :show, status: :created, location: @nap }\n else\n format.html { render :new }\n format.json { render json: @nap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @terminal = Terminal.new(terminal_params)\n\n respond_to do |format|\n if @terminal.save\n format.html { redirect_to @terminal, notice: 'Terminal was successfully created.' }\n format.json { render :show, status: :created, location: @terminal }\n else\n format.html { render :new }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @descriptor = Descriptor.new(descriptor_params)\n respond_to do |format|\n if @descriptor.save\n format.html { redirect_to url_for(@descriptor.metamorphosize),\n notice: 'Descriptor was successfully created.' }\n format.json { render :show, status: :created, location: @descriptor.metamorphosize }\n else\n format.html { render :new }\n format.json { render json: @descriptor.metamorphosize.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def create\n @protocol_drug = ProtocolDrug.new(protocol_drug_params)\n\n respond_to do |format|\n if @protocol_drug.save\n format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully created.' }\n format.json { render :show, status: :created, location: @protocol_drug }\n else\n format.html { render :new }\n format.json { render json: @protocol_drug.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agencium = Agencium.new(agencium_params)\n\n respond_to do |format|\n if @agencium.save\n format.html { redirect_to @agencium, notice: 'Agencium was successfully created.' }\n format.json { render :show, status: :created, location: @agencium }\n else\n format.html { render :new }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def drill_params\n params.require(:drill).permit(:question, solutions_attributes: [:id, :solution, :_destroy])\n end",
"def demographics\n @t = Task.find(params[:id])\n #need to make sure to indicate a certain worker has seen the experiment before\n if SawExperiment.find_by_task_id_and_mturk_worker_id(@t.id, params[:workerId]).nil?\n SawExperiment.create(:task_id => @t.id, :mturk_worker_id => params[:workerId])\n end\n if request.post? \n Demographic.create(params[:demographic].merge(:mturk_worker_id => params[:workerId]))\n redirect_to :action => :index, :id => @t.id, :assignmentId => params[:assignmentId], :workerId => params[:workerId]\n end\n end",
"def create\n @inference_clarification_weight = InferenceClarificationWeight.new(params[:inference_clarification_weight])\n\n respond_to do |format|\n if @inference_clarification_weight.save\n format.html { redirect_to @inference_clarification_weight, notice: 'Inference clarification weight was successfully created.' }\n format.json { render json: @inference_clarification_weight, status: :created, location: @inference_clarification_weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inference_clarification_weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @led = Led.new(led_params)\n\n respond_to do |format|\n if @led.save\n format.html { redirect_to @led, notice: 'Led was successfully created.' }\n format.json { render :show, status: :created, location: @led }\n else\n format.html { render :new }\n format.json { render json: @led.errors, status: :unprocessable_entity }\n end\n end\n end",
"def drama_params\n params.require(:drama).permit(:title, :description, :episode, :director, :actor, :rating, :image)\n end",
"def render(context)\n api = URI.parse('https://www.planttext.com/api/scripting')\n http = Net::HTTP.new(api.host, api.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(api.request_uri)\n request['Content-Type'] = 'application/x-www-form-urlencoded'\n uml = \"\\n@startuml\\n#{super}\\n@enduml\\n\"\n request.set_form_data(type: 'svg', plantuml: uml)\n response = http.request(request)\n return \"<p>Can't render PlantUML diagram.</p>\" unless response.code == '200'\n url = response.body.gsub(/^\"|\"$/, '')\n puts \"PlantUML SVG generated: #{url}\"\n \"<p><object data='#{url}' type='image/svg+xml' #{@markup}></object></p>\"\n end",
"def aki_diagnosis_params\n params.require(:aki_diagnosis).permit(:patient_id, :creatinine_test_1_id, :creatinine_test_2_id, :stage, :reason, :increase_net, :increase_percentage)\n end",
"def create\n @teacher = Teacher.find(params[:teacher_id])\n @learningwalk = @teacher.learningwalks.create(params[:learningwalk].merge({:observer => current_teacher.full_name}).merge({:campus => current_teacher.campus}))\n\n respond_to do |format|\n\n if @learningwalk.save\n \n format.html { redirect_to teacher_learningwalks_path(@teacher), notice: 'Observation was successfully created.' }\n format.json { render json: @learningwalk, status: :created, location: @learningwalk }\n else\n format.html { render action: \"new\" }\n format.json { render json: @learningwalk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @showdown = Showdown.new(params[:showdown])\n \n if params[:topic_1]\n @showdown.topic_ids << params[:topic_1]\n end\n \n if params[:topic_2]\n @showdown.topic_ids << params[:topic_2]\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render json: @showdown, status: :created, location: @showdown }\n else\n format.html { render action: \"new\" }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aki_diagnosis = AkiDiagnosis.new(aki_diagnosis_params)\n\n respond_to do |format|\n if @aki_diagnosis.save\n format.html { redirect_to @aki_diagnosis, notice: 'Diagnosis aki was successfully created.' }\n format.json { render :show, status: :created, location: @aki_diagnosis }\n else\n format.html { render :new }\n format.json { render json: @aki_diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hq_vlan = HqVlan.new(params[:hq_vlan])\n params[:hq_vlan][:assigned_hq_nic] ||= {}\n \n respond_to do |format|\n if @hq_vlan.save\n flash[:notice] = 'Virtual Server was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @hq_vlan, :status => :created, :location => @hq_vlan }\n else\n messages = '<ul>Error:'\n @hq_vlan.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @hq_vlan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @terminal_device = TerminalDevice.new(terminal_device_params)\n\n respond_to do |format|\n if @terminal_device.save\n format.html { redirect_to @terminal_device, notice: 'Terminal device was successfully created.' }\n format.json { render :show, status: :created, location: @terminal_device }\n else\n format.html { render :new }\n format.json { render json: @terminal_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @knowledge_point = KnowledgePoint.new(params[:knowledge_point])\n params[:structure_ids].each do |structure_id|\n @structure = Structure.find_by_id(structure_id)\n @knowledge_point.structures << @structure\n end\n respond_to do |format|\n if @knowledge_point.save\n format.html { redirect_to @knowledge_point, :notice => 'Knowledge point was successfully created.' }\n format.json { render :json => @knowledge_point, :status => :created, :location => @knowledge_point }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @knowledge_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def index\n @tunings = Tuning.all\n end",
"def new\n @wiki_page = WikiPage.find(params[:wiki_page_id])\n new_name = params[:diagram_name] || 'New Diagram'\n new_diagram = self.gliffy_handle.document_create(new_name,APP_CONFIG['gliffy_folder'])\n redirect_to edit_url(@wiki_page,new_diagram.document_id)\n end",
"def create\n @admin_hotspot = Admin::Hotspot.new(params[:admin_hotspot])\n\n respond_to do |format|\n if @admin_hotspot.save\n format.html { redirect_to admin_hotspots_path, notice: 'Hotspot was successfully created.' }\n format.json { render json: @admin_hotspot, status: :created, location: @admin_hotspot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_hotspot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lun_disk = LunDisk.new(params[:lun_disk])\n\n respond_to do |format|\n if @lun_disk.save\n format.html { redirect_to @lun_disk, notice: 'Lun disk was successfully created.' }\n format.json { render json: @lun_disk, status: :created, location: @lun_disk }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lun_disk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @diagrams = Diagram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @diagrams }\n end\n end",
"def datum_params\n params.require(:datum).permit(:name, :audio, :video, :gesture, :actor_id, :topic_id, :gesture_tag_id, :keywords, gesture_tag_attributes: [:iconic, :metaphoric, :deictic, :beat])\n end",
"def create\n @trivium = Trivium.new(trivium_params.merge({user_id:current_user.id}))\n\n respond_to do |format|\n if @trivium.save\n format.html { redirect_to new_trivium_path, notice: 'Trivium was successfully created.' }\n format.json { render :show, status: :created, location: @trivium }\n else\n format.html { render :new }\n format.json { render json: @trivium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tunr\n @tunr = Tunr.find(params[:id])\n end",
"def create\n @reflection = Reflection.new(params[:reflection])\n\n respond_to do |format|\n if @reflection.save\n format.html { redirect_to @reflection, notice: 'Reflection was successfully created.' }\n format.json { render json: @reflection, status: :created, location: @reflection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reflection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def graph\n \n \n @graphml = \"<graphml><key id='label' for='all' attr.name='label' attr.type='string'/><key id='link' for='all' attr.name='link' attr.type='string'/><key id='weight' for='all' attr.name='weight' attr.type='double'/><key id='edgetype' for='edge' attr.name='edgetype' attr.type='string'/><key id='nodetype' for='node' attr.name='nodetype' attr.type='string'/><graph edgedefault='directed'>\" \n @sif = ''\n \n @max = 2\n @log = Array.new\n @additional = {'cleavage' => {}, 'inverse_cleavage' => {}, 'inhibition' => {}, 'inverse_inhibition' => {}, 'interaction' => {}}\n add_nodes(nil,self.protein,nil,0,nil)\n add_additional_nodes(@additional['cleavage'],'cleavage')\n add_additional_nodes(@additional['inverse_cleavage'],'inverse_cleavage')\n add_additional_nodes(@additional['inhibition'],'inhibition')\n add_additional_nodes(@additional['inverse_inhibition'],'inverse_inhibition')\n \n @graphml << \"</graph></graphml>\"\n\n \n # f = File.open(\"#{RAILS_ROOT}/public/images/dynamic/#{self.protein.name}-#{'ppi' if ppi}network.graphml\", 'w')\n # f << @graphml\n # f.close\n\n return @graphml\n end",
"def create\n @network_dvr = NetworkDvr.new(network_dvr_params)\n\n respond_to do |format|\n if @network_dvr.save\n format.html { redirect_to @network_dvr, notice: 'Network dvr was successfully created.' }\n format.json { render :show, status: :created, location: @network_dvr }\n else\n format.html { render :new }\n format.json { render json: @network_dvr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question_to_tag_junction = QuestionToTagJunction.new(question_to_tag_junction_params)\n\n respond_to do |format|\n if @question_to_tag_junction.save\n format.html { redirect_to @question_to_tag_junction, notice: 'Question to tag junction was successfully created.' }\n format.json { render :show, status: :created, location: @question_to_tag_junction }\n else\n format.html { render :new }\n format.json { render json: @question_to_tag_junction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @demonstrator = Demonstrator.new(demonstrator_params)\n\n respond_to do |format|\n if @demonstrator.save\n format.html { redirect_to @demonstrator, notice: 'Demonstrator was successfully created.' }\n format.json { render :show, status: :created, location: @demonstrator }\n else\n format.html { render :new }\n format.json { render json: @demonstrator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @segment = @segmentation_variable.segments.create(params[:segment])\n\n respond_to do |format|\n if @segment.save\n format.html { redirect_to @segmentation_variable, notice: t2('create.notice')}\n format.json { render json: @segment, status: :created, location: @segment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @segment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device_lab = DeviceLab.new(device_lab_params)\n\n respond_to do |format|\n if @device_lab.save\n format.html { redirect_to lab_rack_lab_path(:lab_rack_id => Lab.find(@device_lab.lab_id).lab_rack_id, :id =>@device_lab.lab_id), notice: 'Device lab was successfully created.' }\n format.json { render :show, status: :created, location: @device_lab }\n else\n format.html { render :new }\n format.json { render json: @device_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @controlled_vocabulary = ControlledVocabulary.new(controlled_vocabulary_params)\n\n respond_to do |format|\n if @controlled_vocabulary.save\n format.html { redirect_to edit_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Controlled vocabulary was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @ontology = SYMPH::Ontology.save(params[:ontology])\n \n respond_to do |format|\n if @ontology\n flash[:notice] = 'Ontology was successfully created.'\n else\n flash[:notice] = 'Failed on create ontology.'\n end\n format.html { redirect_to :action => :edit, :id => @ontology }\n format.xml { render :xml => @ontology, :status => :created, :location => @ontology }\n end\n end",
"def create\n @maturation = Maturation.new(maturation_params)\n @maturation.bottling = Bottling.find( params[ :bottling_id ] )\n respond_to do |format|\n if @maturation.save\n format.html { redirect_to [:admin, @maturation], notice: 'Maturation was successfully created.' }\n format.json { render :show, status: :created, location: @maturation }\n else\n format.html { render :new }\n format.json { render json: @maturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_analysis_views\n puts \"====================\"\n puts \"creating analysis views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_views\n\n puts \"> done\"\n puts \"====================\"\n end",
"def create\n @talktype = Talktype.new(params[:talktype])\n\n respond_to do |format|\n if @talktype.save\n format.html { redirect_to @talktype, notice: 'Talktype was successfully created.' }\n format.json { render json: @talktype, status: :created, location: @talktype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @talktype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plant = Plant.find(params[:plant_id])\n if params[:plant_tag][:tag].present?\n tags = Tag.where(id: params[:plant_tag][:tag])\n tags.each do |t|\n @plant_tag = PlantTag.new\n @plant_tag.plant = @plant\n @plant_tag.tag = t\n @plant_tag.save\n end\n redirect_to garden_path(@plant.garden)\n else\n render :new\n end\n end",
"def api_v1_canvas_params\n params.permit(:name, :diagram_id)\n end",
"def create\n @interpretation = Interpretation.new(interpretation_params)\n\n respond_to do |format|\n if @interpretation.save\n format.html { redirect_to @interpretation, notice: 'Interpretation was successfully created.' }\n format.json { render :show, status: :created, location: @interpretation }\n else\n format.html { render :new }\n format.json { render json: @interpretation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trivium_params\n params.require(:trivium).permit(:id, :name, :description, :image_credentials, :user_id, :height, :updater_id)\n end",
"def create_way(nodes_list)\n puts 'Creating Way...'\n way = Rosemary::Way.new\n nodes_list.each do |id|\n way << Rosemary::Node.new(id: id)\n end\n way.add_tags(highway: 'unclassified')\n @api.save(way, @changeset)\n end",
"def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alternativa = Alternativa.new(alternativa_params)\n\n respond_to do |format|\n if @alternativa.save\n format.html { redirect_to @alternativa, notice: 'Alternativa was successfully created.' }\n format.json { render :show, status: :created, location: @alternativa }\n else\n format.html { render :new }\n format.json { render json: @alternativa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @adaptive_thought = AdaptiveThought.new(adaptive_thought_params)\n\n respond_to do |format|\n if @adaptive_thought.save\n format.html { redirect_to @adaptive_thought, notice: 'Adaptive thought was successfully created.' }\n format.json { render :show, status: :created, location: @adaptive_thought }\n else\n format.html { render :new }\n format.json { render json: @adaptive_thought.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actuator = Actuator.new(params[:actuator].each_value(&:strip!))\n @actuator.command = Command.new\n\n #if @actuator.save\n # @actuator.data_uri = actuator_commands_path(@atuator)\n # @actuator.configuration_uri = actuator_path(@actuator)\n #end \n\n respond_to do |format|\n if @actuator.save\n format.html { redirect_to(@actuator, :notice => 'Actuator was successfully created.') }\n format.xml { render :xml => @actuator, :status => :created, :location => @actuator }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @actuator.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end",
"def create\n @online_judge = OnlineJudge.new(online_judge_params)\n @online_judge.user = current_user\n\n respond_to do |format|\n if @online_judge.save\n format.html { redirect_to current_user, notice: 'Online judge was successfully created.' }\n format.json { render :show, status: :created, location: @online_judge }\n else\n format.html { render :new }\n format.json { render json: @online_judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @diagram = Diagram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def create\n @typerelsequence = Typerelsequence.new(typerelsequence_params)\n\n respond_to do |format|\n if @typerelsequence.save\n format.html { redirect_to @typerelsequence, notice: 'Typerelsequence was successfully created.' }\n format.json { render :show, status: :created, location: @typerelsequence }\n else\n format.html { render :new }\n format.json { render json: @typerelsequence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @header.merge!({'Content-Type' => \"application/json\"})\n query = {name: \"Default\", region: \"sfo1\", size: \"512mb\", image: '5141286'}\n response = self.class.post('/droplets', {query: query, headers: @header})\n tratar_response(response)\n end",
"def create\n @virtualmachine = Virtualmachine.new(virtualmachine_params) \n #vm = Virtualmachine.new\n @response = @virtualmachine.createVMcall(params[\"virtualmachine\"])\n unless @response.has_key?(\"errors\")\n @virtualmachine.RemoteID = @response[\"virtual_machine\"][\"id\"]\n @virtualmachine.LabelOS = @response[\"virtual_machine\"][\"template_label\"] \n respond_to do |format|\n if @virtualmachine.save\n format.html { redirect_to @virtualmachine, notice: 'Virtualmachine was successfully created.' }\n format.json { render action: 'show', status: :created, location: @virtualmachine }\n else\n format.html { render action: 'new' }\n format.json { render json: @virtualmachine.errors, status: :unprocessable_entity }\n end\n end\n else\n flash.keep[:notice] = \"Errors are #{@response[\"errors\"]}\"\n redirect_to action: :index\n end\n end",
"def tuning_params\n params.require(:tuning).permit(:notes, :name, :instrument_type, :tune_id, :description)\n end",
"def create\n @alternatives_set = AlternativesSet.new(params[:alternatives_set])\n #params[:alternative].each do |foreign_key_name,alternative_id|\n # alternative = Alternative.find(alternative_id)\n # @alternatives_set.alternatives << alternative\n #end\n\n respond_to do |format|\n if @alternatives_set.save\n flash[:notice] = 'AlternativesSet was successfully created.'\n format.html { redirect_to(alternatives_sets_path) }\n format.xml { render :xml => @alternatives_set, :status => :created, :location => @alternatives_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alternatives_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vik = Vik.new(vik_params)\n\n respond_to do |format|\n if @vik.save\n format.html { redirect_to @vik, notice: 'Vik was successfully created.' }\n format.json { render :show, status: :created, location: @vik }\n else\n format.html { render :new }\n format.json { render json: @vik.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gesture = Gesture.new(gesture_params)\n\n if @gesture.save\n render json: @gesture, status: :created, location: @gesture\n else\n render json: @gesture.errors, status: :unprocessable_entity\n end\n end",
"def add_word_view(word, *args)\n http_method = :post\n path = '/word/{word}/wordView'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create\n @tradeview = Tradeview.new(tradeview_params)\n\n respond_to do |format|\n if @tradeview.save\n format.html { redirect_to @tradeview, notice: 'Tradeview was successfully created.' }\n format.json { render :show, status: :created, location: @tradeview }\n else\n format.html { render :new }\n format.json { render json: @tradeview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trivium_params\n params.require(:trivium).permit(:question,:category_id, :option_a, :option_b, :option_c, :option_d, :option_e, :right_answer)\n end",
"def create\n @ram = Ram.new(params[:ram])\n\n respond_to do |format|\n if @ram.save\n format.html { redirect_to @ram, notice: 'Ram was successfully created.' }\n format.json { render json: @ram, status: :created, location: @ram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diagcode = Diagcode.new(diagcode_params)\n\n respond_to do |format|\n if @diagcode.save\n format.html { redirect_to @diagcode, notice: 'Diagcode was successfully created.' }\n format.json { render :show, status: :created, location: @diagcode }\n else\n format.html { render :new }\n format.json { render json: @diagcode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def demi_god_params\n params.require(:demi_god).permit(:name, :parent, :child, :attribute, :description, :is_approved, :is_cannon, :up_vote, :universe_id)\n end",
"def create\n @syndic = Syndic.new(syndic_params)\n\n respond_to do |format|\n if @syndic.save\n format.html { redirect_to @syndic, notice: \"Syndic was successfully created.\" }\n format.json { render :show, status: :created, location: @syndic }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6025509",
"0.5852471",
"0.5678888",
"0.54949474",
"0.54936635",
"0.5356828",
"0.5270989",
"0.5102948",
"0.5099927",
"0.50024647",
"0.484845",
"0.4813623",
"0.48073804",
"0.48020402",
"0.47753787",
"0.47617656",
"0.47148153",
"0.46824607",
"0.4632156",
"0.46232826",
"0.46092778",
"0.45985523",
"0.4574271",
"0.45644635",
"0.45640522",
"0.45600733",
"0.4558197",
"0.45467505",
"0.4546719",
"0.454562",
"0.45396608",
"0.45347285",
"0.45327586",
"0.45306423",
"0.45194378",
"0.45083448",
"0.4504801",
"0.4495663",
"0.44929218",
"0.4488306",
"0.44868445",
"0.44851005",
"0.44829392",
"0.4480599",
"0.4467367",
"0.44665682",
"0.44655728",
"0.44642696",
"0.44604594",
"0.4458295",
"0.4456089",
"0.4454515",
"0.4453666",
"0.44463816",
"0.44462192",
"0.44413945",
"0.44281694",
"0.4426926",
"0.44219184",
"0.44188568",
"0.44111392",
"0.44091874",
"0.44091108",
"0.4407891",
"0.44077852",
"0.44002607",
"0.43999946",
"0.43974328",
"0.4389844",
"0.43894082",
"0.43891123",
"0.43869075",
"0.43846616",
"0.4384277",
"0.43785962",
"0.43729737",
"0.43665242",
"0.4366101",
"0.43638614",
"0.43630567",
"0.43589833",
"0.43549332",
"0.43548742",
"0.43530047",
"0.43505442",
"0.43399474",
"0.4339217",
"0.43384072",
"0.43377668",
"0.43356842",
"0.43325692",
"0.43212008",
"0.4319826",
"0.43158698",
"0.431122",
"0.43109244",
"0.43092236",
"0.43089226",
"0.43032932",
"0.43004927"
] |
0.49316886
|
10
|
PUT /tunning_diagrams/1 PUT /tunning_diagrams/1.json PUT /tunning_diagrams/1.xml
|
def update
respond_to do |format|
if @tunning_diagram.update_attributes(params[:tunning_diagram])
format.html { redirect_to @tunning_diagram, notice: I18n.t('controllers.update_success', name: @tunning_diagram.class.model_name.human) }
format.json { head :no_content }
format.xml { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @tunning_diagram.errors, status: :unprocessable_entity }
format.xml { render xml: @tunning_diagram.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def tunning_diagram_params\n params.require(:tunning_diagram).permit()\n end",
"def update\n @diagram = Diagram.find(params[:id])\n\n respond_to do |format|\n if @diagram.update_attributes(params[:diagram])\n flash[:notice] = 'Diagram was successfully updated.'\n format.html { redirect_to(@diagram) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @diagram.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update_vpn_status\n # Request parameters\n mac = params[:mac]\n vpn_status_name = params[:vpn_status]\n vpn_sw = params[:vpn_sw]\n ip = params[:ip]\n viewpoint = params[:viewpoint] || \"Unknown\"\n vpn_status = VpnStatus.find_by_name vpn_status_name\n node = Node.find_or_create_by_id mac.to_i(16)\n node.update_vpn_status vpn_status,ip,vpn_sw,viewpoint\n render status: :created, :text => \"\"\n end",
"def show \n @videoshop = Videoshop.find(params[:id])\n id = @videoshop.id\n x = @videoshop.views\n vw = Videoshop.update(id, :views => x+1)\n vw.save\n end",
"def update\n @interface = Interface.find(params[:id])\n @virtualmachine = Virtualmachine.find(@interface.virtualmachine_id)\n position_networkcard = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | grep -n \"slot='0x#{@interface.pci_slot}\" | cut -d ':' -f1`\n begin_networkcard = position_networkcard.to_i - 4\n end_networkcard = position_networkcard.to_i + 1\n\n delete_networkcard = `sed -i '#{begin_networkcard},#{end_networkcard}d' /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml`\n filesize = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | wc -l`\n filesize = filesize.to_i - 2 \n\n #inserts interface definition\n\n #place xml insertions here\n respond_to do |format|\n if @interface.update_attributes(params[:interface])\n interface_network_id = @interface.network_id\n @network = Network.find(interface_network_id)\n ifacedata = \"<interface type='network'>\\n<mac address='#{@interface.macaddress}'/>\\n<source network='#{@network.name}'/>\\n<model type='pcnet'/>\\n<address type='pci' domain='0x0000' bus='0x00' slot='0x#{@interface.pci_slot}' function='0x0'/>\\n</interface>\"\n write_at(\"/etc/libvirt/qemu/#{@virtualmachine.hostname}.xml\", filesize, ifacedata)\n format.html { redirect_to @interface, :notice => 'Interface was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interface.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update \n if @tuning.update(tuning_params)\n render json: @tuning\n else\n render json: { error: \"Failed to update tuning\"}, status: :unprocessable_entity\n end\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @interactivekit.update(interactivekit_params)\n format.html { redirect_to @interactivekit, notice: 'Interactivekit was successfully updated.' }\n format.json { render :show, status: :ok, location: @interactivekit }\n else\n format.html { render :edit }\n format.json { render json: @interactivekit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tuning.update(tuning_params)\n format.html { redirect_to @tuning, notice: 'Tuning was successfully updated.' }\n format.json { render :show, status: :ok, location: @tuning }\n else\n format.html { render :edit }\n format.json { render json: @tuning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trayectorium.update(trayectorium_params)\n format.html { redirect_to @trayectorium, notice: 'Trayectorium was successfully updated.' }\n format.json { render :show, status: :ok, location: @trayectorium }\n else\n format.html { render :edit }\n format.json { render json: @trayectorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tune = Tune.find(params[:id])\n\n respond_to do |format|\n if @tune.update_attributes(params[:tune])\n format.html { redirect_to @tune, notice: 'Tune was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tunr\n @tunr = Tunr.find(params[:id])\n end",
"def update\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n if @kit.update_attributes(params[:kit])\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n new_images = params[:images]||[]\n\n @intention = Intention.find_by_uuid(params[:id])\n @intention.image_urls = IntentionsHelper.strip_duplicate_images(new_images)\n @intention.save\n\n points = VISBD_INTENTION_IMAGE_POINTS*new_images.count\n track_event(current_action_item(Intention::COMPONENT_TYPE)||current_enrollment, Intention::VISUALIZED_EVENT, target:@intention, points:points)\n\n render nothing: true\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n begin\n if @descriptor.update(descriptor_params)\n format.html { redirect_to url_for(@descriptor.metamorphosize),\n notice: 'Descriptor was successfully updated.' }\n format.json { render :show, status: :ok, location: @descriptor.metamorphosize }\n else\n format.html { render :edit }\n format.json { render json: @descriptor.metamorphosize.errors, status: :unprocessable_entity }\n end\n # Can not cascade destroy Observations\n rescue ActiveRecord::RecordNotDestroyed\n format.html { render :edit }\n format.json { render json: 'Could not destroy, do observations still exist?', status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chord_diagram.update(chord_diagram_params)\n format.html { redirect_to new_chord_diagram_url, notice: 'Chord diagram was successfully updated.' }\n format.json { render :show, status: :ok, location: @chord_diagram }\n else\n format.html { render :edit }\n format.json { render json: @chord_diagram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def update\n respond_to do |format|\n if @trivium.update(trivium_params)\n format.html { redirect_to @trivium, notice: 'Trivia was successfully updated.' }\n format.json { render :show, status: :ok, location: @trivium }\n else\n format.html { render :edit }\n format.json { render json: @trivium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def set_node\n params[:id] = params[:id] + '/' if (params[:id] == 'rest')\n @node = Fedora.rest(params[:id])\n end",
"def destroy\n #@tunning_diagram = TunningDiagram.find(params[:id])\n if @tunning_diagram.destroy && @tunning_diagram.destroy\n respond_to do |format|\n format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_success', name: @tunning_diagram.class.model_name.human) } \n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_fail', name: @tunning_diagram.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vocabulary.update(vocabulary_params)\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocabulary }\n else\n format.html { render :edit }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n if @drawable.update_attributes(params[:drawable])\n format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n save_file\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def editStage(nostage, name, desc)\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStages']\").set name\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStageDescriptions']\").set desc\n sleep 3\n end",
"def update\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n if @quest_tree.update_attributes(params[:quest_tree])\n format.html { redirect_to @quest_tree, notice: 'Quest tree was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @diagramm = Diagramm.find(params[:id])\n\n session[:diaquenauswahl] = session[:diaquenauswahl_original] if params[:abbruch]\n respond_to do |format|\n p [:XXXXXXXXXXXX, 'params[:diagramm]', params[:diagramm]]\n # @diagramm.quelle_ids = (session[:quellenauswahl])\n #session[:diaquenauswahl].each {|diaque| diaque.save!}\n #@diagramm.diaquen = session[:diaquenauswahl]\n if @diagramm.update_attributes(params[:diagramm])\n flash[:notice] = 'Diagramm wurde gespeichert.'\n format.html { redirect_to(@diagramm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @diagramm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @reflection = Reflection.find(params[:id])\n\n respond_to do |format|\n if @reflection.update_attributes(params[:reflection])\n format.html { redirect_to @reflection, notice: 'Reflection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reflection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to @terminal, notice: 'Terminal was successfully updated.' }\n format.json { render :show, status: :ok, location: @terminal }\n else\n format.html { render :edit }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @showdown = Showdown.find(params[:id])\n \n if params[:topic_1]\n @showdown.topic_ids << params[:topic_1]\n end\n \n if params[:topic_2]\n @showdown.topic_ids << params[:topic_2]\n end\n\n respond_to do |format|\n if @showdown.update_attributes(params[:showdown])\n format.html { redirect_to @showdown, notice: 'Showdown was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @snap = Snap.find(params[:id])\n\n respond_to do |format|\n if @snap.update_attributes(params[:snap])\n format.html { redirect_to(@snap, :notice => 'Snap was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_medium\n end",
"def update\n respond_to do |format|\n if @reflection.update(reflection_params)\n format.html { redirect_to @reflection, notice: 'Reflection was successfully updated.' }\n format.json { render :show, status: :ok, location: @reflection }\n else\n format.html { render :edit }\n format.json { render json: @reflection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n if @mugshot.update_attributes(params[:mugshot])\n format.html { redirect_to @mugshot, notice: 'Mugshot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mugshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n\n respond_to do |format|\n if @expectation_stem.update_attributes(params[:expectation_stem])\n flash[:notice] = 'RiGse::ExpectationStem.was successfully updated.'\n format.html { redirect_to(@expectation_stem) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expectation_stem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n if @gymnasium.update_attributes(params[:gymnasium])\n format.html { redirect_to @gymnasium, notice: 'Gymnasium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gymnasium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tuning = Tuning.new(tuning_params)\n\n respond_to do |format|\n if @tuning.save\n format.html { redirect_to @tuning, notice: 'Tuning was successfully created.' }\n format.json { render :show, status: :created, location: @tuning }\n else\n format.html { render :new }\n format.json { render json: @tuning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hq_vnic = HqVnic.find(params[:id])\n \n respond_to do |format|\n if @hq_vnic.update_attributes(params[:hq_vnic])\n flash[:notice] = 'Network Interface was successfully updated.'\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_vnic.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_vnic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @list = HqVlan.all(:order => :name)\n @object = HqVlan.find(params[:id])\n \n params[:hq_vlan][:assigned_hq_nic] ||= {}\n \n @hq_vlan = HqVlan.find(params[:id])\n respond_to do |format|\n if @hq_vlan.update_attributes(params[:hq_vlan])\n @objects = HqVlan.all(:order => 'name ASC')\n flash[:notice] = 'Virtual Server was successfully updated.'\n format.js {redirect_to :action => 'edit', :template => 'reflected/edit' } if request.xhr?\n format.html { redirect_to :action => 'edit', :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_vlan.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_vlan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tune.update(tune_params)\n format.html { redirect_to @tune, notice: 'Tune was successfully updated.' }\n format.json { head :no_content } \n else\n format.html { render action: 'edit' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kit.update(kit_params)\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lun_disk = LunDisk.find(params[:id])\n\n respond_to do |format|\n if @lun_disk.update_attributes(params[:lun_disk])\n format.html { redirect_to @lun_disk, notice: 'Lun disk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lun_disk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_kit(params)\n # separate the ID from the other params\n id = params['id']\n params.reject! { |k,v| k == 'id' }\n\n resp = @api.save_kit(params, id)\n @io.display_kit_info resp\n # return the id so a queued operation can continue operating on this kit\n id\n end",
"def update\n @neighborhood_topic = NeighborhoodTopic.find(params[:id])\n\n respond_to do |format|\n if @neighborhood_topic.update_attributes(params[:neighborhood_topic])\n format.html { redirect_to @neighborhood_topic, notice: 'Neighborhood topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neighborhood_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inference_clarification_weight = InferenceClarificationWeight.find(params[:id])\n\n respond_to do |format|\n if @inference_clarification_weight.update_attributes(params[:inference_clarification_weight])\n format.html { redirect_to @inference_clarification_weight, notice: 'Inference clarification weight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inference_clarification_weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @reflection.update(reflection_params)\n render :show, status: :ok, location: api_v1_reflection_url(@reflection)\n else\n render json: @reflection.errors, status: :unprocessable_entity\n end\n end",
"def update\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n if @konfig.update_attributes(params[:konfig])\n format.html { redirect_to admin_konfig_path(@konfig), notice: 'Config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vocabulary\n @vocabulary = Vocabulary.find(params[:id])\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n respond_to do |format|\n if @terminal_device.update(terminal_device_params)\n format.html { redirect_to @terminal_device, notice: 'Terminal device was successfully updated.' }\n format.json { render :show, status: :ok, location: @terminal_device }\n else\n format.html { render :edit }\n format.json { render json: @terminal_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def editAnnotation ## accepts annotation id\n \n\t# Deprecate the old annotation\n deleteAnnotation\n \n\t# Create a new annotation linking back to the old one.\n addAnnotation\nend",
"def set_trayectorium\n @trayectorium = Trayectorium.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tablet.update(tablet_params)\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { render :show, status: :ok, location: @tablet }\n else\n format.html { render :edit }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agencium.update(agencium_params)\n format.html { redirect_to @agencium, notice: 'Agencium was successfully updated.' }\n format.json { render :show, status: :ok, location: @agencium }\n else\n format.html { render :edit }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_kit(payload, id=nil)\n url = \"kits\" + (id.nil? ? \"\" : \"/#{id}\")\n resp = make_request :post, url, payload\n check_response_for_field resp, \"kit\"\n end",
"def update\n current_admin_user\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if can?(:>=, \"5\")\n params[:kit_media_type][:compartment_layout] = params[:kit_media_type][:compartment_layout].to_json\n @kit_media_type = Kitting::KitMediaType.find(params[:id])\n respond_to do |format|\n if @kit_media_type.update_attributes(params[:kit_media_type])\n format.html { redirect_to @kit_media_type, notice: 'Kit media type is updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kit_media_type.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def set_tuning\n @tuning = Tuning.find(params[:id])\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update\n authorize! :update, @kit\n respond_to do |format|\n if @kit.update(kit_params)\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { render :show, status: :ok, location: @kit }\n else\n format.html { render :edit }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def changeFileOnView\n \n @queryparams = params\n\n if @queryparams[:thumb_up] && @queryparams[:thumb_up] == \"true\"\n devfile = Devfile.find_by_id(@queryparams[:file_devfile_id])\n devfile.update_attribute(:rank, devfile.rank + 1)\n end\n \n if @queryparams[:thumb_down] && @queryparams[:thumb_down] == \"true\"\n devfile = Devfile.find_by_id(@queryparams[:file_devfile_id])\n value = devfile.rank - 1\n if value < 0\n value = 0\n end\n devfile.update_attribute(:rank, value) \n end\n \n if @queryparams[:showMetadata] && @queryparams[:showMetadata] == \"true\"\n @showMetadata = \"true\"\n end\n \n \n @metadatatypes = MetadataType.find(:all, :order => \"updated_at ASC\" )\n \n metadata_select = metadata_select = @@metadata_select_part1 + @@metadata_select_part2+ @@metadata_conditions + \" AND devfiles.id = \" + @queryparams[:file_devfile_id] + \" ORDER BY metadatas.devfile_id, metadatas.updated_at\" \n metas = Metadata.find_by_sql(metadata_select)\n \n @metadatas = {}\n @results = Metadata.find_all_by_devfile_id(@queryparams[:file_devfile_id])\n linkMetadataToResults(metas)\n\n \n if session[:username]\n @signed_in_user = session[:username]\n @user = User.find(:first, :conditions => [\"username = ?\", session[:username]])\n @device_names = Array.new\n @user.devices.each do |d|\n @device_names.push(d.dev_name)\n end\n end\n \n puts \"FUUUPAAR\"\n @ttest = \"jeps\"\n \n puts \"Alkaa\".background(:blue)\n dev_file = Devfile.find_by_id(@queryparams[:file_devfile_id])\n puts dev_file.name.background(:blue)\n blob = Blob.find_by_id(@queryparams[:blob_update_id])\n\n @user_username = @queryparams[:username]\n @device_dev_name = @queryparams[:device_name]\n @device_id = @queryparams[:device_id]\n @file_path = dev_file.path\n @file_name = dev_file.name\n @file_rank = dev_file.rank\n\n @file_type = dev_file.filetype\n @file_devfile_id = dev_file.id\n @file_created_at = dev_file.created_at.strftime('%F %T').to_s\n\n @file_privatefile = dev_file.privatefile\n @blob_size = blob.size\n @blob_version = blob.version\n @blob_filedate = blob.filedate.strftime('%F %T').to_s\n @blob_modified_at = blob.updated_at.strftime('%F %T').to_s\n @blob_id = blob.id\n @blob_uploaded = blob.uploaded\n @blob_thumbnail_name = blob.thumbnail_name\n @blob_predecessor_id = blob.predecessor_id\n @blob_follower_id = blob.follower_id\n @blob_hash = blob.blob_hash\n @fullpath = (@file_path + @file_name.gsub(/[\\s]/, '%20'))[1..-1]\n \n @file_uri = '/user/' + @user_username + '/device/' + @device_dev_name + '/files/' + @fullpath\n \n puts \"Renderointi\"\n render :update do |page|\n page[@queryparams[:file_devfile_id]].replace_html :partial => 'file'#, :locals => {:status => stat, :image => @queryparams[:image]} \n end\n \n end",
"def update_dimension\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n if parent_id = params[:dimension][:parent_id]\n params[:dimension][:parent_id] = BSON::ObjectID.from_string(parent_id)\n end\n dimension.update_attributes(params[:dimension])\n render :update do |page|\n page.replace_html(\"list_dimensions\", :partial => \"dimensions\",\n :locals => { :dimensions => [@current_knowledge.dimension_root] })\n end\n end",
"def create\n @trayectorium = Trayectorium.new(trayectorium_params)\n\n respond_to do |format|\n if @trayectorium.save\n format.html { redirect_to edit_trayectorium_path(@trayectorium.id), notice: 'Trayectorium was successfully created.' }\n format.json { render :show, status: :created, location: @trayectorium }\n else\n format.html { render :new }\n format.json { render json: @trayectorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # raise params.to_h.to_yaml\n\n respond_to do |format|\n if @word_set.update(word_set_params)\n format.html { redirect_to @word_set, info: 'Word set was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @word_set }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @controlled_vocabulary.update(controlled_vocabulary_params)\n format.html { redirect_to edit_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Controlled vocabulary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @controlled_vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n @ideium = Ideium.find(params[:id])\n\n respond_to do |format|\n if @ideium.update_attributes(params[:ideium])\n format.html { redirect_to @ideium, notice: 'Ideium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ideium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @maturation.bottling = Bottling.find( params[ :bottling_id ] )\n respond_to do |format|\n if @maturation.update(maturation_params)\n format.html { redirect_to [:admin, @maturation], notice: 'Maturation was successfully updated.' }\n format.json { render :show, status: :ok, location: @maturation }\n else\n format.html { render :edit }\n format.json { render json: @maturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n if @illustration.update_attributes(params[:illustration])\n format.html { redirect_to @illustration, :notice => 'Illustration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @illustration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end",
"def update\n @vdisk = Vdisk.find(params[:id])\n\n respond_to do |format|\n if @vdisk.update_attributes(params[:vdisk])\n format.html { redirect_to @vdisk, notice: 'Vdisk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vdisk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reset_tv_document(vault_id, api_key)\n schema = self.get_document_schema\n schemaToJsonString = schema.to_json\n schemaToBase64 = Base64.encode64(schemaToJsonString)\n tvResponse = `curl https://api.truevault.com/v1/vaults/#{vault_id}/documents/#{self.documentID} \\\n -u #{api_key}: \\\n -X PUT \\\n -d \"document=#{schemaToBase64}\"`\n\n # Parse and return a json hash of the TrueVault response\n tvResponseJSON = JSON.parse(tvResponse).with_indifferent_access\n end",
"def update\n @aspect = Aspect.find(params[:id])\n\n respond_to do |format|\n if @aspect.update_attributes(params[:aspect])\n flash[:notice] = 'Aspect was successfully updated.'\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aspect.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @mirror = Mirror.find(params[:id])\n\n respond_to do |format|\n if @mirror.update_attributes(params[:mirror])\n format.html { redirect_to @mirror, notice: 'Mirror was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mirror.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n if @ram.update_attributes(params[:ram])\n format.html { redirect_to @ram, notice: 'Ram was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diagram = Diagram.new(params[:diagram])\n\n respond_to do |format|\n if @diagram.save\n flash[:notice] = 'Diagram was successfully created.'\n format.html { redirect_to(@diagram) }\n format.xml { render :xml => @diagram, :status => :created, :location => @diagram }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diagram.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n if @illustration.update_attributes(params[:illustration])\n format.html { redirect_to @illustration, notice: 'Illustration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @illustration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tbldog.update(tbldog_params)\n format.html { redirect_to @tbldog, notice: 'Tbldog was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbldog }\n else\n format.html { render :edit }\n format.json { render json: @tbldog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n if @intelligence.update_attributes(params[:intelligence])\n flash[:notice] = 'Intelligence was successfully updated.'\n format.html { redirect_to(intelligences_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @intelligence.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5468396",
"0.540846",
"0.5381618",
"0.5317307",
"0.52022266",
"0.50914097",
"0.5015315",
"0.49808025",
"0.49579468",
"0.4956918",
"0.4947348",
"0.4920314",
"0.48651648",
"0.48610976",
"0.48513702",
"0.482983",
"0.48271123",
"0.4812472",
"0.47715932",
"0.4768334",
"0.47498888",
"0.47433862",
"0.4736069",
"0.47311535",
"0.47177315",
"0.47114623",
"0.47094905",
"0.46971607",
"0.46935576",
"0.46852335",
"0.46744123",
"0.46726543",
"0.4670949",
"0.4653031",
"0.46526483",
"0.4651536",
"0.46319374",
"0.4629284",
"0.46166816",
"0.46088725",
"0.459643",
"0.45902434",
"0.4584822",
"0.45799622",
"0.45753857",
"0.4572852",
"0.45637265",
"0.4556081",
"0.45467025",
"0.45463988",
"0.45420635",
"0.45418075",
"0.45408994",
"0.45337945",
"0.45246142",
"0.45112312",
"0.45090854",
"0.45054615",
"0.45036843",
"0.44964474",
"0.44898137",
"0.4485053",
"0.4481567",
"0.4479729",
"0.4478174",
"0.44775212",
"0.4473484",
"0.44719037",
"0.44696838",
"0.44683695",
"0.44675255",
"0.44638768",
"0.44635734",
"0.44597003",
"0.44586977",
"0.44541538",
"0.44539216",
"0.44517636",
"0.44504416",
"0.444902",
"0.4448865",
"0.44477305",
"0.44454023",
"0.4443787",
"0.44409728",
"0.44407052",
"0.44376415",
"0.4437393",
"0.44364327",
"0.44251052",
"0.4419183",
"0.44190785",
"0.44185248",
"0.44111776",
"0.44106767",
"0.4405781",
"0.4403863",
"0.4403449",
"0.440283",
"0.44022095"
] |
0.6469807
|
0
|
DELETE /tunning_diagrams/1 DELETE /tunning_diagrams/1.json DELETE /tunning_diagrams/1.xml
|
def destroy
#@tunning_diagram = TunningDiagram.find(params[:id])
if @tunning_diagram.destroy && @tunning_diagram.destroy
respond_to do |format|
format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_success', name: @tunning_diagram.class.model_name.human) }
format.json { head :no_content }
format.xml { head :no_content }
end
else
respond_to do |format|
format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_fail', name: @tunning_diagram.class.model_name.human) }
format.json { head :no_content }
format.xml { head :no_content }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @diagramm = Diagramm.find(params[:id])\n @diagramm.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagramme_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @reflection.destroy\n head :no_content\n end",
"def destroy; delete end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n \n end",
"def delete_tables\n delete_characters\n delete_kiosks\n delete_traps\n delete_buttons\n end",
"def destroy\n @tune.destroy\n respond_to do |format|\n format.html { redirect_to tunes_url }\n format.json { head :no_content }\n end\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def delete\n execute_prlctl('delete', @uuid)\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"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",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @chord_diagram.destroy\n respond_to do |format|\n format.html { redirect_to new_chord_diagram_url, notice: 'Chord diagram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tune = Tune.find(params[:id])\n @tune.destroy\n\n respond_to do |format|\n format.html { redirect_to tunes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def delete\n \n end",
"def destroy\n @reflection = Reflection.find(params[:id])\n @reflection.destroy\n\n respond_to do |format|\n format.html { redirect_to reflections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tuning.destroy\n respond_to do |format|\n format.html { redirect_to tunings_url, notice: 'Tuning was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def delete_from_disk; end",
"def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\n end\n end",
"def delete\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def delete\n Vision.destroy_all\n Goal.destroy_all\n render 'welcome/index'\n end",
"def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end",
"def run_on_deletion(paths)\n end",
"def run_on_deletion(paths)\n end",
"def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end",
"def destroy\n end",
"def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execute_command(options,message,command)\n return\nend",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end"
] |
[
"0.6749001",
"0.63204056",
"0.6253094",
"0.61594135",
"0.61372536",
"0.60985154",
"0.6084779",
"0.6075024",
"0.6073417",
"0.6040757",
"0.6013109",
"0.59900504",
"0.5987455",
"0.5973118",
"0.59715456",
"0.5968056",
"0.5964777",
"0.5962027",
"0.59588146",
"0.59562695",
"0.59466696",
"0.5923945",
"0.59200895",
"0.59007967",
"0.58914",
"0.5882496",
"0.5882493",
"0.5882493",
"0.5881036",
"0.58772993",
"0.58703464",
"0.5867908",
"0.58619523",
"0.58619523",
"0.58619523",
"0.58619523",
"0.58619523",
"0.58619523",
"0.58619523",
"0.58606726",
"0.5859564",
"0.5857701",
"0.5857701",
"0.5857701",
"0.5857701",
"0.5857701",
"0.5857701",
"0.5857701",
"0.5853547",
"0.5847129",
"0.5846506",
"0.5846506",
"0.58459973",
"0.5841492",
"0.58412087",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192",
"0.5840192"
] |
0.68134
|
0
|
Use callback to share common setup or constraints between actions
|
def load_tunning_diagram
@tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def action_hook; end",
"def run_actions; end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def callbacks; end",
"def callbacks; end",
"def define_action_hook; end",
"def actions; end",
"def add_actions; end",
"def setup_handler\n end",
"def post_setup\n end",
"def action_run\n end",
"def workflow\n end",
"def callback\n end",
"def after_set_callback; end",
"def callback\n\n end",
"def callback\n\tend",
"def before_setup; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def matt_custom_action_begin(label); end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"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",
"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",
"def execute(setup)\n @action.call(setup)\n end",
"def config(action, *args); end",
"def pre_authorize_cb=(_arg0); end",
"def advice\n end",
"def pre_c(callback)\n return unless Moguro.enabled?\n contract_handler.contract_arguments(callback)\n end",
"def pre_task\n end",
"def after_generate_callbacks; end",
"def before_dispatch(env); end",
"def callback_phase\n super\n end",
"def prepare_for_execution(evt,config)\n # here for sub-classes to override.\n end",
"def setup\n # override and do something appropriate\n end",
"def perform_action(data); end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def action=(_arg0); end",
"def around_hooks; end",
"def after_validate\n end",
"def process_action(...)\n send_action(...)\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def define_action_helpers; end",
"def callback=(_arg0); end",
"def lookup_action; end",
"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",
"def before_workflow_launch(workflow, user)\n #raise \"Must implement in target model!\"\n end",
"def setup(_context)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n #implement in subclass;\n end",
"def action_target()\n \n end",
"def action(unit)\n\tend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup(resources) ; end",
"def verify_callback; end",
"def verify_callback; end",
"def callback\n @on_declare\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"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",
"def define_action_helpers?; end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action\n end",
"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",
"def before_action \n end",
"def _handle_action_missing(*args); end",
"def default_action; end",
"def action_locator_args()\n \n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def before_run; end",
"def do_adapter_specific_setup; end",
"def verify_callback=(verify_callback); end",
"def verify_callback=(verify_callback); end",
"def action\n end",
"def process_custom_method\n # da implementare per eventuali estensioni\n end",
"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",
"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",
"def setup_signals; end",
"def setup(&b)\r\n\t\t\t@setup = b\r\n\t\tend",
"def call\n setup_context\n super\n end",
"def setup(&code)\n @setup = code\n end",
"def set_actions\n actions :all\n end",
"def callback_type; end",
"def setup(state) ; end",
"def perform_action(*args)\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def validate_step\n case action_name\n when 'protocol'\n validate_catalog\n when -> (n) { ['service_details', 'save_and_exit'].include?(n) }\n validate_catalog && validate_protocol\n when 'service_calendar'\n validate_catalog && validate_protocol && validate_service_details\n else\n validate_catalog && validate_protocol && validate_service_details && validate_service_calendar\n end\n end",
"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",
"def activate; end",
"def delegated_arguments; end"
] |
[
"0.62433624",
"0.61606205",
"0.61442274",
"0.60236615",
"0.60236615",
"0.5957384",
"0.59124553",
"0.5815883",
"0.57709527",
"0.57247967",
"0.56691265",
"0.5662611",
"0.5647806",
"0.5625292",
"0.5624815",
"0.55596256",
"0.5546272",
"0.5532163",
"0.5514178",
"0.5499426",
"0.54848015",
"0.5482519",
"0.5482519",
"0.5482519",
"0.5482519",
"0.5482519",
"0.5479049",
"0.5476298",
"0.54715216",
"0.54693305",
"0.5441172",
"0.5417189",
"0.5406942",
"0.539786",
"0.53970546",
"0.5395786",
"0.5389535",
"0.53324336",
"0.53142816",
"0.53069067",
"0.52959824",
"0.5293459",
"0.5293459",
"0.5288901",
"0.5288199",
"0.527382",
"0.52681017",
"0.52588063",
"0.5253281",
"0.5252508",
"0.5240553",
"0.5231318",
"0.5224699",
"0.5215382",
"0.5209399",
"0.5209399",
"0.5196834",
"0.51883125",
"0.5182675",
"0.51783335",
"0.51770794",
"0.517232",
"0.5161194",
"0.5161194",
"0.51573956",
"0.5156276",
"0.51471573",
"0.5146972",
"0.5140138",
"0.5140138",
"0.5138253",
"0.5135363",
"0.5134531",
"0.51294076",
"0.51265556",
"0.5124587",
"0.5114198",
"0.51139283",
"0.5110295",
"0.51097935",
"0.51097935",
"0.5103252",
"0.5100922",
"0.5100662",
"0.50991726",
"0.50960815",
"0.5095221",
"0.5094036",
"0.50921893",
"0.50919586",
"0.508763",
"0.5084916",
"0.5084732",
"0.5080853",
"0.5080853",
"0.5080853",
"0.50768256",
"0.50741315",
"0.5068305",
"0.5066589",
"0.50657725"
] |
0.0
|
-1
|
User this method to whitelist the permissible parameters. Example: params.require(:person).permit(:name, :age) Also, you can specialize this method with peruser checking of permissible attributes.
|
def tunning_diagram_params
params.require(:tunning_diagram).permit()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def person_params\n params.require(:person).permit!\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def person_params\n params.require(:person).permit(:name, :occupation, :quote, :special_ability)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def person_params\n params.require(:person).permit(:name)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def person_params\n params.require(:person).permit(:name, :age)\n end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end",
"def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end",
"def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end",
"def person_params\n params.require(:person).permit(:name)\n end",
"def pointless_params\n params.require(:pointless).permit(:title, :content)\n end",
"def expected_permitted_parameter_names; end",
"def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def permitted_params\n @permitted_params ||= declared(params,\n include_missing: false,\n include_parent_namespaces: false)\n end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def permitted_create_params\n fail NotImplementedError\n end",
"def person_params\n params.require(:person).permit(:name, :height)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def person_params\n params.require(:person).permit(:name, :gender)\n end",
"def unpermitted_parameters\n fail 'Define me!'\n end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def <%= singular_name %>_params\n params.require(:<%= singular_name %>).permit(<%= attributes_allowed %>)\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def person_params\n person_params = params[:person]\n person_params ? person_params.permit(:first_name, :last_name, :email, :bio, :gender, :job, :birthdate, :picture) : {}\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"def post_params\n params.require(:post).permit!\n end",
"def user_params\n params.require(:user).permit!\n end",
"def user_params\n params.require(:user).permit!\n end",
"def user_params\n params.require(:user).permit!\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def some_thing_params\n params.require(:some_thing).permit(:val)\n end",
"def user_params\n params.require(:user).permit(:username, :email, :age, :political_affiliation, :password)\n # this is saying go into params look for a key of what is in the require() method and look inside that object for the keys included in permit()\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def person_params\n params.require(:person).permit(:name, :age, :gender, :alive, :hair_color, :eye_color)\n\n end",
"def person_params\n #params.require(:person).permit(:name, :email, :phone, :mobile, :position_id, :type)\n params.require(classe.underscore.partition(\"/\").last.to_sym).permit(:name, :email, :phone, :mobile, :position_id, :type)\n end",
"def post_params\n\t\t\t# equivalent\n\t\t\t# params.require(:post).permit(:title, :text, :allow_comments)\n\t\t\tparams.require('post').permit('title', 'text', 'allow_comments')\n\t\tend",
"def person_params\n params.require(:person).permit(:username, :password,:email)\n end",
"def pet_params\n\t \tparams.require(:pet).permit(:name)\n\t \t# this returns a hash with all the sanitized parameters, with just the stuff we want\n\t end",
"def person_params\n params.require(:person).permit(:gender, :height, :weight)\n end",
"def person_params\n params.require(:person).permit(:first_name, :last_name, :gender)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def post_params\n # allow attributes that I trust, ignore any scary malicious unsation evil data\n\n params.require(:post).permit(:title, :body, :is_published, :is_featured)\n end",
"def person_params\n params.require(:person).permit(:first_name, :last_name, :email, :phone)\n end",
"def person_params\n params.require(:person).permit(:first_name, :last_name, :description)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def post_params\n # params.require(:post).permit(policy(@post).permitted_attributes) instead of permitted_attributes\n params.require(:post).permit(:title, :body)\n end",
"def quote_params\n params.permit!\n end",
"def person_params\n params.require(:person).permit(:name, :email, :email_confirmation, :giving_to_id, :receiving_from_id, :wishlist, :avoiding_giving_to_id)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def user_params\n params.require(:user).permit!\n end",
"def user_params\n params.require(:user).permit!\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def user_params\n permitted_parameters = [:name, :email, :password, :password_confirmation]\n\n params.slice(*permitted_parameters).permit(*permitted_parameters)\n end",
"def check_params\n true\n end",
"def param_perfil\n \tparams.require(:perfil).permit(:nombre, :apellidos, :sexo, :ciudad, :fecha_nacimiento)\n end",
"def person_params\n params.require(:person).permit(\n :first_name,\n :last_name,\n :role,\n :school_id,\n :grade,\n :dream_team,\n :email,\n :phone,\n :sex,\n :legacy_notes\n )\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def person_params\n\t\tparams.require(:person).permit(:first_name, :last_name, :email, :age, :moto, :address, :city, :state, :zip)\n\tend",
"def person_params\n params.require(:person)\n .permit(:display_name, :email, :language, :avatar_provider,\n :tagline, :introduction, :bragging_rights, :occupation,\n :skills, :gender, :looking_for_friends,\n :looking_for_dating, :looking_for_relationship,\n :looking_for_networking, :birthdate, :relationship,\n :other_names)\n end",
"def person_params\n params.require(:person).permit(:firstName, :lastName, :middleInitial, :pet, :birthday, :favoriteColor, :phoneNumber)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def post_card_params\n params[:post_card].permit!\n end",
"def test_params(params)\n test_params = params.require(:question_programming).permit(\n :prepend, :append, :autograded, :solution, :submission, :submit_as_file,\n submission_files: [],\n solution_files: [],\n data_files: [],\n test_cases: {\n public: [:expression, :expected, :hint, :inline_code],\n private: [:expression, :expected, :hint, :inline_code],\n evaluation: [:expression, :expected, :hint, :inline_code]\n }\n )\n\n whitelist(params, test_params)\n end"
] |
[
"0.78805184",
"0.7715858",
"0.7491385",
"0.7300915",
"0.7262711",
"0.7255844",
"0.72538334",
"0.7227243",
"0.7163269",
"0.7161134",
"0.71351975",
"0.71351975",
"0.7103507",
"0.7088179",
"0.7047137",
"0.6974054",
"0.6969322",
"0.69616586",
"0.694162",
"0.6932733",
"0.6889958",
"0.6884776",
"0.6863029",
"0.68429655",
"0.6822283",
"0.68181944",
"0.6802467",
"0.6776302",
"0.67436635",
"0.6734871",
"0.6731932",
"0.6692788",
"0.6687309",
"0.66739696",
"0.6667181",
"0.66618973",
"0.6653098",
"0.6628677",
"0.6625748",
"0.66067594",
"0.65952563",
"0.65814954",
"0.6578785",
"0.6577709",
"0.65741163",
"0.65518206",
"0.6546994",
"0.65468276",
"0.6540592",
"0.65262574",
"0.6502526",
"0.6498078",
"0.6486286",
"0.6486028",
"0.6480036",
"0.6480036",
"0.6480036",
"0.64788604",
"0.6478791",
"0.6475275",
"0.6459249",
"0.64529854",
"0.64468133",
"0.6442879",
"0.6441719",
"0.6438469",
"0.6437368",
"0.64271593",
"0.64205354",
"0.64177334",
"0.64139557",
"0.64047855",
"0.6392471",
"0.63880545",
"0.6385961",
"0.638359",
"0.6381697",
"0.6379609",
"0.6378799",
"0.6376145",
"0.6371238",
"0.63656825",
"0.63603985",
"0.6355092",
"0.63547117",
"0.63523",
"0.63523",
"0.6343887",
"0.6343887",
"0.63395154",
"0.63355696",
"0.6333725",
"0.63325316",
"0.63279027",
"0.632752",
"0.6327098",
"0.6326729",
"0.6321645",
"0.63199407",
"0.631696",
"0.6315824"
] |
0.0
|
-1
|
Returning any kind of identification you want for the model
|
def name
return self.email
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def identifier(model)\n models[model]\n end",
"def input_id_from_type(type); end",
"def identifier\n best_identifier\n end",
"def identification_name(identification_type)\n case identification_type\n when Donor.identification_types['pan_card']\n 'Permanent Account Number'\n when Donor.identification_types['aadhaar_card']\n 'Aadhaar Number'\n when Donor.identification_types['passport']\n 'Passport number'\n when Donor.identification_types['voter_id_card']\n 'Elector\\'s photo identity number'\n when Donor.identification_types['driving_license']\n 'Driving License number'\n when Donor.identification_types['ration_card']\n 'Ration card number'\n when Donor.identification_types['tax_payer_country_of_residence']\n 'Tax Identification Number'\n else\n ''\n end\n end",
"def identify(ident=:default)\n self.class.identify(ident)\n end",
"def get_id_from_model(name, type, options={})\n matching = connection.send(type, options).select {|x| x.name == name }\n if matching.size > 1\n raise(Puppet::Error, \"Found multiple #{type} matching: #{name}, Puppet expects this to be unique. Failing.\")\n elsif matching.empty?\n raise(Puppet::Error, \"Did not find a #{type} mathing: \"\"#{name}\"\". Failing.\")\n else\n matching.first.id\n end\n end",
"def identifier\n identifiers = geo_concern.identifier\n if identifiers.nil? || identifiers.empty?\n geo_concern.id\n elsif identifiers.is_a?(String)\n identifiers\n else\n identifiers.first\n end\n end",
"def identification\n request('getIdentification')\n end",
"def model_identifier\n raise 'Invalid' unless id\n \"#{self.class.name}##{id}\"\n end",
"def identify\n 'name'\n end",
"def identify\n 'name'\n end",
"def identify\n 'name'\n end",
"def identify\n 'name'\n end",
"def known_identities; end",
"def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id(name)}\"\n end",
"def get_identification_type\n if user_signed_in?\n @identification_type = current_user.cvs.find_by(params[:identification_type])\n end\n end",
"def identifier; end",
"def identifier; end",
"def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end",
"def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end",
"def model_id_string(model_class, attributes)\n components = []\n\n components << model_class.name\n\n if model_class <= Kithe::Model\n components << attributes[\"id\"]\n components << attributes[\"friendlier_id\"]\n components << attributes[\"title\"].slice(0, 30)\n end\n\n components.join(\"/\")\n end",
"def identify; end",
"def identificacion_company\n \"#{type_identification}-#{rif}\"\n end",
"def id\n @id ||= self.class.model_name.name.downcase\n end",
"def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id @schema.title}.#{Model::to_id name}\"\n end",
"def identifier\n attributes.fetch(:identifier)\n end",
"def id() end",
"def id2name() end",
"def id2name() end",
"def humanise_identifier(model)\n klass = model.constantize\n klass.human_attribute_name identifier(model)\n end",
"def preprocess_model\n identifier = attribute_from_model(:id)\n identifier ||= attribute_from_model(:user_id)\n identifier ||= attribute_from_model(:email)\n raise StandardError unless identifier\n end",
"def find_phoneable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end",
"def identifier\n # TODO: Don't parse ser_type every time\n r_class = Thales::Datamodel::CLASS_FOR[record.ser_type]\n data = r_class.new.deserialize(record.ser_data)\n\n data.identifier\n end",
"def id\n raise NotImplementedError\n end",
"def identifier\n self.class.identifier_for(send(self.class.identifying_attribute))\n end",
"def id\n @model.guid\n end",
"def identifier(resource_type, name)\n raise NotImplementedError, :identifier\n end",
"def model_id\n model.id\n end",
"def identity_type\n return @identity_type\n end",
"def find_contactable contact\n contactable_type = contact.contactable_type\n id_param = contactable_type.classify.constantize.find(contact.contactable_id)\n return contactable = id_param\n end",
"def identity\n :id\n end",
"def identifier\n id_value || super\n end",
"def id\n model.id.to_s\n end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def name\n \"identity\"\n end",
"def model_type_key\n model.model_type_key\n end",
"def identify_name\n @identify_name ||= begin\n if self.respond_to?(:name)\n self.try(:name)\n elsif self.respond_to?(:title)\n self.try(:title)\n else\n 'NONE'\n end\n end\n end",
"def id\n raise NotImplementedError\n end",
"def identifier\n @info.identifier\n end",
"def identifier\n @info.identifier\n end",
"def identifier_type\n {\n coding: [{\n system: CODING_SYSTEM,\n code: IDENTIFIER_CODE,\n userSelected: false\n }]\n }\n end",
"def id\n name\n end",
"def id\n name\n end",
"def rarity_id(c)\n Rarity.find_by(name: c['rarity']).id\nrescue NoMethodError\n Rarity.find_by(name: 'Common').id\nend",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def identify\n Identity.new(self).create\n nil\n end",
"def identify\n Identity.new(self).create\n nil\n end",
"def name\n \"identity\"\n end",
"def returned_type\n model.returned_type\n end",
"def identifier_value\n user.icn\n end",
"def identifier\n id || name || default_identifier\n end",
"def identify\n\n return \"I am a #{self.class}\"\n\n end",
"def id?(str); end",
"def lookup_model_names; end",
"def id\n name && name.gsub(' ', '').downcase\n end",
"def resource_class\n params.each do |name, _value|\n if /(.+)_id$/.match?(name)\n model = name.match(%r{([^\\/.]*)_id$})\n return model[1].classify.constantize, name\n end\n end\n nil\n end",
"def mapping_identity\n interfaces.first[\"id\"]\n end",
"def typed_id\n self.class.name + ':' + self.id.to_s\n end",
"def id; 1; end",
"def guess_identifier_type ident\n # Note identifier normalisation in HydraDurham::IdentifierNormalisation.\n # These rules are a little excessive assuming normalisation has been done\n # already since website form identifires shouldn't be present anymore.\n # However it won't hurt to be prepared for those as well.\n rules=[{regex: /^doi:(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^info:doi\\/(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^.*dx\\.doi\\.org\\/(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^ark:(.*)/i, type: 'ARK', value: 'ark:\\1' },\n {regex: /^arxiv:(.*)/i, type: 'arXiv', value: 'arXiv:\\1'},\n {regex: /^.*arxiv\\.org\\/[^\\/]+\\/(.*)/i, type: 'arXiv', value: 'arXiv:\\1'},\n 'issn', 'isbn', 'istc', 'lissn',\n {prefix: 'urn:lsid:', type: 'LSID', keep_prefix: true}, 'pmid',\n {regex: /^purl:(.*)/i, type: 'PURL', value: '\\1'},\n {regex: /(.*([\\W]|^)purl\\W.*)/i, type: 'PURL', value: '\\1'},\n 'upc',\n {prefix: 'urn', type: 'URN', keep_prefix: true}, # urn should be after LSID because LSID also starts with urn\n {regex: /(https?:)(.*)/i, type: 'URL', value: '\\1\\2'} ,\n {regex: /(.*)/, type: 'Handle', value: '\\1'} \n ]\n\n rules.each do |rule|\n if rule.class==String\n rule={ prefix: \"#{rule}:\", type: rule.upcase }\n end\n if rule.key? :regex\n if rule[:regex] =~ ident\n return { id_type: rule[:type], id: (ident.sub rule[:regex], rule[:value])}\n end\n else\n if ident.downcase.start_with?(rule[:prefix])\n if rule[:keep_prefix]\n return { id_type: rule[:type], id: ident }\n else\n return { id_type: rule[:type], id: ident[(rule[:prefix].length) .. -1]}\n end\n end\n end\n end\n end",
"def id2name\n to_s\n end",
"def element_id what\n \"#{object_type}_#{what}\"\n end",
"def type\n {\n '@' => :user_id,\n '!' => :room_id,\n '$' => :event_id,\n '+' => :group_id,\n '#' => :room_alias\n }[sigil]\n end",
"def type\n {\n '@' => :user_id,\n '!' => :room_id,\n '$' => :event_id,\n '+' => :group_id,\n '#' => :room_alias\n }[sigil]\n end",
"def name\n id.to_s\n end",
"def get_name_for(model)\n if model.nil?\n 'nil'\n elsif model.is_a? User\n model.full_name\n elsif model.is_a? Role\n model.title\n elsif model.is_a? Event\n model.initiative.full_title\n elsif model.is_a? Initiative\n model.full_title\n else\n 'unknown'\n end\n end",
"def name\n id\n end",
"def modelid\n @attributes.fetch('modelid', nil)\n end",
"def css_id(model)\n \"#{model.class.to_s.downcase}#{model.id}\"\n end",
"def id\n name\n end",
"def id\n [\"#{name}_id\", \"#{model_name}_id\", 'id'].uniq.\n map { |id| controller.params[id] }.find(&:present?)\n end",
"def identifier_string\n name\n end",
"def find_opinionable\n params.each do |name, value|\n if name =~ /(.+)_id$/\n return $1.classify.constantize.find(value)\n end\n end\n nil\n end",
"def model\n @type.constantize\n end",
"def model\n @type.constantize\n end",
"def objname\n id\n end",
"def object_id() end",
"def entityID\n end",
"def entityID\n end",
"def get_id(path, user, classname)\n begin \n if classname == \"person\"\n return People.all.first.to_param\n end\n \n object = case classname\n when \"user\"\n user || User.first\n when \"pseud\"\n user.try(:default_pseud) || Pseud.first\n when \"medium\"\n Media.first\n when \"collection\"\n user.owned_collections.first\n when \"restricted_work\"\n Work.where(:restricted => true).in_collection(Collection.find(@last_id)).first\n when \"tag_wrangler\"\n if permit?(\"tag_wrangler\")\n user\n else\n Role.find_by_name(\"tag_wrangler\").users.first\n end\n when \"nomination\"\n TagSetNomination.for_tag_set(OwnedTagSet.find(@last_id)).owned_by(user).first\n when \"setting\"\n AdminSetting.first\n when \"assignment\", \"claim\", \"signup\"\n klass = \"challenge_#{classname}\".classify.constantize\n query = classname == \"assignment\" ? klass.by_offering_user(user) :\n (classname == \"signup\" ? klass.by_user(user) : \n (classname == \"claim\" ? klass.by_claiming_user(user) : nil))\n if path.match('collection')\n query = query.in_collection(Collection.find(@last_id))\n end\n query.first\n when \"item\", \"participant\"\n \"collection_#{classname}\".classify.constantize.where(:collection_id => @last_id).first\n when \"tag_wrangling\", \"user_creation\", \"translator\", \"translation\"\n # not real objects\n nil\n else\n klass = classname.classify.constantize\n if klass.column_names.include?(\"user_id\")\n klass.where(:user_id => user.id).first\n elsif klass.column_names.include?(\"pseud_id\")\n klass.where(:pseud_id => user.default_pseud.id).first\n else\n classname.classify.constantize.first\n end\n end\n\n # return the id\n object.try(:id)\n rescue\n @errors << \"NOT SURE HOW TO FIND #{classname}\"\n nil\n end \n end"
] |
[
"0.65590584",
"0.648132",
"0.6455226",
"0.6344137",
"0.633256",
"0.62737584",
"0.621614",
"0.6179366",
"0.61688393",
"0.6113753",
"0.6113753",
"0.6113753",
"0.6113753",
"0.61099976",
"0.6098491",
"0.6065589",
"0.60568094",
"0.60568094",
"0.60554343",
"0.60554343",
"0.6036695",
"0.6014165",
"0.5998191",
"0.59911305",
"0.5981055",
"0.5957351",
"0.5937575",
"0.59303045",
"0.59303045",
"0.59290695",
"0.59254616",
"0.5917309",
"0.58992803",
"0.5892695",
"0.58852494",
"0.58776456",
"0.5875617",
"0.5873085",
"0.58577114",
"0.5853113",
"0.58496225",
"0.58471245",
"0.5838794",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826205",
"0.5826174",
"0.58181727",
"0.5798489",
"0.57624215",
"0.5757973",
"0.5757973",
"0.5751581",
"0.5739956",
"0.5739956",
"0.5730981",
"0.57264304",
"0.5722844",
"0.5722844",
"0.5706402",
"0.57011694",
"0.5697232",
"0.5684172",
"0.56761456",
"0.56726754",
"0.56655043",
"0.56537616",
"0.56505996",
"0.56457335",
"0.5641952",
"0.56260055",
"0.5623591",
"0.5615107",
"0.5612523",
"0.5612486",
"0.5612486",
"0.5608471",
"0.5607191",
"0.56055534",
"0.56020546",
"0.5597965",
"0.5595449",
"0.5589702",
"0.55887485",
"0.55873436",
"0.5576607",
"0.5576607",
"0.5574861",
"0.5568402",
"0.55636317",
"0.55636317",
"0.5561599"
] |
0.0
|
-1
|
Returning the email address of the model if an email should be sent for this object (Message or Notification). If no mail has to be sent, return nil.
|
def mailboxer_email(object)
#Check if an email should be sent for that object
#if true
return "define_email@on_your.model"
#if false
#return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def email\n result_record = default_email_record\n default_email_record.email if result_record\n end",
"def email\n result_record = default_email_record\n default_email_record.email if result_record\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n # return \"define_email@on_your.model\"\n return email\n #if false\n #return nil\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n #return \"define_email@on_your.model\"\n #if false\n #return nil\n return nil\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return \"define_email@on_your.model\"\n #if false\n #return nil\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n if send_notification_mails == true\n return email\n else\n return nil\n end\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\n end",
"def email?\n message_type&.to_sym == :email\n end",
"def email\n mail.first\n end",
"def email\n mail.first\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\nend",
"def email\n begin\n super\n rescue NoMethodError\n nil\n end\n end",
"def email\n\t\tif self.email_address\n\t\t\tself.email_address.email\n\t\telse\n\t\t\tself.user.email\n\t\tend\n\tend",
"def email\n return Contact.get_default_email self.id\n end",
"def email?\n !@email_to.nil?\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n email\n #if false\n #return nil\n end",
"def email\n # If product_specific_contacts is off, always return the facility's email\n return facility.email unless SettingsHelper.feature_on? :product_specific_contacts\n contact_email.presence || facility.try(:email)\n end",
"def email\n pull unless @details\n begin\n return @details.email_address.address\n rescue\n return nil\n end\n end",
"def email\n multi_email.primary_email_record.try(:email)\n end",
"def mailboxer_email(object)\n return email\n end",
"def reportable_email\n try(:email) || try(:user).try(:email) || try(:owner).try(:email) || raise(\"No reportable_email found\")\n end",
"def subscribed_email\n !@changes.old_email.blank? ? @changes.old_email : @record.email\n end",
"def email\n self.user.try(:email) || self.original_email\n end",
"def email\n self.user.try(:email) || self.original_email\n end",
"def sender_email\n msg['from_email'] || msg['sender'] || entry['sender'] || reject['sender']\n end",
"def recipient_email\n return @recipient_email\n end",
"def recipient_email\n return @recipient_email\n end",
"def mailboxer_email(obj=nil)\n return nil\n end",
"def email\n if self[:email] && !@email_name\n self[:email]\n elsif self.email_name && self.email_domain\n self[:email] = \"#{self.email_name}@#{self.email_domain}\"\n end\n end",
"def mailboxer_email(object)\n shouldSendEmail = true\n email if shouldSendEmail\n end",
"def email\n return @email\n end",
"def email\n return @email\n end",
"def mailboxer_email(_object)\n email\n end",
"def email\n\t\tnil\n\tend",
"def email\n\t\tnil\n\tend",
"def mailboxer_email(object)\n self.email\n end",
"def contact_email\n TESTING_EMAIL || @comment[:email]\n end",
"def mailboxer_email(object)\n email\n end",
"def mailboxer_email(object)\n email\n end",
"def investor_email_address\n return self.user_company_info.blank? ? self.email : self.user_company_info.business_email\n end",
"def email_address\n return @email_address\n end",
"def email_address\n return @email_address\n end",
"def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end",
"def email_address\n (email_addresses.where(primary: true).first || email_addresses.first).try(:email) ||\n current_address.try(:email) ||\n permanent_address.try(:email) ||\n user.try(:username)\n end",
"def should_send_email?\n self.delivery_email_status.nil?\n end",
"def email\n if @data.attribute_names.include?(:cmupreferredmail)\n @email ||= @data[:cmupreferredmail].last\n else\n @email ||= @data[:mail].last\n end\n end",
"def mailboxer_email(object)\n\t email\n\tend",
"def contact_email\n return @contact_email\n end",
"def user_email\n msg['email'] || entry['email'] || reject['email']\n end",
"def mailboxer_email(object)\n #If actor has disabled the emails, return nil.\n return nil if !notify_by_email\n #If actor has enabled the emails and has email\n return \"#{name} <#{email}>\" if email.present?\n #If actor is a Group, has enabled emails but no mail we return the highest_rank ones.\n if (group = self.subject).is_a? Group\n relation = group.relation_customs.sort.first\n receivers = group.contact_actors(:direction => :sent, :relations => relation)\n emails = Array.new\n receivers.each do |receiver|\n receiver_emails = receiver.mailboxer_email(object)\n case receiver_emails\n when String\n emails << receiver_emails\n when Array\n receiver_emails.each do |receiver_email|\n emails << receiver_email\n end\n end\n end\n return emails\n end\n end",
"def receiver_email\n nil\n end",
"def email\n mentee_user ? mentee_user.email : nil\n end",
"def address\n @address ||= Mail::Address.new(self.to_s) rescue nil\n end",
"def email\n preferred_email\n end",
"def email\n self[:emailAddress]\n end",
"def receiver_email\n nil\n end",
"def to_email_address\n @to_email_address\n end",
"def to_email_address\n @to_email_address\n end",
"def sender_email?\n !self.sender_email.blank?\n end",
"def sender_email?\n !self.sender_email.blank?\n end",
"def primary_email\n if self[\"gd$email\"]\n _email = self[\"gd$email\"].find { |e| e.primary == \"true\" }\n _email ? _email.address : nil\n else\n nil # no emails at all\n end\n end",
"def email_address\n raw_info['email_addresses'] && raw_info['email_addresses'].first\n end",
"def email_user?\n self.user.email_for?(self.attachable_type.downcase) || self.user.email_for?(self.action)\n end",
"def email\n\t\treturn @email\n\tend",
"def mailer_to\n resolve_value(_notification_email)\n end",
"def email_for?(class_name)\n begin\n return true if User.force_email_on.include?(class_name.to_sym)\n !self.email.blank? and self.email_on?(class_name.downcase.to_sym)\n rescue # in case array isn't set\n false\n end\n end",
"def deliver_emails?\n if self.default_options[:deliver_emails].nil?\n true\n else\n self.default_options[:deliver_emails]\n end\n end",
"def email_via\n @email_via || :smtp\n end",
"def email\n if md = RE_EMAIL.match(contact.to_s)\n md[0]\n else\n nil\n end\n end",
"def assignee_email\n \tself.assignee.email if self.assignee\n end",
"def email_optional?\n false\n end",
"def sms_email_address\n carrier.sms_email_address(self) if carrier\n end",
"def mail_from_project_sender\n sender = if @issue\n p = @issue.project\n s = CustomField.find_by_name('project-sender-email')\n p.custom_value_for(s).try(:value) if p.present? && s.present?\n end\n (sender.present? && sender) || Setting.mail_from\n end",
"def email\n find_by_type('email')\n end",
"def email_enabled\n self[:email_enabled]\n end",
"def generic_email_domain_check\n\n notification_helper = NotificationHelper.new\n\n if is_generic_email?\n notification_helper.set_generic_email(self.id)\n end\n\n\n end",
"def recipient\n return self.unless_nil?('invitee.email', deliveries.unless_nil?('first.recipients', '') )\n end",
"def setup_recipients( email )\r\n if RAILS_ENV == 'production'\r\n return email\r\n else\r\n return AppConfig.DEBUG_EMAIL_ADDRESS\r\n end\r\n end",
"def get_email_for_booking_notification(booking)\n email = nil\n property = booking.property\n pc = PropertyChannel.find_by_property_id_and_channel_id(property.id, self.id)\n\n # email address is different for new, modify, and cancel\n if booking.type_new?\n email = pc.expedia_reservation_email_address\n elsif booking.type_modify?\n email = pc.expedia_modification_email_address\n elsif booking.type_cancel?\n email = pc.expedia_cancellation_email_address\n end\n email\n end",
"def new_email\n e = read_attribute :new_email\n e.present? ? e : email\n end",
"def primary_smtp_address\n return @primary_smtp_address\n end",
"def recipient_email=(value)\n @recipient_email = value\n end",
"def recipient_email=(value)\n @recipient_email = value\n end",
"def email\n\t\t@email\n\tend",
"def email\n\t\t@email\n\tend",
"def get_email_recipient\n user == chat.sender ? chat.recipient : chat.sender\n end",
"def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end",
"def contact_email\n UserMailer.contact_email\n end",
"def organiser_email\n organiser ? organiser.email : \"\"\n end",
"def email\n user.present? ? user.email : self[:email]\n end",
"def email_with_formatting\n (self.email.blank?) ? 'N/A' : self.email\n end",
"def needs_email_change?\n self[:force_email_change] || !self.email.present?\n end",
"def email_address\n get_attribute(Yoti::Attribute::EMAIL_ADDRESS)\n end",
"def email\n get_attribute('Email')\n end",
"def sender\n ENV['NOTIFICATION_FROM_EMAIL'] || 'noreply@some.gov'\n end",
"def product_email\n UserMailer.product_email\n end",
"def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end",
"def email\n if read_attribute(:active) == 1\n if Rails.env.development?\n self.first_name + \" \" + self.last_name + \" <dtg_ror_devel@lists.teradyne.com>\"\n else\n read_attribute(:email)\n end\n else\n \"\"\n end\n end",
"def email\n attributes['email']\n end",
"def email\n @attributes[:email]\n end"
] |
[
"0.74394685",
"0.74394685",
"0.7433783",
"0.7351371",
"0.73307574",
"0.7324078",
"0.7205258",
"0.70875454",
"0.7013618",
"0.7013618",
"0.6981674",
"0.6878962",
"0.6852198",
"0.6794687",
"0.6764991",
"0.67487496",
"0.67481905",
"0.67164683",
"0.67000943",
"0.66906345",
"0.66485226",
"0.66289294",
"0.6608082",
"0.6608082",
"0.6591288",
"0.6570398",
"0.6570398",
"0.654396",
"0.6523555",
"0.6522288",
"0.6510879",
"0.6510879",
"0.65004355",
"0.6489667",
"0.6489667",
"0.64792943",
"0.6464642",
"0.6448703",
"0.6448703",
"0.6439029",
"0.6429262",
"0.6429262",
"0.6410287",
"0.6389368",
"0.6380461",
"0.63755935",
"0.6374659",
"0.63745636",
"0.6370974",
"0.63593996",
"0.6335833",
"0.63319904",
"0.63301176",
"0.63024753",
"0.63009787",
"0.62850255",
"0.6273171",
"0.62597257",
"0.62491536",
"0.62491536",
"0.62450874",
"0.6234843",
"0.622435",
"0.6210592",
"0.62027067",
"0.6172332",
"0.61519444",
"0.61504364",
"0.614659",
"0.6141143",
"0.6139463",
"0.6137156",
"0.6131694",
"0.61153173",
"0.61075383",
"0.61010295",
"0.6061006",
"0.6056292",
"0.605269",
"0.6048244",
"0.6046957",
"0.6037767",
"0.6037767",
"0.6034811",
"0.6034811",
"0.6034288",
"0.6028294",
"0.6009604",
"0.6004987",
"0.6000585",
"0.5995743",
"0.59666",
"0.5964918",
"0.5954512",
"0.59498215",
"0.592629",
"0.591944",
"0.5919022",
"0.5913884",
"0.59079"
] |
0.7342027
|
4
|
Constructor takes one argument name of the Player instance
|
def initialize(name = 'Unnamed Player')
@name = name
@score = 0
@available_dices = 5
@dice_set = DiceSet.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(player_name)\n @name = player_name.to_s\n @life_points = 10\n end",
"def initialize name\n @player = name\n @@player_count+=1\n end",
"def initialize(name_player)\n @life_points = 10\n @name = name_player\n end",
"def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end",
"def initialize(name, player_number)\n @name = name.capitalize\n @number = player_number\n end",
"def initialize player\r\n @card_player=player\r\n @name = player.name\r\n end",
"def initialize(name_of_human_player)\n @name = name_of_human_player\n @life_points = 100\n @weapon_level = 1\n end",
"def initialize(player_name)\n @name = player_name\n @life_points = 10\n end",
"def initialize(name) # j'initialise les données qui doivent être ajoutées en même temps que la création du player\n @name = name # le nom du joueur\n @life_points = 10 # le niveau de vie de départ\n end",
"def initialize(new_name)\n\t\t@name = new_name\n\t\t\n\t\tif self.class == Player\t\t#Player for the first game app.rb \n\t\t\t@life_points=10\n\t\t\t@@all_players << self\t #adds new players if necessary \n\t\tend\n\n\tend",
"def initialize(player_name)\n\t\t\t@player = Player.new(player_name)\n\t\t\t@rooms = []\n\t\tend",
"def initialize(player_name)\n\t\t@player = Player.new(player_name)\n\t\t@rooms = []\n\tend",
"def initialize(player_name)\n\t\t@player = Player.new(player_name)\n\t\t@rooms = []\n\tend",
"def initialize(name)\n @name = name\n @games_won = 0\n @@all_players << self\n end",
"def initialize(name)\n @name = name\n @plays = []\n end",
"def initialize(player)\n @player = player\n end",
"def initialize(player_name)\n\t\t@player = Person.new(player_name)\n\t\t@secret_number = SecretNumber.generate\n\tend",
"def initialize(name) #initialize the song class with a name\n @name = name\n end",
"def initialize name\n @name = name\n end",
"def set_name(player_name)\n @player_name = player_name\n end",
"def initialize(name)\n @name = name #initializes the name\n end",
"def initialize(nameIn)\n @name = nameIn\n end",
"def initialize(nameIn)\n @name = nameIn\n end",
"def initialize\n @name = name\n end",
"def initialize(name)\n @human_player = HumanPlayer.new(name)\n @enemies = []\n for i in 1..3\n robot_name = \"player#{i}\"\n enemies << Player.new(robot_name)\n end\n end",
"def initialize(name)\r\n @name = name\r\n end",
"def initialize(name)\r\n @name = name\r\n end",
"def initialize (name, life_points, weapon_level)\n @life_points = 100\n @weapon_level = weapon_level = 1\n super(name,life_points) #on récupère les attributs de la classe Player\n end",
"def initialize name\n @name = name\n end",
"def initialize(name)\n @name = name\n \n end",
"def initialize(name)\n self.name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @human_player = HumanPlayer.new(name)\n @enemies = []\n for i in 1..3\n robot_name = \"player#{i}\"\n enemies << Player.new(robot_name)\n end\n end",
"def initialize(args = {})\n @name = args[:name]\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name) # This initializes our class by using the name variable.\n @name = name\n end",
"def initialize name\n\t\t\t@name = name\n\t\tend",
"def initialize(name)\n self.name = name\n end",
"def initialize(name)\n \n @name = name\n end",
"def initialize(name)\n @name= name\n end",
"def initialize(name)\n self.name = name \n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(player_name) #initialize player_name so we can create a local variable.\n @player = Player.new(player_name)\n @rooms = [] #could also do @rooms = Array.new\n end",
"def initialize(name = '')\n self.name = name\n end",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n\t\t@name = name\n\tend",
"def initialize(name)\n @human_player = HumanPlayer.new(name)\n @enemies = []\n \n for i in 0..4\n @enemies << Player.new('ENEMY ' + i.to_s)\n end\n end",
"def initialize(num, name) #we are settig up an internal variable, piece, in the class Player\n\t\t@piece=num #the piece variable is defined as the player number, either 1 or 2\n\tend",
"def initialize(name) # this is a constructor because it gets called whenever we create a new object.\n @name = name\n end",
"def initialize\n \t\t@player_name = gets_name\n \t\t@player_token = gets_token\n \tend",
"def initialize(name)\r\n \t\t@name = name\r\n \tend",
"def initialize(name)\n @name = name\n @lives = 3\n @turn = false\n end"
] |
[
"0.8037702",
"0.79228747",
"0.792003",
"0.7903484",
"0.78550553",
"0.7828283",
"0.7797295",
"0.7783487",
"0.7690049",
"0.7674859",
"0.76047456",
"0.75539786",
"0.75539786",
"0.75199616",
"0.75087094",
"0.7382767",
"0.7381529",
"0.73285675",
"0.72871447",
"0.72648495",
"0.7259368",
"0.72332066",
"0.72332066",
"0.72233087",
"0.7208125",
"0.7205524",
"0.7205524",
"0.72000223",
"0.71974325",
"0.71793765",
"0.7176295",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.7167923",
"0.71644866",
"0.71597797",
"0.7158074",
"0.7158074",
"0.7158074",
"0.7158074",
"0.7158074",
"0.7151023",
"0.7142243",
"0.71362084",
"0.71335053",
"0.71286696",
"0.71209174",
"0.711742",
"0.7109301",
"0.7094206",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70934635",
"0.70803434",
"0.70770425",
"0.7069697",
"0.7069697",
"0.7069697",
"0.7069697",
"0.7069697",
"0.7069697",
"0.7017362",
"0.7009289",
"0.70088756",
"0.7001051",
"0.6994688",
"0.69850206"
] |
0.7257724
|
21
|
Roll dices for the current round and calculates score
|
def roll
@dice_set.clear
@dice_set.roll(@available_dices)
calculate_points
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_roll\n end \n end\n \n return @total_score\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_normal\n end\n end\n\n return @total_score\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_normal\n end\n end\n\n return @total_score\n end",
"def score_dice(dice)\n score(dice_values(dice))\n end",
"def score\n total_score = 0\n current_roll = 0\n\n while current_roll < @rolls.size - 1\n roll = @rolls[current_roll]\n next_roll = @rolls[current_roll + 1]\n\n if roll == 10 #strike\n total_score += 10 + @rolls[current_roll + 1] + @rolls[current_roll + 2]\n current_roll += 1\n elsif roll + next_roll == 10 #spare\n total_score += 10 + @rolls[current_roll + 2]\n current_roll += 2\n else #normal players\n total_score += roll + next_roll\n current_roll += 2\n end\n end\n\n return total_score\n end",
"def roll_dice(dice, num_dice)\n dice.roll(num_dice)\n values = dice.values\n puts \"Your dice values: #{values}\"\n roll_score = dice.score(values)\n puts \"Roll score #{roll_score}\"\n [roll_score, values]\n end",
"def score_strike\n @total_score += 10 + @rolls[@current_roll + 1] + @rolls[@current_roll + 2]\n @current_roll += 1\n end",
"def score_strike\n @total_score += 10 + @rolls[@current_roll + 1] + @rolls[@current_roll + 2]\n @current_roll += 1\n end",
"def score_strike\n @total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n @current_roll += 1\n end",
"def roll_dice_and_process(player_id,roll_count,total_score)\n player_rolls = roll(roll_count)\n remaining_elements , roll_score = get_score(player_rolls)\n total_score[player_id] += roll_score\n puts \"Player #{player_id} rolls: #{player_rolls}\"\n puts \"Score in this round: #{roll_score}\"\n [remaining_elements,roll_score]\nend",
"def score_roll\n @total_score += @roll + @next_roll\n @current_roll += 2\n end",
"def dice_trial(dice_obj, player_obj, dice_to_roll)\n\t\tputs \"Rolling dice now:\"\n\t\tdice_to_roll.each do |i|\n\t\t\tdice_value = roll_a_dice\n\t\t\tputs \"Dice ##{i} value: #{dice_value}\"\n\t\t\tdice_obj.scores[\"dice_#{i}\".to_sym] = dice_value\n\t\tend\n\t\tputs \"Score summary of all dices ==> #{pretty_print_hash(dice_obj.scores)}\"\n\t\t# Possible score options\n\t\tputs \"\\n\\n\"\n\t\tplayer_obj.calculate_and_display_score_options(dice_obj.scores)\n\t\tputs \"Overall score for player #{player_obj.id}:\"\n\n\t\tscore_display(player_obj.score)\n\t\tputs \"=\"*20\n\t\tputs \"Following are possible scores to choose from:\"\n\t\tscore_display(player_obj.round_scores, true)\n\tend",
"def score\n\t\tpontos = 0\n\t\tindex = 0\n\t\twhile (index < 20 && @rolls[index]) do\n\t\t\tif strike? index\n\t\t\t\tpontos += pontosStrike (index)\n\t\t\telsif spare? index\n\t\t\t\tpontos += pontosSpare (index)\n\t\t\telsif @rolls[index + 1]\n\t\t\t\tpontos += @rolls[index] + @rolls[index + 1]\n\t\t\telse\n\t\t\t\tpontos += @rolls[index]\n\t\t\tend\n\t\t\tindex += 2\n\t\tend\n\t\tpontos\n\tend",
"def roll\n dice = die_array\n @score = Die.roll(dice)\n @count = dice.map { |d| d[/(\\d+)d\\d+/, 1].to_i || 1 }.inject(0, :+)\n return self\n end",
"def dices\n\t\t@rollAgain = 0\n\t\t@goalParam = 0\n\tend",
"def roll_dice\n @dice.each do |die| \n # reset roll value of die\n die.reset\n # roll and assign value\n die.roll\n end\n end",
"def rolls\n # theoretical dices which have X faces from 1 to X included and are evenly balance (as much as our PRNG)\n @rolls ||= (quantity ? quantity.value : 1).times.map{ rand(faces.value) + 1 }\n end",
"def roll(dice)\n dice\n end",
"def score( dice )\n total_score = 0\n hash = Hash.new(0)\n dice.each {|x| hash[x] += 1}\n total_score += hash[1] < 3 ? hash[1] * 100 : 1000 + (hash[1] - 3) * 100\n total_score += hash[5] < 3 ? hash[5] * 50 : 500 + (hash[5] -3) * 50\n total_score += hash[6] > 2 ? 600 : 0\n total_score += hash[4] > 2 ? 400 : 0\n total_score += hash[3] > 2 ? 300 : 0\n total_score += hash[2] > 2 ? 200 : 0\n total_score\n end",
"def roll!\n @total = 0\n @dice_sets.each do |set|\n @total += set.roll!\n end\n @mods.each do |mod|\n @total += mod\n end\n\n @total\n end",
"def roll\n @dice.roll(@num_dice_to_roll)\n roll_score = @dice.score\n @turn_score += roll_score\n @@reactor.push_event(DieRollEvent.new(self, @dice.values, roll_score))\n if roll_score == 0\n stop(false)\n end\n #else option to go again\n end",
"def score(dice)\n score = 0\n # n refers to an array which members are non-special die faces except when occurring three times in a roll of three or more.\n n = [2,3,4,6]\n # Creates an empty hash referred to as scorer with default value of zero\n scorer = Hash.new(0)\n # Iterates through the dice roll and creates a key/value pair in scorer\n # where the key is the die face and the value is increased by one for every occurrence of that die face\n dice.each do |die| scorer[die] += 1\n end\n # Iterates through the hash scorer, looking for the key 1 with a value equal to or greater than 3.\n if scorer[1] >= 3\n # 1000 is added to score for 3 occurrences of die face 1, and 100 is added for each additional occurrence.\n score += 1000+(100*(scorer[1]-3))\n # If the value of the key 1 is less than 3 it adds 100 to score for every occurrence of the die face 1.\n elsif scorer[1] < 3\n score += scorer[1]*100\n end\n # Iterates through the hash scorer, looking for the key 5 with a value equal to or greater than 3.\n if scorer[5] >= 3\n # 500 is added to score for 3 occurrences of die face 5, and 50 is added for each additional occurrence.\n score += 500+(50*(scorer[5]-3))\n # If the value of the key 5 is less than 3 it adds 50 to score for every occurrence of the die face 5.\n elsif scorer[5] < 3\n score += scorer[5]*50\n end\n# Iterates through array referred to as n.\n n.each do |x|\n if scorer[x] == 3\n score += x * 100\n end\n end\n # Returns the value of score after all the die values have been summed.\n score\nend",
"def score\n @rolls.reduce(:+)\n end",
"def score(dice)\n points = 0\n if straight?(dice)\n 1500\n elsif three_pairs?(dice)\n 750\n else\n points += three_of_kind2(dice)\n points += ones2(dice)\n points += fives2(dice)\n end\n end",
"def roll\n\t\tputs \"Rolling a #{@sides} sided die #{@rolls} times.\"\n\t\t#puts 1 + rand(@sides)\n\t\ti = 0\n\t\ttotal = 0\n\t\twhile i < @rolls do\n\t\t\troll_value = 1 + rand(@sides)\n\t\t\ttotal = total + roll_value\n\t\t\ti += 1\n\t\t\tputs \"Roll number #{i}: #{roll_value}\"\t\n\t\tend\n\t\tputs \"Total of all rolls: #{total}\"\n\tend",
"def play_round\n scorer = BeingLucky.new(Array.new(5, Die.new))\n\n while scorer.can_roll?\n roll_score = scorer.score\n puts \"Score for this roll: #{roll_score}\"\n puts \"Score for this round: #{scorer.turn_score}\"\n puts \"Dice left to roll: #{scorer.dice_count}\"\n\n unless scorer.can_roll?\n puts \"You lose! No more dice means no points this round\"\n return 0\n end\n\n puts \"roll again? (Y/N): \"\n if STDIN.gets.chomp.downcase == \"n\"\n # cash out the points and break the loop\n return scorer.turn_score\n end\n\n end\n\n end",
"def roll(dice)\n p \"Press enter to roll the dice\"\n gets.chomp\n @player_score = @players[0].roll(dice)\n p \"Hey #{@players_joined[0]}, you rolled #{@player_score}\"\n formulate_score()\n end",
"def roll(user_id)\n puts \"Rolling for user #{user_id}\"\n\n @reset_score = false\n _total_score_of_this_roll = 0\n _dice_number_to_roll = NUM_DICE\n loop do \n dice_roll_result = roll_dice(_dice_number_to_roll)\n result_of_roll = calculate_score(user_id, _dice_number_to_roll, dice_roll_result)\n \n score_of_this_roll = result_of_roll[0]\n\n if result_of_roll[1] == _dice_number_to_roll\n @reset_score = true\n break\n end\n\n if !($user_is_in_game[user_id])\n if score_of_this_roll > $min_score_to_enter_game \n $user_is_in_game[user_id] = true\n else\n puts \"User scored #{score_of_this_roll} < 300, can't continue\"\n break\n end\n end\n\n _total_score_of_this_roll += result_of_roll[0]\n _dice_number_to_roll = result_of_roll[1]\n\n if (_dice_number_to_roll == 0) && (score_of_this_roll > 0) && ($user_is_in_game[user_id])\n dice_to_roll = NUM_DICE\n end\n\n if _dice_number_to_roll > 0\n puts \"#{_dice_number_to_roll} non-scoring dice available, want to roll? (y/n) \"\n _want_to_roll = gets.chomp.downcase\n if _want_to_roll != 'y'\n break\n end\n end\n break if _dice_number_to_roll == 0 && !($user_is_in_game[user_id])\n end\n if !(@reset_score)\n $score_board[user_id] += _total_score_of_this_roll\n else\n _total_score_of_this_roll = 0\n end\n\n\tputs \"user #{user_id} scored #{_total_score_of_this_roll} in this roll \\n\"\n puts \"\\n --------------------\\n\"\nend",
"def strikeScore(rollIndex)\n 10 + @rolls[rollIndex + 1] + @rolls[rollIndex + 2]\n end",
"def roll_dices\n @dices = Hazard.s2d6\n end",
"def roll_dice(sides, dice)\n\tfor i in 1..dice\n\t\tresult = 1 + rand(sides)\n\t\tif result == sides\n\t\t\t# this is fixed \n\t\t\tputs result.to_s.red\n\t\telse\n\t\t\tputs result\n\t\tend\n\tend\nend",
"def roll( dice, sides, array, total )\n # Recursively roll dice and tally the frequency of each possible result.\n if 0 < dice\n (1..sides).each {|s| roll( dice - 1, sides, array, s + total )}\n else\n array[total - 1] += 1.0\n end\n end",
"def score(dice)\n dice.sort\n\n if !dice.any?\n return 0\n end\n\n arr = Array.new (6)\n count = 1\n 6.times do\n arr[count-1] = dice.count(count)\n count +=1\n end\n\n sum = 0\n count = 1\n arr.each do |item|\n p \" #{count + 1} = #{item} :\"\n if item == 0 || item == nil\n count += 1\n next\n end\n\n if item >= 3 && count == 1\n sum += 1000 + 100 * (item - 3)\n elsif item >= 3 && count == 5\n sum += 5 * 100 + 50 * (item - 3)\n elsif item >= 3\n sum += count * 100\n end\n\n if item < 3 && count == 1\n sum += item * 100\n elsif item < 3 && count == 5\n sum += item * 50\n end\n\n count +=1\n end\n sum\nend",
"def score\n\n # Initialise local counters\n scoreCounter = 0\n rollIndex = 0\n frameIndex = 0\n\n # Block to run over all frames\n @rolls.each do |roll|\n if frameIndex < 10\n if strike?(rollIndex)\n # A strike means a special score and the frame is cleared in one roll\n scoreCounter += strikeScore(rollIndex)\n rollIndex += 1\n elsif spare?(rollIndex)\n # A strike means a special score and the frame is cleared in two rolls\n scoreCounter += spareScore(rollIndex)\n rollIndex += 2\n else\n # A strike means a regular score and the frame is cleared in two rolls\n scoreCounter += regularScore(rollIndex)\n rollIndex += 2\n end\n frameIndex += 1\n end\n end\n\n # Return value\n scoreCounter\n\n end",
"def score(dice)\r\n \r\nend",
"def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\n end",
"def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\n end",
"def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\n end",
"def execute_turn\n display_scores\n\n @players.each do |idx, player|\n dice_count = DICE_COUNT\n current_score = 0\n\n loop do\n @dice.roll(dice_count)\n dice_score = @dice.score\n current_score = (dice_score == 0)? 0: current_score + dice_score\n\n @dice.dump_values(\"Player #{idx} rolls \")\n puts \"Score in this round: #{current_score}\"\n puts \"Total score: #{player.total_points}\"\n\n non_scoring_dice = @dice.non_scoring_dice_count\n dice_count = (non_scoring_dice == 0)? DICE_COUNT: non_scoring_dice\n # Have modified the print to show the dice he can re-roll\n if current_score != 0\n puts \"You can roll #{dice_count} dice again, do you want to(y/n)?\"\n re_roll = gets.chomp\n end\n break if (current_score == 0) || re_roll == \"n\"\n end\n\n next if current_score == 0\n player.add_points(current_score)\n end\n end",
"def roll\n\t\t\tsum = 0\n\t\t\t@count.times do |i|\n\t\t\t\tsum += (1 + rand(@sides))\n\t\t\tend\n\t\t\treturn sum\n\t\tend",
"def roll\n results = []\n\n self.dice.each do |die|\n results << die.roll\n end\n\n return results\n end",
"def roll\n generate_raw_results\n return @result if !@keep_mode || @keep_number.to_i >= @ndice\n\n use_dice = case @keep_mode\n when :keep_best then @raw_result_details.sort[-@keep_number..]\n when :keep_worst then @raw_result_details.sort[0..(@keep_number - 1)]\n end\n\n @result = use_dice.inject(0) { |so_far, die_result| so_far + die_result }\n end",
"def score(dice)\n\n points = 0\n \n # iterate through each eye of the dice\n [1, 2, 3, 4, 5, 6].each do |eyes|\n \n count = dice.count(eyes)\n\n case eyes\n when 1\n count >= 3 ? points += 1000 + (100 * (dice.count(1) - 3)) : points += ( dice.count(1) * 100 )\n when 5 \n points += ( 500 + ((count - 3) * 50) ) if count >= 3\n points += (count * 50) if count < 3\n else\n points += (eyes * 100) if count >=3\n end\n end\n\n return points\nend",
"def score\n if strike?\n pins + next_two_rolls rescue nil\n elsif spare?\n pins + next_roll rescue nil\n else\n pins\n end\n end",
"def show\n number=@dice.dice_number #Number of dice\n sides=@dice.dice_sides #sides\n @roll_array = [] #array to store multiple results of dices\n number.times do\n @roll_array << (rand(sides) + 1)\n end\n @total = 0\n @roll_array.each do |roll|\n new_total = @total + roll\n @total = new_total #total of all results\n end\n return @roll_array,@total\n end",
"def roll_all\n dice.map(&:roll)\n end",
"def score_bowling_game_rolls(rolls)\n padded_rolls = pad_rolls(rolls)\n frames = map_to_frames(padded_rolls)\n chunks = map_to_chunks(frames)\n chunks.map { |chunk| chunk_to_score(chunk) }.sum(&:to_i)\n end",
"def strike_frame\n @total_score += 10 + @next_roll + @first_roll_next_frame\n @current_roll +=1\n end",
"def roll\n @dice.each(&:roll)\n if @dice.first == @dice.last\n dup_dice = @dice.map { |d| Die.new(id: d.id + 2, number: d.number) }\n @dice.concat(dup_dice)\n end\n end",
"def roll_dice(num_dice = 1, num_sides = 6)\n\n\taccumulator = 0\n\tdice_type = Dice.new(num_sides)\n\n\tnum_dice.times do \n\t\tif Production\n\t\t\taccumulator += dice_type.roll\n\t\telse\n\t\t\troll_result = dice_type.roll \n\t\t\taccumulator += roll_result\t\n\t\t\tif MSG_LEVEL >= DEBUG\n\t\t\t\tputs \"roll_dice:: Rolled a #{roll_result} & current total is: #{accumulator}\"\n\t\t\tend\n\t\tend\n\tend # times loop\n\n\tif !Production \n\t\tputs \"#{num_dice} #{dice_type.num_sides.to_s} sided dice were rolled and totaled #{accumulator}\"\n\telse\n\t\tputs \"#{accumulator}\"\n\tend\n\nend",
"def each_roll(dice, num_dice, accumulated_score)\n roll_score, values = roll_dice(dice, num_dice)\n if roll_score == 0\n accumulated_score = 0\n else\n # accumulated_score for that turn\n accumulated_score += roll_score\n\n # Gets number of valid dice for next roll\n num_dice = get_valid_dice_count(num_dice, values)\n end\n [num_dice, accumulated_score]\n end",
"def spareScore(rollIndex)\n 10 + @rolls[rollIndex + 2]\n end",
"def score(dice)\n @num = @points = 0 # Number of points\n dice = dice.sort! # Sort the array\n @len = dice.length\n #puts dice\n #puts @len\n if [] == dice\n #puts \"Score: 0\"\n return 0\n end \n while @num < @len\n @num_curr = dice.count(dice[@num])\n #puts @num_curr\n if 1 == dice[@num]\n if @num_curr >= 3\n @points += 1000 # Add 1000 points\n @points += 100 * (@num_curr - 3) # Add 100x\n else \n @points += 100 * @num_curr # Add 100x\n end\n @num += @num_curr # Push forward num\n elsif 5 == dice[@num]\n if @num_curr >= 3\n @points += 500 # Add 500 points\n @points += 50 * (@num_curr - 3) # Add 50x \n else \n @points += 50 * @num_curr # Add 50x \n end\n @num += @num_curr # Push forward num\n else\n if @num_curr >= 3\n @points += 100*dice[@num] # Add 100*n\n end \n @num += @num_curr # Push forward num\n end \n end \n return @points\nend",
"def score(dice)\n \n if dice.empty?\n return 0\n end\n\n var_score = 0\n\n conteo = (0..9).to_a.each.map { |x| dice.count(x)} \n \n #Evaluating 1\n if ( conteo[1] / 3 ) >= 0\n multiplier1 = conteo[1]/3\n var_score += multiplier1 * 1000\n end\n\n if ( conteo[1] % 3 ) != 0\n var_score += (conteo[1] % 3)*100\n end\n \n #Evaluating 5\n if ( conteo[5] % 3 ) != 0\n var_score += (conteo[5] % 3)* 50\n end\n\n #Evaluating numbers x 3 \n if (conteo[2..9].count { |x| x >= 3 }) > 0\n triplets = conteo[2..9].map {|x| x / 3}\n array_multiplicator = triplets.each_with_index.select {|num,index| (num > 0)}.map {|x| x[0]}\n product_triplets = triplets.each_with_index.select {|num,index| (num > 0)}.map {|x| x[1]}.map {|x| (x+2)*100}\n var_score += array_multiplicator.zip(product_triplets).map{|x| x.inject(&:*)}.sum\n end\n\n var_score\nend",
"def calculate_score(user_id, num_dice, scores)\n\t@reset_score = false\n\t_non_scoring_dice_count = 0\n\tfinal_score = 0\n\tscore_map = Hash.new(0)\n\tscores.each {|item| score_map[item] += 1}\n\n\tputs \"unique scores #{score_map.to_s}\"\n\t\n\tscore_map.each do |key,number_of_dice|\n\t\tif number_of_dice >= 3\n\t\t\tfinal_score += $score_ref_sheet[key]\n\t\t\tif key ==1 or key == 5\n\t\t\telse\n\t\t\t\t_non_scoring_dice_count += number_of_dice - 3\n end\n elsif key == 1 || key == 5\n final_score += number_of_dice * $score_ref_sheet_1_5[key]\n\t\telsif \n\t\t\t_non_scoring_dice_count += number_of_dice\n end\n end\n\n puts \"non scoring #{_non_scoring_dice_count} and num dice is #{num_dice}, score for this roll is #{final_score}\"\n\treturn final_score, _non_scoring_dice_count\nend",
"def score(dice)\n # You need to write this method\n if dice.empty?\n return 0\n end\n total = 0\n dice.sort!\n if dice.size >= 3\n dice.each_slice(3) do |slice|\n if slice.uniq.size == 1\n if slice.first == 1\n total += 1000\n else\n total += get_single_score_points slice\n end\n else\n total += get_single_score_points slice\n end\n\n end\n else\n total += get_single_score_points dice\n end\n total\nend",
"def roll_dice\n self.cubes.where(:held => false).each do |cube|\n cube.roll\n end\n end",
"def score( dice )\n res = 0\n val = { \"111\" => 1000, \"666\" => 600, \"555\" => 500, \"444\" => 400,\n \"333\" => 300, \"222\" => 200, \"1\" => 100, \"5\" => 50 }\n\n [*1..6].each do |num|\n next if dice.count(num).nil?\n many = dice.count(num)\n if many >= 3\n res += val[num.to_s * 3]\n many -= 3\n end\n if num == 1 || num == 5\n until many < 1\n res += val[num.to_s]\n many -= 1\n end\n end\n end\n \n res\nend",
"def score_normal\n @total_score += @roll + @next_roll\n @current_roll +=2\n end",
"def score(dice)\n hash = Hash.new(0)\n score = 0\n dice.each { |key| hash[key] += 1 }\n hash.each do |key, value|\n if key == 1\n score += 100 * (value % 3)\n score += 1000 * (value / 3)\n elsif key == 5\n score += 50 * (value % 3)\n score += 500 * (value / 3)\n else\n score += key * 100 * (value / 3)\n end\n end\n score\nend",
"def regularScore(rollIndex)\n @rolls[rollIndex] + @rolls[rollIndex + 1]\n end",
"def score_normal\n @total_score += @roll + @next_roll\n @current_roll += 2\n end",
"def roll\n case rule\n when :each\n roll_all\n when :sum\n total\n when :worst\n take_worst\n when :best\n take_best\n end\n end",
"def score( dice )\n @result = []\n values = [*1..6]\n values.each do |i|\n if dice.count(i) >= 3\n case i\n when 1\n result << 1000\n when 2\n result << 200\n when 3\n result << 300\n when 4\n result << 400\n when 5\n result << 500\n when 6\n result << 600\n end\n if (dice.count(i) - 3) > 0\n case i\n when 1\n result << 100 * (dice.count(1) - 3)\n when 5\n result << 50 * (dice.count(5) - 3)\n end\n end\n else\n once_check(i)\n # case i\n # when 1\n # result << 100 * dice.count(1)\n # when 5\n # result << 50 * dice.count(5)\n # end\n end\n end\n result.sum\nend",
"def updatePlayer(player)\n puts \"\\n\"\n print \"#{ frase } | \"\n print \" #{@@listPlayer[player].name }\".colorize(:green)\n print \" you roll : \"\n valuesOfRoll = @@listPlayer[player].arrayV\n p valuesOfRoll\n arrayValuesPoints = @@scoreTable.evaluate(@@listPlayer, player)\n scoreRolling = arrayValuesPoints.pop\n print \"You got : \"\n print \"#{scoreRolling}\".colorize(:green) if scoreRolling > 0\n print \"#{scoreRolling}\".colorize(:red) if scoreRolling == 0\n print \" points \"\n gets.chomp\n @@listPlayer[ player ].score += scoreRolling\n dices = arrayValuesPoints.length\n @@listPlayer[ player ].arrayV = []\n dices = 0 if scoreRolling == 0\n @@listPlayer[ player ].score = 0 if @@listPlayer[ player ].score < 300 and dices == 0\n return dices\n end",
"def roll\n return rand(@sides) + 1 ## roll_value = rand(@sides) + 1\n end",
"def roll\n return rand(@sides) + 1 ## roll_value = rand(@sides) + 1\n end",
"def roll_dice( dice_command, roll_count )\n begin\n puts \"Executing #{roll_count} roll(s) of #{dice_command}\"\n results, total = Dice.new( dice_command ).roll( roll_count )\n puts \"Result: [#{results.join(', ')}] => #{total}\" \n rescue Exception => e\n puts \"Roll error: #{e}\"\n end\nend",
"def roll()\n raise InvalidSidesException.new(\"A number of sides is needed for a die.\") if @sides == 0\n raise InvalidSidesException.new(\"An appropriate number of sides is required.\") if @sides < 6\n \n rand(@sides) + 1\n end",
"def score\n @total_score = 0\n @current_roll = 0\n @frame = 1\n\n while rolls?\n set_roll_logic\n if @frame > 10\n return @total_score\n else\n score_frame\n end\n end\n return @total_score\n end",
"def bonus_panel\n dice = roll_dice\n if dice == 1\n puts dice\n puts \"No change made to your score\"\n else\n puts dice\n puts \"Your score multiplies by #{dice}!\".colorize(:blue)\n end\n @score *= dice\n end",
"def roll_all #function connecting roll, get_last_roll and cheat_roll\n score = rand(@walls)+1 #set variable to the roll score\n self.set_last_roll(score) #we set the last roll by using the function cheat roll\n return self.get_last_roll #return the last roll\n end",
"def apply_roll_to_total(roll_reason, roll_result)\n case roll_reason\n when :basic, :reroll_new_die, :reroll_new_keeper, :reroll_replace\n @total = roll_result\n when :reroll_add\n @total += roll_result\n when :reroll_subtract\n @total -= roll_result\n when :reroll_use_best\n @total = [@value, roll_result].max\n when :reroll_use_worst\n @total = [@value, roll_result].min\n end\n end",
"def dice_outcomes(die=1, rolls=1)\n\tresults = Hash.new(0)\n\n\t# Roll the dice rolls times and track the sums in hash\n\trolls.times do \n\t\tresults[roll_dice(die)] += 1 # Utilize existing function! Ruby will evaluate L side first\n\tend\n\n\t# Print out number each possible outcome occurred\n\t(1..(6*die)).each do |key|\n\t\tputs \"#{key}: \" + \"\\#\"*results[key]\n\tend\nend",
"def roll\n dice_sides = [1, 2, 3, 4, 5, 6]\n dice_sides.sample\nend",
"def player2roll\n\tputs \"\\n\\n#{Name_2}, how many dice would you like to roll (1-6)?\\n\\n\"\n\tnum_dice2 = gets.chomp.to_i\n\tdice2 = (1..num_dice2).to_a\n\tdice_rolls2 = []\n\tsum2 = 0\n\tdice2.each_with_index do |a, index|\n\t\tdice_rolls2.push rand(1..6)\n\t\tunless dice_rolls2[index] == 1\n\t\t\tsum2 = 0\n\t\t\tdice_rolls2.each { |a| sum2+=a }\n\t\tend\n\tend\n\n\tif dice_rolls2.include? 1\n\t\tsum2 = 0\n\t\tputs \"\\nBummer, #{Name_2}! You rolled a 1. No points.\\n\\n\"\n\telse\n\t\tputs \"\\n#{Name_2}, you rolled a total of #{sum2}\\n\\n\"\n\tend\nend",
"def roll(message, dice = '1d20')\n result = Die.roll(dice.split(' '))\n if result.is_a?(Integer)\n result = \"#{message.user.nick} rolls #{dice} totalling #{result}\"\n end\n message.reply result\n end",
"def score\n return score = 0\n score = 0\n score += 1000 if dice.count(1) >= 3\n score += 200 if dice.count(2) == 3\n score += 300 if dice.count(3) == 3\n score += 400 if dice.count(4) == 3\n score += 500 if dice.count(5) >= 3\n score += 600 if dice.count(6) == 3 # Los de 2, 3, 4, 5 y 6 se tienen que poder unificar !!!!!!\n score += 50 * (dice.count(5) % 3)\n score += 100 * (dice.count(1) % 3)\n \n \n # si todas las dice son diferentes entre si y no hay ni unos ni cincos saca un cero\n# si tienes 3 unos anota 1000 puntos, \n# si tienes 3 iguales, que no son unos, multiplica ese numero por 100\n# si tienes un 1 (a parte de los otros 3) sumas 100\n# si tienes dos 1 (a parte de los otros 3) sumas 200\n# si tienes un 5 (a parte de los otros 3) sumas 50\n # You need to write this method\n end",
"def roll\n rand(sides)+1\n end",
"def turn(dice)\n accumulated_score = 0\n num_dice = 5\n\n puts \"Player #{@id}, your turn\"\n loop do\n num_dice, accumulated_score = each_roll(dice, num_dice, accumulated_score)\n break if accumulated_score == 0\n\n # Interactive prompt asking whether to roll again or not\n puts 'Would you like to roll again? [y/n]'\n next unless gets.strip == 'n'\n\n accumulated_score = valid_init_turn(accumulated_score)\n break\n end\n\n # Updates @net_score by adding accumulated_score for this turn\n update_score(accumulated_score)\n end",
"def score(dice)\n n = 0\n (1..9).each do |i|\n amount = dice.find_all{|d| d == i}.size\n case i\n when 1\n if amount > 2\n n += 1000 + (amount - 3) * 100\n else\n n += amount * 100\n end\n when 5\n if amount > 2\n n += 500 + (amount - 3) * 50\n else\n n += amount * 50\n end\n else\n if amount > 2\n n += i * 100\n end\n end\n end\n\n return n\nend",
"def game\n player = 0\n dices = 5\n winner = -1\n @@scoreTable.displayPoints( @@listPlayer )\n loop do\n dices.times{ @@listPlayer[ player ].arrayV << rollDice }\n @@listPlayer[ player ].arrayV.sort!\n @@scoreTable.displayTurn(@@listPlayer, player)\n dices = updatePlayer( player )\n player+=1 if dices == 0\n dices = 5 if dices == 0\n player = 0 if player >= @@listPlayer.length\n winner = @@scoreTable.winner(@@listPlayer)\n break if winner >= 0\n 2.times { puts \"\\n \" }\n end\n @@scoreTable.celebrate(winner,@@listPlayer)\n system('clear')\n puts \"~~~~~~~~~~~~~~~~ Thanks for playing ~~~~~~~~~~~~~~~~~\"\n puts \"~~~~~~~~~~~~~ Gem created by rubiocanino ~~~~~~~~~~~~~\"\n puts \"\"\n end",
"def scorelist(roll)\n #return a hash that shows all the possible scores for these dice, sorted\n categories = ['yahtzee','fourk','house','threek', \n 'n6', 'n5', 'n4', 'n3', 'n2', 'n1', 'small' ,'large', 'chance']\n scores = {}\n categories.each do |entry|\n #populate the hash\n scores[entry] = eval(\"#{entry}(#{roll})\")\n end\n return scores.sort_by{|k,v| v}.reverse\nend",
"def dice_roll\n return (rand(6) + 1)\n end",
"def roll_die(sides)\n\tresult = 1 + rand(sides)\nend",
"def roll(dice)\n rand(1..6)*dice\nend",
"def roll_dice\n dice = rand(6) + 1\n end",
"def human_turn\n term_score = 0 # Variable used to store the term score\n\n puts \"Type r to roll, or h to hold. \"\n\n selection= gets.chomp\n select = selection\n\n dice = 0\n \n # prompts the user for input until they enter \"h\" or their rolled a dice to 1 which puts their turn on hold\n until selection == \"h\" || dice.to_i == 1\n \n # Conditional statement to check if user input is valid\n if selection != \"r\"\n # if not a valid input then prompts the user to type again\n puts \"input can only be r or h\"\n selection= gets.chomp\n\n else selection == \"r\"\n # if it is a valid input then roll the dice\n dice = roll_dice # calls the roll_dice method\n \n # Conditional statement to check if the dice value is 1\n if dice.to_i == 1\n # if value is one output and change term score to zero\n puts \"#{name} hi rolled a #{dice.to_s}.\"\n term_score = 0\n human_score = 0\n puts \"#{name} hi turn total is #{term_score.to_s}\"\n else\n # if value is not one output and add up the term score\n puts \"#{name} rolled a #{dice.to_s}.\"\n term_score += dice\n puts \"#{name} turn total is #{term_score.to_s}\"\n \n # prompts the user to input selection again\n puts \"Type r to roll, or h to hold. \"\n selection= gets.chomp\n \n end\n \n end \n \n end\n \n # stores the term score in to the instance variable human score\n @human_score = term_score + @human_score\n \n end",
"def getDiceRoll()\n\tdie1 = rand(Diemaxroll - (Dieminroll - 1)) + Dieminroll\n\tdie2 = rand(Diemaxroll - (Dieminroll - 1)) + Dieminroll\n\treturn die1 + die2\nend",
"def test_score_is_correct_for_all_no_special_rolls\n (1..4).each do |pins|\n @game.reset\n (1..20).each do |r|\n @game.roll(pins)\n end\n assert_equal(pins * 20, @game.score, \"bowling score wrong for all pin counts up to 4. pins = #{pins}\")\n end\n end",
"def score\n # puts\n # p @frames\n\n raise RuntimeError, 'Score cannot be taken until the end of the game' unless game_over?\n\n base_rolls = @frames[0..9].flatten.size\n arr = @frames.flatten\n # p arr\n arr.map!.with_index do |elem, ndx|\n if ndx < base_rolls\n # p \"elem == #{elem}\"\n\n # should split the bonus calc off into a separate method\n # calc the bonus for the 1st subsequent roll\n bonus = arr[ndx + 1] == 'X' ? 10 : arr[ndx + 1] if elem == 'X' || elem == '/'\n if elem == 'X'\n # add the bonus for the 2nd subsequent roll\n bonus += if arr[ndx + 2] == 'X'\n 10\n elsif arr[ndx + 2] == '/'\n 10 - arr[ndx + 1]\n else\n arr[ndx + 2]\n end\n\n # p \"bonus == #{bonus}\"\n 10 + bonus\n elsif elem == '/'\n # p \"bonus == #{bonus}\"\n (10 - arr[ndx - 1]) + bonus\n else\n elem\n end\n end\n end\n # p arr\n # p arr[0...base_rolls]\n arr[0...base_rolls].sum\n end",
"def straight_D(roll_count)\r\n if roll_count == 1\r\n sm_straight = ((20.0/36.0)*100).truncate(2)\r\n lg_straight = ((2.0/36.0)*100).truncate(2)\r\n straights = [sm_straight, lg_straight]\r\n elsif roll_count == 2\r\n sm_straight = (((16.0/36.0)*(20.0/36.0) + (20.0/36.0))*100).truncate(2)\r\n #LARGE STRAIGHT\r\n #prob_one is the chance of rolling short edge (1 or 6) on first roll and long edge on second\r\n prob_one = (9.0/36.0)*(1.0/6.0)\r\n #prob_two is chance of rolling long edge on first roll and either remaining edge on second\r\n prob_two = (9.0/36.0)*(2.0/6.0)\r\n #prob_three is chance of rolling nothing on first roll and both on second\r\n prob_three = ((16.0/36.0)*(2.0/36.0))\r\n #add these to the chance of rolling both on first roll\r\n lg_straight = ((prob_one + prob_two + prob_three + (2.0/36.0))*100).truncate(2)\r\n straights = [sm_straight, lg_straight]\r\n end\r\nend",
"def dice_roller2\n (1..6).each do |roll1|\n (1..6).each do |roll2|\n puts \"#{roll1} #{roll2}\"\n end\n end\nend",
"def dice_outcomes(dice, rolls)\n outcomes = []\n rolls.times do |roll|\n outcomes << roll_dice(dice)\n end\n occurences = outcomes.each_with_object(Hash.new(0)) do |outcome, count|\n count[outcome] += 1\n end\n occurences.sort.map do |key, val|\n outcome = \"\"\n val.times do\n outcome << '#'\n end\n $stdout.puts \"#{key}: #{outcome}\"\n end\nend",
"def successes(min = 8, reroll = 10, subtract = false)\n count = 0\n rote = false\n\n # if this result set has already been rerolled, simply count the successes\n # in the result and return the total (rather than rerolling /again/)\n if @rerolled\n @ten_result.each do |value|\n count += 1 if value >= min\n end\n\n return count\n end\n\n if reroll == 0\n reroll = 10\n rote = true\n end\n\n # this bonus dice is used for any rerolls that accrue\n bonus_dice = ::DiceRoller::Dice.new(sides = 10)\n\n # reroll failed dice once and add the results to the array\n if rote\n rote_rerolls = []\n\n @ten_result.each do |result|\n rote_rerolls << bonus_dice.roll if result < min\n end\n\n @ten_result += rote_rerolls\n end\n\n # loop through the rolled results and count successes. values greater than\n # the reroll value are rolled again.\n final_result = []\n\n @ten_result.each do |dice|\n this_dice = [dice]\n\n this_dice.each do |result|\n count += 1 if result >= min\n count -= 1 if subtract and result == 1\n\n # each pass through this loop is a rerolled dice\n if result >= reroll\n bonus_result = bonus_dice.roll\n\n # add the reroll result to the current dice's results, this will\n # reroll as appropriate\n this_dice << bonus_result\n end\n end\n\n final_result += this_dice\n end\n\n @ten_result = final_result\n @rerolled = true\n count\n end",
"def roll\n # code goes here\n rand(1..6)\n # bonus solve using array\n #possible_rolls = (1..6).to_a\n #possible_rolls[rand(0..5)]\nend",
"def score\n 2 * won + drawn + noresult\n end",
"def dice_roll\n rand(1..6)\n end",
"def score\n total = 0\n\n #loop through every frame scores\n @frame_score_array.each_with_index do |frame,index|\n\n # if frame is not an array, frame is a strike\n if !frame.kind_of? Array\n # p \"not array. it's strike\"\n # p index\n\n # sum up total of current frame plus next 2 rolls\n next_two_sum = @frame_sum_array[index..index+2].inject { |sum, n| sum+n }\n\n # check whethere there are any strikes after the current frame\n if next_two_sum == 30 || next_two_sum == 20\n # add & sum score from next 2 rolls into current\n @frame_sum_array[index] = @frame_sum_array[index..index+2].inject { |sum, n| sum+n }\n else\n # add & sum score from next 2 rolls into current\n @frame_sum_array[index] = @frame_sum_array[index..index+1].inject { |sum, n| sum+n }\n end\n else\n # p \"not strike. might be spare.\"\n # if frame is a spare\n if frame.inject { |sum, n| sum+n } == 10\n # only take the score of the next roll\n @frame_sum_array[index] += @frame_score_array[index+1][0]\n end\n end\n end\n\n # add total\n total = @frame_sum_array.inject { |sum, n| sum+n }\n end",
"def roll(dice, expression_map: DICE_EXPRESSION_TO_ROLLER_MAP)\n dice_roller = expression_map.fetch(dice) { dice }\n dice_roller.call\n end"
] |
[
"0.7530656",
"0.7526535",
"0.7526535",
"0.7419668",
"0.741699",
"0.7372666",
"0.7356575",
"0.7356575",
"0.7301996",
"0.7237499",
"0.72321147",
"0.7179739",
"0.7173664",
"0.71542454",
"0.7114859",
"0.7105003",
"0.7073966",
"0.7071923",
"0.7055875",
"0.70199597",
"0.699146",
"0.69758785",
"0.6972713",
"0.69472957",
"0.69004357",
"0.6876015",
"0.68506515",
"0.6825877",
"0.6822728",
"0.6777184",
"0.67659134",
"0.6723049",
"0.67154217",
"0.6714392",
"0.6711131",
"0.6700123",
"0.6700123",
"0.6700123",
"0.6675283",
"0.66595095",
"0.6638781",
"0.6612504",
"0.65912217",
"0.6585762",
"0.65778923",
"0.6564919",
"0.65610135",
"0.6548135",
"0.6538781",
"0.6533953",
"0.65013766",
"0.6479096",
"0.64651114",
"0.6464864",
"0.6448797",
"0.64332",
"0.6428876",
"0.642652",
"0.64146256",
"0.6379519",
"0.63686734",
"0.6356995",
"0.63450676",
"0.6342043",
"0.63393736",
"0.63365203",
"0.63365203",
"0.63228",
"0.6322613",
"0.6321783",
"0.6306576",
"0.6299748",
"0.62658644",
"0.6264845",
"0.62586796",
"0.62556916",
"0.6254266",
"0.621718",
"0.621411",
"0.61951166",
"0.6193543",
"0.618392",
"0.6167043",
"0.61474717",
"0.6144371",
"0.6135306",
"0.6126203",
"0.61165816",
"0.6114431",
"0.61136025",
"0.6110849",
"0.6103832",
"0.6095978",
"0.60944736",
"0.60910225",
"0.6082725",
"0.6081557",
"0.60799104",
"0.60770917",
"0.6058828"
] |
0.77730453
|
0
|
Little helper to clean up examples
|
def notify(instrumentation)
ActiveSupport::Notifications.instrument(
'client_request_matrix_data.google_distance_matrix', instrumentation
) do
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_examples\n examples.\n map {|title, body|\n [\n \"#{ title }:\",\n body.lines.map {|l|\n # only indent non-empty lines\n # makes compacting newline sequences easier (see below)\n if l.match(/^\\s*$/)\n l\n else\n ' ' + l\n end\n },\n ''\n ]\n }.\n flatten.\n join(\"\\n\").\n # compact newline sequences\n gsub(/\\n\\n+/, \"\\n\\n\")\n end",
"def examples_from(path) # rubocop:disable Metrics\n string = File.read(path)\n string = ERB.new(string).result\n\n examples_lines = string.lines.slice_before(/\\A\\s*!!!/)\n next_line_number = 1\n examples = examples_lines.flat_map do |example_lines|\n cur_line_number = next_line_number\n next_line_number += example_lines.size\n\n title_command = example_lines[0].strip\n # Remove the first example when the file starts with comments\n next unless title_command.start_with?('!!!')\n\n title = title_command.sub('!!!', '').lstrip\n example_string = example_lines[1..].join.rstrip + \"\\n\"\n\n # Completely remove lines with only a !# comment on them\n example_string = example_string.gsub(/^[ \\t]*!#.*\\n?/, '')\n\n # Remove !# comments\n example_string = example_string.gsub(/\\s*!#.*/, '')\n\n if example_string.include?('^')\n silent_example_string = example_string.gsub('^^', '').gsub('^', '-').gsub('%%', '')\n out_example_string = example_string.gsub('^^', 'HL.out = ')\n .gsub('%%', ' ')\n .gsub('^', '=')\n [\n Example.new(\"(^ as -)#{title}\", silent_example_string, path, cur_line_number),\n Example.new(\"(^ as =)#{title}\", out_example_string, path, cur_line_number),\n ]\n else\n Example.new(title, example_string, path, cur_line_number)\n end\n end\n\n examples.compact\n end",
"def examples(examples)\n example = YARD::CodeObjects::Lucid::ScenarioOutline::Examples.new(:keyword => examples[:keyword],\n :name => examples[:name],\n :line => examples[:location][:line],\n :comments => examples[:comments] ? examples.comments.map{|comment| comment.value}.join(\"\\n\") : '',\n :rows => []\n )\n example.rows = [examples[:tableHeader][:cells].map{ |c| c[:value] }] if examples[:tableHeader]\n example.rows += matrix(examples[:tableBody]) if examples[:tableBody]\n\n @step_container.examples << example\n\n # For each example data row, a new scenario must be generated using the\n # current scenario as the template.\n\n example.data.length.times do |row_index|\n\n # Generate a copy of the scenario.\n\n scenario = YARD::CodeObjects::Lucid::Scenario.new(@step_container,\"example_#{@step_container.scenarios.length + 1}\") do |s|\n s.comments = @step_container.comments\n s.description = @step_container.description\n s.add_file(@file,@step_container.line_number)\n s.keyword = @step_container.keyword\n s.value = \"#{@step_container.value} (#{@step_container.scenarios.length + 1})\"\n end\n\n # Generate a copy of the scenario steps.\n\n @step_container.steps.each do |step|\n step_instance = YARD::CodeObjects::Lucid::Step.new(scenario,step.line_number) do |s|\n s.keyword = step.keyword.dup\n s.value = step.value.dup\n s.add_file(@file,step.line_number)\n\n s.text = step.text.dup if step.has_text?\n s.table = clone_table(step.table) if step.has_table?\n end\n\n # Look at the particular data for the example row and do a simple\n # find and replace of the <key> with the associated values. It's\n # necessary ot handle empty cells in an example table.\n\n example.values_for_row(row_index).each do |key,text|\n text ||= \"\"\n step_instance.value.gsub!(\"<#{key}>\",text)\n step_instance.text.gsub!(\"<#{key}>\",text) if step_instance.has_text?\n step_instance.table.each{ |row| row.each { |col| col.gsub!(\"<#{key}>\",text) } } if step_instance.has_table?\n end\n\n # Connect the steps that have been created to the scenario that was\n # created and then add the steps to the scenario.\n\n step_instance.scenario = scenario\n scenario.steps << step_instance\n end\n\n # Add the scenario to the list of scenarios maintained by the feature\n # and add the feature to the scenario.\n\n scenario.feature = @feature\n @step_container.scenarios << scenario\n end\n end",
"def generate_examples_section\n @catalog['resources'].each do |r|\n\n type = r['type']\n title = r['title'].gsub /'/, \"\\\\\\\\'\"\n parameters = r['parameters']\n\n if parameters.nil?\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}')\\n\" +\n \" end\\n\\n\"\n next\n end\n\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}').with({\\n\"\n\n parameters.each do |k, v|\n unless type == 'File' and k == 'content'\n if v.class == String\n v.gsub! /'/, \"\\\\\\\\'\"\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Integer, TrueClass, FalseClass].include?(v.class)\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Array, Hash].include?(v.class)\n @content += \" '#{k}' => #{v},\\n\"\n else\n raise \"Unhandled input at #{type}[#{title}] of class #{v.class}\"\n end\n end\n end\n\n @content += \" })\\n end\\n\\n\"\n\n ensr = parameters['ensure']\n cont = parameters['content']\n\n if type == 'File' and\n not cont.nil? and\n (ensr == 'file' or ensr == 'present' or\n not parameters.has_key?('ensure'))\n\n mod = cont.clone\n\n if parameters.has_key?('content')\n begin\n mod.gsub!('\\\\') { '\\\\\\\\' }\n mod.gsub! /\"/, '\\\"'\n mod.gsub! /\\@/, '\\@'\n mod.gsub! /\\$;/, '\\\\$;'\n rescue\n end\n end\n\n if not cont.nil?\n if @options[:md5sums]\n generate_md5sum_check(title, cont)\n else\n generate_content_check(title, mod)\n end\n end\n end\n end\n end",
"def parse_examples(section, sections)\n examples = []\n\n section = section.sub('Examples', '').strip\n\n examples << section unless section.empty?\n while sections.first && sections.first !~ /^\\S/\n lines = sections.shift.split(\"\\n\")\n examples << deindent(lines).join(\"\\n\")\n end\n\n @examples = examples\n end",
"def test_what_is_said_in_specification\n WLang::dialect(\"specification\") do\n rules WLang::RuleSet::Basic\n rules WLang::RuleSet::Imperative\n end\n tests = [\n [\"*{authors as who}{${who}}{, }\", \"blambeau, llambeau, ancailliau\"],\n [\"*{authors as who}{${who}} {, }\", \"blambeaullambeauancailliau {, }\"],\n [\"*{authors as who} {${who}}{, }\", nil]\n ]\n context = {\"authors\" => [\"blambeau\", \"llambeau\", \"ancailliau\"]}\n \n tests.each do |test|\n template, expected = test\n if expected.nil?\n assert_raise WLang::ParseError do\n assert_equal(expected, template.wlang(context, \"specification\"))\n end\n else\n assert_equal(expected, template.wlang(context, \"specification\"))\n end\n end\n end",
"def work_examples!\n @html.css('pre').each do |pre|\n lines = pre.content.split(\"\\n\")\n first_line = lines.first.to_s.strip\n next unless first_line.match(/^# ([A-Za-z]+)$/i)\n\n sections = split_lines(lines)\n example = Example.new sections\n @examples.push example\n template = Tilt.new(Ifdoc.root('data', 'templates', 'example.haml'))\n\n pre.after(template.render(example))\n pre.remove\n end\n end",
"def examples\n @examples ||= []\n end",
"def shared_examples_for(title)\nend",
"def before_examples(examples)\n @multiline = []\n end",
"def example_passed(example)\n end",
"def given_block\n examples = [\n [{ :year => '2018', :make => 'fo', :model => 'focus', :trim => 'blank' },\n { :year => 2018, :make => 'Ford', :model => 'Focus', :trim => nil }],\n [{ :year => '200', :make => 'blah', :model => 'foo', :trim => 'bar' },\n { :year => '200', :make => 'blah', :model => 'foo', :trim => 'bar' }],\n [{ :year => '1999', :make => 'Chev', :model => 'IMPALA', :trim => 'st' },\n { :year => 1999, :make => 'Chevrolet', :model => 'Impala', :trim => 'ST' }],\n [{ :year => '2000', :make => 'ford', :model => 'focus se', :trim => '' },\n { :year => 2000, :make => 'Ford', :model => 'Focus', :trim => 'SE' }]\n ]\n\n examples.each_with_index do |(input, expected_output), index|\n if (output = normalize_data(input)) == expected_output\n puts \"Example #{index + 1} passed!\"\n else\n puts \"Example #{index + 1} failed,\n Expected: #{expected_output.inspect}\n Got: #{output.inspect}\"\n end\n end\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def test_no_text_samples\n no_text_samples = [\"go.mod\", \"go.sum\"]\n Samples.each do |sample|\n if sample[:language] == \"Text\"\n refute_includes no_text_samples, sample[:filename], \"#{sample[:filename]} should NOT be added as a sample for #{sample[:language]}\"\n end\n end\n end",
"def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend",
"def examples\n parsed {\n @examples\n }\n end",
"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",
"def docopt_examples(width)\n return [] if @examples.empty?\n\n doc = [\"Examples:\"]\n base_command = @superspace ? \"run #{@superspace}\" : \"run\"\n @examples.each do |command|\n helpline = \" #{base_command} #{command}\"\n wrapped = word_wrap helpline, width\n doc << \"#{wrapped}\"\n end\n doc\n end",
"def examples\n @examples ||= HappinessExercises::Example.new\nend",
"def tutorial\n puts\n rules\n deck = Visualized.new\n examples deck.base_deck\n bad_examples deck.base_deck\nend",
"def visit_examples(examples)\n tc_before_examples(examples)\n super\n tc_after_examples(examples)\n end",
"def test_example(output_exmpl, input_exmpl)\n converted_exmpl = output_suite.convert_example(input_exmpl, output_exmpl.opts, renderer)\n msg = output_exmpl.desc.presence || input_exmpl.desc\n\n assert_equal output_exmpl, converted_exmpl, msg\n end",
"def examples\n @examples\n end",
"def after_examples(examples)\n # Output any multiline args that followed this step\n @multiline.each do |row|\n @data << row\n end\n @multiline = []\n end",
"def prepLoadSamples(inputStr, sampleTypes)\n \n # reformat input stripwells, associate positions on analyzer 96-well tray\n stripwells = operations.map { |op| op.input(inputStr).collection }.uniq\n \n case sampleTypes\n when 'DNA'\n # associate row, col for each sample\n operations.each_with_index do |op, i|\n op.associate :qc_row, (i/WELLS_PER_STRIPWELL.to_f).floor\n op.associate :qc_column, i % WELLS_PER_STRIPWELL\n #op.plan.associate \"qc_row_and_column_#{op.input(inputStr).sample.id}\", \"Your QC result for #{op.input(inputStr).sample.id} is in row #{op.get(:qc_row)} and column #{op.get(:qc_column)}\"\n end\n num_samples = 0\n \n show do \n title \"Relabel stripwells for stripwell rack arrangement\"\n note \"Place the stripwells in a green stripwell rack.\"\n note \"To wipe off old labels, use ethanol on a Kimwipe.\"\n warning \"Please follow each step carefully.\"\n # new label for each well\n stripwells.each_with_index do |s, i|\n num_samples = num_samples + s.num_samples\n note \"Grab stripwell #{s} (#{s.num_samples} wells). Wipe off the current ID. Label the first well <b>#{i+1}</b>\"\n end\n end\n \n rows = (num_samples/WELLS_PER_STRIPWELL.to_f).ceil\n # samples are sucked up as entire strips, so need to fill empty wells in last row with EB (techs have aliquots)\n eb_wells = rows*WELLS_PER_STRIPWELL - num_samples\n \n show do \n title \"Prepare EB stripwells\"\n note \"Make a stripwell of #{eb_wells} wells, pipette <b>10 uL</b> of <b>EB buffer</b> into each of its wells\"\n note \"Label the 1st well <b>#{stripwells.size+1}</b>\"\n end\n \n show do \n title \"Uncap stripwells\"\n note \"Uncap the stripwells and make sure there are no air bubbles\"\n end\n \n show do \n title \"Remove empty wells\"\n note \"Remove all empty wells from the stripwells\"\n note \"The size(s) of the stripwell(s) should be: \"\n stripwells.each_with_index do |s, i|\n note \"<b>Stripwell #{i+1}:</b> #{s.num_samples} well(s)\"\n end\n note \"<b>EB:</b> #{eb_wells} well(s)\"\n end\n # arrange stripwells before loading\n show do \n title \"Arrange stripwells in holder\"\n note \"Arrange the stripwells in the green tube rack so that there is a well in each column and row.\"\n note \"Make sure to mantain the order of the stripwells, as labeled (1,2,3, etc.)\"\n end \n when 'RNA'\n # RNA QIAXcel prep before hand has empty wells filled with buffer; Make sure to direct tech to align stripwells correctly\n stripwell_to_row = Hash.new(0)\n tab = [['Stripwell ID','Row #']]\n \n stripwells.each_with_index do |s, idx| \n tab.push([s.id, idx + 1])\n stripwell_to_row[s.id] = idx\n end\n \n groupby_stripwell = operations.group_by {|op| op.input(inputStr).item.id}\n groupby_stripwell.each do |stripwell, ops|\n ops.each_with_index do |op, i| \n op.associate :qc_row, stripwell_to_row[stripwell]\n op.associate :qc_column, op.input(inputStr).column\n end\n end\n\n # Associate row, col for each sample - TODO: account for ladder in the first stripwell ie: if ladder sample type in stripwell.matrix add 1 to each column\n # operations.each_with_index do |op, i|\n # op.associate :qc_row, (op.input(inputStr).row + 1 /WELLS_PER_STRIPWELL.to_f).floor\n # op.associate :qc_column, op.input(inputStr).column % WELLS_PER_STRIPWELL\n # end\n\n show do \n title 'Aligning RNA Samples for the Fragment Analyzer'\n separator\n note \"<b>Follow the table below to align the stripwells correctly on the green tube rack.</b>\"\n table tab\n end\n num_samples = 0\n stripwells.each do |s|\n s.matrix.each do |row|\n row.each do |well| \n if well != -1\n num_samples + 1\n end\n end\n end\n end\n \n end\n # log_info 'num_samples', num_samples\n # load samples\n show do \n title \"Arrange stripwells in fragment analyzer\"\n note \"Arrange the stripwells in the fragment analyzer in the EXACT SAME ORDER as they are arranged in the green tube rack.\"\n note \"Close the lid on the machine.\"\n end\n \n #return \n num_samples\n \n end",
"def examples=(str)\n @examples = str.strip.split(\"\\n\").map { |s| \" #@appname #{s.rstrip}\\n\" }\n end",
"def test_cases; end",
"def test_multiple_formats\n two_format_setup\n\n correct = <<~HEREDOC\n <picture>\n <source srcset=\"ss\" type=\"webp\">\n <source srcset=\"ss\" type=\"original\">\n <img src=\"good_url\">\n </picture>\n HEREDOC\n\n assert_equal correct, @tested.to_s\n end",
"def prepare_stripwells_for_analysis stripwells, num_samples, eb_wells\n show do \n title \"Uncap stripwells\"\n note \"Uncap the stripwells and make sure there are no air bubbles\"\n end\n\n show do \n title \"Remove empty wells\"\n note \"Remove all empty wells from the stripwells\"\n note \"The size of the stripwells should be as follows: \"\n stripwells.each_with_index do |s, i|\n note \"Stripwell #{i + 1}: #{s.num_samples} wells\"\n end\n note \"Stripwell #{stripwells.size + 1}: #{eb_wells}\" if !eb_wells.zero?\n end\n\n show do \n title \"Arrange stripwells in holder\"\n note \"Arrange the stripwells in the green tube rack so that there is a well in each column and row.\"\n note \"Make sure to mantain the order of the stripwells, as labelled.\"\n end \n end",
"def with_example_arguments\n new_args = missing_required_arguments.each_with_object({}) do |arg, h|\n h[arg.name.to_sym] = arg.example if arg.example_defined?\n end\n with_arguments(**new_args)\n end",
"def test_username_with_invalid_examples\n person = @valid_person\n invalid_usernames = %w{rails/rocks web2.0 javscript:something ME}\n invalid_usernames.each do |username|\n person.username = username\n assert !person.valid?, \"#{username} shouldn't pass validation, but does\"\n end\n end",
"def build_examples_output(output)\n output.join(\"\\n\\n\\t\")\n end",
"def build_examples_output(output)\n output.join(\"\\n\\n\\t\")\n end",
"def tidy(data); end",
"def xinclude_examples name, *args, **kwargs, &block\n xdescribe '(skipped)' do\n if kwargs.empty?\n include_examples name, *args, &block\n else\n include_examples name, *args, **kwargs, &block\n end # if-else\n end # describe\n end",
"def emit_differences(species, confused_with)\n <<-difference\n #{confused_with}: '''\n to do description\n '''\n \n difference\n end",
"def describe=(_); end",
"def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end",
"def test_introspects_properly\n i = Tracksperanto::Import::Syntheyes\n assert_equal 'Syntheyes \"Tracker 2-D paths\" file', i.human_name\n assert !i.autodetects_size?\n assert_not_nil i.known_snags\n assert !i.known_snags.empty?\n end",
"def test_replacements(tests, method, options = {})\n tests.each do |test|\n text = Ramparts.send(method, test[:text], options) do\n INSERTABLE\n end\n if text.casecmp(test[:filtered]) != 0\n raise \"Expected: #{test[:filtered]}\\nGot: #{text}\\nBlock '#{test[:filtered]}'\"\n end\n end\nend",
"def usage( examples, explanation = nil )\n puts \"Script #{@name} #{version} - Usage:\"\n (examples.respond_to?(:split) ? examples.split(\"\\n\") : examples).map {|line| puts \" #{@name} #{line}\"}\n puts explanation if explanation\n exit 1\n end",
"def test_print_items_books_word_is_singular_and_exclamation_point\r\n\t\tdriver = Driver.new(1)\r\n\t\tdriver.num_books = 1\r\n\t\tsingular_sentence = driver.print_items(driver)[0]\r\n\t\tassert_includes singular_sentence, \"book!\"\r\n\tend",
"def description_with_errors_on_extensions\n case @collection_name\n when :errors_on\n \"have #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}\"\n when :error_on\n \"have #{relativities[@relativity]}#{@expected} error on :#{@args[0]}\"\n else\n description_without_errors_on_extensions\n end\n end",
"def example_passed(_)\n end",
"def normalize_testcases(body, idx, decoder)\n prev = ''\n body.each do |l|\n if l[idx].empty?\n l[idx] = prev\n else\n if l[idx].strip.match(/^-+$/)\n l[idx] = :dont_care\n else\n l[idx] = decode(decoder, l[idx])\n end\n prev = l[idx]\n end\n end\n end",
"def explanation\n end",
"def pass_flaky_test(example)\n example.clear_exception\n add_to_summary(:quarantined_tests, example.id)\n end",
"def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end",
"def test_format_reason_code_description\n valid_rc_desc = \"The impact of prior payer(s) adjudication including payments and/or adjustments\"\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code1))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code2))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code3))\n end",
"def test_clean_moviename_working\n @test = CinePassion.new\n \n assert_equal(@test.CleanMovieName(\"Home.DVDRip\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.LiMiTED\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.REPACK\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.720p\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.FRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.UNRATED\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.iNTERNAL\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.TRUEFRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.DVDRip.LiMiTED.REPACK.720p.FRENCH.UNRATED.iNTERNAL.TRUEFRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.TRUEFRENCH.iNTERNAL.UNRATED.FRENCH.720p.REPACK.LiMiTED.DVDRip\"), \"Home\")\n end",
"def clean_up\n puts \"Run the following commands to clean up your test data:\"\n puts \"oc delete pv --all\"\n puts \"oc delete pvc --all\"\n puts \"Deleting temporary test files\"\n `rm -rf #{$templates_path}/*`\nend",
"def alter_description(description, additions, subtractions)\n new_description = description\n additions.each do |addition|\n stylized_weights = addition.weights&.join('->')\n if stylized_weights == '' || stylized_weights.nil?\n stylized_weights = 'body weight'\n end\n\n # This will look off for things I do 1 set or rep of,\n # but I'm ok with that - it makes eventually parsing\n # a dump of my data from Strava in the future easier.\n new_description << <<~EOF\n #{addition.exercise}: #{addition.num_sets} sets of #{addition.num_reps} reps at #{stylized_weights} lbs\n EOF\n end\n subtractions.each do |subtraction|\n new_description_array = new_description.split(\"\\n\").reject do |line|\n line.index(subtraction) == 0\n end\n new_description = new_description_array.join(\"\\n\")\n end\n\n new_description\nend",
"def test_parsing\n assert_raises( SugarException ) {\n sugar = Sugar.new()\n sugar.sequence = INVALID_SEQUENCE\n }\n assert_nothing_raised {\n sugar = Sugar.new()\n\t\t\tsugar.extend( Sugar::IO::CondensedIupac::Builder )\n sugar.sequence = IUPAC_DISACCHARIDE\n }\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def test_shouting_with_no_exclamation_mark\n remark = 'I HATE YOU' # => \"I HATE YOU\"\n assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark) # => true\n end",
"def test_namae\n err = assert_compile 'namae.y'\n assert_no_warnings err\n assert_parser_unchanged 'namae.y'\n end",
"def scrubbed\n end",
"def example_tag(text); end",
"def shared_examples_for_keywords\n spec_keywords('shared_examples_for')\n end",
"def clean_yard(yard)\n # write code here \nend",
"def standard_specs; end",
"def my_array_deletion_method!(source, thing_to_delete)\r\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\r\nend",
"def _test_2\n dotest(\n TestCase45a2,\n \"\"\"\n.0 - 1\n.1 - 2\ndone.\n \"\"\".strip)\n end",
"def pre_process(expectations, source)\n\t\tsource\n\tend",
"def testNormalWithUnknownContent\n initTestCase do\n $Context[:WikiContent] = \"UnknownContent - Line 1\\nUnknownContent - Line 2\"\n $Context[:NewWikiContentRegExp] =\n Regexp.escape('* <code><small>[') +\n '....-..-.. ..:..:..' +\n Regexp.escape(\"]</small></code> - Commit DummyCommitID by DummyCommitUser: DummyCommitComment\\nUnknownContent - Line 1\\nUnknownContent - Line 2\")\n execTest(\n 'DummyUserID',\n [\n 'BranchName',\n 'DummyCommitID',\n 'DummyCommitUser',\n 'DummyCommitComment'\n ]\n )\n end\n end",
"def remove_spec(full_name); end",
"def descrips_match(expected, descrips)\n begin\n expected.zip(descrips).collect {\n |x, y| (x == :anything || x == y) }.inject(true) {\n |x, y| x && y }\n rescue TypeError => te\n puts \"TypeError: #{te}\"\n end\n end",
"def fix_common_typos!\n # well, I don't know what kind of typos people do!\n @pattern.squish!\n end",
"def test_base_whitespace\n assert_equal 'white space.jpg',\n tested('\"white space.jpg\"').source_names.first\n end",
"def test_parsing_siblings_source_and_result\n to_parse = %q{@html {@body { }@content { }}}.chomp\n assert_source to_parse, %q{_src='';_src.concat('<html>');_src.concat('<body>');_src.concat('</body>');_src.concat('<content>');_src.concat('</content>');_src.concat('</html>');_src;}.chomp\n assert_result to_parse, \"<html><body></body><content></content></html>\"\n end",
"def test_feed_title2_sanitize\n##\n# todo:\n## strip all tags from title2\n## limit to 255 chars\n## e.g. title2 such as this exist\n\n title2_in = %Q{This is a low-traffic announce-only list for people interested in hearing news about Polymer (<a href=\"http://polymer-project.org\">http://polymer-project.org</a>). The higher-traffic mailing list for all kinds of discussion is <a href=\"https://groups.google.com/group/polymer-dev\">https://groups.google.com/group/polymer-dev</a>}\n title2_out = %Q{This is a low-traffic announce-only list for people interested in hearing news about Polymer (http://polymer-project.org). The higher-traffic mailing list for all kinds of discussion is https://groups.google.com/group/polymer-dev}\n\n assert_equal title2_out, strip_tags( title2_in )\n assert_equal 229, strip_tags( title2_in )[0...255].length\n end",
"def specs_with_shared_example(shared_example, path)\n command = \"grep -lrE 'it_should_behave_like .(#{shared_example}).' #{path}\"\n `#{command}`.split\n end",
"def charm_failure\n slowly do\n\"\"\"\nDuncan barks, wags his tail, rolls over, does all his awesome tricks...\n\nBut the troll just looks on in disdain. \n\n'Go home, little dog, before I sqquish you.' \n\"\"\"\n end\n what_next\n end",
"def extract_title(test_case)\n requirements_tags = all_tags(test_case).select{|tag| tag.name =~ /req_\\w+/}.map{|tag| /req_(\\w+)/.match(tag.name)[1]}.join(', ')\n if test_case.source.last.is_a?(Cucumber::Core::Ast::ExamplesTable::Row)\n title = test_case.source.select{|s| s.is_a?(Cucumber::Core::Ast::ScenarioOutline)}.first.name\n if ENV['OLD_STYLE_OUTLINE_NAMES'] \n title += ' :: ' + test_case.source.last.send(:data).map{|key,value| \"#{key}='#{value}'\"}.join(', ')\n else\n title += \" \" + test_case.source.last.send(:data).map{|key,value| \"#{key}=#{value}\"}.join(', ')\n end\n else\n title = test_case.source.last.name\n end\n [requirements_tags,title].compact.join(' ').strip\n end",
"def test_normalization_data\n skip if jruby?\n failures = []\n\n normalization_file = File.join(File.dirname(__FILE__), \"NormalizationTest.txt\")\n File.open(normalization_file, \"r\") do |file|\n file.each_line do |line|\n # Skip line if it's only a comment or header\n next if line =~ /^(?:\\#|\\@)/\n\n # Determine where the comment portion of the line starts, and split.\n split_point = line.index(\" # \")\n tests = line[0..split_point]\n comment = line[(split_point + 3)..-1]\n\n # Break comment portion into listed chars and description\n desc_chars, description = comment.split(/(?<=[\\)])\\s/)\n\n # Trim/split description characters and remove illustrative circles.\n desc_chars = desc_chars.gsub!(/^\\(|\\u{25CC}|\\)$/, \"\").split(/;\\s/)\n\n # Unescape test sequences into unicode characters.\n tests = tests.split(/;\\s?/).map! do |test|\n test.gsub!(/([\\h]{4,6}\\s?)+/) do |m|\n eval(%(\"\\\\u{#{m}}\")) # rubocop:disable Eval\n end\n end\n\n # Be verbose maybe.\n tputs([description, desc_chars.inspect], STDERR) if $DEBUG\n\n # Ensure unescaped characters match description characters\n assert_equal tests, desc_chars\n\n tries = [::UTF8Proc.NFC(tests[0]), ::UTF8Proc.NFD(tests[0]),\n ::UTF8Proc.NFKC(tests[0]), ::UTF8Proc.NFKD(tests[0])]\n\n failures << \"#{tries.inspect} != #{tests[1..-1]}\" if tries != tests[1..-1]\n end\n end\n failures.each { |f| STDERR.puts \"Failure: #{f}\" } if $DEBUG\n\n assert_empty failures\n end",
"def add_example(types, example, ex_num, format)\n # Skip example if it is JSON only\n return if example =~ /This example is JSON only/m\n name = nil\n if types.start_with?('#')\n # In some cases, a more specific name is used.\n name, types = types.split(/\\s+/, 2)\n name = name[1..-1] # Remove initial '#'\n end\n types = types.split(/,\\s*/)\n name ||= \"#{types.join('-')}-#{ex_num}\"\n\n # Write example out for reading later\n path = \"schema.org/#{name}-#{format}.html\"\n File.open(File.expand_path(\"../../../../#{path}\", __FILE__), \"w\") {|f| f.write(example)}\n\n types.each do |t|\n next unless @classes.has_key?(t)\n \n @classes[t][:examples] ||= {}\n @classes[t][:examples][name] ||= {}\n @classes[t][:examples][name][format] = path\n end\n\n end",
"def get_adjective\n\t\t[\"pretty\", \"ugly\", \"hideous\"].sample\n\tend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def stest_method_1(test); end",
"def test_complex_pronouns\n assert_equal('yes, I rule', WordPlay.switch_pronouns('yes, you rule'))\n assert_equal('Am I stupid?', WordPlay.switch_pronouns('are u stupid?'))\n assert_equal('why do i cry?', WordPlay.switch_pronouns('why do you cry?'))\n end",
"def testNormalTrackWithAliasList\n execute_Mix_WithConf({\n :Recordings => {\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :Alias => [ 'Track 1', 'Track 2' ]\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Track 2' => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1, :Cleaned_Env1_1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '02_Clean/Record/Env1.1.04.NoiseGate', '05_Mix/Final/Final.wav'\n end\n end"
] |
[
"0.6309135",
"0.5955377",
"0.5943286",
"0.59292436",
"0.5867937",
"0.57253605",
"0.5625203",
"0.56016016",
"0.5600385",
"0.5575843",
"0.5571277",
"0.5522046",
"0.5470743",
"0.5470743",
"0.54483247",
"0.54189974",
"0.5412778",
"0.5412643",
"0.5398807",
"0.53766084",
"0.5362165",
"0.5360276",
"0.5303997",
"0.5249858",
"0.52167785",
"0.5197065",
"0.51907563",
"0.5175478",
"0.51374215",
"0.5125093",
"0.5119906",
"0.5107513",
"0.50762314",
"0.50762314",
"0.5073293",
"0.5070142",
"0.5066848",
"0.5063351",
"0.5055078",
"0.5050204",
"0.50487864",
"0.50391906",
"0.5038082",
"0.5033228",
"0.50273955",
"0.50217354",
"0.50192904",
"0.49738985",
"0.49680242",
"0.4965577",
"0.4958099",
"0.49541083",
"0.4953992",
"0.49497333",
"0.49417844",
"0.49413761",
"0.49380258",
"0.49350196",
"0.49337286",
"0.49291727",
"0.49141738",
"0.4912792",
"0.49075",
"0.48895517",
"0.48889056",
"0.48852977",
"0.48842594",
"0.48841742",
"0.48825935",
"0.48788533",
"0.48775646",
"0.48742762",
"0.48734412",
"0.48731065",
"0.48701432",
"0.48647442",
"0.4847755",
"0.48439768",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48427153",
"0.48417184",
"0.4840782",
"0.4839225"
] |
0.0
|
-1
|
=========== Refund money from transaction==============
|
def create_issue_refund
@error = ""
if params[:refund_amount].present?
if params[:refund_amount].to_d > 0.0 && params[:refund_amount].to_d <= @trans.amount
@refund_trans = Transaction.new(
amount: params[:refund_amount].to_d,
transaction_type: "Payment",
status: "Refunded",
from_account_id: current_user.account.id,
to_account_id: @trans.from_account.id,
transaction_from: "User",
transaction_to: "User",
kaenko_currency_id: @trans.kaenko_currency_id,
status: "Completed" ,
user_id: current_user.id,
transaction_from_id: current_user.id,
transaction_to_id: @trans.transaction_from_id,
parent_id: @trans.id
)
Transaction.transaction do
if @refund_trans.save
@account_balance = current_user.account.account_balances.where(
"kaenko_currency_id = ?",
@trans.kaenko_currency_id
).first
@account_balance.update_attributes(balance: @account_balance.balance - params[:refund_amount].to_d)
@trans.update_attributes(status: "Refunded")
end
end
else
@error = "Please enter valid amount."
end
else
@error = "Please enter amount."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def refund(money, authorization ,options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:refund, post)\n end",
"def refund(money, authorization, options = {})\n post = {}\n add_order_id(post, order_id_from(authorization))\n add_amount(post, money, options)\n\n commit('Credit', post, options)\n end",
"def refund(money, identification, options = {})\n parameters = extract_authorization(identification, {})\n\n commit('REFUND', money, parameters)\n end",
"def transfer_funds()\n vendor = Portfolio.find(self.seller_id)\n customer = Portfolio.find(self.buyer_id)\n amount = self.transaction_cost\n customer.balance -= amount\n vendor.balance += amount\n \n Transactor.transaction do \n raise \"Transaction of funds failed!\" unless customer.save && vendor.save\n end\n end",
"def refund(money, identification, options = {})\n requires!(options, :card_number)\n\n post = { trans_id: identification,\n card_num: options[:card_number] }\n\n post[:first_name] = options[:first_name] if options[:first_name]\n post[:last_name] = options[:last_name] if options[:last_name]\n post[:zip] = options[:zip] if options[:zip]\n\n add_invoice(post, options)\n add_duplicate_window(post)\n\n commit('CREDIT', money, post)\n end",
"def refund(refund); end",
"def refund!(amnt = nil)\n RefundRepository.new(api).create(token, amnt)\n end",
"def withdraw!(amount)\n amount = -amount if amount > 0\n add_transaction(amount)\n\n balance\n end",
"def withdraw(amount)\n @balance = @balance - amount\n end",
"def withdraw(amount)\n @balance -= amount\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def amount_refunded\n amt = Money.new(0)\n transactions.each do |t|\n if t.transaction_type == \"refund\" && t.status != \"voided\"\n amt += t.money_amount\n end\n end\n return amt\n end",
"def payment(amount)\n @balance -= amount\n end",
"def deposit(amount, *args)\n do_transaction :deposit, amount, *args\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end",
"def refund(amount, trans_id = nil)\n params = {\n :command => :r,\n :trans_id => trans_id,\n :amount => amount\n }\n requires!(params, :command, :trans_id, :amount)\n commit(params)\n end",
"def withdraw(amount)\n @balance -= amount\n end",
"def refund(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('refund', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def refund transaction\n transaction = Transaction.new transaction\n order_id = transaction.order_id.to_i\n transaction_id = transaction.transaction_id\n transaction_params = ActiveSupport::OrderedHash.new\n transaction_params['amount'] = transaction.amount.to_s\n transaction_params['currency'] = transaction.currency\n transaction_params['reference'] = transaction.reference.to_s\n params = ActiveSupport::OrderedHash.new\n params['apiOperation'] = 'REFUND'\n params['transaction'] = transaction_params\n\n request :put, \"/merchant/#{merchant_id}/order/#{order_id}/transaction/#{transaction_id}\", params\n end",
"def refund_amount\n\t\ttotal = 0\n\n\t\t#Check for special refund entitlement\n\t\tself.payments.each do |p|\n\t\t\tif p.created_at <= self.course.refund_enrollments_before\n\t\t\t\t#Give full refund\n\t\t\t\ttotal = total_paid\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\t#At a minimum, refund the total paid in excess of the deposit\n\t\tif total == 0\n\t\t\ttotal = total_paid - self.course.deposit\n\t\tend\n\n\t\treturn total - total_refunded\n\tend",
"def refund(money, authorization, options={})\n execute_dependant(:refund, money, authorization, options)\n end",
"def refund(money, reference, options = {})\n standard_response\n end",
"def deposit(cash)\n @balance += cash\n end",
"def deposit(amount)\n @balance += amount\n @balance\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def direct_debit()\n @amount -= 50 if @type == \"personal\"\n @amount -= 100 if @type == \"business\"\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(money_to_deposit)\n @balance += money_to_deposit\n end",
"def withdrawal(t)\n if (@balance - t.amount) < 0\n #print error message\n puts \"#{t.date} Overdraft: Unable to complete transaction to #{t.payee} for #{t.amount}\"\n\n else\n @balance = @balance - t.amount\n t.currBalance = @balance\n @ledger << t\n\n end\n end",
"def refund!\n if charged && !canceled\n transaction = Stripe::Charge.retrieve(trans_id)\n if transaction.refund\n update updated: true, canceled: true\n else\n raise result.errors\n end\n end\n end",
"def refund_amount\n\t\treturn 0 unless get_cart_pending_balance < 0\n\t\treturn get_cart_pending_balance\n\tend",
"def withdraw(amount_to_withdraw)\n @balance -= amount_to_withdraw\n end",
"def deposit(amount)\n @balance = @balance + amount\n end",
"def refund(money, card, transaction_id, options = {})\n if options[:refund_all].present?\n transaction { refund_all(transaction_id) }\n else\n transaction do\n refund_amount cent_amount: money,\n currency: options[:originator].payment.currency,\n transaction_id: transaction_id,\n reason: options[:originator].reason.name\n end\n end\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end",
"def deposit(t)\n\n @balance += t.amount\n t.currBalance = @balance\n @ledger << t\n\n end",
"def deposit\n end",
"def deposit\n end",
"def deposit(amount)\n if (balance < 10000) && (balance + amount >= 10000)\n @balance += amount\n else\n @balance += amount\n @transactions -= 1\n end\n end",
"def do \n validate\n ZipMoney.api.refund(@params)\n end",
"def charge_renter(rental)\n # make debit operation on balanced\n balanced.debit(rental)\n\n # account it on subledger\n subledger.debit(rental)\n end",
"def refund( trans_id, amount_in_cents )\n resp = client.refund(\n token: payment.token,\n trans_id: trans_id,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.refunds.create!(\n amount_in_cents: amount_in_cents,\n description: \"Refund value\",\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise RefundFailure.new( ex.response )\n end",
"def deposit(amount)\n \n #return if amount_is_not_valid(amount)\n ActiveRecord::Base.transaction do\n #note: need to use self or Account as a prefix when using balance, since it is not a variable or anythign defined in tis class\n self.update!(balance: self.balance + amount)\n end \n end",
"def withdraw(amount, *args)\n do_transaction :withdrawal, amount, *args\n end",
"def deposit(money)\n @balance += money\nend",
"def cancel!\n if AccountTransaction.transfer(self.num * self.price, self.startup.account, self.startup.account, :escrow, :balance).new_record?\n self.errors.add(:num, 'could not be refunded to your startup\\'s balance') \n return false\n end\n if self.responses.count > 0\n self.num = 0\n self.save\n else\n self.destroy\n end\n end",
"def deposit(amount)\n deposit_account = Account.find_by(account_type: :deposit)\n raise 'No deposit account, has the db been seeded?' if\n deposit_account.nil?\n\n create_transfer('deposit', amount, deposit_account, self)\n end",
"def create_financial_transaction_refund_deposit\n if self.sum_deposit_available_for_refund > 0\n financial_transaction = {\n transaction_type: 'payin_refund',\n purpose: 'deposit',\n amount: self.sum_deposit_available_for_refund,\n fees: 0,\n src_type: :src_payin_vid,\n src_vid: self.financial_transactions.payin.finished.take.transaction_vid\n }\n t = self.financial_transactions.create( financial_transaction )\n\n # FIXME(RA): should be triggered from a job:\n t.process!\n else\n LOG.error \"Not possible to refund a negative value.\"\n end\n end",
"def deposit(money)\n self.balance = (self.balance + money)\n end",
"def refund!\n response = credit_card.credit!(total_amount_in_cents, payment.authorization)\n self.response = response\n self.description = response.message\n self.authorization = response.authorization\n if response.success?\n invoice.update_attribute(:status, \"closed\")\n self.status = \"cleared\"\n self.save!\n return true\n else\n self.status = \"failed\"\n for item in self.line_items\n item.amount = 0\n end\n self.save!\n return false\n end\n end",
"def overdraft_fee\n @balance -= 30 \n end",
"def withdraw_funds\n @account = Account.find(params[:withdrawAccountKey])\n @account.balance = @account.balance - params[:withdrawAmountKey].to_f\n @account.save\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n\t@transaction.amount = @transaction.amount.abs\t\n\n\tif !@transaction.accounts_id.nil?\n\t\tif @transaction.transaction_type.name == 'Expense'\n\t\t\t@transaction.account.balance = @transaction.account.balance + @transaction.amount\n\t\telse if @transaction.transaction_type.name == 'Deposit'\n\t\t\t@transaction.account.balance = @transaction.account.balance - @transaction.amount\n\t\t\tend\n\t\tend\n\t\t@transaction.account.save\n\tend\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to(transactions_url) }\n format.xml { head :ok }\n end\n end",
"def cancel_refund\n price - price * cancel_factor\n end",
"def deposit(amount)\n amount = amount.abs\n @balance = @balance + amount\n one_transaction\n return @balance\n end",
"def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end",
"def update_tran\n self.tran.update_attributes(date: self.date)\n\n if self.account_trans.count == 1\n tran_amount = self.discrepancies ? self.amount - self.discrepancies : self.amount\n tran_amount *= -1\n self.account_trans.first.update_attributes(date: self.date, amount: tran_amount)\n\n self.create_discrepancies\n else\n tran_amount = self.discrepancies ? self.amount - self.discrepancies : self.amount\n tran_amount *= -1\n self.account_trans.first.update_attributes(date: self.date, amount: tran_amount)\n if self.discrepancies\n self.account_trans.second.update_attributes(date: self.date, amount: self.discrepancies)\n else\n self.account_trans.second.destroy\n end\n end\n end",
"def deposit(amt)\n @bank_acct += amt\n puts \"Your balance is #{@bank_acct}.\"\n end",
"def void_last_transaction\n @total -= @prices #subtract prices from the total price\n end",
"def deduct(amount)\n @balance -= amount\n end",
"def despositing_adds_transaction_to_bank_statement\n account = BankAccount.new\n account.deposit('10-01-2012', 1000)\n p account\n p account.bank_statement\nend",
"def refund(money, identification, options = {})\n form = {}\n add_txn_id(form, identification)\n add_test_mode(form, options)\n commit(:refund, money, form)\n end",
"def remove_money(amount)\n @wallet -= amount\nend",
"def revoke\r\n @fund -= 15\r\n puts \"Project #{@name} pissed someone off, and they revoked their donation.\"\r\nend",
"def deposit(name, amount)\n find_account(name)[:balance] += amount\n end",
"def withdraw acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money -(amount)\n\n\t\t\tadjust acct, amount\n\t\tend",
"def deposit!(amount)\n raise NegativeDepositError if amount < 0\n add_transaction(amount)\n\n balance\n end",
"def refund_backers!\n self.class.transaction do\n Transaction.build do |tr|\n tr.description = \"Refund Fundraiser(#{id}) #{pledges_count} Pledges - Total Pledges: $#{total_pledged} Account Balance: $#{account_balance}\"\n\n # remove all money from the fundraiser account\n tr.splits.create(amount: -account_balance, item: self)\n\n # for each pledge, add a split adding money to person accounts\n pledges.find_each do |pledge|\n # get the amount to refund (pledge split where account is this fundraiser)\n if (split = pledge.splits.find_by_account_id(account.id))\n tr.splits.create(amount: split.amount, item: pledge.person)\n end\n end\n end\n end\n end",
"def refund_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"REFUND\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def refund_order\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n order = Commit.find(params[:order_id])\n charge = Stripe::Charge.retrieve(order.sale.stripe_charge_id, :stripe_account => order.product.wholesaler.stripe_id)\n begin\n refund = charge.refunds.create(:amount => charge.amount, :refund_application_fee => true)\n rescue => e\n return render :json => {\n success: false,\n error: e.message\n }\n end\n if !refund.nil?\n order.refunded = true\n order.sale_made = false\n product_sales = order.product.current_sales.to_f\n new_sales = order.full_price ? product_sales+order.amount.to_f*order.product.price.to_f : product_sales+order.amount.to_f*order.product.discount.to_f\n order.product.current_sales = new_sales\n order.save(validate: false)\n return render :json => {\n success: true,\n order: order,\n charge: charge,\n refund: refund\n }\n end\n end",
"def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end",
"def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end",
"def deshacer\n entidad.deposit monto, operadora\n end",
"def give_back_money\n if(@transaction.sender)\n @transaction.sender.balance += @transaction.amount\n @transaction.sender.save\n \n end\n\n if(@transaction.receiver)\n @transaction.receiver.balance -= Monetize.parse(convert(Money.new(@transaction.amount,findCurrency(@transaction.sender_id,@transaction.receiver_id,'sent')), @transaction.receiver.currency)).fractional\n @transaction.receiver.save\n end\n end",
"def transfer_funds_to(amount, target)\n self.balance -= amount\n target.balance += amount\n Account.transaction do\n raise \"Transaction Failed\" unless self.save && target.save && self.balance >0\n end\n end",
"def deposit(amount)\n @balance += amount\n return @balance\n end",
"def deduct\n @balance -= @journey_log.fare\n end",
"def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end",
"def void_last_transaction\n @total = @total - @last_transaction_amt\n end",
"def debit(amount)\n self.balance -= amount\n end",
"def credit(amount)\n\t\t@revenue += amount\n\tend",
"def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end",
"def restaure\n montant = self.amount\n\n # je mets a jour le solde du client\n account = Await.find(self.id).customer.account\n customer = Await.find(self.id).customer\n if account.blank?\n\n puts \"Aucun utilisateur ne correspond a cette intention de retrait\"\n Raise ActiveRecord::RecordNotFound \"Pas de compte trouvé\"\n\n else\n\n if account.update(amount: account.amount + montant.to_f)\n puts \"Customer Updated\"\n else\n puts \"Une erreur est survenu\"\n end\n\n end\n \n end",
"def withdraw(name, amount)\n a = find_account(name)\n a[:balance] < amount ? a[:balance] -= 30 : a[:balance] -= amount\n end",
"def stripe_refund\n return unless charge_id.present?\n Reservation.transaction do\n charge = Stripe::Charge.retrieve(charge_id)\n charge.refunds.create(amount: charge.amount, reverse_transfer: true)\n update_attributes(refunded: true, is_paid: false, billing_phase: :not_billed, charge_id: nil)\n end\n rescue Exception => e\n custom_params = { reservation_id: id, charge_id: charge_id, amount: charge.amount }\n Rollbar.error(e, 'Stripe refund failed', custom_params)\n end",
"def handle_refund\n if saved_change_to_state == %w(purchased refunded)\n refund = self.build_refund({\n payment_id: payment_id,\n state: :pending,\n })\n refund.save!\n seller.decrease_balance(payment.amount)\n end \n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def credit(money, authorization, options={})\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, authorization, options)\n end",
"def withdraw(amount)\n raise ArgumentError.new \"You have run out of transactions\" if @transactions == 0\n if balance < 10000\n puts \"You cannot make any more transactions until you are over $10,000\"\n elsif balance - amount < 10000\n amount += 100\n @balance -= amount\n @transactions -= 1\n else\n @balance -= amount\n @transactions -= 1\n end\n end",
"def update\n orig = CardTransaction.find(params[:id])\n debug 'orig loaded'\n trans = orig.clone\n debug 'orig cloned'\n trans.amount = params[:card_transaction][:amount]\n trans.save\n debug 'trans saved'\n debug \"transaction: #{trans.inspect}\"\n stat = do_refund(orig, trans)\n debug stat.inspect\n if transaction['respstat'] == 'A' && trans.receiptData?\n redirect_to payment_receipt_url(trans.id)\n else\n redirect_to payments_url # the list of payments\n end\n rescue\n redirect_to payments_url # the list of payments\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def deposit(amount)\n @balance += amount\n puts \"Deposit #{amount}. New Balance: $#{@balance}\"\n returned\n end",
"def update_purchase_balance\n update(balance: financial_transactions.sum(:total_amount))\n end",
"def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end",
"def withdraw(amount)\n withdrawal_account = Account.find_by(account_type: 'withdrawal')\n raise 'No withdrawal account, has the db been seeded?' if\n withdrawal_account.nil?\n\n create_transfer('withdrawal', amount, self, withdrawal_account)\n end"
] |
[
"0.7117888",
"0.6953859",
"0.6891258",
"0.689027",
"0.6822686",
"0.6806595",
"0.67969036",
"0.67913246",
"0.6771533",
"0.6748782",
"0.6731747",
"0.6705402",
"0.6687968",
"0.6677174",
"0.66758776",
"0.6673207",
"0.66716194",
"0.66571033",
"0.66395646",
"0.65961367",
"0.6594139",
"0.65692085",
"0.6552088",
"0.6550616",
"0.6546817",
"0.6546817",
"0.6546173",
"0.65460527",
"0.65372944",
"0.6535147",
"0.6535096",
"0.65332663",
"0.65184885",
"0.651581",
"0.65034753",
"0.6497346",
"0.6497346",
"0.6497346",
"0.6496671",
"0.6473318",
"0.64697444",
"0.6468576",
"0.6468576",
"0.6456782",
"0.6446227",
"0.64369667",
"0.6436068",
"0.64359367",
"0.6416784",
"0.64012057",
"0.6392715",
"0.6390976",
"0.63824105",
"0.63776773",
"0.63692504",
"0.63651574",
"0.6362702",
"0.6354116",
"0.6351207",
"0.6333783",
"0.63187057",
"0.63177824",
"0.63144046",
"0.63063127",
"0.6306013",
"0.6305685",
"0.6304251",
"0.6301369",
"0.62853605",
"0.62836325",
"0.6273875",
"0.6272253",
"0.6269013",
"0.6264842",
"0.6263389",
"0.62475395",
"0.62475395",
"0.6246731",
"0.6245495",
"0.6241657",
"0.6235921",
"0.6235614",
"0.6225452",
"0.62228125",
"0.6219858",
"0.6218214",
"0.6205568",
"0.6205033",
"0.6203126",
"0.62000144",
"0.61938965",
"0.6186861",
"0.61845934",
"0.6182624",
"0.61800754",
"0.61727685",
"0.6171334",
"0.61691445",
"0.6165637",
"0.61577564"
] |
0.64714897
|
40
|
extract french and other addresses
|
def extract_destinations
destinations = @tiers.mails.group_by { |dest| dest.split('.').last == 'fr' }
@french = destinations[true]
@other = destinations[false]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def full_address\n part_1 = address\n part_2 = [zip_code, city].reject(&:blank?).join(' ')\n part_3 = \"France\"\n [part_1, part_2, part_3].reject(&:blank?).join(', ')\n end",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def decompose_address(parts)\n addresses = parts || []\n address, city, zip, country_code = nil, nil, nil, nil\n\n if !addresses.empty?\n address = addresses[0] if addresses[0]\n zip, city = addresses[1].split(\" \", 2) if addresses[1]\n country_code = addresses[2] if addresses[2]\n end\n\n [address, city, zip, country_code]\n end",
"def ship_to_address\n all = {}\n for key_out in [:city, :last_name, :first_name, :country, :zip, :address]\n all[key_out] = unescape params['x_ship_to_' + key_out.to_s]\n end\n \n all\n end",
"def full_address\n [self.address, \"Madrid\", \"Spain\"].compact.join(\", \") if self.address\n end",
"def addresses\n format_entities('gd$structuredPostalAddress', :format_address)\n end",
"def full_hq_address\n part_1 = hq_address\n part_2 = [hq_zip_code, hq_city].reject(&:blank?).join(' ')\n part_3 = hq_country.present? ? hq_country : \"France\"\n [part_1, part_2, part_3].reject(&:blank?).join(', ')\n end",
"def address_form(address_parts)\n businessAddress = []\n address_parts.each do |part|\n part = part.text.strip\n if !part.blank?\n businessAddress << part\n end\n end\n\n businessAddress.join(\", \")\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def full_street_address #Take all location fields, remove nil elements with .compact, then return a string for Geocoder\n [address_1, address_2, city, country, z_post_code].compact.join(', ')\n end",
"def full_address\n [landmark_name, city, country].compact.join(', ')\n end",
"def afficeur\n @city_link.map do |element|\n villes = get_city_names(element)\n email = get_townhall_email(element)\n @result = []\n @result << {villes => email}\n end\n end",
"def get_townhall_email(townhall_url)\n\tpage = Nokogiri::HTML(open(townhall_url)) \n\temail_array = []\n\n\temail = page.xpath('//*[contains(text(), \"@\")]').text\n town = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split \n# On divise la string pour pouvoir récupérer uniquement le nom de la ville\n\n email_array << {town[3] => email} \n# On indique la position du nom de la ville dans la string pour la récupérer\n\tputs email_array\n\treturn email_array\nend",
"def parse_phonefax(table_cells)\n type = [\"Phone\\:\", \"Fax\\:\"]\n complete_data = {}\n type.each do |data|\n table_cells.each_with_index do |cell, index|\n if cell.children.to_s.match(data)\n table_cells_match = table_cells[index+1].children[1]\n if cell.children.to_s.match(\"Hablamos Español\")\n complete_data.merge! ({ data.to_s.strip.gsub(/\\n/, '').gsub(/\\t/, '').to_sym => table_cells_match.children[0].to_s.gsub(/\\n/, '').gsub(/\\t/, '') + \"Hablamos Español. Landlord can accept Spanish-language phone calls.\"})\n else\n complete_data.merge! ({ data.to_s.strip.gsub(/\\n/, '').gsub(/\\t/, '').to_sym => table_cells_match.children[0].to_s.gsub(/\\n/, '').gsub(/\\t/, '')})\n end\n end\n end\nend\n complete_data\nend",
"def parse_recipients(addresses)\n list_addresses = addresses.gsub(/[\\r\\n]+/, '').gsub(/(@((?:[-a-z0-9]+\\.)+[a-z]{2,})(\\>)?)\\,/i, '\\1'+\"\\n\")\n list_addresses.split(\"\\n\").map{|full_address|\n {'name' => extract_name(full_address), 'email' => extract_email_address(full_address)}\n }\n end",
"def get_email (ville_names)\n\n # Loop on each cities in the array to get the email\n for n in 0...ville_names.length\n\n # get each link to the depute\n page_url_ville = \"https://www.annuaire-des-mairies.com/95/#{ville_names[n]}.html\"\n\n ville_page = Nokogiri::HTML(open(page_url_ville))\n\n # If any bug when trying to get any email\n begin\n\n # Put each email in an array \"ville_email_array\"\n @ville_email_array << ville_page.xpath(\"//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()\").to_s\n rescue => e\n\n @ville_email_array << \" \"\n end\n end\n\n # This value as to be returned.\n # If not this not show email in the json file for the function save_as_json\n return @ville_email_array\n end",
"def print_addresses\n puts \"Dirección\"\n addresses.each { |address| puts address.to_s('corta') }\n end",
"def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end",
"def extract_locale_from_ip(only_available_locales = false)\n parsed_locale = filter_locale(self.ip_info(:country_code), only_available_locales) rescue nil\n LocalE.log_result 'ip', request.remote_ip, parsed_locale, 'unknown ip location', 'locale'\n parsed_locale\n end",
"def full_address\n \"#{region}, #{district}, #{street_type} #{street_name}, д. #{house_number} кв. #{apartment}\"\n end",
"def address_full\n \"#{self.address.titleize}, Toronto, ON\"\n end",
"def lines\n address = format.apply(formatting_values)\n lines = address.split(\"\\n\").reject {|line| line.strip.empty? }\n lines << country_name.upcase\n end",
"def scrape_addresses (links)\n\temails = []\n\tlinks.each do |url|\n\tpage_url = \"http://annuaire-des-mairies.com/#{url}\"\n\tpage = Nokogiri::HTML(URI.open(page_url))\n\temails << page.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n\tend\n\treturn emails\nend",
"def normalize_address(address)\n normalize(address).split(' ').map { |word| StreetAbbrevs[word] || word }.join(' ')\n end",
"def mailing_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::CORRESPONDENCE)\n end",
"def test_19110_address_2\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[2]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(2)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end",
"def process_country_names(country)\n # country.map do |c|\n country.gsub!('&', 'and')\n country.gsub /\\s+/, '-'\n # end\n end",
"def full_address\n\t\t[\"#{self.street}\", self.city, self.country].compact.join(', ')\n\tend",
"def townhall_and_email(html)\n \n contact = get_townhall_city(html).zip(get_townhall_email(html)).map{ |x| [x].to_h}\n puts contact\n\n end",
"def address(format = :full)\n if state_code.to_s != \"\"\n s = \", #{state_code}\"\n elsif state.to_s != \"\"\n s = \", #{state}\"\n else\n s = \"\"\n end\n \"#{city}#{s} #{postal_code}, #{country}\".sub(/^[ ,]*/, '')\n end",
"def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end",
"def address_matches\n filtered_matches(ignore: [:first_name, :family_name], perfect: [:street, :city])\n end",
"def full_address\n [area, city, country].compact.join(', ')\n end",
"def address(input)\n\t(/[0-9]{4}(\\s|\\,){1}(.+?)(\\s|\\,){1}(?i)((str)|(street)|(ave)|(avenue)|(rd)|(road)|(blvd)|(boulevard))(\\.)?/i =~ input)? \"true\" : \"false\"\nend",
"def full_address\n [address, city, state, zipcode, country].compact.join(\", \")\n end",
"def get_countries\n doc = Nokogiri::HTML(open('https://www.britannica.com/topic/list-of-countries-1993160'))\n countries_extracted = doc.css(\"li a\").text.split('Britannica')[1].split(' geography')[0].rstrip\n @processed_countries = countries_extracted.split(/(?<!\\s)(?=[A-Z])/)\n end",
"def test_19110_address\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[1]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(1)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(1)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(1)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(1)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(1)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end",
"def full_address\r\n [street, city, state, zip_code].delete_if{ |content| content.blank? }.join(\", \")\r\n end",
"def full_address\n [ address, city, state, zipcode, country ].compact.join(', ')\n end",
"def parse_response\n @fields['address_components'].each do |field|\n parse_field(field)\n end\n define_address\n end",
"def full_address\n \"#{street_address}, #{city}, #{ISO3166::Country.new(country_code.upcase).name}\"\n end",
"def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend",
"def address\n [province_c, county_c, town_c].join(',')\n end",
"def get_sale_country(address)\n country = \"\"\n\n if address[\"c\"] != \"-\"\n country = address[\"c\"]\n elsif address[\"r\"] != \"-\"\n #if address[\"r\"] contains only numbers do not want\n country = get_country(address[\"r\"]) unless address[\"r\"] =~ /\\d+$/\n elsif address[\"l\"] != \"-\"\n country = get_country(address[\"l\"])\n end\n\n return country\n end",
"def address\n {\n street: @data[:ulica].to_s,\n number: @data.values_at(:nr_domu, :nr_lokalu).compact.join('/'),\n code: @data[:pna].to_s,\n town: @data[:miejscowosc].to_s\n }\n end",
"def get_townhall_email(townhall_url)\r\n page = get_page(townhall_url)\r\n email = page.xpath('//*[contains(text(), \"@\")]').text\r\n town_name = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split #nom de ville\r\n email_array_one_hash = [{town_name[3] => email}] #nom\r\n return email_array_one_hash\r\nend",
"def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end",
"def full_address\n\t\t\"#{street}, #{postal_code}, #{city}, #{country}\"\n\tend",
"def fs_contact_addresses_array\n pre_format = fscontact.blank? ? evaluator : fscontact\n return [] if pre_format.nil?\n\n pre_format.split(',').map do |a|\n (a =~ /@/ ) ? a : a + '@' + SCs[:standard_mail_domain]\n end\n end",
"def street_address\n search('.mapaddress').children.first.text.chop rescue nil\n end",
"def text_address\n [street, city, state].join(\" \")\n end",
"def secondary_address; end",
"def address\n [address1, city, state, country, zip].compact.join(', ')\n end",
"def address\n [city, state, country].compact.join(', ')\n end",
"def full_address\n address.presence || [street_number, routes, locality, administrative_area_level_1, country].compact.reject(&:blank?).join(', ')\n end",
"def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end",
"def address_detail\n \"#{province.try :name}#{city.try :name}#{district.try :name}#{address}\"\n end",
"def parse\n @lexemes = []\n\t@tokens = []\n\t@addresses = RMail::Address::List.new\n\t@errors = 0\n\tnew_address\n get\n address_list\n\treset_errors\n\t@addresses.delete_if { |a|\n\t !a.local || !a.domain\n\t}\n end",
"def address\n [country, state, city].compact.join(', ')\n end",
"def to_addresses\n emails = interest_addresses.concat(focus_addresses)\n if emails.empty?\n emails << 'info@unglobalcompact.org'\n end\n emails.uniq\n end",
"def parse_registered_office_address(address)\n return company if address.nil?\n\n @address_line1 = [address['po_box'], address['address_line_1']].compact.join(', ')\n @address_line2, @locality = ensure_we_have_locality(address['address_line_2'], address['locality'])\n @county = address['region']\n @postcode = address['postal_code']\n @country = 'GB'\n end",
"def gerund\n b = gerundive.sub( /.*\\s+(.*)um.*$/, \"\\\\1\" )\n b += \"ī, ō, etc.\"\n return b\n end",
"def addresses\n warn \"DEPRECATED: use postalAddress from a Person entry\"\n []\n end",
"def residential_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::RESIDENCE)\n end",
"def test_19110_address_3\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[3]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(3)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(3)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(3)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end",
"def address\n return \"\" unless [city, state, state_code].all?(&:present?)\n \"#{city}, #{state}(#{state_code})\"\n end",
"def full_address\n city.present? ? city_delim = city + \",\" : city_delim = city\n [address_1, address_2, city_delim, state, zip].reject(&:nil? || empty?).join(' ')\n end",
"def extract_postcode(address)\n postcode = \"\"\n if /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)\n postcode = /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)[0]\n end\nend",
"def address\n [street, city, state, country].compact.join(', ')\n end",
"def full_address\n \"#{address}, #{city}, #{state}, #{zip}\"\n end",
"def full_street_address\n [address, city, state, country].compact.join(', ')\n end",
"def get_deputes_name\n\n deputes_name_array = []\n # Régister URL of the needed website\n page_url_deputes = \"http://www2.assemblee-nationale.fr/deputes/liste/alphabetique\"\n\n depute_page = Nokogiri::HTML(open(page_url_deputes))\n\n # From the website, get an array of the city name, convert it to string, put in downcase and replace \" \" to \"-\" if any space\n return deputes_name_array = depute_page.xpath(\"//*[contains(@id, 'deputes-list')]/div/ul/li/a/text()\").map {|x| x.to_s }\nend",
"def addresses; end",
"def full_street_address\n postcode_only_address\n end",
"def get_addresses apts\n return apts.map { |apt| apt.address }\n end",
"def get_address(tds)\n clean_whitespace(tds[2].at('div').inner_text)\nend",
"def get_address(tds)\n clean_whitespace(tds[2].at('div').inner_text)\nend",
"def parse_address_text(text) \n #clear variables\n @errors = []\n @address_hash = {}\n \n @address_hash[:text_block] = text\n \n split_address_lines(text)\n \n #****************************DEBUG*********************************************************************\n # puts \"address_hash: #{@address_hash}\"\n # puts \"errors: #{@errors}\"\n #****************************DEBUG*********************************************************************\n \n return {address: @address_hash, errors: @errors}\nend",
"def captureurlmail #capture url des villes du 95\r\nurl2 = \"http://www.annuaire-des-mairies.com/val-d-oise.html\"\r\ndoc2 = Nokogiri::HTML(open(url2))\r\nadresse2 = doc2.css('.lientxt')\r\nnoms = []\r\nvilles = []\r\nemails = []\r\nadresse2.each do |link|\r\n\t#noms.push(url2 + (link['href'][1..-1]))\r\n\tp=\"http://www.annuaire-des-mairies.com\"\t\r\n\t#puts link['href'][1..-1]\r\n\tp+=link['href'][1..-1]\r\n\tnoms << p\r\n\tq=link['href'][1..-1]\r\n\tr=q.split('/')\r\n\ts=r[2]\r\n\tt=s.split('.')\t\t\r\n\tville=t[0]\r\n\tvilles << ville\t\r\nend\r\nnoms.each do |adresse|\r\n\tdoc3 = Nokogiri::HTML(open(adresse))\r\n\tadresse3 = doc3.css(\".txt-primary\")[3].text.split(\" \")[2]\r\n\tif ['@'].include?(adresse3) == true\r\n\t\temails << adresse3.to_s\r\n\telse\r\n\t\temails << nil\r\n\tend\r\n\t\r\nend\r\n\r\nHash[villes.zip(emails)].each do |ville,email|\r\n\tputs ville+\" => \"+email\r\n#my_hash=Hash[villes.zip(emails)]\r\n#return my_hash(ville_entree)\r\nend\r\nend",
"def parse_address_verification_response(xml)\n i = 0\n list_of_verified_addresses = []\n (Hpricot.parse(xml)/:address).each do |address|\n i+=1\n h = {}\n # Check if there was an error in an address element\n if address.search(\"error\") != []\n return \"Address number #{i} has the error '#{address.search(\"description\").inner_html}' please fix before continuing\"\n end\n if address.search(\"ReturnText\") != []\n h[:verified] = false\n else\n h[:verified] = true\n end\n address.children.each { |elem| h[elem.name.to_sym] = elem.inner_text unless elem.inner_text.blank? }\n list_of_verified_addresses << h\n end\n #Check if there was an error in the basic XML formating\n if list_of_verified_addresses == []\n error = Hpricot.parse(xml)/:error\n return error.search(\"description\").inner_html\n end\n return list_of_verified_addresses\n end",
"def parse(string)\n string.scan(ADDRESS_REGEXP).flatten\n end",
"def address\n\t [inst_add1, inst_add2, inst_city, inst_state, inst_zip].compact.join(\", \")\n\tend",
"def getaddresses(name)\n return [name] if ADDRESS_REGEX.match(name)\n @resolvers.each do |resolver|\n addresses = []\n resolver.each_address(name) { |address| addresses << address }\n return addresses unless addresses.empty?\n end\n []\n end",
"def get_townhall_email(townhalls_urls_and_cities)\n\n return nil if townhalls_urls_and_cities.nil? || townhalls_urls_and_cities.empty?\n # return nil if list_townhall_urls.nil? || list_townhall_urls.empty? || list_cities.empty? || list_cities.nil?\n\n # Pour une meilleur compréhension\n list_townhall_urls = townhalls_urls_and_cities[0]\n list_cities = townhalls_urls_and_cities[1]\n\n\n #2/Liste des emails--------------------je fais une recherche sur tout... qui contient du text et @ (email ;o)! ) \n list_townhall_email=Array.new\n\n list_townhall_email = list_townhall_urls.each{ |url_hall|\n\n # Lecture d'une page html url_hall (de la ville) pour chaque mairie\n Nokogiri::HTML(URI.open(url_hall)).xpath('//*[contains(text(), \"@\")]').text\n }\n \n # -=-=-=- Init d'un Array (tableau de hash, conformément au format demandé) -=-=-=-\n # -=-=-=- MISE EN FORME -=-=-=-\n townhall_and_email_tab = Array.new\n\n # for i in 0..cities.length-1 do \n (0..list_cities.length-1).each do | i |\n townhall_and_email_tab[i] = Hash.new\n townhall_and_email_tab[i][list_cities[i]] = list_townhall_email[i]\n end\n \n return townhall_and_email_tab\nend",
"def full_address(include_country = false, include_secondary = false)\n address = \"#{street_address(include_secondary)} #{postal_code} #{city}\"\n address = \"#{address} POLOGNE\" if include_country\n address\n end",
"def buildAddress(addrRaw)\n # Check if first address row contains P O Box substring\n isPoB = addrRaw['s'].include? \"P O Box\"\n location = Array.new\n\n fullLoc = (addrRaw['s'] == \"-\" || isPoB) ? \"\" : \"#{addrRaw['s']}, \"\n partialLoc = (addrRaw['s2'] == \"-\") ? \"\" : \"#{addrRaw['s2']},\" \n partialLoc += (addrRaw['l'] == \"-\") ? \"\" : \"#{addrRaw['l']}, \" \n partialLoc += (addrRaw['r'] == \"-\") ? \"\" : \"#{addrRaw['r']}, \" \n partialLoc += (addrRaw['z'] == \"-\") ? \"\" : \"#{addrRaw['z']}, \" \n partialLoc += (addrRaw['c'] == \"-\") ? \"\" : \"#{addrRaw['c']}\"\n\n fullLoc += partialLoc\n\n # If address does not contain an 'AU', it is added to the end of the address\n if fullLoc != \"\"\n if fullLoc.exclude? \"AU\"\n # Set fullLoc as well as partialLoc in case all address was contained in the first line\n fullLoc += \", AU\"\n partialLoc += \", AU\"\n end\n end\n \n location[0] = fullLoc\n location[1] = partialLoc\n \n return location\n end",
"def full_address\n return \"#{address}, #{city}, #{state}, #{zip}\"\nend",
"def delivery_address\n\t\tadd=Partay.get('http://shoponline.tescolotus.com/api/v1/Customer/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token })\n\t\tresponse_address=JSON(add)\n\t\tself.address_info(JSON(response_address)[\"address\"][\"name\"])\n\tend",
"def parse_email(s)\n e = Mail::Address.new(s)\n (s == '' || e.address != s || e.local == e.address) ? nil : e\nend",
"def parse\n name.split.collect do |address|\n address.split(',')\n end.flatten.uniq\n end",
"def address\n \"%s %s %s %s\"%([self.prefecture_code,self.address_city,self.address_street,self.address_building])\n end",
"def address\n [street, [postal_code, l].join(' ')].join(\"\\n\")\n end",
"def test_19110_address_5\n\n xExpect = @@xFile.xpath('//gmd:contactInfo[4]')\n\n hJson = JSON.parse(@@mdJson)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(5)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n hJson['dataDictionary'][0]['responsibleParty']['party'].delete_at(0)\n jsonIn = hJson.to_json\n\n hResponseObj = ADIWG::Mdtranslator.translate(\n file: jsonIn, reader: 'mdJson', writer: 'iso19110', showAllTags: true\n )\n\n xMetadata = Nokogiri::XML(hResponseObj[:writerOutput])\n xGot = xMetadata.xpath('//gmd:contactInfo')\n\n assert_equal xExpect.to_s.squeeze(' '), xGot.to_s.squeeze(' ')\n\n end",
"def full_address\n [address, city].compact.join(', ')\n end",
"def full_address\n\t\t[address1, address2, city, state, zipcode].join(', ')\n\tend",
"def full_address\n \"#{address1}, #{address2}, #{city}, #{state}, #{zipcode}\"\nend",
"def full_address\n return \"#{@address}, #{@apart} #{@city} #{@state}, 60611\"\n end",
"def get_full_address\n [\n (address.empty? ? nil : address),\n (self.le_city.nil? ? nil : self.le_city.get_full_name)\n ].compact.join(\", \")\n end"
] |
[
"0.67254376",
"0.629819",
"0.6006042",
"0.6006042",
"0.599553",
"0.57814217",
"0.5732348",
"0.57316375",
"0.5690134",
"0.5647639",
"0.56393284",
"0.56388414",
"0.56385905",
"0.5616885",
"0.5599533",
"0.5587805",
"0.55788124",
"0.55572313",
"0.5554167",
"0.5537792",
"0.553198",
"0.552571",
"0.55198824",
"0.55147153",
"0.5513529",
"0.55132055",
"0.5503778",
"0.5498544",
"0.54955685",
"0.54855716",
"0.5484108",
"0.5478745",
"0.547689",
"0.5470074",
"0.5467731",
"0.54571587",
"0.54531014",
"0.54525775",
"0.54377097",
"0.54295444",
"0.5420116",
"0.541827",
"0.54144084",
"0.5409464",
"0.54086924",
"0.540838",
"0.5406536",
"0.5397343",
"0.53965694",
"0.53955626",
"0.539391",
"0.53739",
"0.5373811",
"0.53732586",
"0.53727007",
"0.53702796",
"0.53675157",
"0.5366105",
"0.53601867",
"0.5359571",
"0.53443235",
"0.53429496",
"0.53406775",
"0.533735",
"0.5333217",
"0.5330963",
"0.53309286",
"0.5319829",
"0.53116643",
"0.53053015",
"0.53018427",
"0.5296591",
"0.5290318",
"0.52816486",
"0.5274849",
"0.5273229",
"0.5273149",
"0.5266269",
"0.5266269",
"0.52634764",
"0.5260503",
"0.5258765",
"0.52524686",
"0.52495956",
"0.5240782",
"0.5240613",
"0.52360183",
"0.52353495",
"0.5215738",
"0.52131456",
"0.51970273",
"0.51899856",
"0.5174301",
"0.51740634",
"0.5173999",
"0.5173465",
"0.51727873",
"0.51726335",
"0.5171342",
"0.51633626"
] |
0.6258206
|
2
|
do notification for this tiers
|
def notify
return false unless @tiers # invalid tiers_id
extract_destinations
if @french || @other
done = notify_all_destinations
say_notified if done && @mode
done
else # no mail
register_tiers
false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notify\n end",
"def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def send_notification\n self.target_followers.each do |target_follower|\n @user = User.find(target_follower.follower_id)\n Notification.create_notification(@user.profilable_id, @user.profilable_type, text = \"#{self.name} updated his/her profile\", \"Enterprise\") && reload unless target_follower == self || target_follower.nil?\n end\n end",
"def send_notifications\n end",
"def notifications\n end",
"def notifier; end",
"def notifier; end",
"def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end",
"def send_notification\n\n\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n key = KEY_FORMAT % @visualization.id\n $tables_metadata.multi do\n $tables_metadata.hset(key, @user.username, current_timestamp + @notification_ttl)\n $tables_metadata.expire(key, @notification_ttl)\n end\n end",
"def notify\n if self.recruitment.first_notify.present?\n self.recruitment.unset(:first_notify)\n MemberMailerWorker.perform_async(member_id: self.recruitment.member.id.to_s, recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n TeamMailerWorker.perform_async(recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n end\n end",
"def notify_change\n SpecificNodeMailer.notify_change\n end",
"def notify\n raise NotImplementedError\n end",
"def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end",
"def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end",
"def notify(notice)\n if @config.use_dogapi?\n notify_dogapi_event(notice) if @config.send_event\n notify_dogapi_metric(notice) if @config.send_metric\n end\n if @config.use_statsd?\n notify_statsd_event(notice) if @config.send_event\n notify_statsd_metric(notice) if @config.send_metric\n end\n end",
"def engine_notify_datas_updated(datas_updated)\n end",
"def notify_tech\n if self.status_id_changed?\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 rocketElevAlert = ENV[\"TWILIO_FROM\"]\n tech_phone_number = ENV[\"TWILIO_TO\"]\n sms_body = \"The Elevator #{self.id} with Serial Number #{self.serialNumber} needs an intervention\"\n if self.status_id == Status.find_by(name: \"intervention\").id\n @client.messages.create(\n from: ENV[\"TWILIO_FROM\"],\n to: tech_phone_number, #self.column.battery.building.techPhone,\n body: sms_body)\n end\n end\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def process\n @notifier.process\n end",
"def notify_travellers\n if current_user.nil?\n trip = session[:trip]\n else\n trip = Trip.find(params[:id])\n end\n\n drivers = []\n passengers = []\n\n trip.travellers.each do |t|\n if t.type == 'Driver'\n drivers << t\n else\n passengers << t\n end\n end\n\n trip_output_data = params[:data]\n\n drivers.each { |driver| DriverMailer.trip_email(trip, driver, trip_output_data, current_user).deliver_now }\n passengers.each { |passenger| PassengerMailer.trip_email(trip, passenger, trip_output_data, current_user).deliver_now }\n\n render json: {message: 'Emails were successfully sent.'}\n end",
"def will_notify\n #Resque.safe_enqueue Notification, to_user_id, id, APP::NOTIFICATIONS::MESSAGE\n end",
"def send_email_changed_notification; end",
"def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end",
"def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend",
"def notify_post\n raise \"not yet implemented\"\n end",
"def notification\n doctor = Doctor.first\n DoctorMailer.notification(doctor)\n end",
"def notify_parties\n buyer.add_transaction self\n seller.add_transaction self if seller\n end",
"def send_notification\n AdminMailer.delay.new_report(self)\n end",
"def notify\n changed(true)\n notify_observers(self)\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notify\n return {}\n end",
"def notify\n return {}\n end",
"def notify\n return {}\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def slack_notifier\n\n if self.status_id_changed?\n require 'date'\n current_time = DateTime.now.strftime(\"%d-%m-%Y %H:%M\")\n notifier = Slack::Notifier.new ENV[\"Slack_Webhook_URL\"] do\n defaults channel: \"#elevator_operations\"\n end\n notifier.ping \"The Elevator #{self.id} with Serial Number #{self.serialNumber} changed status from #{Status.find_by(id: self.status_id_was).name} to #{Status.find_by(id: self.status_id).name} at #{current_time}.\"\n end\n \n \n \n \n end",
"def notify_subscribers\n NotifierJob.perform_later(self)\n end",
"def send_new_booking_request_notifications\n\n if pay_now\n notify_manager_pay_now\n notify_request_to_customer_pay_now\n else\n notify_manager\n notify_request_to_customer\n end\n\n end",
"def notify_employee\n \t\temployees.each do |employee|\n \t\t\tputs \"Notification sent to #{employee.name} at #{employee.email}\"\n \t\t\tputs \"\"\n \t\tend\t\n end",
"def notify(res_type, key, data) \n\t\t\traise \"Called notify without active deployment!\" if MU.mommacat.nil?\n\t\t\tMU.mommacat.notify(res_type, key, data)\n\t\tend",
"def notify\n if self.task.first_notify.present?\n self.task.unset(:first_notify)\n MemberMailerWorker.perform_async(member_id: self.task.member.id.to_s, task_application_id: self.id.to_s, perform: :send_new_task_application)\n TeamMailerWorker.perform_async(task_application_id: self.id.to_s, perform: :send_new_task_application)\n end\n end",
"def notify(mid, *args, **kwargs)\n @notification_name = mid\n do_notify(*args, **kwargs)\n end",
"def notify\n MemberMailerWorker.perform_in(15.minutes, member_id: self.employer.id.to_s, package_order_id: self.id.to_s, perform: :send_package_invoice_to_employer)\n #TeamMailerWorker.perform_async(package_order_id: self.id.to_s, perform: :send_new_package_order)\n end",
"def send_update\n changed\n notify_observers(self)\n end",
"def run\n @notifier.run\n end",
"def perform_work\n object_client.notify_goobi\n end",
"def notify(*args, **kwargs)\n new.notify(*args, **kwargs)\n end",
"def notify\n @transaction_id = params[:transaction_id]\n do_notify\n end",
"def notify sender_id:, referent:, instance:, users:, params: {}\n notify_push(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n notify_inapp(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n end",
"def notify\n @teams_to_notify.each do |id|\n team_set = get_team_set_by_team_id(id)\n team_set.thinkspace_peer_assessment_review_sets.each do |review_set|\n mailer_class.notify_quant_data_reset(@assessment, review_set.ownerable).deliver_now\n end\n end\n end",
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end",
"def notify activity\n\n # people who are subscribed to the tags of the question\n t_subscribers = target.subscribers.all\n\n (t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end",
"def notify\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_invoice_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_new_job_order)\n\n end",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end",
"def object_updated(object)\n notify\n end",
"def notify_supplier_final_payment_paid\n WeixinsJob.perform_later({:event => 'delivery_final_payment_paid', :id => self.id}) if supplier.weixin\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def broadcast_check_for_hunts!\n @account.self_and_all_descendant_customers.find_each do |customer|\n ServiceRunnerJob.perform_later(\n \"DeviceBroadcasts::Customer\",\n customer,\n { type: \"hunts\", payload: {} }.to_json\n )\n end\n end",
"def create_notification; end",
"def notify_subscribers\n NotificationSubscription.notify(self)\n end",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def notify_starting\n\t\tuser_list = []\n\t\tparty_list.each do |uid, uhash|\n\t\t\tuser_list <<= uid if uhash[:status] == STATUS_ATTENDING\t\t\t\n\t\tend\n\t\tnotification = EventNotification.new(NOTIF_EVENT_STARTING, self)\n\t\tnotify(notification, user_list, false)\n\tend",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def notification(data)\n type = data.delete(\"type\") || data.delete(:type) || data.delete(\"type\") || data.delete(:type)\n zone = to_demiurge_name(data.delete(\"zone\") || data.delete(:zone) || @item.zone)\n location = to_demiurge_name(data.delete(\"location\") || data.delete(:location) || @item.location)\n actor = to_demiurge_name(data.delete(\"actor\") || data.delete(:actor) || @item)\n @item.engine.send_notification(data, type: type.to_s, zone: zone, location: location, actor: actor, include_context: true)\n nil\n end",
"def send_email_changed_notification?; end",
"def notify_followers(community, current_user, update)\n followers.each do |follower|\n unless follower.id == current_user.id\n if update\n Notification.create(:notifiable_id => self.id, :notifiable_type => \"Listing\", :receiver_id => follower.id, :description => \"updated\")\n PersonMailer.new_update_to_followed_listing_notification(self, follower, community).deliver\n else\n Notification.create(:notifiable_id => comments.last.id, :notifiable_type => \"Comment\", :receiver_id => follower.id, :description => \"to_followed_listing\")\n PersonMailer.new_comment_to_followed_listing_notification(comments.last, follower, community).deliver\n end\n end\n end\n end",
"def send_mail_on_creation(rent)\n RentMailer.success_rent_email(rent.id).deliver_later\n end",
"def send_deletion_notification\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n Notification.create(:user => @tutor, :receiver_id => @student.id, :message => @tutor.title + ' has removed you from their student list')\n end",
"def fire(event)\n\t\tevent.add_labels(self.labels) unless self.labels.empty?\n\t\t# send any notifications\n\tend",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def notify?\n true\n end",
"def notify?\n true\n end",
"def notify_each opts={}\n _notification_builders[opts[:on] || :after_create] << Supports::Notifications::Builders::NotificationBuilder.new(opts)\n end",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end",
"def send_execution_notification\n payload = execution_notification_payload\n trade_order.portfolio.user.notify_devices payload, self\n end",
"def send_notification(method, params); end",
"def notification (user_id)\n requests = Requests.requests_for_edit_notification(user_id)\n if(requests != nil)\n senders_id = Array.new\n requests.each do |t|\n sender_id = t.senders_id\n senders_id.push sender_id\n end\n senders_id.each do |s|\n notification = Notifications.set_notification(s)\n user = Users.find_by_id(user_id).username\n requests.each do |t|\n if (t.senders_id == s)\n description = user + \" \" + \"edited his/her trip, please check it!\"\n Notifications.create_notification_trip(notification, description)\n end\n end\n end\n return\n end\n end",
"def perform(notifiable_id, notifiable_type, prefix)\n title=\"New #{prefix}-#{notifiable_type}\"\n \n if title == 'New Post-Like' || 'New Comment-Like'\n like = Like.find(notifiable_id)\n receiving_user = like.likeable.user\n \n elsif title == 'New Post-Comment'\n comment = Comment.find(notifiable_id)\n receiving_user = comment.post.user\n \n elsif title == 'New Request-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friended\n \n elsif title == 'New Accept-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friender\n end\n \n receiving_user.notifications.create(title: title, user_id: receiving_user.id, \n notifiable_id: notifiable_id, notifiable_type: notifiable_type)\n end",
"def notify\n @attributes.fetch('notify', false)\n end",
"def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end",
"def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end",
"def notify\n descriptor = MU.structToHash(cloud_desc)\n descriptor[\"cloud_id\"] = @mu_name\n descriptor\n end",
"def notify_administrators!\n AdminMailer.new_pending_interest_point(self).deliver!\n end",
"def notification\n BookingMailer.notification\n end",
"def add_team_specific_notifier(team_postfix, api_key)\n if api_key.nil? || api_key.length == 0\n Honeybadger.instance_eval do\n define_singleton_method(\"notify_#{team_postfix}\") do |exception, options = {}|\n notify(exception, options)\n end\n end\n else\n Honeybadger.instance_eval do\n define_singleton_method(\"notify_#{team_postfix}\") do |exception, options = {}|\n notify(exception, options.merge({ tn_team: team_postfix }))\n end\n end\n end\n end",
"def send_ready_notification\n\n end",
"def notify\n graduate_course = GraduateCourse.find(params[:graduate_course])\n subperiod = params[:subperiod].to_i\n year = params[:year]\n if true\n head :ok\n start(graduate_course,subperiod,year)\n cap = Capability.find_by_name(\"Gestione schemi d'orario\")\n puts \"INIZIATO\"\n receivers = graduate_course.users.find(:all, :include => :capabilities, :conditions => [\"capabilities.id = ?\", cap.id])\n receivers.each do |r|\n TeacherMailer.deliver_timetable_calculate_is_started(r,graduate_course,params[:subperiod].to_i)\n end\n else\n head :unavailable\n end\n end",
"def notify!(status)\n msg = message.call(model, status: status_data_for(status))\n\n hash = { alert_type: default_alert_type(status) }\n hash.store(:msg_title, @title)\n hash.store(:date_happened, @date_happened) if @date_happened\n hash.store(:priority, @priority) if @priority\n hash.store(:host, @host) if @host\n hash.store(:tags, @tags) if @tags\n hash.store(:aggregation_key, @aggregation_key) if @aggregation_key\n hash.store(:source_type_name, @source_type_name) if @source_type_name\n hash.store(:alert_type, @alert_type) if @alert_type\n send_event(msg, hash)\n end",
"def trigger(signal_number = nil)\n\t\t\t\t@notifications.each(&:signal)\n\t\t\tend"
] |
[
"0.6846709",
"0.6812397",
"0.6638251",
"0.6638251",
"0.6400945",
"0.63631654",
"0.6316323",
"0.6270889",
"0.6270889",
"0.625349",
"0.62436175",
"0.62123454",
"0.62123454",
"0.62123454",
"0.6206341",
"0.619524",
"0.61609405",
"0.6044616",
"0.60317105",
"0.6019092",
"0.59932035",
"0.5983321",
"0.5952364",
"0.59347343",
"0.59036493",
"0.5864184",
"0.58544296",
"0.5847057",
"0.58388656",
"0.582202",
"0.5811908",
"0.58107054",
"0.5810698",
"0.5806139",
"0.5792655",
"0.5791236",
"0.57907593",
"0.57907593",
"0.57907593",
"0.5783376",
"0.57825625",
"0.57716554",
"0.5760999",
"0.5759482",
"0.5752714",
"0.57461166",
"0.5742984",
"0.5740215",
"0.57361317",
"0.57338345",
"0.57284856",
"0.5704352",
"0.56998414",
"0.5691322",
"0.5688176",
"0.5678237",
"0.5658721",
"0.563772",
"0.56270945",
"0.5621644",
"0.56122434",
"0.56122434",
"0.5602897",
"0.560016",
"0.55980355",
"0.5592663",
"0.55892557",
"0.5582639",
"0.5575409",
"0.55743563",
"0.55743563",
"0.5567723",
"0.55621046",
"0.5550825",
"0.55492103",
"0.55346596",
"0.5523553",
"0.55191517",
"0.55186737",
"0.5515767",
"0.5513521",
"0.55075413",
"0.5502489",
"0.5499403",
"0.5492486",
"0.5490659",
"0.54884744",
"0.5487451",
"0.5457803",
"0.5454254",
"0.54531324",
"0.5451265",
"0.5449916",
"0.54495865",
"0.5447292",
"0.5439272",
"0.5435153",
"0.5431469",
"0.54305196",
"0.5429824"
] |
0.61250633
|
17
|
send all notification mails
|
def notify_all_destinations
done_french = !@french || notify_french(@french)
done_other = !@other || notify_english(@other)
done_french && done_other
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end",
"def groups_notification_email\n @data = last_notification\n # Only send if there's something to send\n return unless @data.any?\n rails_secrets = Rails.application.secrets\n send_to = rails_secrets.user_default_email\n send_from = 'notifications@' + rails_secrets.domain_name\n mail(from: send_from, to: send_to,\n subject: 'Competitor-Monitor Changes Notification')\n end",
"def send_notifications!\n # The person who wrote the note, anybody who's left a comment on this note minus \"current\" comment creator\n notification_emails.each do |email|\n Notifier.comment(self, email).deliver\n end\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def send_notifications\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end",
"def send_notification\n # Getting users of current group\n @group = Group.find(params[:id])\n @users = @group.users\n\n # Subject for mail\n if action_name == \"create\"\n subject = \"New task creation\"\n else\n subject = \"Task update\"\n end\n\n # Sending mail to each user of the group\n @users.each do |user|\n TaskMailer.task_create_notification(subject, user, @group, @task).deliver_now\n end\n\n end",
"def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end",
"def send_notifications\n\t\t#puts \"------------- CAME TO SEND NOTIFICAITONS FOR RECEIPT ------------------\"\n\t\t## we will have to override the gather recipients.\n\t\t## how to get the patient ?\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\t#puts \"recipient is: #{recipient}\"\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => RECEIPT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => build_var_hash,\n\t\t\t\t\t:template_sender_id => RECEIPT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\t#puts \"the recipient has email id\"\n\t\t\t\t#puts recipient.email_ids.to_s\n\t\t\t\temail = OrderMailer.receipt(recipient,self,self.payable_to_organization.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def notify_all\n if @size > 0\n @report << \"#{@size} abonnement(s) à notifier\"\n do_notify_all\n @report << Registry.report_missed_notifications\n else\n @report << 'Pas de notification à faire'\n end\n @report\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end",
"def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end",
"def send_account_notifications\n notifications = NotificationType.check_all(self)\n\n notifications_to_email = {}\n\n # Check preferences for what to do with each notification type\n NotificationType.types.each do |notification_type_string|\n notification_type = notification_type_string.constantize.first\n\n next unless notifications[notification_type_string].present?\n actions = notification_preferences.find_by_notification_type_id(notification_type.id).try(:actions) ||\n NotificationPreference.default_actions\n\n # Collect any emails that need sent\n if actions.include?('email')\n notifications_to_email[notification_type] = notifications[notification_type_string]\n end\n\n next unless actions.include?('task')\n # Create a task for each notification\n notifications[notification_type_string].each do |notification|\n notification_type.create_task(self, notification)\n end\n end\n\n # Send email if necessary\n if notifications_to_email.present?\n NotificationMailer.notify(self, notifications_to_email).deliver\n end\n end",
"def send_emails\n self.attendees.distinct.each do |attendee|\n UpdatesMailer.updates_mail(attendee, self).deliver_now\n end\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def notification(params)\n mail(params)\n end",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n \n begin\n apps.each do |app|\n app.call(:request => request, \n :response => response, \n :settings => settings,\n :logger => logger)\n end\n rescue StandardError => e\n logger.info(\"FAIL\") { e.to_s }\n logger.debug(\"FAIL\") { \"#{e.inspect}\\n\"+e.backtrace.join(\"\\n \") }\n\n if settings.service.raise_exceptions\n raise\n else\n next\n end\n end\n\n response.deliver\n end\n rescue Exception => e\n logger.fatal(\"Caught exception: #{e}\\n\\n#{e.backtrace.join(\"\\n\")}\")\n raise\n end",
"def perform\n User.where(id: @bug.notify_on_deploy).each do |user|\n NotificationMailer.deploy(@bug, user).deliver\n end\n end",
"def send_admin_mail\n admins = Admin.all\n\n admins.each do |admin|\n if admin.reminder\n AdminMailer.new_user_waiting_for_approval(admin.email).deliver_now\n end\n end\n end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <admin@sensoriumhealth.com>\",\n\t return_path: \"contact@sensoriumhealth.com\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n\n process_request(request, response) && response.deliver\n end\n rescue StandardError => e\n logger.fatal(\"SERVER ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n raise\n end",
"def send_notifications(unituser, msg)\n user = unituser.user\n user.send_sms(msg)\n UserMailer.send_email(user, user.email, msg).deliver if user.contact_flags[1] == \"1\"\n UserMailer.send_email(user, user.email2, msg).deliver if user.contact_flags[3] == \"1\"\n end",
"def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end",
"def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend",
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end",
"def send_email(notification,receiver)\n new_notification_email(notification,receiver)\n end",
"def send_notification\n\n\n end",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify(subject,body,obj = nil,sanitize_text=true,notification_code=nil,send_mail=true,sender=nil)\n Mailboxer::Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code,send_mail,sender)\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end",
"def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"info@ourcompany.com\",\n :subject => \"New Job Posted!\"\n )\n \n end",
"def send_batch_notification_email(notifications, options = {})\n return if notifications.blank?\n if notifications.map{ |n| n.target }.uniq == [self]\n Notification.send_batch_notification_email(self, notifications, options)\n end\n end",
"def push_notification\n NotificationMailer.push_notification\n end",
"def send_feedback_reminders_emails\n # Send the emails\n feedback_reminders.each do |fr|\n fr.send_feedback_reminder_email\n end\n\n # Shift the send_feedback_reminders_after date of\n # FEEDBACK_REMINDERS_INTERVAL seconds in the future\n self.send_feedback_reminders_after =\n Time.zone.today + FEEDBACK_REMINDERS_INTERVAL\n\n # Increment feedback_reminders_count\n self.feedback_reminders_count += 1\n\n # save the connection\n save\n end",
"def send_notification\n AdminMailer.delay.new_report(self)\n end",
"def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end",
"def send_welcome_email\n subscription = self.subscription\n parent_no_valids = ParentNoValid.where(subscription: subscription)\n parent_no_valids.each do |parent_no_valid|\n ParentNoValidMailer.welcome(parent_no_valid).deliver_now\n end\n end",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"cneumann@marsmonitoring.com\") #.deliver_later\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def notify_admins\n mentioned_admins.each do |mentioned|\n NotificationMailer.mentioned_email(self.admin, mentioned, self.admin_chatroom).deliver_now\n end\n end",
"def send_email(object)\n # SomeNotifier.notification(...).deliver_now\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def notify\n ReminderMailer.notify\n end",
"def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end",
"def send_email(payment, bill)\n Admin.all.each do |admin|\n Pony.mail :to => admin.email,\n :from => payment.contributor_email,\n :subject => I18n.t(:upload_receipt_subject),\n :html_body => erb(:\"/mails/payment_confirmation\",\n :locals => {:receipt => payment, :bill => bill },\n :layout => false),\n :via => :smtp\n\n end\nend",
"def send_emails\n mail = build_mail\n get_recipients do |recipient|\n unless EmailResponse.exists?(email: recipient.email) # bounces & complaints\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end\n end\n end",
"def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end",
"def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end",
"def send_bulk_email(message, subject = 'Notification')\n client = IronWorkerNG::Client.new\n payload = {}\n payload['message'] = message\n payload['Subject'] = subject\nend",
"def send_mail(changed_watched_paths, hash, paths_by_users)\n \n # send one email for email address\n paths_by_users.keys.each do |user_email|\n subject=nil\n body=String.new @body_prefix\n \n # merge in the changed paths this user is interested in\n paths_by_users[user_email].each do |watched_path|\n \n if changed_watched_paths[watched_path]\n \n body << \"\\n\" << changed_watched_paths[watched_path].join(\"\\n\")\n # take any to generate the branch\n if !subject\n \n subject= String.new @subject_prefix\n subject << extract_branch(changed_watched_paths[watched_path])\n subject << \" by user \"\n subject << hash[:author]\n\t @logger.debug(\"Subject is=\"<< subject)\n end\n end \n end\n \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"revision: \" << hash[:rev]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n \n yield(user_email, subject, body)\n \n end\n end",
"def deliver\n User.all.each do |user|\n UserMailer.send_message(user,self).deliver\n end\n end",
"def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end",
"def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end",
"def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend",
"def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def deliver\n #find all the abonnes emails\n @abonnes = Abonne.all.collect(&:email)\n # Sends the newsletter to each one\n @abonnes.each do |abonne|\n NewsletterMailer.deliver_newsletter(abonne, self)\n end\n # Set the delivered_at time to now\n self.update_attribute(:delivered_at, Time.now)\n end",
"def all(*args, &block)\n Mail.all(*args, &block)\n end",
"def send_notification\n unless development?\n recipient_email = Hacker.first(:username => self.recipient).email\n Notifier.send_message_notification(recipient_email, self.sender)\n end\n end",
"def notify_all\n MemberMailerWorker.perform_async(member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_freelancer)\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_job_order_paid)\n\n\n MemberMailerWorker.perform_in(4.hours, member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_employer)\n MemberMailerWorker.perform_in(4.hours, member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_freelancer)\n\n km_properties = self.job.km_properties\n km_properties[:paid_job] = self.currency.convert_to_idr(self.budget)\n km_properties[:job_order_id] = self.id.to_s\n km_properties[:type] = self.class.to_s\n\n KissmetricsWorker.perform_async(perform: :job_paid, identity: self.job.member.email, properties: km_properties)\n\n # notify other applicants that a freelancer has been hired, only for the first job order\n if self.first_paid_order?\n all_applicants = self.job.job_applications\n all_applicants.each do |ja|\n if ja != self.job_application\n MemberMailerWorker.perform_async(member_id: ja.member.id.to_s, job_order_id: self.id.to_s, perform: :send_freelancer_hired_to_other_applicants)\n end\n end\n end\n end",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def push_notification\n UserMailer.new_message(self).deliver_now\n end",
"def send_reminder_for_all(rss_user_id)\n assigned_documents = get_assigned_documents(rss_user_id)\n ids = []\n types = []\n assigned_documents.each do |doc|\n ids << doc['assignmentid']\n types << doc['type']\n end\n reminder_ids = ids.join(',')\n reminder_types = types.join(',')\n send_reminder(rss_user_id, reminder_ids, reminder_types)\n end",
"def create_mail\n # Removes the current user from the recipients and cc\n # if he doesn't want to receive notifications about what he does\n @author ||= User.current\n if @author.pref[:no_self_notified]\n recipients.delete(@author.mail) if recipients\n cc.delete(@author.mail) if cc\n end\n \n notified_users = [recipients, cc].flatten.compact.uniq\n # Rails would log recipients only, not cc and bcc\n mylogger.info \"Sending email notification to: #{notified_users.join(', ')}\" if mylogger\n \n # Blind carbon copy recipients\n if Setting.bcc_recipients?\n bcc(notified_users)\n recipients []\n cc []\n end\n super\n end",
"def notify_groups_for_alert(alert)\n @alert = alert\n groups = Group.where(id: alert.groups_alerted)\n\n users = groups.inject([]) do |users, group|\n users += group.users\n end.uniq\n\n user_emails = users.map(&:email)\n\n mail bcc: user_emails, subject: \"Alerta de inventário de item\"\n end",
"def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end",
"def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def process_emails(reader_info)\n notifications = reader_info.notifications\n notifications.each do |notification|\n case notification[:notification_type]\n when \"email\"\n send_email(reader_info) if notification[:checked]\n when \"internal\"\n send_internal(reader_info) if notification[:checked]\n when \"sms\"\n send_sms(reader_info) if notification[:checked]\n when \"e-boks\"\n send_e_boks(reader_info) if notification[:checked]\n end\n end\n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify_email\n begin\n QuoteMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send quote email notification. #{e.message}\")\n end\n end",
"def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end",
"def notification_mail(reports, staff)\n @reports = reports\n @reports_keys = reports.keys\n \n @first_name = staff.first_name\n @last_name = staff.last_name\t\n\t\n\t# This is an AF kludge...need to revisit\n\tsubject = reports.size > 1 ? \"Radar Digest\" : \"Radar #{reports.first[1][0].display_name} #{reports.first[1][0].tag} (#{reports.first[1][0].staff.name})\"\n \n mail(:to => staff.email, :subject => \"#{subject}: \" + Time.now.to_s(:my_time)) \n end",
"def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"mitsuimasayoshi@gmail.com\", subject: \"[Localgarage]Printer_URL\"\n end",
"def send_mandrill(mail)\n m = Mandrill::API.new\n\n sending = m.messages.send_template('sweep-notification',\n [\n {\n :name => 'Notification',\n :content => \"#{mail.body}\"\n },\n {\n :name => 'unsub',\n :content => \"#{mail['unsub_link']}\"\n }\n ],\n message = @message)\n Rails.logger.info sending\n end",
"def notify_email2(fuel_limit)\n @fuel_limit=fuel_limit\n mail(to: @fuel_limit.emails, subject: 'Notification Email')\n end",
"def notify_email\n begin\n InsuranceLeadMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send insurnace lead notification. #{e.message}\")\n end\n end",
"def send_notifications\n send_new_post_to(:sender) if self.sender.notify_on_comment_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_comment_received\n end",
"def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def send_travel_reminders\n @title = 'Send reminders'\n @travels = Travel.pending.where(\"reminder_sent IS ? AND member_id IS NOT ?\", nil, nil)\n @messages = []\n @travels.each do |travel|\n if travel.member.email\n @messages << Notifier.travel_reminder(travel) \n travel.update_attribute(:reminder_sent, Date.today)\n#puts \"**Reminder_sent set to #{travel.reload.reminder_sent}\"\n end\n end\n @messages.each {|m| m.deliver}\n flash[:notice] = \"Sent #{@messages.count} travel reminder messages\"\n AppLog.create(:severity=>'info', :code=>'Notice.travel_reminder', :description => flash[:notice])\n redirect_to travels_path\n end",
"def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end",
"def sendmail(to, notification_mail, params, attachments = [])\n raise NotImplementedError, \"you should implement #{self.class}##{__method__}\"\n end",
"def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end",
"def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end",
"def weekly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end",
"def send_admin_notification\n Notifications.send_admin_notification(User.admin, self).deliver\n end",
"def send_mail\n @url = \"http://www.whwater.com/news/tstz/\"\n @planned_notices = fetch_notices \"http://www.whwater.com/news/jhxts/Index.html\"\n @emergent_notices = fetch_notices \"http://www.whwater.com/news/tfxts/Index.html\"\n if changed_in_website?\n TabWaterMailer.tab_water_info(@planned_notices, @emergent_notices, @url).deliver\n end\n end",
"def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end",
"def notify\n @teams_to_notify.each do |id|\n team_set = get_team_set_by_team_id(id)\n team_set.thinkspace_peer_assessment_review_sets.each do |review_set|\n mailer_class.notify_quant_data_reset(@assessment, review_set.ownerable).deliver_now\n end\n end\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def send_mail(recipient, subject)\n if recipient.email_notifications\n mail(to: recipient.email, subject: subject)\n else\n p 'recipient has email notifications turned off.'\n end\n end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('lumi.xperia@gmail.com', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in SendSecureDataAccessLinkJob'\n ).deliver if @failed_logs.present?\n end",
"def deliver\n APN::Notifications.deliver([self])\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end"
] |
[
"0.78565943",
"0.7747894",
"0.76817447",
"0.76007515",
"0.75743717",
"0.733876",
"0.733143",
"0.7303527",
"0.72838527",
"0.72536343",
"0.72476107",
"0.72438985",
"0.71408147",
"0.7120416",
"0.70938724",
"0.708356",
"0.7008678",
"0.698971",
"0.69853824",
"0.69696784",
"0.69679075",
"0.69585115",
"0.6929693",
"0.6870018",
"0.6866211",
"0.68475294",
"0.6806608",
"0.6790689",
"0.67473274",
"0.6742602",
"0.6735702",
"0.67231756",
"0.67162764",
"0.67140925",
"0.6705023",
"0.6703336",
"0.66994464",
"0.6692207",
"0.6682463",
"0.6671833",
"0.666778",
"0.6660234",
"0.6659636",
"0.6649197",
"0.66303813",
"0.6601196",
"0.65986574",
"0.65965354",
"0.6590663",
"0.6584717",
"0.65829575",
"0.65749574",
"0.65745986",
"0.6572289",
"0.6565841",
"0.65573573",
"0.65570176",
"0.65519047",
"0.6547659",
"0.65427583",
"0.6540782",
"0.6540528",
"0.65404224",
"0.65385455",
"0.65382797",
"0.6537552",
"0.65291244",
"0.6524852",
"0.6502468",
"0.6502468",
"0.64983594",
"0.64918643",
"0.64870566",
"0.6481119",
"0.64797264",
"0.6472885",
"0.6472819",
"0.6462259",
"0.6460972",
"0.64557976",
"0.6443321",
"0.6438633",
"0.64343613",
"0.6433032",
"0.64282286",
"0.64178985",
"0.6408598",
"0.6408317",
"0.64020765",
"0.64016974",
"0.64009225",
"0.6392165",
"0.6390826",
"0.6388671",
"0.6383975",
"0.6381021",
"0.6366018",
"0.63646847",
"0.636416",
"0.63605785",
"0.6353482"
] |
0.0
|
-1
|
send notification in french to this address
|
def notify_french(dest)
mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tender_updated\n @greeting = \"Χαίρετε\"\n\n mail to: \"to@example.org\"\n end",
"def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end",
"def notify_shipped(order)\n @order = order\n @info = @order.info\n email = @order.user.email\n subject = \"特快車出貨通知! (訂單編號:#{@order.token})\"\n\n mail(to: email, subject: subject) do |format|\n format.text\n format.html\n end\n end",
"def send_devise_notification(notification, *args)\n I18n.with_locale(locale) { super notification, *args }\n end",
"def notification(to,f)\n send_as :notification\n recipients to\n from f\n fbml \"Not\"\n end",
"def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"mitsuimasayoshi@gmail.com\", subject: \"[Localgarage]Printer_URL\"\n end",
"def sendmail_confirm\n @greeting = \"元気ー?\"\n\n mail to: \"m.seino@ashita-team.com\"\n end",
"def received(vin_cod)\n @vin_cod = vin_cod\n\n mail to: \"falcon.vinnica@gmail.com\", subject: 'Запрос по vin коду на Falcon motors'\n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def new_place_notification (merchant)\n @merchant = merchant\n mail to: \"sales@halalfoodhunt.com\", subject: \"A Place Has Been Listed\"\n end",
"def admin_broadcast(desired_locale, emails_as_string, subject, body)\n ActionMailer::Base.smtp_settings = APP_CONFIG[:admin_mail]\n set_locale( desired_locale )\n\n @content_type = \"text/html\"\n @recipients = \"noreply@kroogi.com\"\n @bcc = emails_as_string\n @from = head_encode(\"\\\"Kroogi (No Reply)\\\"\".t) + \" <noreply@kroogi.com>\"\n @subject = head_encode(\"[Kroogi] \" + subject)\n @sent_on = Time.now\n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/\"\n @body[:body] = body\n end",
"def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def subscribeDemand(musician)\n @musician = musician\n\n mail to: @musician.email, subject: \"Confirmation de votre inscription sur leboncouac.fr\"\n end",
"def deliver\n I18n.switch_locale self.language || Utility.language_code do \n EmailMailer.deliver_share_kase(self, self.kase) if self.valid?\n end\n end",
"def order_shipped(order)\n @order = order\n mail :to => User.find_by_id(@order.user_id).email, :subject => \"来自Time international GmbH的包裹发送信息\"\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <noreply@svivatova.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def send_notification(user, questionnaire)\n I18n.default_locale = I18n.locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you'),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers)\n end",
"def new_letter_notification(message)\n sender = User.find message.user_id\n reciever = User.find message.reciever\n setup_email(reciever)\n @subject += \"Вам пришло личное сообщение от #{sender.full_name}\"\n body[:sender] = sender\n body[:message] = message\n body[:url] = RAILS_URL + \"messages/view/#{message.id}\"\n end",
"def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end",
"def send_text_message(note)\n @greeting = note.message + \" (\" + note.created_at.in_time_zone(\"Eastern Time (US & Canada)\").strftime('%m/%d/%Y') + \")\"\n\n mail to: '8593613596@vtext.com, tkcrone@gmail.com, 8593611777@vtext.com, twcrone@gmail.com', subject: 'Love Note'\n end",
"def notification(params)\n mail(params)\n end",
"def send_email(message)\n @message = message\n mail to: \"china@pozitive.biz, coddeys@gmail.com\", subject: \"Request from website\"\n end",
"def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def sent(order)\n @order = order\n mail :to => \"njunichiro@gmail.com\", :subject => \"注文を受けました\"\n end",
"def confirm(order)\n @order = order\n mail :to => \"njunichiro@gmail.com\", :subject => \"注文を受けました。ありがとうございます。\"\n end",
"def notify(internet_up)\n time = Time.now\n if internet_up\n %x( growlnotify -m \"The internet is up!\")\n puts \"Internet is UP\".green + \" @ #{time.strftime(\"%I:%M:%S %p\")}\"\n puts \"Text sent!\".blue if @mail.deliver\n else\n %x( growlnotify -m \"Internet is DOWN\" )\n puts \"Internet is DOWN\".red + \" @ #{time.strftime(\"%I:%M:%S %p\")}\"\n end\nend",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def content(address, name)\n @greeting = \"Hi! #{name}\"\n\n mail to: address, subject: '謝謝你報名參加TKU Hackathon,提醒您活動時間是2014/3/29'\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def order_notification(ship)\n @ship = ship\n mail :subject => t('mytranslations.order_notification.subject'),\n :to => Refinery::Inquiries::Setting.notification_recipients,\n :reply_to => ship.client.email\n end",
"def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end",
"def show_notfication\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_notification\n\n\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def admin_behavior_warning(email, company_phone, notification)\n @company_phone = company_phone\n @company = @company_phone.company\n @notification = notification\n mail(\n to: email,\n subject: 'GurúComm | Una línea esta cerca del límite de uso'\n )\n end",
"def reminder_email(user)\n @user = user\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def geo_notification(to_user, cc_users, new_subs, hostname)\n recipients \"#{to_user.name} <#{to_user.email}>\"\n cc cc_users.map{|user| \"#{user.name} <#{user.email}>\"}\n from \"pipeline@modencode.org\"\n reply_to \"help@modencode.org\"\n subject GEO_SUBJECT_TEMPLATE\n body :name => to_user.name.split(/ /).first,\n :subs_with_geo => new_subs[:with_geo],\n :subs_no_geo => new_subs[:no_geo],\n :subs_processing => new_subs[:processing],\n :hostname => hostname\n end",
"def application_confirmed(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end",
"def notify(params)\n @body = params[\"/contact\"][:message]\n @from = params[\"/contact\"][:email]\n @phone = params[\"/contact\"][:phone]\n @name = params[\"/contact\"][:name]\n mail to: \"renovationgroupedin@gmail.com\", subject: 'Mail from website', from: \"#{@from}\"\n end",
"def send_a_mail(name, title, body)\n @name = name\n @body = body\n @title = title\n\n #mail to: \"window@i.ua\"\n mail subject: \"Сообщение от сайта Никиты с темой #{@title}\"\n end",
"def sendmail_confirm(user)\n @user = user\n mail(to: user.email,\n subject: \"会計よりお知らせ\")\n end",
"def notify_host\n OrganisationMailer.notify_host\n end",
"def say_hi(medium)\n @medium = medium\n\n mail(to: '446146366@qq.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'hhuang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwu@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\").deliver\n end",
"def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"kat_tun_jinkazu_love@yahoo.co.jp\", subject: \"登録完了通知\"\n end",
"def dealer_request(request, addr=\"info@realcraftboats.com\")\n @request = request\n mail(to: addr, :subject => \"Заявка на дилерство\") do |format| #\"info@realcraftboats.com\"\n format.text\n format.html\n end\n end",
"def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(link: \"/reports/#{@report.id}\")\n subject = \"[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def notify(message, phone, date, errors)\n @message = message\n @phone = phone\n @date = date\n @errors = errors\n #@class_name = class_name\n #@method = method || nil\n\n mail(to: 'apimail@payquick-cm.com', subject: 'Erreur creation compte PAYQUICK')\n end",
"def sofortkontakt\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def refer(line_item)\n @line_item = line_item\n @greeting = \"Hi #{@line_item.name}\"\n @job = Job.find(@line_item.job_id)\n\n mail to: line_item.email, subject:\"Hi #{@line_item.name}, 猎友会给您推荐职位了\", temlate_path: 'refer_notifier',template_name: 'refer'\n end",
"def notify from, to, message, data = nil\n string = \"Alert: #{@@alert_name}\n\n[ #{from} ] => [ #{to} ]\n \n#{message}\n \n \"\n string += \"\n \n Data: \n #{data}\n \" if data\n print string\n self.send_slack(string)\n self.send_telegram(string)\n end",
"def new_notification(name,email,mobile,description)\n @name = name\n @email = email\n @mobile = mobile\n @description = description\n mail to: \"bloomberg490@gmail.com, dineshcharkha@gmail.com \", subject: \"Query From Super White Marble\"\n end",
"def register_confirmation(address)\n \tmail to: address\n # mail to: 'appdente@gmail.com'\n end",
"def notification_of_new_comment(comment, host=nil)\n set_locale comment.listing.author.locale\n subject_string = comment.author.name + \" on kommentoinut ilmoitustasi\"\n url = host ? \"http://#{host}#{listing_path(comment.listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(comment.listing.author.id)}\" : \"test_url\"\n recipients comment.listing.author.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :comment => comment, :url => url, :settings_url => settings_url, :listing_title => get_title_with_category(comment.listing)\n end",
"def shipped(order)\n @order = order\n mail to: order.mail, subject: 'Заказ из GlebKs stall отправлен'\n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def notification_of_new_update_to_listing(listing, recipient, host=nil)\n set_locale recipient.locale\n subject_string = t(:listing_you_follow_has_been_updated)\n url = host ? \"http://#{host}#{listing_path(listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(recipient.id)}\" : \"test_url\"\n recipients recipient.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :listing => listing, :url => url, :settings_url => settings_url, :recipient => recipient, :listing_title => get_title_with_category(listing)\n end",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"cneumann@marsmonitoring.com\") #.deliver_later\n end",
"def new_quote_notice(quote)\n @quote = quote\n mail(subject: \"[team] New Enquiry Received\")\n end",
"def notification(user,fname,grade, comment,labname)\n @grade = grade\n\t@fname = fname\n\t@comment = comment\n\t@lab_name = labname\n mail(to: user, subject: 'Lab Grade')\n end",
"def send_mail_confirm(data)\n @name = data[:name]\n @body = data[:body]\n\n address = ['tt.tanishi100@gmail.com']\n address += ['hajiming@gmail.com', 'aki030402@gmail.com'] if Rails.env.production?\n mail(\n :subject => \"Pornfolio お問い合わせ\",\n :to => address.join(',')\n )\n end",
"def subscription(letter)\n @greeting = \"ご担当者様\"\n @name = letter.name\n @company = letter.company\n @email = letter.email\n mail to: \"office.comforthousing@gmail.com\",subject: \"[コンフォート]ニュースレター購読申し込み\"\n end",
"def send_confirmation_sms\n SmsApi.send_sms \"+1#{self.phone}\", \"Your confirmation code for StreetEats is #{self.phone_confirmation_code}\"\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def received(order)\n \t@order = order\n\n @greeting = \"Привет, #{@order.profile.first_name}!\"\n\n emails = [@order.profile.email, 'order@ginius.ru']\n # emails = [@order.profile.email]\n mail to: emails, subject: \"Ginius: заявка №#{@order.id} принята!\"\n end",
"def notify_order(order)\n @order = order\n to = ADMIN_EMAIL\n\n mail :to => email_to(to), :subject => \"Pocket Prints Order ##{order.order_code}\"\n end",
"def create_msg(txt)\n if :locale == 'de'\n self.action = \"Nachricht: '#{txt}'\"\n else\n self.action = \"Message: '#{txt}'\"\n end\n end",
"def dispute_notification(id, amount, currency)\n @id, @amount, @currency = id, amount, currency\n \n mail to: \"kaysertranslation@gmail.com\",\n subject: \"Hikarigo dispute created. Attention may be needed\"\n end",
"def send_notification(msg)\n $BLIX_NOTIFY.push(msg)\n puts \"[DummyServer] notify: message=#{msg}\" if $DEBUG\n end",
"def message\n \"You have a new notification!\"\n end",
"def mattching_men(user)\n @user = user\n mail(\n subject: \"【トークストア】マッチングしました!\", #メールのタイトル,\n to: user.email\n ) do |format|\n format.text\n end\n end",
"def notify_changed_request_status(request)\n @request=request\n mail(to: request.user.email,\n subject: \"#{request.user.name} your request has been #{I18n.t \"request_status.#{request.status}\"}\")\n end",
"def shipped(order)\r\n @order = order\r\n mail to: order.email, subject: 'Заказ из Pragmatic Store отправлен'\r\n end",
"def event_notify(uri, event, hdrs = {})\n hnames = hdrs.keys.map { |k| k.to_s.downcase } || []\n hdrs[\"To\"] = \"<#{uri}>\" unless hnames.include?(\"to\")\n hdrs[\"From\"] = \"<#{uri}>;tag=#{rand(1 << 32)}\" unless hnames.include?(\"from\")\n hdrs[\"Event\"] = EVENTNOTIFY[event] || event.to_s\n\n uac_dlg \"NOTIFY\", uri, hdrs\n end",
"def notification_per_succ_ref(smb, code_id, customer, friend, campaign)\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n @code_id = code_id\n mail(:to => smb.email, :subject => \"Successful Referral Notification\")\n end",
"def important_message\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def welcome_email(user_info)\n @email = user_info[:mail]\n @name = user_info[:name]\n mail(:to => @email, :subject => \"تم تأكيد تسجيلك في !\")\n end",
"def contact_mail\n @greeting = \"お問い合わせ\"\n # @contact = contact\n\n mail to: \"to@example.org\"\n\n mail subject: \"myAppからお問い合わせがありました\"\n end",
"def came_question\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/questions/#{@question.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@question.user.login_name}さんから質問がありました。\"\n end",
"def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end",
"def send_messages(event)\n begin\n scheme = request.scheme\n host = request.host\n rescue NameError\n scheme = 'http'\n host = 'testing'\n end\n message = <<EOL\nPlease attend this blood drive event and help save lives.\n#{scheme}://#{host}/events/#{event.id}\nEOL\n Donor.where(zipcode: event.zipcode).map(&:phone).each do |ph|\n @client.messages.create(:from => twilio_number, :to => ph , :body =>message)\n end\n end",
"def email_sent(to)\n puts green(\"Notification sent to: #{to}\")\n end",
"def new_caitredette_service_notice(req)\n @req = req\n mail(subject: \"[team] New Caitredette Service Request Received\")\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def signup_notification(user)\n\t\tsetup_email(user)\n\t\t subject self.site_name+\" : \"+I18n.t('mailer.signup_notification.subject')\n\t\t body :url => self.daurl+\"/admin/activate/#{user.activation_code}\",\n\t\t\t:site => self.site_name,\n\t\t\t:user_login => user.login,\n\t\t\t:user_password => user.password\n end",
"def contacto\n @greeting = \"Hi\"\n\n #@email = 'email al cual envias' #<- email al cual enviaras\n #@alias = '' #<- nombre de quien envia ejem 'Carlos Acosta Del Rio'\n #@reply = '' #<- a quien contestaran\n \n\n mail :to => @email, :subject => \"Contacto De Su Sitio SIC\", :from => \"\\\"\" + @alias + \"\\\" \", :reply_to => @reply\n end",
"def notice_post\n @greeting = \"Hi\"\n\n mail to: \"dan5.ya+bukt@gmail.com\"\n end",
"def notify_password_reset!\n with_user_locale do\n reset_single_access_token!\n UserMailer.password_reset(self).deliver!\n end\n end",
"def delete_notification\n\n @greeting = \"Hi\"\n\n mail to: \"seekle.info@gmail.com\",subject:\"ユーザー退会した!\"\n \nend",
"def inquiry(contact_message)\n @contact_message = contact_message\n mail to: \"newsletterstar@gmail.com\",\n from: contact_message.email,\n subject: \"Neue Kontaktanfrage\"\n end",
"def order_shipped\n@greeting = \"Hi\"\nmail :to => \"to@example.org\"\nend",
"def notify_order\n UserMailer.notify_order\n end",
"def recepcion\n @greeting = \"Hi\"\n\n mail to: \"jlaraojeda@gmail.com\", :subject =>\"nuestro primer correo\"\n end"
] |
[
"0.654578",
"0.65252733",
"0.64850813",
"0.6276096",
"0.62659794",
"0.6239277",
"0.6083753",
"0.6067907",
"0.5981108",
"0.5964361",
"0.59534293",
"0.59455216",
"0.5942909",
"0.5942316",
"0.59048444",
"0.5872955",
"0.58694094",
"0.58549124",
"0.5846537",
"0.5846181",
"0.58425",
"0.5838309",
"0.582429",
"0.58043015",
"0.58025146",
"0.5795961",
"0.576101",
"0.5760679",
"0.5751164",
"0.57303476",
"0.5728748",
"0.5723246",
"0.5722577",
"0.5696598",
"0.56964236",
"0.56963426",
"0.569184",
"0.5682742",
"0.5665523",
"0.56586194",
"0.5656113",
"0.5655178",
"0.56519383",
"0.5650496",
"0.5646636",
"0.5640457",
"0.56342906",
"0.56249523",
"0.5596749",
"0.55855465",
"0.5580985",
"0.55797076",
"0.5578321",
"0.5573917",
"0.55711675",
"0.5566603",
"0.55492556",
"0.55352926",
"0.55284065",
"0.5517928",
"0.55157864",
"0.5511566",
"0.5510229",
"0.5508906",
"0.5505997",
"0.55035675",
"0.55024004",
"0.5500942",
"0.5492783",
"0.54922026",
"0.54865533",
"0.54798687",
"0.5473316",
"0.5470668",
"0.547028",
"0.5453882",
"0.5451989",
"0.544439",
"0.5443861",
"0.54417115",
"0.5440891",
"0.54407895",
"0.5437653",
"0.5436557",
"0.5435738",
"0.5434469",
"0.5431026",
"0.54289126",
"0.54141057",
"0.54111946",
"0.5404467",
"0.5396606",
"0.5395582",
"0.5392601",
"0.5391215",
"0.5388996",
"0.5384369",
"0.53842133",
"0.53804016",
"0.53758156"
] |
0.6973913
|
0
|
WARNING: DO NOT INLINE : Hack for collective
|
def french_model_file
FRENCH_MODEL_FILE
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inline_code; end",
"def inline?; false; end",
"def inline?; false; end",
"def all_inline?; end",
"def private; end",
"def code_point=(_); end",
"def probers; end",
"def big_bad; end",
"def max_fast_inline(num_of_requests); end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def external; end",
"def internal; end",
"def villian; end",
"def bs; end",
"def custom; end",
"def custom; end",
"def isolated; end",
"def isolated; end",
"def rassoc(p0) end",
"def generate_comprehensive\n\n end",
"def ibu; end",
"def parse_inline_math; end",
"def terpene; end",
"def anchored; end",
"def suivre; end",
"def berlioz; end",
"def code_point; end",
"def sharp; accidental; end",
"def plain; end",
"def tiny; end",
"def final; end",
"def early_inline(fname, abi, t, a, link_out, code, label)\n # Fresh labels, scalar variables and vector variables on demand.\n # Asking for l[x] the first time generates a new object\n # of the right type. Asking again fetches the same object.\n l = Hash.new{|ht,k| ht[k] = new_label}\n l[0] = label\n l[-1] = link_out\n s = Hash.new{|ht,k| ht[k] = Variable.fresh(:scalar)}\n v = Hash.new{|ht,k| ht[k] = Variable.fresh(:vector)}\n # This special object makes it possible to specify code\n # expansion in a very convenient way.\n # The definition is pretty ugly, don't worry - it just works :-)\n # RUBY 1.9: For Ruby 1.9 .send needs to be changed to .funcall (or .fcall)\n c = Object.new\n (class << c; self; end).send(:define_method, :[]=) {|lab, dsc|\n code[l[lab]] = Code.new(dsc[0], [], dsc[1], *dsc[2..-1].map{|i| l[i]})\n }\n\n case fname\n when 'length'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:dp3, [s[0], a[0], a[0]], 1]\n c[1] = [:rsq, [s[1], s[0]], 2]\n c[2] = [:rcp, [t, s[1]], -1]\n when 'radians'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:mul, [t, a[0], Math::PI/180.0], -1]\n when 'degrees'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:mul, [t, a[0], 180.0/Math::PI], -1]\n when 'inversesqrt'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:rsq, [t, a[0]], -1]\n when 'sqrt'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:rsq, [s[0], a[0]], 1]\n c[1] = [:rcp, [t, s[0]], -1]\n when 'distance'\n raise \"#{fname} function should have 2 arguments\" unless a.size == 2\n c[0] = [:sub, [v[0], a[0], a[1]], 1]\n c[1] = [:dp3, [s[0], v[0], v[0]], 2]\n c[2] = [:rsq, [s[1], s[0]], 3]\n c[3] = [:rcp, [t, s[1]], -1]\n when 'normalize'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n # v1 = arg[0] . arg[0]\n # target = rsq(v1) * arg[0]\n c[0] = [:dp3, [s[0], a[0], a[0]], 1]\n c[1] = [:rsq, [s[1], s[0]], 2]\n c[2] = [:mul, [t, a[0], s[1]], -1]\n else\n #code[l[0]] = Code.new(:call, [], [fname, abi, target, *args], l[-1])\n c[0] = [:call, [fname, abi, t, *a], -1]\n end\nend",
"def preproc; end",
"def inline!\n @inline = true\n end",
"def too_complex; end",
"def silly_adjective; end",
"def intern() end",
"def preprocess(&block); end",
"def original; end",
"def sld; end",
"def wrapper; end",
"def _V(data) ; end",
"def code_of_conduct; end",
"def outer; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def alt; end",
"def sic_code; end",
"def schubert; end",
"def beautify; end",
"def beautify; end",
"def lsi; end",
"def my955; end",
"def stderrs; end",
"def precompiled(locals)\n source, offset = super\n [source, offset + 1]\n end",
"def cops; end",
"def cops; end",
"def cops; end",
"def grade_inline?\n false\n end",
"def processed_source=(_); end",
"def processed_source=(_); end",
"def malts; end",
"def autofinish; end",
"def possibly_include_hidden?; end",
"def op; end",
"def begin; end",
"def rewrite_inline_code(code)\n\n # Fors strings file, remove server-side keys (i.e '@@foo' = 'bar')\n if localized_strings?\n code.gsub!(/[\"']@@.*[\"']\\s*?:\\s*?[\"'].*[\"']\\s*,\\s*$/,'')\n\n # Otherwise process sc_super\n else\n code.gsub!(/sc_super\\(\\s*\\)/, 'arguments.callee.base.apply(this,arguments)')\n code.gsub!(/sc_super\\((.+?)\\)/) do\n SC.logger.warn \"\\nWARNING: Calling sc_super() with arguments is DEPRECATED. Please use sc_super() only.\\n\\n\"\n \"arguments.callee.base.apply(this, #{$1})\"\n end\n end\n\n # and finally rewrite static_url\n replace_static_url(code)\n code\n end",
"def code=(_arg0); end",
"def code=(_arg0); end",
"def interpret\r\n return __________________ # <<2\r\n end",
"def compilereturn\n\n end",
"def ca; end",
"def transform; end",
"def processor; end",
"def jack_handey; end",
"def intensifier; end",
"def strain; end",
"def g; end",
"def g; end",
"def formation; end",
"def herald; end",
"def spice; end",
"def transformations; end",
"def as_you_like_it_quote; end",
"def src; end",
"def src; end",
"def src; end",
"def verdi; end",
"def expanded; end",
"def internal?; end",
"def herebody_s=(_arg0); end",
"def succ!() end",
"def faint; end",
"def faint; end"
] |
[
"0.6889724",
"0.6675696",
"0.6675696",
"0.6618395",
"0.6413179",
"0.60098547",
"0.5924349",
"0.59042925",
"0.58059376",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5775712",
"0.5763482",
"0.5759488",
"0.5732742",
"0.5730331",
"0.5730331",
"0.57157785",
"0.57157785",
"0.57097596",
"0.5690535",
"0.56876093",
"0.5680356",
"0.566914",
"0.56416893",
"0.56342703",
"0.5624095",
"0.56100696",
"0.56092924",
"0.55989814",
"0.55871433",
"0.5581742",
"0.55780387",
"0.55769175",
"0.5565742",
"0.55635035",
"0.55398196",
"0.55318123",
"0.5525776",
"0.5515511",
"0.55123097",
"0.5500627",
"0.54947627",
"0.54812753",
"0.54546374",
"0.5442673",
"0.5442673",
"0.5442673",
"0.54425573",
"0.5437376",
"0.5420573",
"0.5414574",
"0.5414574",
"0.5413176",
"0.53742486",
"0.53727734",
"0.53691196",
"0.5367022",
"0.5367022",
"0.5367022",
"0.5365413",
"0.5349145",
"0.5349145",
"0.5347691",
"0.53472185",
"0.53428966",
"0.53382486",
"0.5334242",
"0.5329924",
"0.5329687",
"0.5329687",
"0.5321954",
"0.5314514",
"0.530971",
"0.53064",
"0.5298274",
"0.52941173",
"0.52940476",
"0.5292523",
"0.52880234",
"0.52880234",
"0.52871037",
"0.5284684",
"0.5282411",
"0.5279874",
"0.5274409",
"0.5272139",
"0.5272139",
"0.5272139",
"0.52711064",
"0.52506137",
"0.5250392",
"0.52494025",
"0.52466226",
"0.52463216",
"0.52463216"
] |
0.0
|
-1
|
send notification in english to this address
|
def notify_english(dest)
mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notify_french(dest)\n mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))\n end",
"def tender_updated\n @greeting = \"Χαίρετε\"\n\n mail to: \"to@example.org\"\n end",
"def admin_broadcast(desired_locale, emails_as_string, subject, body)\n ActionMailer::Base.smtp_settings = APP_CONFIG[:admin_mail]\n set_locale( desired_locale )\n\n @content_type = \"text/html\"\n @recipients = \"noreply@kroogi.com\"\n @bcc = emails_as_string\n @from = head_encode(\"\\\"Kroogi (No Reply)\\\"\".t) + \" <noreply@kroogi.com>\"\n @subject = head_encode(\"[Kroogi] \" + subject)\n @sent_on = Time.now\n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/\"\n @body[:body] = body\n end",
"def send_notification\n\n\n end",
"def notify_shipped(order)\n @order = order\n @info = @order.info\n email = @order.user.email\n subject = \"特快車出貨通知! (訂單編號:#{@order.token})\"\n\n mail(to: email, subject: subject) do |format|\n format.text\n format.html\n end\n end",
"def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"mitsuimasayoshi@gmail.com\", subject: \"[Localgarage]Printer_URL\"\n end",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_text_message(note)\n @greeting = note.message + \" (\" + note.created_at.in_time_zone(\"Eastern Time (US & Canada)\").strftime('%m/%d/%Y') + \")\"\n\n mail to: '8593613596@vtext.com, tkcrone@gmail.com, 8593611777@vtext.com, twcrone@gmail.com', subject: 'Love Note'\n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def new_letter_notification(message)\n sender = User.find message.user_id\n reciever = User.find message.reciever\n setup_email(reciever)\n @subject += \"Вам пришло личное сообщение от #{sender.full_name}\"\n body[:sender] = sender\n body[:message] = message\n body[:url] = RAILS_URL + \"messages/view/#{message.id}\"\n end",
"def notification(params)\n mail(params)\n end",
"def send_message(short_msg, long_msg, notification_type_name, sanitize_text = true, data = '', push_data = '')\n message = Alerter::MessageBuilder.new({\n recipients: self,\n short_msg: short_msg,\n long_msg: long_msg,\n data: data,\n push_data: push_data.to_s,\n notification_type: NotificationType.find_or_create_by(name: notification_type_name),\n }).build\n message.save!\n message.deliver sanitize_text\n end",
"def notify from, to, message, data = nil\n string = \"Alert: #{@@alert_name}\n\n[ #{from} ] => [ #{to} ]\n \n#{message}\n \n \"\n string += \"\n \n Data: \n #{data}\n \" if data\n print string\n self.send_slack(string)\n self.send_telegram(string)\n end",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def message\n \"You have a new notification!\"\n end",
"def send_devise_notification(notification, *args)\n I18n.with_locale(locale) { super notification, *args }\n end",
"def send_message(email, text)\n @notification_server.send_message email, text\n end",
"def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end",
"def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end",
"def send_notification(user, questionnaire)\n I18n.default_locale = I18n.locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you'),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers)\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def send_notification(msg)\n $BLIX_NOTIFY.push(msg)\n puts \"[DummyServer] notify: message=#{msg}\" if $DEBUG\n end",
"def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def notification(to,f)\n send_as :notification\n recipients to\n from f\n fbml \"Not\"\n end",
"def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <noreply@svivatova.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def notify(internet_up)\n time = Time.now\n if internet_up\n %x( growlnotify -m \"The internet is up!\")\n puts \"Internet is UP\".green + \" @ #{time.strftime(\"%I:%M:%S %p\")}\"\n puts \"Text sent!\".blue if @mail.deliver\n else\n %x( growlnotify -m \"Internet is DOWN\" )\n puts \"Internet is DOWN\".red + \" @ #{time.strftime(\"%I:%M:%S %p\")}\"\n end\nend",
"def new_notification(name,email,mobile,description)\n @name = name\n @email = email\n @mobile = mobile\n @description = description\n mail to: \"bloomberg490@gmail.com, dineshcharkha@gmail.com \", subject: \"Query From Super White Marble\"\n end",
"def new_place_notification (merchant)\n @merchant = merchant\n mail to: \"sales@halalfoodhunt.com\", subject: \"A Place Has Been Listed\"\n end",
"def content(address, name)\n @greeting = \"Hi! #{name}\"\n\n mail to: address, subject: '謝謝你報名參加TKU Hackathon,提醒您活動時間是2014/3/29'\n end",
"def sent(order)\n @order = order\n mail :to => \"njunichiro@gmail.com\", :subject => \"注文を受けました\"\n end",
"def sendmail_confirm\n @greeting = \"元気ー?\"\n\n mail to: \"m.seino@ashita-team.com\"\n end",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def say_hi(medium)\n @medium = medium\n\n mail(to: '446146366@qq.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'hhuang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwu@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\").deliver\n end",
"def received(vin_cod)\n @vin_cod = vin_cod\n\n mail to: \"falcon.vinnica@gmail.com\", subject: 'Запрос по vin коду на Falcon motors'\n end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def send_message(text)\n end",
"def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_a_mail(name, title, body)\n @name = name\n @body = body\n @title = title\n\n #mail to: \"window@i.ua\"\n mail subject: \"Сообщение от сайта Никиты с темой #{@title}\"\n end",
"def send_messages(event)\n begin\n scheme = request.scheme\n host = request.host\n rescue NameError\n scheme = 'http'\n host = 'testing'\n end\n message = <<EOL\nPlease attend this blood drive event and help save lives.\n#{scheme}://#{host}/events/#{event.id}\nEOL\n Donor.where(zipcode: event.zipcode).map(&:phone).each do |ph|\n @client.messages.create(:from => twilio_number, :to => ph , :body =>message)\n end\n end",
"def show_notfication\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_sms\n status = self.status\n if status.upcase == 'INTERVENTION'\n self.message\n end\n end",
"def notify(params)\n @body = params[\"/contact\"][:message]\n @from = params[\"/contact\"][:email]\n @phone = params[\"/contact\"][:phone]\n @name = params[\"/contact\"][:name]\n mail to: \"renovationgroupedin@gmail.com\", subject: 'Mail from website', from: \"#{@from}\"\n end",
"def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end",
"def send_email(message)\n @message = message\n mail to: \"china@pozitive.biz, coddeys@gmail.com\", subject: \"Request from website\"\n end",
"def nmwp_notify(api_key, source_system, message)\r\n uri = URI.parse('https://notifymywindowsphone.com/publicapi/notify/')\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n params = {'apikey' => api_key, 'application' => \"Ventyx\", 'event' => source_system, 'description' => message}\r\n\r\n request = Net::HTTP::Post.new(uri.request_uri)\r\n request.set_form_data(params)\r\n response = http.request(request)\r\n\r\n Rails.logger.info \"#{Time.now.utc} - nmwp_notify - #{api_key} - #{source_system} - #{message}\"\r\n end",
"def send_notifications\n return if participant.nil?\n return unless participant.phone_number.length == 10\n\n # grab first 95 characters of description to serve as a preview\n description_preview = description[0...95]\n send_sms(participant.phone_number,\n \"An event in Binder has been assigned to you: #{description_preview}...\")\n end",
"def send_notifications\n end",
"def notify_host\n OrganisationMailer.notify_host\n end",
"def send_text_message(client:, user:, body:, tax_return: nil, locale: nil, to: nil)\n intake = Hub::ClientsController::HubClientPresenter.new(client).intake\n return unless intake.sms_notification_opt_in_yes?\n\n if intake.sms_notification_opt_in_yes? && !intake.sms_phone_number.present?\n DatadogApi.increment('clients.missing_sms_phone_number_for_sms_opt_in')\n return\n end\n\n replacement_args = { body: body, client: client, preparer: user, tax_return: tax_return, locale: locale }\n replaced_body = ReplacementParametersService.new(**replacement_args).process\n client.outgoing_text_messages.create!(\n to_phone_number: to || intake.sms_phone_number,\n sent_at: DateTime.now,\n user: user,\n body: replaced_body,\n )\n end",
"def email_sent(to)\n puts green(\"Notification sent to: #{to}\")\n end",
"def notify(bodystr, subject=nil, *to_addrs)\n from = '\"VAUtil\" <vautil@' + `/bin/hostname`.chomp + '>'\n to = to_addrs.map { |a| '<' + a + '>' }.join(', ')\n message = <<HERE\nFrom: #{from}\nTo: #{to}\nSubject: #{subject.nil? ? \"VAUtil Notification\" : subject }\nDate: #{Time.now}\nMessage-Id: <#{(0...20).map{ (('0'..'9').to_a + ('a'..'z').to_a).to_a[rand(36)] }.join}@coredial.com>\n\n#{bodystr}\nHERE\n Net::SMTP.start(VAUtil.config['mail_host'], 25, 'coredial.com') do |smtp|\n smtp.send_message(message, from, to_addrs)\n end\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def notify(msg, subject)\n end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def send_confirmation_sms\n SmsApi.send_sms \"+1#{self.phone}\", \"Your confirmation code for StreetEats is #{self.phone_confirmation_code}\"\n end",
"def notify_order(order)\n @order = order\n to = ADMIN_EMAIL\n\n mail :to => email_to(to), :subject => \"Pocket Prints Order ##{order.order_code}\"\n end",
"def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end",
"def reminder_email(user)\n @user = user\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end",
"def message text\n $status_message.value = text # trying out 2011-10-9 \n end",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"cneumann@marsmonitoring.com\") #.deliver_later\n end",
"def push_notification\n NotificationMailer.push_notification\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def notify *args # :nodoc:\n printf \"%8s %s\\n\", *args\n end",
"def notify_send(type, message)\n @notify_send ||= '/usr/bin/notify-send'\n puts \"#@notify_send -i gtk-dialog-#{type} 'CruiseControl' \\\"#{message}\\\"\"\n `#@notify_send -i gtk-dialog-#{type} 'CruiseControl' \\\"#{message}\\\"`\n end",
"def event_notify(uri, event, hdrs = {})\n hnames = hdrs.keys.map { |k| k.to_s.downcase } || []\n hdrs[\"To\"] = \"<#{uri}>\" unless hnames.include?(\"to\")\n hdrs[\"From\"] = \"<#{uri}>;tag=#{rand(1 << 32)}\" unless hnames.include?(\"from\")\n hdrs[\"Event\"] = EVENTNOTIFY[event] || event.to_s\n\n uac_dlg \"NOTIFY\", uri, hdrs\n end",
"def order_notification(ship)\n @ship = ship\n mail :subject => t('mytranslations.order_notification.subject'),\n :to => Refinery::Inquiries::Setting.notification_recipients,\n :reply_to => ship.client.email\n end",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def notify(subject,body,obj = nil,sanitize_text=true,notification_code=nil,send_mail=true,sender=nil)\n Mailboxer::Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code,send_mail,sender)\n end",
"def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end",
"def order_shipped(order)\n @order = order\n mail :to => User.find_by_id(@order.user_id).email, :subject => \"来自Time international GmbH的包裹发送信息\"\n end",
"def user_notification_address(user)\n ['\"', user.name, '\" <notifications@', domain, '>'].join\n end",
"def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"kat_tun_jinkazu_love@yahoo.co.jp\", subject: \"登録完了通知\"\n end",
"def admin_behavior_warning(email, company_phone, notification)\n @company_phone = company_phone\n @company = @company_phone.company\n @notification = notification\n mail(\n to: email,\n subject: 'GurúComm | Una línea esta cerca del límite de uso'\n )\n end",
"def mail_sent_to_admin(user)\n subject \"4D Techlab - New user\"\n from \"4d Techlab Notifier <noreply@4dtechlab.com>\"\n headers \"Reply-to\" => \"info@4dtechlab.com\"\n recipients 'pavel.krusek@gmail.com'\n sent_on Time.now\n #content_type = \"text/plain\"\n body :user_url => user_url(user)\n end",
"def confirm(order)\n @order = order\n mail :to => \"njunichiro@gmail.com\", :subject => \"注文を受けました。ありがとうございます。\"\n end",
"def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(link: \"/reports/#{@report.id}\")\n subject = \"[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end",
"def curate_text\n notification_type = get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n if notification_type.eql?('ACKNOWLEDGEMENT')\n @text += self.content[:short_text][:ack_info] unless self.content[:short_text][:ack_info].empty?\n else\n [:host_info, :state_info, :additional_info, :additional_details].each do |info|\n @text += self.content[:short_text][info] unless self.content[:short_text][info].empty?\n end\n end\n end",
"def post_announcement\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/announcements/#{@announcement.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@announcement.user.login_name}さんからお知らせです。\"\n end",
"def notify(message)\n Mail.deliver do\n to to\n from from\n subject subject\n body message\n end\n\n puts \"New message has been notified on Mail: #{message}\"\n end",
"def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\n end",
"def notify(message, options={})\n title = options.delete(:title) || 'Rulebow Notification'\n Notify.notify(title, message.to_s, options)\n end",
"def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end",
"def message\n t(\".message\")\n end",
"def message\n t(\".message\")\n end",
"def notify_changed_request_status(request)\n @request=request\n mail(to: request.user.email,\n subject: \"#{request.user.name} your request has been #{I18n.t \"request_status.#{request.status}\"}\")\n end",
"def send_ta_notification(user)\n\t\t@user = user\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def geo_notification(to_user, cc_users, new_subs, hostname)\n recipients \"#{to_user.name} <#{to_user.email}>\"\n cc cc_users.map{|user| \"#{user.name} <#{user.email}>\"}\n from \"pipeline@modencode.org\"\n reply_to \"help@modencode.org\"\n subject GEO_SUBJECT_TEMPLATE\n body :name => to_user.name.split(/ /).first,\n :subs_with_geo => new_subs[:with_geo],\n :subs_no_geo => new_subs[:no_geo],\n :subs_processing => new_subs[:processing],\n :hostname => hostname\n end"
] |
[
"0.64111954",
"0.6263988",
"0.62529945",
"0.62239",
"0.6223147",
"0.62105626",
"0.6192396",
"0.61874944",
"0.61850315",
"0.6183237",
"0.613429",
"0.6119588",
"0.6111077",
"0.6101984",
"0.6058111",
"0.6035919",
"0.6025501",
"0.6006228",
"0.5996783",
"0.5979157",
"0.5969079",
"0.5960152",
"0.5959944",
"0.59561974",
"0.5953028",
"0.59427565",
"0.59267825",
"0.5926193",
"0.5917677",
"0.5905038",
"0.58893347",
"0.5884609",
"0.5882146",
"0.58675545",
"0.58605725",
"0.5845681",
"0.5845224",
"0.5828579",
"0.581395",
"0.5808179",
"0.58027095",
"0.5796669",
"0.5767238",
"0.57629824",
"0.5762126",
"0.5752702",
"0.5742379",
"0.5741032",
"0.5729917",
"0.57005334",
"0.570007",
"0.56965935",
"0.56811464",
"0.5680871",
"0.5666342",
"0.5660884",
"0.5653075",
"0.56525224",
"0.56485987",
"0.56468016",
"0.56449336",
"0.5643478",
"0.5636069",
"0.56320316",
"0.5631378",
"0.56303036",
"0.56299394",
"0.56299394",
"0.5628106",
"0.5616661",
"0.5602066",
"0.5600965",
"0.55981237",
"0.5593772",
"0.5593635",
"0.5593527",
"0.5593527",
"0.55879515",
"0.55751026",
"0.5573338",
"0.5569718",
"0.55665696",
"0.55637527",
"0.5559887",
"0.555326",
"0.5551572",
"0.55487984",
"0.55461514",
"0.553831",
"0.55371636",
"0.5534912",
"0.5532257",
"0.5530586",
"0.5530129",
"0.553012",
"0.5528695",
"0.5528695",
"0.55194634",
"0.55192834",
"0.5502715"
] |
0.7066022
|
0
|
WARNING: DO NOT INLINE : Hack for collective
|
def english_model_file
ENGLISH_MODEL_FILE
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inline_code; end",
"def inline?; false; end",
"def inline?; false; end",
"def all_inline?; end",
"def private; end",
"def code_point=(_); end",
"def probers; end",
"def big_bad; end",
"def max_fast_inline(num_of_requests); end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def external; end",
"def internal; end",
"def villian; end",
"def bs; end",
"def custom; end",
"def custom; end",
"def isolated; end",
"def isolated; end",
"def rassoc(p0) end",
"def generate_comprehensive\n\n end",
"def ibu; end",
"def parse_inline_math; end",
"def terpene; end",
"def anchored; end",
"def suivre; end",
"def berlioz; end",
"def code_point; end",
"def sharp; accidental; end",
"def plain; end",
"def tiny; end",
"def final; end",
"def early_inline(fname, abi, t, a, link_out, code, label)\n # Fresh labels, scalar variables and vector variables on demand.\n # Asking for l[x] the first time generates a new object\n # of the right type. Asking again fetches the same object.\n l = Hash.new{|ht,k| ht[k] = new_label}\n l[0] = label\n l[-1] = link_out\n s = Hash.new{|ht,k| ht[k] = Variable.fresh(:scalar)}\n v = Hash.new{|ht,k| ht[k] = Variable.fresh(:vector)}\n # This special object makes it possible to specify code\n # expansion in a very convenient way.\n # The definition is pretty ugly, don't worry - it just works :-)\n # RUBY 1.9: For Ruby 1.9 .send needs to be changed to .funcall (or .fcall)\n c = Object.new\n (class << c; self; end).send(:define_method, :[]=) {|lab, dsc|\n code[l[lab]] = Code.new(dsc[0], [], dsc[1], *dsc[2..-1].map{|i| l[i]})\n }\n\n case fname\n when 'length'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:dp3, [s[0], a[0], a[0]], 1]\n c[1] = [:rsq, [s[1], s[0]], 2]\n c[2] = [:rcp, [t, s[1]], -1]\n when 'radians'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:mul, [t, a[0], Math::PI/180.0], -1]\n when 'degrees'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:mul, [t, a[0], 180.0/Math::PI], -1]\n when 'inversesqrt'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:rsq, [t, a[0]], -1]\n when 'sqrt'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n c[0] = [:rsq, [s[0], a[0]], 1]\n c[1] = [:rcp, [t, s[0]], -1]\n when 'distance'\n raise \"#{fname} function should have 2 arguments\" unless a.size == 2\n c[0] = [:sub, [v[0], a[0], a[1]], 1]\n c[1] = [:dp3, [s[0], v[0], v[0]], 2]\n c[2] = [:rsq, [s[1], s[0]], 3]\n c[3] = [:rcp, [t, s[1]], -1]\n when 'normalize'\n raise \"#{fname} function should have 1 argument\" unless a.size == 1\n # v1 = arg[0] . arg[0]\n # target = rsq(v1) * arg[0]\n c[0] = [:dp3, [s[0], a[0], a[0]], 1]\n c[1] = [:rsq, [s[1], s[0]], 2]\n c[2] = [:mul, [t, a[0], s[1]], -1]\n else\n #code[l[0]] = Code.new(:call, [], [fname, abi, target, *args], l[-1])\n c[0] = [:call, [fname, abi, t, *a], -1]\n end\nend",
"def preproc; end",
"def inline!\n @inline = true\n end",
"def too_complex; end",
"def silly_adjective; end",
"def intern() end",
"def preprocess(&block); end",
"def original; end",
"def sld; end",
"def wrapper; end",
"def _V(data) ; end",
"def code_of_conduct; end",
"def outer; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def alt; end",
"def sic_code; end",
"def schubert; end",
"def beautify; end",
"def beautify; end",
"def lsi; end",
"def my955; end",
"def stderrs; end",
"def precompiled(locals)\n source, offset = super\n [source, offset + 1]\n end",
"def cops; end",
"def cops; end",
"def cops; end",
"def grade_inline?\n false\n end",
"def processed_source=(_); end",
"def processed_source=(_); end",
"def malts; end",
"def autofinish; end",
"def possibly_include_hidden?; end",
"def op; end",
"def begin; end",
"def rewrite_inline_code(code)\n\n # Fors strings file, remove server-side keys (i.e '@@foo' = 'bar')\n if localized_strings?\n code.gsub!(/[\"']@@.*[\"']\\s*?:\\s*?[\"'].*[\"']\\s*,\\s*$/,'')\n\n # Otherwise process sc_super\n else\n code.gsub!(/sc_super\\(\\s*\\)/, 'arguments.callee.base.apply(this,arguments)')\n code.gsub!(/sc_super\\((.+?)\\)/) do\n SC.logger.warn \"\\nWARNING: Calling sc_super() with arguments is DEPRECATED. Please use sc_super() only.\\n\\n\"\n \"arguments.callee.base.apply(this, #{$1})\"\n end\n end\n\n # and finally rewrite static_url\n replace_static_url(code)\n code\n end",
"def code=(_arg0); end",
"def code=(_arg0); end",
"def interpret\r\n return __________________ # <<2\r\n end",
"def compilereturn\n\n end",
"def ca; end",
"def transform; end",
"def processor; end",
"def jack_handey; end",
"def intensifier; end",
"def strain; end",
"def g; end",
"def g; end",
"def formation; end",
"def herald; end",
"def spice; end",
"def transformations; end",
"def as_you_like_it_quote; end",
"def src; end",
"def src; end",
"def src; end",
"def verdi; end",
"def expanded; end",
"def internal?; end",
"def herebody_s=(_arg0); end",
"def succ!() end",
"def faint; end",
"def faint; end"
] |
[
"0.6889724",
"0.6675696",
"0.6675696",
"0.6618395",
"0.6413179",
"0.60098547",
"0.5924349",
"0.59042925",
"0.58059376",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5783583",
"0.5775712",
"0.5763482",
"0.5759488",
"0.5732742",
"0.5730331",
"0.5730331",
"0.57157785",
"0.57157785",
"0.57097596",
"0.5690535",
"0.56876093",
"0.5680356",
"0.566914",
"0.56416893",
"0.56342703",
"0.5624095",
"0.56100696",
"0.56092924",
"0.55989814",
"0.55871433",
"0.5581742",
"0.55780387",
"0.55769175",
"0.5565742",
"0.55635035",
"0.55398196",
"0.55318123",
"0.5525776",
"0.5515511",
"0.55123097",
"0.5500627",
"0.54947627",
"0.54812753",
"0.54546374",
"0.5442673",
"0.5442673",
"0.5442673",
"0.54425573",
"0.5437376",
"0.5420573",
"0.5414574",
"0.5414574",
"0.5413176",
"0.53742486",
"0.53727734",
"0.53691196",
"0.5367022",
"0.5367022",
"0.5367022",
"0.5365413",
"0.5349145",
"0.5349145",
"0.5347691",
"0.53472185",
"0.53428966",
"0.53382486",
"0.5334242",
"0.5329924",
"0.5329687",
"0.5329687",
"0.5321954",
"0.5314514",
"0.530971",
"0.53064",
"0.5298274",
"0.52941173",
"0.52940476",
"0.5292523",
"0.52880234",
"0.52880234",
"0.52871037",
"0.5284684",
"0.5282411",
"0.5279874",
"0.5274409",
"0.5272139",
"0.5272139",
"0.5272139",
"0.52711064",
"0.52506137",
"0.5250392",
"0.52494025",
"0.52466226",
"0.52463216",
"0.52463216"
] |
0.0
|
-1
|
public instance methods ...................................................
|
def total
Product.find(self.product_id).price * quantity.to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def implementation; end",
"def implementation; end",
"def initialize\n\t\t\n\tend",
"def instance; end",
"def instance; end",
"def instance; end",
"def internal; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n \n end",
"def initialize\r\n\r\n end",
"def initialize\n\n end",
"def initialize\n\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize() end",
"def public; end",
"def public; end",
"def initialize()\r\n\r\n end",
"def methods() end",
"def initialize\n \n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize()\n\t\tend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n\n\n\n end",
"def init\n\n end",
"def custom; end",
"def custom; end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n end",
"def private_method\n end",
"def initialize\n\t\nend",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def initialize()\n\n end",
"def init; end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def initialize()\n end",
"def wrapper; end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize\n # nothing here for now\n end",
"def probers; end",
"def schubert; end",
"def call\n # implement in subclasses\n end",
"def initialize\n # complete\n end",
"def initialize\n super\n end",
"def initialize\n super\n end"
] |
[
"0.8471986",
"0.75887525",
"0.75887525",
"0.7408363",
"0.7389037",
"0.7389037",
"0.7389037",
"0.733222",
"0.7306463",
"0.7306463",
"0.7306463",
"0.7306463",
"0.72930485",
"0.7246825",
"0.71916157",
"0.71916157",
"0.7188285",
"0.7188285",
"0.7188285",
"0.7188285",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.71772283",
"0.717547",
"0.7158524",
"0.7158524",
"0.7155128",
"0.7117962",
"0.70864844",
"0.7083803",
"0.7083803",
"0.7051571",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7049422",
"0.7008867",
"0.69978327",
"0.69662195",
"0.69662195",
"0.69255924",
"0.69255924",
"0.6889708",
"0.688844",
"0.68462354",
"0.68315357",
"0.68315357",
"0.68315357",
"0.68315357",
"0.68267643",
"0.6821341",
"0.678897",
"0.678897",
"0.678897",
"0.678897",
"0.678897",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.67836267",
"0.6782913",
"0.6782913",
"0.6782913",
"0.6782913",
"0.6782913",
"0.6782913",
"0.6778",
"0.6778",
"0.67705375",
"0.6753091",
"0.6741016",
"0.6741016",
"0.6741016",
"0.6735953",
"0.6735953",
"0.6735526",
"0.67244315",
"0.67237324",
"0.6723106",
"0.67188394",
"0.6716415",
"0.6716415"
] |
0.0
|
-1
|
return the string that contains last name, comma, space, first name Split the string and then combine them together in reverse
|
def swap_name(name)
name.split.reverse.join(', ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def flip_first_last_name(name)\n fixed_name = name.split(\", \")\n if fixed_name[1] \n fixed_name[1] + ' ' + fixed_name[0]\n else\n name\n end\n end",
"def last_name_first_name(name)\n last = last_name(name)\n first = name.gsub(last, '').strip \n \"#{last}, #{first}\"\n end",
"def rearrange(string)\n match = /(\\w+), (\\w+) (\\w+)/.match(string) #(1)\n last_name = match[1]\n first_name = match[2]\n middle_name = match[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\" #(2)\nend",
"def rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = match[1]\n first_name = match[2]\n if match[3]\n separator = \"#{match[3][0,2]}. \" # (2)\n else\n separator = ' ' # (3)\n end\n \n \"#{first_name}#{separator}#{last_name}\" # (4)\nend",
"def last_first_name\n ret = \"\"\n ret += name unless name.blank?\n ret += \", \" unless firstname.blank? or name.blank?\n ret += firstname unless firstname.blank?\n ret\n end",
"def swap_name(full_name)\n first, last = full_name.split\n \"#{last}, #{first}\"\n\n # LS solution:\n # full_name.split.reverse.join(', ')\nend",
"def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end",
"def your_name_reversed(x)\r\n x.to_str\r\n x.downcase! # Ensure all down-case for easier future coding\r\n x = x.split(' ')\r\n return x.reverse # Returns the swapped last and first name\r\nend",
"def reversed_name\n if infix\n [last_name, infix, first_name].join(', ')\n else\n [last_name, first_name].join(', ')\n end\n end",
"def split_first_lastname s\n last,first = s.split(/,/,2)\n first = '' if first == nil\n return first,last.capitalize\n end",
"def swap_name(first_last)\n first, last = first_last.split\n \"#{last}, #{first}\"\nend",
"def first_last_name\n names = name.split\n names.first + \" \" + names.last\n end",
"def swap_name(name_str)\n first_name, last_name = name_str.split\n \"#{last_name}, #{first_name}\"\nend",
"def first_last_name_swap(first_last_name)\n first_last_name.split.reverse.join(' ')\nend",
"def last_name_first\n if name\n stripped_name = name.strip\n\n leading_dots = if name =~ /^([A-Za-z\\s\\.]*)\\s/\n $1\n end\n\n if leading_dots\n stripped_name = stripped_name.gsub(/#{leading_dots}/, \"\")\n return stripped_name + \", \" + leading_dots\n end\n\n name_parts = stripped_name.split(' ')\n if name_parts.count > 1\n [name_parts[1, name_parts.length].join(' '), name_parts[0]].join(', ')\n else\n name\n end\n else\n \"\" # return empty string instead of nil if no name\n end\n end",
"def name_inverted\n [last_name, first_name].compact.join(', ')\n end",
"def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n #take just first letter of middle name\n last_first += middle_name.slice(0,1)\n last_first += \". \"\n end\n last_first\n end",
"def rearrange(string)\n has_middle_name = /(\\w+), (\\w+) (\\w+)/.match(string) # (1)\n no_middle_name = /(\\w+), (\\w+)/.match(string) # (2)\n\n if has_middle_name # (3)\n last_name = has_middle_name[1]\n first_name = has_middle_name[2]\n middle_name = has_middle_name[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\"\n elsif no_middle_name\n last_name = no_middle_name[1]\n first_name = no_middle_name[2]\n \"#{first_name} #{last_name}\"\n end\nend",
"def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend",
"def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = first.split.join\n last = last.split.join\n str = (first[0]+last).downcase.gsub(/[^0-9a-z]/i, '')\nend\nend",
"def swap_name(str)\n str.split.reverse.join(', ')\nend",
"def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend",
"def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend",
"def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end",
"def swap_name(str)\n str.split.reverse.join(\", \")\nend",
"def swap_first_last(name) \r\n\tnew_name = name.split(\" \").reverse.join(\" \")\r\n\treturn new_name\r\nend",
"def last_name\n name.split(' ').pop\n end",
"def pretty_name\n name = @first_name.concat(@last_name).split /(?=[A-Z])/\n name = name[0] + \" \" + name[1]\n return name\n # return first_name + \" \" + last_name\n end",
"def surname_and_initials\n a = split\n initials = a.pop\n a.collect(&:capitalize).join(' ') + ' ' + initials\n end",
"def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end",
"def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end",
"def first_name\n name.partition(',').last\n end",
"def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n first.gsub! (/[^a-z]/i, \"\")\n last.gsub! (/[^a-z]/i, \"\")\n ((first.split(\" \").join[0]<<last).split(\" \").join.downcase)\n\nend",
"def swap_name(string)\n string.split.reverse.join(', ')\nend",
"def swap_name(string)\n string.split.reverse.join(', ')\n end",
"def swap_name(full_name)\n first_name, last_name = full_name.split(' ')\n\n altered_name = \"#{last_name}, #{first_name}\"\nend",
"def swap_name(string)\n new_string = ''\n arr = string.split(' ')\n new_string << \"#{arr[-1]}, #{arr[0]}\"\nend",
"def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end",
"def format_name(first, last)\n\tf_return = \"\"\n\tl_return = \"\"\n\tif first[0]\n\t\tf_return = first.gsub(\" \", \"\")\n\t\tf_return =f_return.gsub(/[^A-Za-z]/, '')\n\t\tf_return = f_return[0].downcase\n\telse\n\t\tf_return = \"\"\n\tend\n\tif last[0]\n\t\tl_return = last.gsub(\" \", \"\")\n\t\tl_return = l_return.gsub(/[^A-Za-z]/, '')\n\t\tl_return.downcase!\n\telse\n\t\tlast = \"\"\n\tend\n if f_return[0] && l_return[0]\n \treturn f_return+l_return\n else\n \treturn nil\n end\nend",
"def swap_name(str)\n full_name = str.split\n \"#{full_name[1]}, #{full_name[0]}\"\nend",
"def format_name(first, last)\n first.gsub!(/\\d|\\W|_/, \"\")\n last.gsub!(/\\d|\\W|_/, \"\")\n if first.empty? || last.empty?\n nil\n else\n first.split(\" \").join.downcase[0] + last.split(\" \").join.downcase\n end\nend",
"def swap_name(str)\n \"#{str.split[1]}, #{str.split[0]}\"\nend",
"def name_swap\n\tuser_name = first_last.split(' ')\n\nend",
"def swap_first_last(name)\n name = name.downcase\n swap_name = name.split(' ')\n swap_name[1] << ' '\n swap_name_reverse = swap_name.reverse\n swap_name_reverse_joined = swap_name_reverse.join\nend",
"def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end",
"def swap_name(strings)\n strings.split.reverse.join(', ')\nend",
"def first_name(full_name)\n full_name.partition(', ').last\n end",
"def name\n [first_name, last_name].join(' ').strip\n end",
"def format_name(first, last)\n if last == '' || first == ''\n word = nil\n else\n user_name = ''\n user_name += first.gsub(' ', '').gsub(/[^0-9A-Za-z]/, '')[0]\n user_name += (last.gsub(' ','').gsub(/[^0-9A-Za-z]/, ''))\n user_name.gsub(/\\d/, '').downcase\n end\nend",
"def format_name(name)\n name.match(/\\,/).nil? ? name : \"#{name.split(\", \").reverse.join(\" \")}\"\n end",
"def swap_name(real_name)\n swapped_name = real_name.split(/ /).reverse #split and swap first name and last name\n last_name = swapped_name[0].chars\n first_name = swapped_name[1].chars\n swapped_name = [last_name, first_name] #split characters of the first and last names\nend",
"def swap_name(full_name)\n name_array = full_name.split(\" \")\n \"#{name_array[1]}, #{name_array[0]}\"\nend",
"def full_name\n [first_name, last_name].join(' ').strip\n end",
"def swap_name(string)\n \"#{string.split[1]}, #{string.split[0]}\"\nend",
"def swap_names(full_name)\n names = full_name.split(\" \")\n first_name = names[0]\n last_name = names[1]\n\n return [last_name, first_name]\nend",
"def name_lastfirst\n\t\treturn [ self.sn, self.givenName ].compact.join( ', ' )\n\tend",
"def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end",
"def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"def last_name_first_name\n \"#{last_name}, #{first_name}\"\n end",
"def listing_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tinitials = firstpart.gsub(/([[:upper:]])[a-zé]+/, '\\1.')\n\t\t\tinitials + ' ' + lastname\n\t\tend",
"def split_name\n\t\t@full_name.split('')\n\tend",
"def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end",
"def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def swap_name(name)\n name.split(' ').reverse.join(', ')\nend",
"def swap_name(name)\r\n name.split.reverse.join(', ')\r\nend",
"def last_name\n if name.split.count > 1\n name.split[-1]\n else\n ''\n end\n end",
"def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end",
"def format_name(first, last)\n if (first.empty? || last.empty?)\n nil\n else\n (first.gsub(/\\s+/, '')[0]+last.gsub(/\\s+/, '')).downcase\n end\nend",
"def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end",
"def format_name(first, last)\n if first.empty? || last.empty?\n nil\n else\n formatted_first = first.delete(' ')\n formatted_last = last.delete(' ')\n return (formatted_first[0] + formatted_last).downcase\n end\nend",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n \tnil\n else \n \tfirst.gsub!(/[^A-Za-z]/, '')\n \tlast.gsub!(/[^A-Za-z]/, '')\n \tfirst = first.strip\n\tlast = last.split.join(\"\").strip\n\tuser_name = first[0] + last\n\tuser_name = user_name.downcase \n end\n user_name\nend",
"def swap_name(name)\r\n name.split.reverse.join(\", \")\r\nend",
"def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end",
"def format_name(first, last)\n first.empty? || last.empty? ? nil :\n (first.gsub(/[^A-z]/, \"\")[0] + last.gsub(/[^A-z]/, \"\")).downcase\nend",
"def paternal_last_names\n \"#{last_name} #{last_name}\"\n end",
"def translate_name(name)\nreversed_name = name.split(' ').reverse\nnew_first = reversed_name[0].chars.map {|x|\n x.next\n }\nnew_last = reversed_name[1].chars.map {|x|\n x.next\n }\nnew_name = \"#{new_first.join} #{new_last.join}\"\nend",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n return nil\n end\n new_first = first.gsub(/\\W+/,\"\")\n new_last = last.gsub(/\\W+/,\"\")\n username = new_first[0] + new_last\n username = username.downcase.gsub(/\\d/,\"\")\n\nend",
"def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end",
"def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end",
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def format_name(first, last)\n\treturn nil if first.empty? || last.empty?\n (first.gsub(/[\\W0-9_]/, \"\")[0] + last.gsub(/[\\W0-9_]/, \"\")).downcase\nend",
"def full_name \n [first_name, last_name].join(' ')\n end",
"def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end",
"def first_to_last(name)\r\n\t# convert name into array\r\n\tnames = name.split(\" \")\r\n\t# swap first and last\r\n\tl = names.length - 1\r\n\ttemp = names[0]\r\n\tnames[0] = names[l]\r\n\tnames[l] = temp\r\n\t# convert array back into new string\r\n\tnew_name = names.join(\" \")\r\n\treturn new_name\r\nend",
"def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end",
"def informal_name\n given = given_name.presence || \"\"\n chinese, english = given.split(/,\\s*/)\n given = english.presence || chinese # nb. if no comma then chinese will hold the whole name and we'll show that.\n [given, family_name].join(' ')\n end",
"def swap_name_order(name)\n # Split input into first name and last name\n first_name = name.split(' ')[0].capitalize\n last_name = name.split(' ')[1].capitalize\n fake_name_1 = last_name + \" \" + first_name\nend",
"def full_name\r\n last_name.blank? ? \"#{first_name} #{mi}\" : \"#{last_name}, #{first_name} #{mi}\"\r\n end",
"def swap_name(given_name)\n name_array = given_name.split\n \"#{name_array[1]}, #{name_array[0]}\"\nend",
"def first_name\n n = @name.split(',')\n n[1].strip\n end",
"def names(first_name, last_name)\n\t\"#{last_name.upcase}, #{first_name.capitalize}\"\nend",
"def full_name\n [ first_name, last_name].join(' ').squeeze(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end"
] |
[
"0.76949465",
"0.76815027",
"0.76703227",
"0.7492497",
"0.7465855",
"0.74643314",
"0.7390674",
"0.73892635",
"0.7389244",
"0.73819494",
"0.736028",
"0.73563695",
"0.7341007",
"0.7325225",
"0.7317771",
"0.7270826",
"0.72299665",
"0.7215072",
"0.71906596",
"0.7142038",
"0.713571",
"0.7120644",
"0.7120644",
"0.7118858",
"0.71182674",
"0.707046",
"0.70456606",
"0.70455754",
"0.7040897",
"0.7032452",
"0.7022448",
"0.7005435",
"0.69720197",
"0.6968026",
"0.69581455",
"0.69336355",
"0.6909716",
"0.6875298",
"0.68583924",
"0.68583",
"0.6856193",
"0.6851292",
"0.6848296",
"0.6831974",
"0.68007624",
"0.67997205",
"0.67961013",
"0.67959905",
"0.6794726",
"0.678023",
"0.67799515",
"0.67710745",
"0.6769749",
"0.676339",
"0.67545277",
"0.67526436",
"0.6733077",
"0.6732845",
"0.6718001",
"0.6718001",
"0.6699768",
"0.6689039",
"0.6683257",
"0.66827595",
"0.6676955",
"0.66693807",
"0.66659164",
"0.66581345",
"0.66557235",
"0.6652061",
"0.66488206",
"0.6643205",
"0.66426647",
"0.66414684",
"0.6641296",
"0.663023",
"0.662752",
"0.66233087",
"0.66198933",
"0.66119474",
"0.66101646",
"0.6606254",
"0.66011596",
"0.65898573",
"0.6586066",
"0.6582127",
"0.65706706",
"0.6564574",
"0.65629673",
"0.6555678",
"0.65542114",
"0.6551295",
"0.65512574",
"0.6550055",
"0.6544019",
"0.65350217",
"0.65350217"
] |
0.6575941
|
89
|
Test that sentences of words are split up into distinct words correctly
|
def test_words
assert_equal(%w{this is a test}, "this is a test".words)
assert_equal(%w{these are mostly words}, "these are, mostly, words".words)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n original_str = @str.join( \" #{word} \" ) + \".\"\n assert_equal \"This #{word} Script.\", original_str.titlecase\n \n # Test with uppercase small word\n str = @str.join( \" #{word.capitalize} \" ) + \".\"\n assert_equal \"This #{word} Script.\", str.titlecase\n \n end\n end",
"def unique_words(text)\n split_normalise(text).uniq\nend",
"def test_words\n assert_equal(%w{this is a test}, \"this is a test\".words)\n assert_equal(%w{these are mostly words}, \"these are, mostly, words.\".words)\n end",
"def split_sentences\n #break text first by paragraph then into chunks delimited by a period\n #but these are not quite sentences yet\n chunks = (self.split(/\\n+/).map { |p| \"#{p}\\n\".split(/\\.(?:[^\\w])/) }).flatten.compact\n \n #if a sentence is split at Mr.|Ms.|Dr.|Mrs. \n #then recombine it with its remaining part and nil it to delete later\n tmp=''\n sentences = chunks.map { |c|\n ss = (tmp != '')? \"#{tmp}. #{c}\" : c\n if c.match(/(?:Dr|Mr|Ms|Mrs)$/) #what about John F. Kennedy ([A-Z])\n tmp = ss\n ss=nil\n else\n tmp = ''\n end\n ss\n } \n sentences.compact #delete nil elements\n end",
"def split(text)\n text.downcase.scan(WORDS).uniq\n end",
"def split_sentences\n sentences = self.plain_text.split(\".\")\n while sentences.include?(\" \") do\n sentences = check_for_blanks_in_arr(sentences)\n end\n sentences\n end",
"def test_words_without_spaces\n @words = @tester.words(number: 1000)\n\n @words.each { |w| refute_match(/\\s/, w) }\n end",
"def test_words_without_spaces\n @words = @tester.words(number: 1000)\n\n @words.each { |w| refute_match(/\\s/, w) }\n end",
"def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end",
"def test_get_words_many_spaces\n #assert false # bogus assert -- remove or comment out\n assert(@concordance.get_words(\" seven seventy seven \").length==4,\"Number of words returned wrong\")\n assert(@concordance.get_words(\" seven seventy seven \").include?(\"seven\"),\"Does not include all the words\")\n assert(@concordance.get_words(\" seven seventy seven \").include?(\"seventy\"),\"Does\nnot include all the words\")\n\n end",
"def split_in_similar_groups(words)\n words.select! { |word| word.size > POSTFIX_LENGTH }\n words.sort! { |a, b| a.size <=> b.size }\n\n split_by_condition(words, lambda { |a, b| a.size == b.size }).flat_map do |same_word_length_group|\n split_by_condition(same_word_length_group.sort,\n lambda { |a, b| same_part(a) == same_part(b) })\n end\n end",
"def split_words\n @split_words ||= words\n .downcase\n .split\n .collect{|w| w.gsub /\\W/, ''}\n end",
"def test_sentence_without_open_compounds_allowed\n 1000.times do\n sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: false)\n\n assert_equal(5, sentence.split.length)\n end\n end",
"def test_sentence_without_open_compounds_allowed\n 1000.times do\n sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: false)\n\n assert_equal(5, sentence.split.length)\n end\n end",
"def count_sentences\n \tself.split(/[.?!]/).delete_if{|obj| obj == \"\"}.count\n end",
"def count_sentences\n return self.split(/\\.|\\?|\\!/).delete_if {|word| word.size < 1}.count\n\n end",
"def unique_words(text)\n normalize(text).uniq\nend",
"def unique_words(text)\n normalize(text).uniq\nend",
"def test_standard_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end",
"def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end",
"def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n \n end",
"def count_sentences\n \n self.split(/[.?!]+/).count\n \n end",
"def count_sentences\n self.split(/[.?!] /).count\n end",
"def count_sentences\n array = self.split(/[.!?]\\s/)\n array.count\n end",
"def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|sentence| sentence.size < 2 }.count\n end",
"def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|w| w.size < 2}.size\n binding.pry\n end",
"def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end",
"def test_standard_words\n @words = @tester.words(42)\n @words.each {|w| assert @standard_wordlist.include?(w) }\n end",
"def all_possible_word_combos(input)\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tall = nouns + verbs + articles\n\t\n\ttemp_array_for_combo = []\n\tall_valid_sentences_based_on_input = []\n\n\tfor word in all do \n\t\tif input.include?(word)\n\t\t\ttemp_array_for_combo << word\n\t\tend\n\tend\n\t# how many words can be in sentence?\n\t# we dont have any rules for word count in a sentence, only examples are 3 or 4 word sentences\n\ttemp_array_test_validity = temp_array_for_combo.combination(4).to_a + temp_array_for_combo.combination(3).to_a \n\n\tfor sentence in temp_array_test_validity do \n\t\t# sort the characters \n\t\tcombined_sentence = sentence.join.chars.sort\n\t\tcombined_sentence = combined_sentence.join\n\t\t# and check to match with input\n\t\tif combined_sentence == input\n\t\t\tall_valid_sentences_based_on_input.push(sentence)\n\t\tend\n\tend\n\n\tfor sentence in all_valid_sentences_based_on_input do \n\t\tsentence = sentence.sort! { |a,b| a <=> b }\n\tend\n\treturn all_valid_sentences_based_on_input\nend",
"def one_off_words(str,word_list)\n result = []\n better_list = word_list.select{|word| word.size == str.size}\n better_list.each do |word|\n i = 0\n count = 0\n while i < word.size\n count += 1 if word[i] == str[i]\n i += 1\n end\n result << word if word.size - count == 1\n end\n result\nend",
"def valid_sentence(str, dictionary)\n $processing = {}\n final_result = []\n sentences(str, dictionary).each do |a|\n set = a.split(\" \")\n if all_words_valid?(set) && verb_correct?(set) && noun_articles_correct?(set)\n final_result << a\n end\n end\n final_result.sort! #This can be returned without any sort but it added because it looks cool.\n end",
"def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend",
"def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @wordlist, w }\n end",
"def test_sentence_choice\n assert_equal('This is a great test', \n WordPlay.best_sentence(['This is a test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test', WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end",
"def standardize(word)\n word.split(\"\").uniq\nend",
"def test_sentence_choice\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a test',\n 'This is another test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def count_sentences\n self.split(/[.!]/).count\n end",
"def alternate_words(sentence) #Not clear why failing test because exact same output\n\tarray = sentence.split(' ')\n\t\n\tnew_array = []\n\tarray.length.times {|index| new_array << array[index] if index.even?}\n\tnew_array.map! {|element| element.gsub(/\\p{P}(?<!')/, \"\")}\n\treturn new_array\nend",
"def love_test(s, t)\n e = []\n m = s.gsub(\" \",\"\").split(\"\") + t.gsub(\" \",\"\").split(\"\")\n e << s.gsub(\" \",\"\").split(\"\").uniq\n e << t.gsub(\" \",\"\").split(\"\").uniq\n l = e.flatten.group_by(&:itself).map { |i, d| [i, d.count]}.to_h\n k = l.keep_if{ |k, v| v > 1}\n print (m.size/k.size)\nend",
"def divide_sentence(chunk, prev_chunk_last_word)\n single_word = chunk.split.size == 1\n\n return [ EMPTY_STR, chunk ] if prev_chunk_last_word.empty? && single_word\n return [ EMPTY_STR, chunk ] if prev_chunk_last_word[LAST_SYMB] == SPACE_BAR && single_word\n return [ chunk, EMPTY_STR ] if prev_chunk_last_word[LAST_SYMB] != SPACE_BAR && chunk[FIRST_SYMB] != SPACE_BAR && single_word\n [\n (chunk[FIRST_SYMB] == SPACE_BAR ? SPACE_BAR : EMPTY_STR) + chunk.split[FIRST_SYMB..BEFORE_LAST_SYMB].join(SPACE_BAR),\n chunk.split.last + (chunk[LAST_SYMB] == SPACE_BAR ? SPACE_BAR : EMPTY_STR)\n ]\n end",
"def count_sentences\n sentence_array = self.split(/[.?!]/)\n sentence_array.delete_if{|sentence| sentence.empty?}\n sentence_array.length\n \n\n end",
"def words\n self.sentence.split('-')\n end",
"def words\n sentences.map { |sentence| sentence.words.map { |word| word } } .flatten.each\n end",
"def missingWords(s, t)\n res = []\n s_words = s.split(\" \")\n t_words = t.split(\" \")\n i = 0\n j = 0\n while i < s_words.length\n if s_words[i] != t_words[j]\n res.push(s_words[i])\n else \n j += 1\n end\n i += 1\n end\n res\nend",
"def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end",
"def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end",
"def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^[:blank:]]/, \"\")\n l.downcase!\n l.strip!\n # Only 'short' words (discard numbers only)\n l.split(\" \").reject{|w| /\\A\\d+\\z/.match(w) || w.length < 3 || w.length > 10}.each do |w|\n @valid_words.add(w)\n end\n end\n @valid_words\n end",
"def valid_sentence(string, dictionary)\n #Create a global variable to be able to access throughout\n $process = {}\n final_sentences = []\n sentences(string, dictionary).each do |array|\n set = array.split(\" \")\n if dictionary_words?(set) && verb_present?(set) && noun_articles_present?(set)\n final_sentences << array\n end\n end\n final_sentences.sort!\n end",
"def typoglycemiaSentence(input)\n words = input.split(' ')\n words.map! { |x| typoglycemiaWord(x) }\n words.join(\" \")\nend",
"def meaningful_words phrase, divider=\" \"\n\t\tphrase = normalize_phrase(phrase).split(divider)\n\t\tfilter(phrase)\n\tend",
"def test_word\n @standard_wordlist = I18n.translate('faker.lorem.words')\n\n 100.times { assert_includes @standard_wordlist, @tester.word }\n end",
"def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end",
"def word_seqs(str)\n runs = str.split( /(?:\\s[#{PUNCT}]+)|(?:[#{PUNCT}]+\\s)/ )\n runs.map do |run|\n run.gsub(/[#{PUNCT}]+/,' ').split(/\\s/).select{ |w| w !~ /\\s/ }\n end\n end",
"def alternate_words(sentence)\n alt_words=[]\n sentence.split(/[ \\!\\@\\$\\#\\%\\^\\&\\*\\(\\)\\-\\=\\_\\+\\[\\]\\:\\;\\,\\.\\/\\<\\>\\?\\\\\\|]/).reject {|word| word == \"\"}.each_with_index do |word, i|\n alt_words << word if i.even?\n end\n alt_words\nend",
"def split_words(str)\n\nend",
"def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend",
"def test_supplemental_words\n @words = @tester.words(number: 10_000, supplemental: true)\n\n @words.each { |w| assert_includes @complete_wordlist, w }\n end",
"def test_supplemental_words\n @words = @tester.words(number: 10_000, supplemental: true)\n\n @words.each { |w| assert_includes @complete_wordlist, w }\n end",
"def split_on_sentences(speaker, string)\n aa = []\n end_index = 0\n start_index = nil\n text_length = string.length\n while true\n if end_index < text_length\n start_index = end_index\n end_index = string.index(%r{\\.|\\?|!}, end_index)\n end_index ||= text_length\n aa << string[start_index...end_index.next].strip\n end_index += 1\n end\n break unless end_index < text_length\n end\n batch_subs(speaker, aa)\n end",
"def words\n @phrase = @phrase.split(' ')\n end",
"def interesting_words(sentence, stop_word_array=['a', 'the', 'on'])\n # TODO\nend",
"def variation_words word\n ( deletions(word) + transpositions(word) + replacements(word) + insertions(word) ).uniq\n end",
"def break_words(word, lowercase = false)\n normalized(word, lowercase: lowercase).split(/\\s+/)\n end",
"def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend",
"def word_unscrambler(str, words)\n result = []\n dictionary = words\n scrambled = str\n #words = words.sort! ###\n\n words.each do |word|\n #puts \" word.split = #{word.split}\" ########\n test = word.split\n test = test[0]\n puts \"test = #{test}\" ########\n #puts \"test.split = #{test.split}\" ######\n end\n\n\n puts \"dictionary = #{dictionary}\"\n puts \"scrambled = #{scrambled}\"\n #result = test ####\n\n return result\nend",
"def words(my_sentence)\n length = my_sentence.length\n words_array = []\n i = 0\n word = \"\"\n\n until i == length\n l = my_sentence[i]\n j = my_sentence[i + 1]\n \n if l != \" \" && j != \" \"\n word += l\n elsif l != \" \" && j == \" \"\n word += l\n words_array << word\n word = \"\"\n elsif l == \" \" && j == \" \"\n word += l\n elsif l == \" \" && j != \" \"\n word += l\n words_array << word\n word = \"\"\n end\n \n if i == length - 1\n words_array << word\n end\n\n i += 1\n end\n\n return words_array\nend",
"def alternate_words(sentence)\n\tnew = []\n \n'!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |x|\n sentence = sentence.gsub(x, ' ')\n end\n \n var = sentence.split() \n var.each_with_index {|x,y| new.push x if y.even?}\n\treturn new\nend",
"def adv\n @words1 = Word.all.sample(1)[0].word\n @words2 = Word.all.sample(1)[0].word\n end",
"def word_overlap?(item)\n first_array = self.clean_description.split.declutter\n second_array = item.clean_description.split.declutter\n\n first_array.percentage_similarity_to(second_array) > 85 ? \"Too much word overlap\" : false\n end",
"def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def break_words(stuff)\n words = stuff.split(' ')\nend",
"def tokenize(s)\nterms = s.gsub(/(\\s|\\d|\\W)+/u,' ').rstrip.strip.downcase.split(' ')\nterms.reject!{|term| @@stop_words.include?(term) || term.length < 3}\nterms\nend",
"def convert_sent sent\n # y = []\n # sent.split(' ').each do |x|\n # y << x.split('')\n # end\n # y\n # sent.split(' ').map(&:chars)\n\n alpha = ('a'..'z').to_a\n\n sent.chars.map(&:downcase).reject{ |x| x == ' ' }.uniq.sort == alpha\n sent.chars.map(&:downcase).reject{ |x| x == ' ' }.uniq.push('x').sort == alpha\n\nend",
"def words\n word_list = @lines.map do |line|\n line.split(\" \")\n end\n word_list.uniq\n end",
"def correct_words\n self.student_responses.select { |x| x.correct }.collect { |x| x.word_id }.uniq\n end",
"def test_contain_period\n %w( example.com del.icio.us ).each do |word|\n assert_equal word, word.titlecase\n end\n end",
"def split_word\n split_word = @random_word.split('')\n return split_word\n end",
"def count_sentences(text)\n # covers sentences that end with a ., ?, or !\n text.split(/[.?!]/).count \nend",
"def complex_words\n @complex_words ||= unique_words.select { |word| syllables_in(word) >= 3 }\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend",
"def real_words(permutations, wordlist)\n validwords = []\n wordlist = wordlist.to_set\n permutations.each { |x| validwords << x if wordlist.include?(x) }\n validwords\nend",
"def savvy_shuffled_sentence(s1,s2)\n hash1,hash2 = Hash.new(0),Hash.new(0)\n s1.split(' ').each {|word| hash1[word] += 1}\n s2.split(' ').each {|word| hash2[word] += 1}\n hash1 == hash2\nend",
"def words(s)\n s.split\nend",
"def o_words(sentence)\n\treturn sentence.split.select { |word| word.include?('o') } \nend",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map(&:downcase).include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def dedupe(words)\n words.select do |word|\n word.downcase != @word.downcase \n end\n end",
"def remove_duplicate_words(s)\n s.split(' ').uniq.join(' ')\nend",
"def reverberate(sentence)\n new_sentence = []\n\n sentence.split(' ').each do |word|\n if word.length > 2\n new_sentence << reverberated(word)\n else\n new_sentence << word\n end\n end\n new_sentence.join(' ')\nend",
"def ordered_word?(string)\n string.split('') == string.split('').sort ? true : false\nend",
"def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend",
"def to_sentences(paragraph)\n\n#---------------- Step 1: Break up paragraph into pieces based on punctuation. \n\n\told_sentences = paragraph.split(/(?<=\\.\"|\\.\\)|\\.)(?<!\\.\\s\\.|\\.\\s\\.\"|\\.\\s\\.\\))\\s(?!\\.)|(?<=\\.\\s\\.\\s\\.\\s\\.\"|\\.\\s\\.\\s\\.\\s\\.\\)|\\.\\s\\.\\s\\.\\s\\.)\\s/)\n\t\t\t\t\t\t\t\t\t\t# splits on space in two cases: 1. if preceded by exactly one dot, possibly followed by ) or \"\n\t\t\t\t\t\t\t\t\t\t# 2. if preceded by four dots, possibly followed by ) or \" \n\t\t\t\t\t\t\t\t\t\t# (exactly one dot before SPLIT no dot after) OR (four dots before SPLIT)\n\n\t\n#---------------- Step 2: Re-join some pieces so that embedded quotes and parenthetical remarks aren't broken.\n\n \tnew_sentences = []\n\told_count = 0\t\t\t\t\t\t# position in old array built in Step 1\n\tnew_count = 0\t\t\t\t\t\t# position in new array built now in Step 2\n\t\t\n\twhile old_count < old_sentences.length\n\t\t\t\t\t\t\t\t\t\t# each step in outer while loop adds a new element to new_sentences\n\t\tskip = 0\t\t\t\t\t\t# skip keeps track of how many elements of old_sentences are used\n\t\tnew_sentences[new_count] = old_sentences[old_count]\n\n\t\twhile old_count + skip < old_sentences.length and (new_sentences[new_count].count('\"')%2 == 1 or new_sentences[new_count].count('(') != new_sentences[new_count].count(')'))\n\t\t\t\t\t\t\t\t\t\t# each step in inner while loop checks last element of new_sentences for mismatched quotes or parentheses, ...\t\t\t\t\t\t\t\t\t\t\n\n\t\t\tif new_sentences[new_count].count(')') > new_sentences[new_count].count('(')\n\t\t\t\told_sentences[old_count] = old_sentences[old_count].sub!(/\\)/, \"\")\n\t\t\t\tbreak\n\t\t\tend\t\t\t\t\t\t\t# ... if there's a mismatched right parenthesis, deletes it, ...\n\n\t\t\tif old_count + skip + 1 == old_sentences.length and (new_sentences[new_count].count('(') > new_sentences[new_count].count(')'))\n\t\t\t\told_sentences[old_count] = old_sentences[old_count].sub!(/\\(/, \"\")\n\t\t\t\tskip = -1\n\t\t\t\tnew_count -= 1\n\t\t\t\tbreak\t\t\t\t\t# ... if there's a mismatched left parenthesis or quote,\n\t\t\tend\t\t\t\t\t\t\t# joins next element of old_sentences to current new_sentence, unless\n\t\t\t\t\t\t\t\t\t\t# reach end of paragraph with mismatch; then deletes mismatched ( or ',\n\t\t\t\t\t\t\t\t\t\t# not joining subsequent elements of old_sentences to current new_sentence.\n\t\t\tskip += 1\n\t\t\tnew_sentences[new_count] = new_sentences[new_count] + \" \" + old_sentences[old_count + skip]\t\t\t\n\t\tend\n\n\t\tnew_count += 1\t\t\n\t\told_count += skip + 1\n\tend\n\n\n#---------------- Step 3: Make sure each piece starts and ends with a single quote.\n\n\tsentences_with_quotes = []\n\tnew_sentences.each do |x|\n\t\tx = x.chomp\n\t\tx = \"'\"+x if x[0] != \"'\"\n\t\tx = x+\"'\" if x[x.length-1] != \"'\"\n\t\tsentences_with_quotes << x\n\tend\n\n\treturn sentences_with_quotes\n\nend",
"def test_String_003_ToSentence\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_003_ToSentence\")\n puts2(\"#######################\")\n \n \n puts2(\"\\nA specific string...\")\n sString = \"oNCE UPON a time Long ago and far away\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n \n puts2(\"\\nFour sets of 2 pseudo words as sentences...\")\n 4.times {\n sString = random_pseudowords(2,10)\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 3 pseudo words ending in a period as sentences...\")\n 2.times {\n sString = random_pseudowords(3,10) + \".\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 4 pseudo words ending in a exclamation point as sentences...\")\n 2.times {\n sString = random_pseudowords(4,10) + \"!\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 5 pseudo words ending in a question mark as sentences...\")\n 2.times {\n sString = random_pseudowords(5,10) + \"?\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n end",
"def alternate_words(sentence)\n #creates an array with all these symbols as elements\n #iterates throuch each element and makes new sentence\n #equal to the substitution of each of the element\n #which is being iterated in the array\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n sentence = sentence.gsub(char, ' ')\n end\n #new array called words, made out of splitting\n #string at every \" \" instance\n words = sentence.split\n #new empty array\n #pushes even indexed words into new array\n solution = []\n words.each_with_index do |word, index|\n solution << word if index.even?\n end\n solution\nend",
"def words_the_same?(word_to_test)\n word_to_test.downcase == @word.downcase\n end",
"def report_on_dups\n @sentences.each do |s|\n # Count pairs\n previous = \"\"\n s.each do |word,tag|\n if word == previous and tag != \".\" and tag != \".-hl\" and tag != \",\"\n puts word + \" \" + tag\n puts (s.map { |e| e.first }).join(' ')\n end\n previous = word\n end\n end\n end",
"def test_find_topic_sentences1\n\t text1 = [\"The sweet potatoes in the vegetable bin are green with mold.\"]\n\t\ttext2 = [\"The sweet potatoes in the vegetable bin are green with mold.\"]\n subm_text = Array.new\n subm_text << text1\n subm_text << text2\n\n #setting up sentences and similarities before generation of clusters\n subm_sents = Array.new #Sentence[] s = new Sentence[2]; \n g = GraphGenerator.new\n g.generate_graph(subm_text[0], pos_tagger, core_NLP_tagger, false, false)\n subm_sents << Sentence.new(0, g.vertices, g.edges, g.num_vertices, g.num_edges)\n g.generate_graph(subm_text[1], pos_tagger, core_NLP_tagger, false, false)\n subm_sents << Sentence.new(1, g.vertices, g.edges, g.num_vertices, g.num_edges)\n\n\t\t#calculating sentence similarity\n ssim = SentenceSimilarity.new\n #sentence similarity\n sent_sim = ssim.get_sentence_similarity(pos_tagger, subm_sents, speller)\n sent_list = ssim.sim_list\n sim_threshold = ssim.sim_threshold\n\t\t\n\t\tcg = ClusterGeneration.new\n #cluster creation \n result = cg.generate_clusters(subm_sents, sent_sim, sent_list, sim_threshold)\n \n #identifying topic sentences\n tsent = TopicSentenceIdentification.new\n tsent.find_topic_sentences(result, sent_sim)\n\t\t\n\t\t#assert statements\n\t\tassert_equal(1, result[0].topic_sentences.length) #only 1 topic sentence is selected\n\t\tassert_equal(1, result[0].topic_sentences[0].ID) #the first cluster contains 0 sentences\n\t\t\n\t #checking sentence states\n\t\tassert_equal(true, subm_sents[0].flag_covered)\n\t\tassert_equal(true, subm_sents[1].flag_covered)\n end"
] |
[
"0.6853352",
"0.68158805",
"0.66949224",
"0.66271335",
"0.66233927",
"0.6602829",
"0.6602356",
"0.6602356",
"0.6575891",
"0.64489406",
"0.64481384",
"0.6442091",
"0.6430795",
"0.6430795",
"0.64174986",
"0.6384774",
"0.6374738",
"0.6374738",
"0.63480407",
"0.6308421",
"0.62806326",
"0.6249617",
"0.62332827",
"0.62241507",
"0.62064695",
"0.6198154",
"0.61898184",
"0.61734486",
"0.61555845",
"0.61485946",
"0.6146408",
"0.6129023",
"0.6080877",
"0.60698617",
"0.6069273",
"0.6050409",
"0.6048448",
"0.603718",
"0.60223067",
"0.6004789",
"0.599434",
"0.5983385",
"0.59796965",
"0.5968471",
"0.5933349",
"0.5925",
"0.5923829",
"0.5915335",
"0.59132695",
"0.58895594",
"0.5887197",
"0.5877236",
"0.5876761",
"0.5874784",
"0.5862463",
"0.5854792",
"0.5854427",
"0.5849451",
"0.5849451",
"0.58477235",
"0.5822554",
"0.5818143",
"0.5810231",
"0.58088815",
"0.579675",
"0.57883",
"0.57878506",
"0.57808506",
"0.57766235",
"0.577394",
"0.57708555",
"0.5766446",
"0.5764448",
"0.57617134",
"0.5759863",
"0.57503957",
"0.57441133",
"0.5742905",
"0.57338417",
"0.5732966",
"0.5728957",
"0.5718241",
"0.5717853",
"0.5716903",
"0.57138234",
"0.57106036",
"0.57098025",
"0.5696828",
"0.56953764",
"0.5694805",
"0.56943744",
"0.5692873",
"0.5692679",
"0.56918466",
"0.5690879",
"0.56894284",
"0.5685331",
"0.56833833",
"0.5682661",
"0.5679008"
] |
0.6735185
|
2
|
Test that the correct sentence is chosen, given the input
|
def test_sentence_choice
assert_equal('This is a great test',
WordPlay.best_sentence(['This is a test',
'This is another test',
'This is a great test'],
%w{test great this}))
assert_equal('This is a great test',
WordPlay.best_sentence(['This is a great test'],
%w{still the best}))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_sentence_choice\n assert_equal('This is a great test', \n WordPlay.best_sentence(['This is a test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test', WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input).downcase # Taking the input, processing and prepare it\n\t\tsentence = best_sentence(prepared_input) # Finding the best sentence to use based on input\n\t\tresponses = possible_responses(sentence) # Finding what responses are suitable based on the sentence\n\t\tresponses[rand(responses.length)] # Randomly picking one of the sentences.\n\tend",
"def user_choice_text_version\n this_here = pick_a_story\n puts \"\\n #{this_here.title}\"\n puts \"\\n\"\n Narrabot::Scraper.aesop_fable_text(this_here) if !this_here.text_and_moral\n puts this_here.text_and_moral\n puts \"\\n\"\n #puts \"Would you like me to read this story in my beautiful voice?\"\n #input = gets.chomp\n #switch = yes_or_no(input)\n #if switch == true\n # puts \"\"\n # \"#{this_here.text_and_moral}\".play (\"en\")\n #else\n # puts \"\"\n # play_and_puts(\"Okay\")\n #end\n end",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def present_test(challenge)\n\n\tConsole_Screen.cls #clear the display area\n\tprint challenge + \"\\n\\n: \" #display the challenge sentence\n\tresult = STDIN.gets #collect the player's input\n\tresult.chop! #remove the end of line marker\n\n\t#analyze the player input and see if it is correct\n\tif challenge == result then\n\n\t#keep track of the number of corretly retyped challenge sentences \n\t$noRight += 1\n\tConsole_Screen.cls #clear the display area\n\t#keep player informed\n\tprint \"Correct!\\n\\nPress Enter to continue.\"\n\tConsole_Screen.pause #pause the game\n\nelse \n\n\tConsole_Screen.cls #clear the diplay area\n\t#keep the player informed\n\tprint \"Incorrect!\\n\\nPress Enter to continue\"\n\tprint \" Correct sentence: \" + challenge.to_s + \"\\tYour sentence: \" + result.to_s \n\tConsole_Screen.pause #clear the game\n\nuntil result != \" \"\n\n\tConsole_Screen.cls #clear the diplay area\n \n #prompt the playwer for permission to bein the test\n print \"You have to type something \"\n\n result = STDIN.gets #collect the player's response \n result.chop! #remove any extra characters appended to the string\t\nend\nend\nend",
"def test_ask_spaces_returns_answer\n magic_ball = Predictor.new\n assert_includes Predictor::ANSWERS, magic_ball.ask(\"Meow meow meow meow meow?\")\n end",
"def bob(sentence)\n\tif sentence.empty?\n\t\t\"Fine. Be that way!\"\n\telsif sentence == sentence.upcase && sentence != sentence.downcase\n\t\t\"Woah, chill out\"\n\telsif sentence.end_with?(\"?\")\n\t\t\"Sure\"\n\telse\n\t\t\"Whatever\"\n\t\t\n\tend\n\t\nend",
"def response_to(input)\n\t\tprepared_input = preprocess(input.downcase)\n\t\tsentence = best_sentence(prepared_input)\n\t\treversed_sentense = Wordplay.switch_pronouns(sentence)\n\t\tresponses = possible_responses(sentence)\n\t\treturn responses[rand(responses.length)]\n\tend",
"def test_String_003_ToSentence\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_003_ToSentence\")\n puts2(\"#######################\")\n \n \n puts2(\"\\nA specific string...\")\n sString = \"oNCE UPON a time Long ago and far away\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n \n puts2(\"\\nFour sets of 2 pseudo words as sentences...\")\n 4.times {\n sString = random_pseudowords(2,10)\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 3 pseudo words ending in a period as sentences...\")\n 2.times {\n sString = random_pseudowords(3,10) + \".\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 4 pseudo words ending in a exclamation point as sentences...\")\n 2.times {\n sString = random_pseudowords(4,10) + \"!\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 5 pseudo words ending in a question mark as sentences...\")\n 2.times {\n sString = random_pseudowords(5,10) + \"?\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n end",
"def correct(word)\n end",
"def rules_knowledge_question(name)\n puts \"\\n\\n#{name} do you know the rules of rock, paper, scissors? \\n\\n\"\n answer = gets.chomp.downcase\n return answer\nend",
"def test_valid_choice_true_2\n\t\tgame = SetGame.new\n\t\tuser_input = \"3\"\n\t\tassert_equal true, game.valid_choice?(user_input, 3)\n\tend",
"def afterStory(username)\n\nputs \"\n\nWould you like to hear another story?\"\n\nplayagainyesorno = gets.chomp.downcase\n\n case playagainyesorno\n when 'yes', 'yes please', 'yup'\n puts \"Great!\"\n puts \"Your choices are: Rom-Com, Cop Story, or Sci-Fi.\"\n choosestory(username)\n when 'no', 'nope', 'no way'\n puts \"\nOkay, goodbye!\"\n else\n puts \"I don't know what you said! \"\n afterStory(username)\n end\nend",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def confirm_text\n\n puts \"Is that correct? (yes or no)\".colorize(:cyan).indent(10)\n print \"***>\".indent(10)\n\n case gets.chomp.downcase\n when \"yes\"\n puts\n true\n when \"no\"\n puts \"OK let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n else\n puts \"That's not a valid selection. Let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n end\n\nend",
"def question\n\n puts \"What is the best song in the world?\"\n answer= gets.chomp.downcase\n\nend",
"def choose\r\n\tputs \"And what about programing? Do you like programing? Remember, Yes, no, or maybe, only!\"\r\n\tchoice = gets.chomp\r\n\tcase choice.downcase\r\n\twhen \"yes\"\r\n\t\tputs \"That\\'s great!\"\r\n\twhen \"no\"\r\n\t\tputs \"That\\'s too bad!\"\r\n\twhen \"maybe\"\r\n\t\tputs \"Glad you\\'re giving it a chance!\"\r\n\telse\r\n\t\tputs \"What does that even mean??\"\r\n\tend\r\nend",
"def check_sentence(sentence)\n\t# type here\n\t# change return\n\treturn true\nend",
"def speak_to_grandma(input_phrase)\n if input_phrase == \"I LOVE YOU GRANDMA!\"\n \"I LOVE YOU TOO PUMPKIN!\"\n elsif input_phrase!=input_phrase.upcase && input_phrase!=\"I LOVE YOU GRANDMA!\"\n \"HUH?! SPEAK UP, SONNY!\"\n else input_phrase!=input_phrase.upcase \n \"NO, NOT SINCE 1938!\"\n end\nend",
"def get_input(message, choices)\n print(message)\n response = gets.chomp.downcase\n while response.length < 1 || !choices.include?(response[0])\n print(\"Invalid selection. \" + message)\n response = gets.chomp.downcase\n end\n return response[0]\nend",
"def choose_word\n case @game_mode\n when \"computer guess\"\n puts \"Choose a word! (It must be in the dictionary)\"\n @word = gets.chomp\n when \"human guess\"\n @word = computer_guess\n end\n end",
"def levitation_quiz\n\t#your code here\n\t\n\tloop do \n\t\tputs 'What is the spell that enacts levitation?'\n spell=gets.chomp\n\t\tbreak if spell=='Wingardium Leviosa'\n\tend\n\tputs 'You passed the quiz!'\nend",
"def how_many_human_players()\n p \"How many human players [0: ai vs ai 1: player vs ai, 2: player vs player]\"\n choice = gets.chomp\n if [\"0\", \"1\", \"2\"].include?(choice) \n choice\n else\n p \"Incorrect Input\"\n how_many_human_players()\n end\nend",
"def game\n puts \"Time to play rock, paper, scissors, lizard, spock!\"\n puts \"Choose your move!\"\n get_input\n puts \"play again? (y)es (n)o\"\n choice = gets.chomp.strip.downcase\n exit unless choice.include?(\"y\")\n game\nend",
"def play(songs)\n puts \"What song would you like to play?\"\n choice = gets.strip #gets will make it a string\n if songs.include?(choice) #this would be better if we regex'ed it for presence of the first word because people are usually too lazy to type everything\n puts choice\n else\n if choice.to_i > songs.size || choice.to_i < 0\n puts \"Invalid input, please try again!\" \n else\n puts \"Playing #{songs[choice.to_i-1]}\"\n end\n end\n puts choice\nend",
"def asks(question: 'some default message', test: false)\n print question unless test\n test || gets.chomp\n end",
"def user_choice(input = nil)\n loop do\n input ||= gets.chomp.downcase\n break if %w[p i l].include?(input)\n puts \"invalid. (p)lay, (l)oad, or (i)nstructions\"\n input = nil\n end\n input\n end",
"def a_turn_of_phrase(sentence)\n # code goes here\nend",
"def difficulty(size,marker)\n p \"1 is easy, 2 is medium, and 3 is unbeatable difficulty\"\n choice = gets.chomp\n if [\"1\", \"2\", \"3\"].include?(choice) \n choose_ai(\"ai \" + choice,size,marker)\n else\n p \"Incorrect Input\"\n difficulty(size,marker)\n end\nend",
"def ask_for_yes_no(msg)\n ['y','yes'].include?(ask_for_user_input(\"#{msg} [y/N]\").strip.downcase)\nend",
"def feedback()\n return $prompt # $prompt is conditionally populated by good_letter(), word_test() and wrong_letter()\nend",
"def pt;z.gets 'Your choice:'; end",
"def sce1_opt1\n # sce1_opt = gets.chomp.to_s.downcase\n puts \"\\nLooks like you will never solve the mystery\"\n puts \"Game Over\"\n `say -vFred Game Over`\nend",
"def answer_question(data, mode)\n country = data[\"name\"]\n capital = data[\"capitalCity\"]\n unless capital == \"\"\n if mode == \"xmode\"\n puts \"#{capital} is the capital of what country?\\n\"\n else\n puts \"What is the capital of #{country}?\\n\"\n end\n guess = gets.chomp\n\n # abort program if \"EXIT\"\n if guess == \"EXIT\"\n abort(\"Bye!\")\n end\n\n # handle blank answers\n if guess == \"\"\n puts \"Incorrect! The capital of #{country} is #{capital}\\n\"\n return false\n end\n\n # allows up to 2 incorrect letters in answer\n # lower each string, and remove non-alphanumerics\n if mode == \"xmode\"\n leven_distance = Levenshtein.distance(guess.downcase.gsub(/[^A-Za-z0-9\\s]/i,''), country.downcase.gsub(/[^A-Za-z0-9\\s]/i,''))\n else\n\t\t\t leven_distance = Levenshtein.distance(guess.downcase.gsub(/[^A-Za-z0-9\\s]/i,''), capital.downcase.gsub(/[^A-Za-z0-9\\s]/i,''))\n end\n if leven_distance < 3 && leven_distance > 0\n if mode == \"xmode\"\n puts \"Your answer was off but we'll accept it! #{capital} is the capital of #{country}\\n\"\n else\n\t\t\t\t puts \"Your answer was off but we'll accept it! The capital of #{country} is #{capital}\\n\"\n end\n return true\n\t\t\telsif leven_distance == 0\n\t\t\t\t puts \"Correct!\\n\"\n\t\t\t\t\treturn true\n else\n if mode == \"xmode\"\n puts \"Incorrect! #{capital} is the capital of #{country}\\n\"\n else\n puts \"Incorrect! The capital of #{country} is #{capital}\\n\"\n end\n return false\n end\n else\n # do nothing\n end\nend",
"def get_sport_choice(sports_reg_ex)\n print \"Please enter the full name of a sport you would like information about:\"\n # Converts input to match format how sports are stored\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n while !sports_reg_ex.has_key? sport\n sport_suggestion = auto_suggest sport, sports_reg_ex\n\n if sport_suggestion != \"\"\n if (yes_no_input \"Did you mean #{sport_suggestion}? (Y/N): \") == \"Y\"\n sport = sport_suggestion\n else\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n else\n puts \"Couldn't identify a sport!\"\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n end\n sport\nend",
"def test_valid_choice_true_4\n\t\tgame = SetGame.new\n\t\tuser_input = \"8\"\n\t\tassert_equal true, game.valid_choice?(user_input, 8)\n\tend",
"def check_winner\n @word.downcase.chars == @guess\n end",
"def levitation_quiz\n loop do\n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\nend",
"def question\n puts \"What kind of maths would you like to do?\"\n @input = gets.chomp.downcase\nend",
"def get_valid_word\n word = gets.chomp\n until is_valid_word?(word)\n puts \"Be better.\"\n word = gets.chomp\n end\n word\n end",
"def test_ask_returns_an_answer\n magic_ball = Predictor.new\n assert_includes Predictor::ANSWERS, magic_ball.ask(\"Meow?\")\n end",
"def ask_guess\n guess = gets.chomp.downcase\n check_guess_is_valid?(guess) ? guess : ask_guess\n end",
"def conversation\n you_say = gets.chomp\n if you_say == \"woof\"\n puts \"WOOF WOOF WOOF\"\n elsif (you_say == \"shakil stop\") || (you_say == \"Shakil STOP!\")\n puts \" \"\n elsif you_say == \"meow\"\n puts \"woof woof woof woof woof\"\n elsif you_say.include? \"treat\"\n puts \" \"\n elsif you_say == \"go away\"\n exit\n end\nend",
"def test_say_favourite_language()\n #Act\n # phrase = @student.say_favourite_language('Ruby')\n # #Assert\n assert_equal('I love Ruby', @student.say_favourite_language('Ruby'))\n end",
"def get_valid_user_choice\r\n choice_ok = false\r\n choice = \"\"\r\n until choice_ok\r\n print \"> \"\r\n choice = gets.chomp\r\n choice_ok = verify_choice_ok(choice)\r\n puts \"Invalid choice.\" unless choice_ok\r\n end\r\n return choice\r\nend",
"def word_test()\n if $build_word.join == $word # if $build_word equals $word, the user won\n $game_over = true # set the flag to indicate that the game is over\n $game_won = true # set the flag to indicate that the player won the game\n $games_won += 1 # so increase the games_won score by 1\n else # if they don't match, run user_input() for another letter\n $prompt = \"Good job - that letter was in the word. Please guess again!\"\n end\nend",
"def test_valid_choice_true_3\n\t\tgame = SetGame.new\n\t\tuser_input = \"4\"\n\t\tassert_equal true, game.valid_choice?(user_input, 8)\n\tend",
"def guessed_all_correct?\n if self.output == self.word \n puts \"You have guessed the word\"\n end\n end",
"def start_game(states,capitals,correct,incorrect)\n50.times do\n question = rand(0..50)\n puts \"what is the Capitol of \" + states[question]\n answer = gets.chomp\n if answer == capitals[question]\n \t puts \"You ROCKSTAR!\"\n correct += 1\n puts \"You have #{correct} correct answer(s) so far - and #{incorrect} incorrect answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n else\n \t puts \"Learn our map... you UNPATRIOT!\"\n incorrect +=1\n puts \"You have #{incorrect} incorrect answer(s) so far - and #{correct} correct answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n end\n end\nend",
"def ask_if_ready(step, index)\n puts \"Are you ready for step #{index + 1}?\\n(#{step[:description]})\"\n answer = gets.chomp\n\n answer.upcase == 'Y' #if answer equals to yes...(if true)\nend",
"def good_boy\n puts \"Are you a good boy?! (Yes/No)\"\n input = gets.chomp\n if input == \"Yes\"\n puts \"Yes you are! Here's a treat!\"\n else\n puts \"That's right, you're a *great* boy!! Have a treat!!\"\n end\n end",
"def sentence; end",
"def test_mixed_pronouns\n assert_equal(\"you gave me life\",\n WordPlay.switch_pronouns(\"i gave you life\"))\n\n assert_equal(\"i am not what you are\",\n WordPlay.switch_pronouns(\"you are not what i am\"))\n end",
"def test_valid_choice_false_5\n\t\tgame = SetGame.new\n\t\tuser_input = \"s\"\n\t\tassert_equal false, game.valid_choice?(user_input, 8)\n\tend",
"def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend",
"def correct word\n known [word] or known(variation_words word) or [word]\n end",
"def test_valid_choice_false_3\n\t\tgame = SetGame.new\n\t\tuser_input = \"a\"\n\t\tassert_equal false, game.valid_choice?(user_input, 3)\n\tend",
"def choosestory(username)\n\nstorychoice = gets.chomp.downcase\n\n case storychoice\n when 'cop story', 'cop story', 'cop', 'cop'\n puts \"\nYou have chosen Cop Story.\"\n copstory(username)\n when 'rom com', 'rom-com', 'romance', 'rom', 'romcom'\n puts \"\n\nYou have chosen Rom-Com.\"\n romcom(username)\n when 'sci fi', 'sci-fi', 'sci', 'science fiction'\n puts \"\n\nYou have chosen Sci-Fi.\"\n scifi(username)\n else\n puts \"Sorry, I don't understand!\n \nWould you like to hear a Rom-Com, Cop Story, or Sci-Fi?\"\n choosestory(username)\n end\nend",
"def win_lose\n if @word_blank == @split_word.join\n puts \"\\nGood job #{@player}, you guessed #{@computer}\\'s word! Would you like to play again?(Yes/No)\\n\"\n rematch = gets.chomp.downcase\n \n elsif @mistakes == 7\n puts \"\\nSorry, #{@player} #{@computer}\\'s word was #{@chosen_word}. Would you like to play again?(Yes/No)\"\n rematch = gets.chomp.downcase\n end\n \n if rematch == \"yes\"\n \n new_game = Hangman.new(\"#{@player}\")\n new_game.chosen_word\n new_game.run\n \n elsif rematch == 'no'\n puts \"\\nThank you for playing!\"\n exit\n end\nend",
"def play_again?\n choice = ''\n loop do\n puts 'Do you want to play again? y/n '\n choice = gets.chomp.downcase\n break if %w(y n).include?(choice)\n puts \"invalid response. enter 'y' or 'n'\"\n end\n choice == 'y'\nend",
"def make_sentence(name, sport)\n puts \"Did you know #{name} likes to play #{sport}\"\nend",
"def player_name\n puts \"What is your name?\"\n name = gets\n name_chomped = name.chomp.capitalize\n puts \"Hi #{name_chomped}! How are you doing today?\"\n response = gets.capitalize\n if response.include? \"not\"\n \tputs \"I am sorry, there's nothing I can do. Let's get on with the game.\"\n elsif response.include? \"Good\" or response.include? \"Great\" \n \tputs \"I am sure you are! But you won't be if you lose!\"\n else\n \tputs \"Okay! Good Luck with the game!\"\n end\n name_chomped\nend",
"def speak_to_grandma(question)\n if question != question.upcase\n return \"HUH?! SPEAK UP, SONNY!\"\n elsif question == \"I LOVE YOU GRANDMA!\"\n return \"I LOVE YOU TOO PUMKIN!\"\n else\n return \"NO, NOT SINCE 1938!\"\n end\nend",
"def inquiry\r\n puts \"Would you like to encrypt or decrypt it?\"\r\n choice = gets.chomp\r\n\r\n if choice == \"encrypt\"\r\n encrypt($random_word)\r\n elsif choice == \"decrypt\"\r\n decrypt($random_word)\r\n elsif choice == \"both\"\r\n decrypt(encrypt($random_word))\r\n else \r\n puts \"I didn't quite catch that... try again\"\r\n inquiry\r\n end\r\nend",
"def test_valid_choice_false_2\n\t\tgame = SetGame.new\n\t\tuser_input = \"4\"\n\t\tassert_equal false, game.valid_choice?(user_input, 3)\n\tend",
"def get_input\n story = gets.chomp\nend",
"def levitation_quiz\n loop do \n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\n\t#your code here\nend",
"def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @player.word_to_guess.include? input\n\t\t\t@player.correct_letters << input\n\t\telsif input == \"save game\"\n\t\t\toutput = File.new('save.yml', 'w')\n\t\t\toutput.puts YAML.dump(@player)\n\t\t\toutput.close\n\t\t\tputs \">game saved<\"\n\t\t\tgame_loop\n\t\telsif input == \"exit\"\n\t\t\texit\n\t\telse\n\t\t\t@player.turn += 1\n\t\tend\n\tend",
"def inquiry\n puts \"Would you like to encrypt or decrypt it?\"\n choice = gets.chomp\n\n if choice == \"encrypt\"\n encrypt($random_word)\n elsif choice == \"decrypt\"\n decrypt($random_word)\n elsif choice == \"both\"\n decrypt(encrypt($random_word))\n else \n puts \"I didn't quite catch that... try again\"\n inquiry\n end\nend",
"def play_game\n display_header\n user = collect_and_validate_input \"Choose a Play (R/P/S)\", :play\n computer = %w(R P S).sample\n \n # determine who won this round\n display_header\n string = case user\n when computer\n \"It's a TIE!!!\"\n when \"P\"\n computer == \"R\" ? \"Paper covers rock! YOU WIN!\" : \"Scissors cut paper! Computer Wins!\"\n when \"R\"\n computer == \"S\" ? \"Rock breaks scissors! YOU WIN!\" : \"Paper covers Rock! Computer Wins!\"\n when \"S\"\n computer == \"P\" ? \"Scissors cut paper! YOU WIN!\" : \"Rock breaks scissors! Computer Wins!\"\n end\n puts string\n \n # ask the user if they wish to play again\n again = (collect_and_validate_input \"Would you like to go again? (Y/N)\", :again).upcase\n again == \"Y\" ? play_game : (puts \"Thanks for playing!\")\nend",
"def ask_if_ready(step, index)\n puts \"Are you ready for step #{index + 1}?\\n(#{step[:description]})\"\n answer = gets.chomp\n\n answer.upcase == 'Y'\nend",
"def check_choice\n @word.downcase.include?(@letter)\n end",
"def ask(question)\n puts(question)\n answer = gets.chomp!\n answer.downcase\nend",
"def play_again_Q\n\tputs \"\\nDo you want to play again? (Y/N)\"\n\tchoice = gets.strip\n\tconfirm_YN(choice)\nend",
"def check_phrase guess\r\n\t\t\t\t\t\t\t\tif guess == @secretword\r\n\t\t\t\t\t\t\t\t\tincement_score\r\n\t\t\t\t\t\t\t\t\t@win = true\r\n\t\t\t\t\t\t\t\t\treturn true\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\treturn false\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend",
"def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end",
"def get_input\n input = gets.chomp.to_str.downcase\n until valid_test(input)\n puts \"Please enter another word.\"\n input = gets.chomp.to_str.downcase\n end\n return input\nend",
"def ask_play_again\n correct_input = 0\n until correct_input == 1\n print 'Do you want to play again? (y/n): '\n option = gets.chomp.downcase\n if %w[y n].include?(option)\n correct_input = 1\n else\n puts 'PLEASE ENTER Y OR N'\n end\n end\n puts \"\\n\\n\"\n option\n end",
"def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end",
"def test_using_acronyms_in_regular_speech\n remark = \"It's OK if you don't want to go to the DMV.\" # => \"It's OK if you don't want to go to the DMV.\"\n assert_equal 'Whatever.', bob.hey(remark), feedback(remark) # => true\n end",
"def get_trilogy_fact_choice\n sleep 1\n puts \"\\n\n Please enjoy the following Trilogy facts! Type 'end'\\n\n at any point to return to the main menu. Enter the\\n\n number that precedes your choice:\\n\n 1. Most talkative character in the trilogy.\\n\n 2. Least talkative character in the trilogy.\\n \"\n valid_response = false\n until valid_response\n input = gets.chomp.to_i\n if input == 1\n sleep 1\n puts \"\\n\n Thank you. Calculating most talkative character:\"\n valid_response = true\n elsif input == 2\n sleep 1\n puts \"\\n\n Thank you. Calculating most talkative character:\"\n valid_response = true\n else\n sleep 1\n puts \"\\n\n Invalid input. Please enter '1' or '2'\"\n end\n end\n input\n end",
"def test_it_gives_correct_elements\n game = Game.new\n input = \"rggb\"\n end",
"def prompt_for_guess\n puts (\"1. Enter a vowel.\")\n\tputs (\"2. Enter a consonant.\")\n\tputs (\"3. Guess the entire word.\")\n\tputs (\"(Enter your letter choice now. If you enter more than a letter than its your own fault.)\")\n end",
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n original_str = @str.join( \" #{word} \" ) + \".\"\n assert_equal \"This #{word} Script.\", original_str.titlecase\n \n # Test with uppercase small word\n str = @str.join( \" #{word.capitalize} \" ) + \".\"\n assert_equal \"This #{word} Script.\", str.titlecase\n \n end\n end",
"def test_valid_choice_false_6\n\t\tgame = SetGame.new\n\t\tuser_input = \"10\"\n\t\tassert_equal false, game.valid_choice?(user_input, 8)\n\tend",
"def valid_sentence?(sentence_array)\n\t# input is expected to be array\n\t# method tests rules. Does the array have \n\t\t# 1 verb or more\n\t\t# 1 noun or 2 articles minimum\n\t\t# are all the words in the dictionary\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tsentence_counter = 0 \n\n\tif sentence_array.class == Array\n\t\t# continue\n\t\tfor sentence in sentence_array do \n\n\t\t\t# are all the words valid in the dictionary?\t\n\t\t\tall = nouns + verbs + articles\n\t\t\tfor word in sentence do \n\t\t\t\tif all.include?(word)\n\t\t\t\t\t# p \"this word is valid\"\n\t\t\t\telse\n\t\t\t\t\tp \"#{word} is not a valid word in the dictionary\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\t# p \"all words in sentence ar valid words..\"\n\t\t\t\n\t\t\t# does it have a verb?\n\t\t\tv = (sentence & verbs)\n\t\t\tif v.count > 0\n\t\t\t\t# p \"sentence at index #{sentence_counter} has at least 1 verb #{v}\"\n\n\t\t\t\t# does it have 1 noun? or if not, does it have 2 articles?\n\t\t\t\tn = (sentence & nouns)\n\n\t\t\t\tif n.count > 0\n\t\t\t\t\t# p \"sentence at index #{sentence_counter} has a noun #{n}\"\n\n\t\t\t\telse\n\t\t\t\t\t# 2 articles?\n\t\t\t\t\ta = (sentence & articles)\n\t\t\t\t\tif a.count >= 2\n\t\t\t\t\t\t# p \"sentence at index #{sentence_counter} has no noun, but 2 articles #{a}\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tp \"false sentence, does not contain a verb #{sentence}\"\n\t\t\t\treturn false\n\t\t\t\t# this sentence does not have a verb\n\t\t\tend\n\t\t\tsentence_counter += 1\n\t\tend\n\t\tputs \"\"\n\t\tputs \"every sentence is valid! \\n #{sentence_array}\"\n\t\treturn true\n\telse\n\t\tp \"the input is not valid, needs to be an array\"\n\t\treturn false\n\t\t# remove this from the array\n\t\t# will have to trick the system\n\tend\n\t\nend",
"def test_valid_choice_false_9\n\t\tgame = SetGame.new\n\t\tuser_input = \"abc\"\n\t\tassert_equal false, game.valid_choice?(user_input, 8)\n\tend",
"def antibody_test_result_prompt\n puts \"\\nIf you know the antibody test result, please enter if it was positive or negative by typing 'positive' or 'negative'.\"\n antibody_res_response = gets.strip.downcase\n return_to_menu(antibody_res_response)\n exit_anything(antibody_res_response)\n if antibody_res_response == \"positive\" \n anti_body_test_result = true\n elsif antibody_res_response == \"negative\"\n anti_body_test_result = false\n else puts \"\\nDid you mean to hit 'positive', 'negative', 'menu', or 'exit'?\"\n antibody_test_result_prompt\n end\n anti_body_test_result\nend",
"def play_again?\n puts \"\\n\" + SMALL_BANNER\n puts \"\\nWould you like to play again?\"\n print \"('y' for yes; otherwise exit):\"\n answer = gets.chomp\n answer.downcase.start_with?('y')\nend",
"def run_test(questions_capital)\n answer = \"\"\n score = 0\n for question in questions_capital\n puts question.prompt\n answer = gets.chomp.upcase\n puts \" \"\n puts \"You've answered: #{answer}\"\n puts \"The correct answer is: #{question.answer}\"\n if answer == question.answer\n score += 1\n puts \"You have answered correctly!\".green\n else\n puts \"Better luck next time!\".red\n end\n puts \" \"\n end\n puts \"You got\" \" \" + score.to_s + \"/\" + questions_capital.length().to_s\n end",
"def asks_question(question)\n puts question\n gets.chomp\nend",
"def best_sentence(input)\n hot_words = @data[:responses].keys.select do |k|\n k.class == String && k =~ /^\\w+$/\n end\n\n WordPlay.best_sentence(input.sentences, hot_words)\n end",
"def try_again\n puts \"Would you like to try again? \"\n response = gets\n response = response.chomp.upcase\n \n if @yes_options.include?(response)\n find_name\n elsif @no_options.include?(response)\n puts \"Thank you for your time.\"\n else\n puts \"I did not understand your response.\"\n try_again\n end \n end",
"def test_valid_choice_false_10\n\t\tgame = SetGame.new\n\t\tuser_input = \"3ab\"\n\t\tassert_equal false, game.valid_choice?(user_input, 8)\n\tend",
"def view_fight_input\n puts \"Would you like to view a specific fight? (y/n)\"\n input = gets.strip.downcase\n end",
"def verify_choice_ok (choice)\r\n if \"adehlnq+?\".include? (choice)\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def generate_sentence\n\n if @array_words.length < 3\n return \"Length of the input_file is too small to produce trigrams\"\n\n # This function results in an error message if there are no capital\n # words or no end of sentence punctutation in the input file.\n elsif (@end_of_sentence_punctutation == 0) or (@sentence_starters.length == 0)\n return \"End of sentence punctuation or sentence starters or both not found in the text!\"\n end\n\n # Based on a random key from the sentence_starters array, which contains\n # all the keys for the hash that start with a capital word a new key is\n # randomly chosen. Words that follow the key are randomly generated\n # based on probilitity. As soon as an end of sentence punctuation is\n # seen the process of generating words that follow a constantly chaging\n # key stops and the sentence is output. Uses the same process to\n # generate following words as the generate_text method. If end of\n # sentence punctutation is found in the starting key, words until the\n # end of sentence punctuation are returned. If the only end of sentence\n # punctuation is found in the first 2 words of the sentence, the program\n # will return an error message.\n key = @sentence_starters.sample\n\n if key.split[0][-1] =~ /[.|!|?]/\n return key.split[0]\n elsif key.split[1][-1] =~ /[.|!|?]/\n return key\n end\n\n sentence = key\n until sentence[-1] =~ /[!|.|?]/ do\n if @trigrams[key] == nil\n key = @trigrams.keys.sample\n end\n\n following_word = @trigrams[key].sample\n sentence += \" #{following_word}\"\n key = \"#{key.split[1]} #{following_word}\"\n \n end\n\n return sentence\n end",
"def test_valid_choice_false_1\n\t\tgame = SetGame.new\n\t\tuser_input = \"0\"\n\t\tassert_equal false, game.valid_choice?(user_input, 3)\n\tend",
"def test_play_game_with_parse__full_word__true\n @game.parse_guess(\"hi there\")\n @game.check_won?\n assert_equal(true, @game.won)\n end",
"def check_guess\n @guess_count += 1 # Increment guess count\n @guess_feedback = \"\"\n return true if @input == @current_word # Return true value if input is same as chosen word - correctly guessed word\n i = 0\n @input.split('').each do |letter| # Split user input and check if each letter is in exact position as chosen word, or if it is somewhere or not in the word at all\n # Use << to append to string as this is faster and doesn't create new string objects, as opposed to concatenation using a +\n # Below line uses nested ternary operators, where the condition is first evaluated and then if true, the first statement is executed, if false, the second statement is executed\n # This allows the code to be more readable and shorter\n @current_word.index(letter) == i ? (@guess_feedback << \"exact \") : (@current_word.index(letter).nil? ? (@guess_feedback << \"miss \") : (@guess_feedback << \"near \"))\n i += 1\n end\n puts @guess_feedback\n end"
] |
[
"0.7755298",
"0.6958053",
"0.69062454",
"0.6733327",
"0.6602947",
"0.65434533",
"0.6469821",
"0.64494824",
"0.6417932",
"0.63412744",
"0.63381684",
"0.63208",
"0.6262111",
"0.6249105",
"0.6216082",
"0.621405",
"0.6162877",
"0.61574835",
"0.61547",
"0.6128183",
"0.61276066",
"0.61275595",
"0.6125878",
"0.6118244",
"0.61166066",
"0.61104447",
"0.6103368",
"0.60971224",
"0.6092059",
"0.60909635",
"0.6090958",
"0.6081111",
"0.6068747",
"0.6068208",
"0.60654473",
"0.6063684",
"0.605778",
"0.6052811",
"0.6038538",
"0.6037948",
"0.60290515",
"0.6028928",
"0.60261005",
"0.6018122",
"0.60035866",
"0.60004157",
"0.59990686",
"0.5996967",
"0.5990531",
"0.59877175",
"0.59849226",
"0.59755963",
"0.5953273",
"0.5945748",
"0.5934373",
"0.5922718",
"0.59215754",
"0.5919609",
"0.5919321",
"0.5914673",
"0.5908221",
"0.5907013",
"0.59048516",
"0.5904076",
"0.5896561",
"0.5896361",
"0.5895177",
"0.5894466",
"0.5887219",
"0.5885725",
"0.5879164",
"0.587686",
"0.586307",
"0.5855007",
"0.5844396",
"0.5842673",
"0.5841237",
"0.5839916",
"0.5839062",
"0.583655",
"0.58322746",
"0.5831968",
"0.58311826",
"0.5828802",
"0.5822674",
"0.58098954",
"0.58050543",
"0.58032316",
"0.5801159",
"0.5801049",
"0.5799778",
"0.5795249",
"0.5793104",
"0.57888854",
"0.5788413",
"0.57833314",
"0.5781913",
"0.57818687",
"0.57813334",
"0.5777154"
] |
0.7765891
|
0
|
Test that basic pronouns are switched by switch_pronouns
|
def test_basic_pronouns
assert_equal("i am a robot", WordPlay.switch_pronouns("you are a robot"))
assert_equal("you are a person", WordPlay.switch_pronouns("i am a person"))
assert_equal("i love you", WordPlay.switch_pronouns("you love me"))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_pronouns\n assert_equal('I am a robot', WordPlay.switch_pronouns('You are a robot'))\n assert_equal('You are a person', WordPlay.switch_pronouns('I am a person'))\n assert_equal('I love you', WordPlay.switch_pronouns('You love me'))\n assert_equal('You suck balls', WordPlay.switch_pronouns('I suck balls'))\n assert_equal('I hate you!?', WordPlay.switch_pronouns('You hate me!?'))\n end",
"def test_complex_pronouns\n assert_equal('yes, I rule', WordPlay.switch_pronouns('yes, you rule'))\n assert_equal('Am I stupid?', WordPlay.switch_pronouns('are u stupid?'))\n assert_equal('why do i cry?', WordPlay.switch_pronouns('why do you cry?'))\n end",
"def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend",
"def test_mixed_pronouns\n assert_equal(\"you gave me life\",\n WordPlay.switch_pronouns(\"i gave you life\"))\n\n assert_equal(\"i am not what you are\",\n WordPlay.switch_pronouns(\"you are not what i am\"))\n end",
"def test_ounce_v_ounces_ounce\r\n \tassert_equal ' ounce', @test_prospector.ounce_v_ounces(1)\r\n end",
"def noun; end",
"def noun; end",
"def indefinite_possessive_pronoun\n return \"its\"\n end",
"def reflex\r\n Pronouns.get_pronoun_set(@object)[3]\r\n end",
"def poss\r\n Pronouns.get_pronoun_set(@object)[2]\r\n end",
"def test_print_plural_fake_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 2 fake rubies in Town.\\n\") {p.print_one_type([0,2],'Town')}\n\tend",
"def test_line_missing_cmd\n alpha = 'RIT'\n assert_equal \"Missing command word (A2P or P2A): #{alpha}\", Phonetic.translate(alpha)\n end",
"def indefinite_reflexive_pronoun\n return \"itself\"\n end",
"def test_print_one_singular_one_plural\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_both_types([1,2],'Town')}\n\tend",
"def speak_as_normal(element)\n reverse_speak_as(element, 'spell-out')\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n reverse_speak_as(element, 'digits')\n end",
"def test_singular_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake ruby',p.singular_or_plural(1,'fake'))\n\tend",
"def set_pronoun\n @pronoun = Pronoun.find(params[:id])\n end",
"def test_plural_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake rubies',p.singular_or_plural(0,'fake'))\n\tend",
"def pword\n end",
"def test_singular_ruby\n\t\tp = Print.new\n\t\tassert_equal('ruby',p.singular_or_plural(1,'rubies'))\n\tend",
"def pluarlizer(num, noun)\n if noun == \"sheep\"\n p \"#{num} Sheep\"\n elsif noun == \"species\"\n p \"#{num} Species\"\n elsif num == 1 && noun == \"children\"\n p \"#{num} Child\"\n elsif num >= 2 && noun == \"children\"\n p \"#{num} Children\"\n elsif num > 1 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"geese\"\n p \"#{num} Goose\"\n elsif num >= 2 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"people\"\n p \"#{num} Person\"\n elsif num >= 2 && noun == \"people\"\n p \"#{num} People\"\n elsif num > 1\n p \"#{num} #{noun}s\"\n else\n p \"Something is wrong\"\n end\nend",
"def puncture\n end",
"def test_print_plural_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 2 rubies in Town.\\n\") {p.print_one_type([2,0],'Town')}\n\tend",
"def test_get_ounce_string_singular\n ret_string = @game.get_ounces_string(1)\n assert_equal(' ounce', ret_string)\n end",
"def test_trip_plural_rubies_singular_fakes\n p = Print.new\n assert_output(\"After 1 days, Rubyist 2 found:\\n\\t10 rubies.\\n\\t1 fake ruby.\\nGoing home victorious!\\n\") {p.print_trip([10,1],1,2)}\n end",
"def test_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(16)}\n\tend",
"def handle_typos_1(doors)\n\tputs \"Man you should make a proper decision or learn how to type!\".upcase\n\tputs \"Try again\"\n\tputs \"> \"\n\tdoor_choose(doors)\nend",
"def test_get_ounce_string_plural\n ret_string = @game.get_ounces_string(2)\n assert_equal(' ounces', ret_string)\n end",
"def test_shake_shake_shake_shake\n magic_ball = Predictor.new\n assert_equal \"SHAKE SHAKE SHAKE\", magic_ball.shake\n end",
"def test_barely_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(10)}\n\tend",
"def test_speak_as_normal\n style = \"#speak-as-spell-out-local,\n #speak-as-spell-out-inherit,\n #speak-as-spell-out-local-ignore,\n #speak-as-spell-out-inherit-ignore {\n speak-as: spell-out;\n }\n #speak-as-lp-local,\n #speak-as-lp-inherit,\n #speak-as-lp-local-ignore,\n #speak-as-lp-inherit-ignore {\n speak-as: literal-punctuation;\n }\n #speak-as-np-local,\n #speak-as-np-inherit,\n #speak-as-np-local-ignore,\n #speak-as-np-inherit-ignore {\n speak-as: no-punctuation;\n }\n #speak-as-digits-local,\n #speak-as-digits-inherit,\n #speak-as-digits-local-ignore,\n #speak-as-digits-inherit-ignore {\n speak-as: digits;\n }\n span, div {\n speak-as: normal;\n }\"\n html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <span id=\\\"speak-as-spell-out-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-spell-out-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-lp-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-lp-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-np-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-np-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-digits-local\\\">111</span>\n <div id=\\\"speak-as-digits-inherit\\\">\n 123 <strong>456</strong>\n </div>\n </body>\n </html>\"\n )\n css_parser = Hatemile::Util::Css::Rcp::RCPParser.new(style)\n css = Hatemile::Implementation::AccessibleCSSImplementation.new(\n html_parser,\n css_parser,\n @configure\n )\n css.provide_all_speak_properties\n speak_as_spell_out_local = html_parser.find(\n '#speak-as-spell-out-local'\n ).first_result\n speak_as_spell_out_inherit = html_parser.find(\n '#speak-as-spell-out-inherit'\n ).first_result\n speak_as_lp_local = html_parser.find('#speak-as-lp-local').first_result\n speak_as_lp_inherit = html_parser.find('#speak-as-lp-inherit').first_result\n speak_as_digits_local = html_parser.find(\n '#speak-as-digits-local'\n ).first_result\n speak_as_digits_inherit = html_parser.find(\n '#speak-as-digits-inherit'\n ).first_result\n\n assert_equal('Speak this text.', speak_as_spell_out_local.get_text_content)\n assert_equal(\n 'Speak this text.',\n speak_as_spell_out_inherit.get_text_content.strip\n )\n assert_equal('Speak this text.', speak_as_lp_local.get_text_content.strip)\n assert_equal('Speak this text.', speak_as_lp_inherit.get_text_content.strip)\n assert_nil(\n html_parser.find('#speak-as-np-local [aria-hidden]').first_result\n )\n assert_nil(\n html_parser.find('#speak-as-np-inherit [aria-hidden]').first_result\n )\n assert_equal('111', speak_as_digits_local.get_text_content)\n assert_equal('123 456', speak_as_digits_inherit.get_text_content.strip)\n end",
"def test_empty_handed\n\t\tp = Print.new\n\t\tassert_output(\"Going home empty-handed.\\n\") {p.print_game_win_or_lose(0)}\n\tend",
"def test_sad\n\t\tp = Print.new\n\t\tassert_output(\"Going home sad.\\n\") {p.print_game_win_or_lose(3)}\n\tend",
"def test_poor_predictable_bart()\n assert_equal(\"Paper wins!\", Game.play(\"paper\", \"rock\"))\n end",
"def pronunciations(input)\n list = 1\n input.body.each do |pronuciation|\n current_pronunciation = pronuciation['raw']\n puts \"#{list}. #{current_pronunciation}\"\n list += 1\n end\n end",
"def essay_writer(title, topic, date, thesis_statement, pronoun)\r\n\tputs \"#{title}\"\r\n\tputs \"\"\r\n\tif \"#{pronoun}\" == \"male\"\r\n\t\tputs \"#{topic} was an important person in #{date}. He did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"female\"\r\n\t\tputs \"#{topic} was an important person in #{date}. She did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"thing\"\r\n\t\tputs\"#{topic} was an important object in #{date}. One of the most important discoveries to date. #{thesis_statement}\"\r\n\telse pronoun == \"place\"\r\n\t\tputs\"#{topic} was an important place in #{date}. An important place in our world of history. #{thesis_statement}\"\r\nend\r\n\r\nend",
"def test_print_singular_fake_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 fake ruby in Town.\\n\") {p.print_one_type([0,1],'Town')}\n\tend",
"def indefinite_personal_subjective_pronoun\n return \"it\"\n end",
"def test_print_dinos_plural\n\t\tassert_output(\"Driver 1 obtained 3 dinosaur toys!\\n\") { print_dinos(3,1) }\n\tend",
"def test_ask_spaces_returns_answer\n magic_ball = Predictor.new\n assert_includes Predictor::ANSWERS, magic_ball.ask(\"Meow meow meow meow meow?\")\n end",
"def test_print_both_plural\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 2 rubies and 2 fake rubies in Town.\\n\") {p.print_both_types([2,2],'Town')}\n\tend",
"def test_magic_ball_silent_shake\n magic_ball = Predictor.new\n assert_silent { magic_ball.shake() }\n end",
"def test_play_song__on_piano\n result = @musician2.play_song(\"Rocket Man\")\n assert_equal(\"Plink Plonk... I'm playing Rocket Man\", result)\n end",
"def test_plural_ruby\n\t\tp = Print.new\n\t\tassert_equal('rubies',p.singular_or_plural(0,'rubies'))\n\tend",
"def pronoun_params\n params.require(:pronoun).permit(:title)\n end",
"def test_using_acronyms_in_regular_speech\n remark = \"It's OK if you don't want to go to the DMV.\" # => \"It's OK if you don't want to go to the DMV.\"\n assert_equal 'Whatever.', bob.hey(remark), feedback(remark) # => true\n end",
"def test_print_singular_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_one_type([1,0],'Town')}\n\tend",
"def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend",
"def is_pronoun(token)\n _is_in(token, @pronoun_tags)\n end",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def nouns\n {\"cat\" => [\"cats\", \"cat\"], \"hero\" => [\"heroes\"]}\n end",
"def resolve_possessive_pronoun(target)\n if target == self\n return \"your\".freeze\n end\n if can_see?(target)\n return target.possessive_pronoun\n else\n return target.indefinite_possessive_pronoun\n end\n end",
"def test_other_than_first_character\n %w( iTunes TitleCase ).each do |word|\n assert_equal word, word.titlecase\n end\n end",
"def test_pick_accusation_suspect\n puts \" testing\"\n player = Player.new\n assert_equal( \"Got it.\", player.pick_accusation_suspect(true, \"Mrs. White\") )\n assert_equal(\"Mrs. White\", player.accusation_suspect)\n assert_equal(\n \"Whaaa...??? That's not one of the suspects! Come on man!\", \n player.pick_accusation_suspect(true, \"ai 87 00\")\n )\n end",
"def test_turn_putter_none\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(0,0).eql? \"\\tFound no rubies or fake rubies in Enumerable Canyon\"\n end",
"def test_2_text_after_first_corinthians\n sample_text = \"1 Cor. 1:1 testing for new pericopes.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"Pericope found.\"\n end",
"def show_prompt\n if( @modifiers == 0 )\n Sketchup.set_status_text \"Pan/Dolly\", SB_PROMPT\n elsif( @modifiers & CONSTRAIN_MODIFIER_MASK != 0 )\n Sketchup.set_status_text \"Truck/Pedestal\", SB_PROMPT\n elsif( @modifiers & COPY_MODIFIER_MASK != 0 )\n Sketchup.set_status_text \"Pan/Tilt\", SB_PROMPT\n end\nend",
"def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end",
"def test_speak_as_literal_punctuation\n style = \"#speak-as-lp-local,\n #speak-as-lp-inherit,\n #speak-as-lp-local-ignore,\n #speak-as-lp-inherit-ignore {\n speak-as: literal-punctuation;\n }\"\n html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <span id=\\\"speak-as-lp-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-lp-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-lp-local-ignore\\\" #{DATA_IGNORE}>\n Speak this text.\n </span>\n <div id=\\\"speak-as-lp-inherit-ignore\\\" #{DATA_IGNORE}>\n Speak <strong>this text.</strong>\n </div>\n </body>\n </html>\"\n )\n css_parser = Hatemile::Util::Css::Rcp::RCPParser.new(style)\n css = Hatemile::Implementation::AccessibleCSSImplementation.new(\n html_parser,\n css_parser,\n @configure\n )\n css.provide_all_speak_properties\n speak_as_lp_local = html_parser.find('#speak-as-lp-local').first_result\n speak_as_lp_inherit = html_parser.find('#speak-as-lp-inherit').first_result\n speak_as_lp_local_ignore = html_parser.find(\n '#speak-as-lp-local-ignore'\n ).first_result\n speak_as_lp_inherit_ignore = html_parser.find(\n '#speak-as-lp-inherit-ignore'\n ).first_result\n\n assert_equal(\n 'Speak this text Dot .',\n speak_as_lp_local.get_text_content\n )\n assert_equal(\n 'Speak this text Dot .',\n speak_as_lp_inherit.get_text_content.strip\n )\n assert_equal(\n 'Speak this text.',\n speak_as_lp_local_ignore.get_text_content.strip\n )\n assert_equal(\n 'Speak this text.',\n speak_as_lp_inherit_ignore.get_text_content.strip\n )\n end",
"def test_sad_low_end\n\t\tp = Print.new\n\t\tassert_output(\"Going home sad.\\n\") {p.print_game_win_or_lose(1)}\n\tend",
"def test_speak_as_no_punctuation\n style = \"#speak-as-np-local,\n #speak-as-np-inherit,\n #speak-as-np-local-ignore,\n #speak-as-np-inherit-ignore {\n speak-as: no-punctuation;\n }\"\n html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <span id=\\\"speak-as-np-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-np-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-np-local-ignore\\\" #{DATA_IGNORE}>\n Speak this text.\n </span>\n <div id=\\\"speak-as-np-inherit-ignore\\\" #{DATA_IGNORE}>\n Speak <strong>this text.</strong>\n </div>\n </body>\n </html>\"\n )\n css_parser = Hatemile::Util::Css::Rcp::RCPParser.new(style)\n css = Hatemile::Implementation::AccessibleCSSImplementation.new(\n html_parser,\n css_parser,\n @configure\n )\n css.provide_all_speak_properties\n\n assert_equal(\n '.',\n html_parser.find(\n '#speak-as-np-local [aria-hidden]'\n ).first_result.get_text_content\n )\n assert_equal(\n '.',\n html_parser.find(\n '#speak-as-np-inherit [aria-hidden]'\n ).first_result.get_text_content.strip\n )\n assert_nil(\n html_parser.find('#speak-as-np-local-ignore [aria-hidden]').first_result\n )\n assert_nil(\n html_parser.find('#speak-as-np-inherit-ignore [aria-hidden]').first_result\n )\n end",
"def phase_two\n puts \"Phase 2 has been started\"\n\n 3.times do\n immune = @borneo.individual_immunity_challenge\n puts \"#{immune} win the immunity\".blue\n voted_off_contestant = @merge_tribe.tribal_council({immune: immune})\n puts \"#{voted_off_contestant} is OUT!\".red\n end\nend",
"def test_3_text_before_first_corinthians\n sample_text = \"This is some text about 1 Corinthians 1:1.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"No pericope found.\"\n end",
"def yell_at_patrons\n @patrons.upcase\n end",
"def hello_and_rules\n puts \"\\t\\t\\tAkinator de animales\"\n puts \"\\nNuestro avanzado sistema de IA tratara de adivinar el animal en el que piensas\"\n puts \"\\nPor los momentos solo puedes pensar en: perro, gato, loro, pollo, tortuga, ardilla, delfin, puerco, ballena o aguila\"\n puts \"\\nResponde 'si' o 'no'\"\nend",
"def test_print_both_singular\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 1 fake ruby in Town.\\n\") {p.print_both_types([1,1],'Town')}\n\tend",
"def test_self_execute\n assert_nothing_raised { Spoonerize::Cli.execute(fixtures['default_words']) }\n end",
"def test_first_word\n execute_secret_word('colombia', 'c')\n end",
"def indefinite_personal_objective_pronoun\n return \"it\"\n end",
"def test_print_dinos_singular\n\t\tassert_output(\"Driver 1 obtained 1 dinosaur toy!\\n\") { print_dinos(1,1) }\n\tend",
"def initialize\n @word = Spicy::Proton.noun(min:5)\n @word_array = word.split(\"\")\n @display_array = Array.new(word.length, \"_\")\n @candles = Array.new(5, \",\")\n @user_guesses = []\n @cake = \"\\t _|||||_ \\n\\t {~*~*~*~}\\n\\t__{*~*~*~*}__\\n\\t-------------\"\n end",
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n original_str = @str.join( \" #{word} \" ) + \".\"\n assert_equal \"This #{word} Script.\", original_str.titlecase\n \n # Test with uppercase small word\n str = @str.join( \" #{word.capitalize} \" ) + \".\"\n assert_equal \"This #{word} Script.\", str.titlecase\n \n end\n end",
"def test_not_print\n RPN rpn = RPN.new(2)\n print = 'leT'\n refute_equal let.downcase, 'print'\n refute rpn.check_print(print)\n end",
"def test_non_alpha\n assert_equal 'MIKE INDIA TANGO', Phonetic.to_phonetic('<~#~@MIT!~#~>')\n assert_equal 'MIKE INDIA TANGO', Phonetic.translate('A2P &*(MIT)#@(#*@')\n end",
"def test_fake_string_1\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(1).eql? '1 fake ruby'\n end",
"def oh_crap_i_forgot(title, person, location, date, thesis, major_accomplishment, pronoun)\n pronoun = 'male' ? p_use = 'he' : p_use = 'she'\n date < 1000 ? e_or_l = 'early era' : e_or_l = 'late era'\n\n puts \"#{title} : The Story of #{person}\"\n puts \" \"\n puts \"In #{e_or_l} #{location}, #{person} was a pretty big deal. #{thesis}. #{pronoun.capitalize} changed the very fabric of #{location} when #{pronoun} #{major_accomplishment}.\"\n puts \" \"\n puts \"All in all, #{e_or_l} #{location} would not have been so successful without #{person}, nor would #{location} be the way it is today without those contributions.\"\n puts \"By Mikee.\"\nend",
"def says (opinion)\n puts \"#{name} says #{opinion}\"\n end",
"def test_magic_ball_methods\n magic_ball = Predictor.new\n assert_respond_to magic_ball, :ask\n assert_respond_to magic_ball, :shake\n refute_respond_to magic_ball, :roll\n end",
"def test_print_books_plural\n\t\tassert_output(\"Driver 1 obtained 3 books!\\n\") { print_books(3,1) }\n\tend",
"def noun_phrase__noun(position, registers)\n begin\n push(:prepositional_phrase, position, registers, :into => :prepositional_phrase, :next => :noun_phrase__noun)\n rescue Ungrammatical\n pop(tag(:noun_phrase, [registers[:determiner], registers[:adjective], registers[:noun], registers[:prepositional_phrase]]))\n end\n end",
"def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend",
"def speak\n puts \"WOOF WOOF\"\n end",
"def test_check_print\n RPN rpn = RPN.new(2)\n print = 'print'\n assert_equal print, 'print'\n assert rpn.check_print(print)\n end",
"def speak\n\t`say 'I am a product.`\nend",
"def test_ping_basic\n @tt.sock.send(@ping, 0)\n pong = @tt.ping_reply\n assert_equal(42, pong.length)\n assert_equal(pong[0, 6], @tt.tap_mac)\n assert_equal(pong[30, 4], @ping[26, 4])\n assert_equal(pong[26, 4], @ping[30, 4])\n end",
"def good_pokemon # :not_very_effective AND :no_effect_on\n good_pokemon = []\n @type.not_very_effective.each {|pokemon| good_pokemon << pokemon}\n @type.no_effect_on.each {|pokemon| good_pokemon << pokemon if !good_pokemon.include?(pokemon)}\n \n if good_pokemon.count > 0\n puts \"\"\n puts \"USE POKEMON OF THESE TYPE(S)\"\n good_pokemon.each_with_index {|pokemon, index| puts \"#{index +1}. #{pokemon.name}\"}\n end\n end",
"def pirates_say_arrrrrrrrr(string)\n\nend",
"def test_ask_returns_an_answer\n magic_ball = Predictor.new\n assert_includes Predictor::ANSWERS, magic_ball.ask(\"Meow?\")\n end",
"def test_magic_ball_print_shake\n magic_ball = Predictor.new\n # Remember the \\n!\n assert_output(\"SHAKE SHAKE SHAKE\\n\") { magic_ball.print_shake }\n end",
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n return $pastel.on_cyan(str)\n end\nend",
"def test_plural_zero\n assert_nil @p.plural?(0) # pass\n end",
"def fix_tlp\n self.tlp = self.tlp.downcase\n self.tlp = \"amber\" if self.tlp == \"yellow\"\n end",
"def test_dsl_7\n #--------------------------------------------\n show Rock - Paper - Scissors - Lizard - Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (loser Rock)\\n\" \\\n \"Rock crushes Scissors (loser Scissors)\\n\" \\\n \"Scissors decapitate Lizard (loser Lizard)\\n\" \\\n \"Lizard poisons Spock (loser Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend"
] |
[
"0.87323207",
"0.85730827",
"0.831533",
"0.82682353",
"0.6167959",
"0.5877165",
"0.5877165",
"0.5872348",
"0.5810333",
"0.56944364",
"0.56425726",
"0.56394184",
"0.5601467",
"0.55877566",
"0.5563721",
"0.55607045",
"0.5539707",
"0.552242",
"0.5400427",
"0.53895354",
"0.5380162",
"0.5371934",
"0.5366477",
"0.535856",
"0.53481364",
"0.5331882",
"0.5319224",
"0.53117746",
"0.530825",
"0.5306361",
"0.5304307",
"0.5303705",
"0.5287871",
"0.5272063",
"0.5252023",
"0.5249818",
"0.5246202",
"0.5218978",
"0.52096975",
"0.52071047",
"0.5177386",
"0.51628894",
"0.51514494",
"0.5128026",
"0.51258534",
"0.51244587",
"0.51198643",
"0.51145416",
"0.5110028",
"0.51038367",
"0.50950253",
"0.50822437",
"0.5081756",
"0.5076701",
"0.50740784",
"0.5065804",
"0.50468975",
"0.5043093",
"0.50392354",
"0.50313264",
"0.5027547",
"0.50166625",
"0.49983004",
"0.49961212",
"0.49905315",
"0.49848405",
"0.4978608",
"0.49745885",
"0.49648255",
"0.4962164",
"0.49581814",
"0.49522063",
"0.49489626",
"0.49434033",
"0.4942382",
"0.49310726",
"0.492648",
"0.49228615",
"0.49225384",
"0.49209797",
"0.49165604",
"0.4898509",
"0.48922753",
"0.48911226",
"0.48882735",
"0.48879546",
"0.48854023",
"0.4880015",
"0.48776257",
"0.4871666",
"0.48672807",
"0.4858674",
"0.4853546",
"0.4849637",
"0.4849637",
"0.4849637",
"0.4849637",
"0.4849637",
"0.4849637",
"0.4849637"
] |
0.8657003
|
1
|
Test more complex sentence switches using switch_pronouns
|
def test_mixed_pronouns
assert_equal("you gave me life",
WordPlay.switch_pronouns("i gave you life"))
assert_equal("i am not what you are",
WordPlay.switch_pronouns("you are not what i am"))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_complex_pronouns\n assert_equal('yes, I rule', WordPlay.switch_pronouns('yes, you rule'))\n assert_equal('Am I stupid?', WordPlay.switch_pronouns('are u stupid?'))\n assert_equal('why do i cry?', WordPlay.switch_pronouns('why do you cry?'))\n end",
"def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend",
"def test_pronouns\n assert_equal('I am a robot', WordPlay.switch_pronouns('You are a robot'))\n assert_equal('You are a person', WordPlay.switch_pronouns('I am a person'))\n assert_equal('I love you', WordPlay.switch_pronouns('You love me'))\n assert_equal('You suck balls', WordPlay.switch_pronouns('I suck balls'))\n assert_equal('I hate you!?', WordPlay.switch_pronouns('You hate me!?'))\n end",
"def test_basic_pronouns\n assert_equal(\"i am a robot\", WordPlay.switch_pronouns(\"you are a robot\"))\n assert_equal(\"you are a person\", WordPlay.switch_pronouns(\"i am a person\"))\n assert_equal(\"i love you\", WordPlay.switch_pronouns(\"you love me\"))\n end",
"def switch?(parameter)\n return true if %W[true on yes start begin 1].include?(parameter.to_s.downcase)\n return false if %W[false off no stop end 0].include?(parameter.to_s.downcase)\n nil\nend",
"def handle_switch(directive, names, extras); end",
"def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end",
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n original_str = @str.join( \" #{word} \" ) + \".\"\n assert_equal \"This #{word} Script.\", original_str.titlecase\n \n # Test with uppercase small word\n str = @str.join( \" #{word.capitalize} \" ) + \".\"\n assert_equal \"This #{word} Script.\", str.titlecase\n \n end\n end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def switch?(value)\n return true if %W[true on yes start begin 1].include?(value.to_s.downcase)\n return false if %W[false off no stop end 0].include?(value.to_s.downcase)\n nil\n end",
"def switch(name,aliases,desc,long_desc,negatable)\n if negatable\n name = \"[no-]#{name}\" if name.to_s.length > 1\n aliases = aliases.map { |_| _.to_s.length > 1 ? \"[no-]#{_}\" : _ } \n end\n invocations = ([name] + aliases).map { |_| add_dashes(_) }.join('|')\n @io.puts \"#{@nest}=== #{invocations}\"\n @io.puts String(desc).strip\n @io.puts\n @io.puts String(long_desc).strip\n @io.puts\n end",
"def switch!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n type = SWITCH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 170:10: 'switch'\n match( \"switch\" )\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__, 49 )\n\n end",
"def switches\n Commandorobo::Utils::consume_switch(@raw.join(' '))\n end",
"def wookiee_sentence; end",
"def user_choice_text_version\n this_here = pick_a_story\n puts \"\\n #{this_here.title}\"\n puts \"\\n\"\n Narrabot::Scraper.aesop_fable_text(this_here) if !this_here.text_and_moral\n puts this_here.text_and_moral\n puts \"\\n\"\n #puts \"Would you like me to read this story in my beautiful voice?\"\n #input = gets.chomp\n #switch = yes_or_no(input)\n #if switch == true\n # puts \"\"\n # \"#{this_here.text_and_moral}\".play (\"en\")\n #else\n # puts \"\"\n # play_and_puts(\"Okay\")\n #end\n end",
"def noun; end",
"def noun; end",
"def essay_writer(title, topic, date, thesis_statement, pronoun)\r\n\tputs \"#{title}\"\r\n\tputs \"\"\r\n\tif \"#{pronoun}\" == \"male\"\r\n\t\tputs \"#{topic} was an important person in #{date}. He did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"female\"\r\n\t\tputs \"#{topic} was an important person in #{date}. She did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"thing\"\r\n\t\tputs\"#{topic} was an important object in #{date}. One of the most important discoveries to date. #{thesis_statement}\"\r\n\telse pronoun == \"place\"\r\n\t\tputs\"#{topic} was an important place in #{date}. An important place in our world of history. #{thesis_statement}\"\r\nend\r\n\r\nend",
"def a_turn_of_phrase(sentence)\n # code goes here\nend",
"def handle_switch(directive, names, extras)\n directive.cop_names.each do |name|\n if directive.disabled?\n names[name] += 1\n elsif (names[name]).positive?\n names[name] -= 1\n else\n extras[directive.comment] << name\n end\n end\n end",
"def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend",
"def case _args\n \"case _args;\" \n end",
"def cases()\n \n end",
"def test_a_vertical_pipe_means_or\n grays = /(James|Dana|Summer) Gray/\n assert_equal 'James Gray', \"James Gray\"[grays]\n assert_equal 'Summer', \"Summer Gray\"[grays, 1]\n assert_equal nil, \"Jim Gray\"[grays, 1]\n end",
"def test_speak_as_normal\n style = \"#speak-as-spell-out-local,\n #speak-as-spell-out-inherit,\n #speak-as-spell-out-local-ignore,\n #speak-as-spell-out-inherit-ignore {\n speak-as: spell-out;\n }\n #speak-as-lp-local,\n #speak-as-lp-inherit,\n #speak-as-lp-local-ignore,\n #speak-as-lp-inherit-ignore {\n speak-as: literal-punctuation;\n }\n #speak-as-np-local,\n #speak-as-np-inherit,\n #speak-as-np-local-ignore,\n #speak-as-np-inherit-ignore {\n speak-as: no-punctuation;\n }\n #speak-as-digits-local,\n #speak-as-digits-inherit,\n #speak-as-digits-local-ignore,\n #speak-as-digits-inherit-ignore {\n speak-as: digits;\n }\n span, div {\n speak-as: normal;\n }\"\n html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <span id=\\\"speak-as-spell-out-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-spell-out-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-lp-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-lp-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-np-local\\\">Speak this text.</span>\n <div id=\\\"speak-as-np-inherit\\\">\n Speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-as-digits-local\\\">111</span>\n <div id=\\\"speak-as-digits-inherit\\\">\n 123 <strong>456</strong>\n </div>\n </body>\n </html>\"\n )\n css_parser = Hatemile::Util::Css::Rcp::RCPParser.new(style)\n css = Hatemile::Implementation::AccessibleCSSImplementation.new(\n html_parser,\n css_parser,\n @configure\n )\n css.provide_all_speak_properties\n speak_as_spell_out_local = html_parser.find(\n '#speak-as-spell-out-local'\n ).first_result\n speak_as_spell_out_inherit = html_parser.find(\n '#speak-as-spell-out-inherit'\n ).first_result\n speak_as_lp_local = html_parser.find('#speak-as-lp-local').first_result\n speak_as_lp_inherit = html_parser.find('#speak-as-lp-inherit').first_result\n speak_as_digits_local = html_parser.find(\n '#speak-as-digits-local'\n ).first_result\n speak_as_digits_inherit = html_parser.find(\n '#speak-as-digits-inherit'\n ).first_result\n\n assert_equal('Speak this text.', speak_as_spell_out_local.get_text_content)\n assert_equal(\n 'Speak this text.',\n speak_as_spell_out_inherit.get_text_content.strip\n )\n assert_equal('Speak this text.', speak_as_lp_local.get_text_content.strip)\n assert_equal('Speak this text.', speak_as_lp_inherit.get_text_content.strip)\n assert_nil(\n html_parser.find('#speak-as-np-local [aria-hidden]').first_result\n )\n assert_nil(\n html_parser.find('#speak-as-np-inherit [aria-hidden]').first_result\n )\n assert_equal('111', speak_as_digits_local.get_text_content)\n assert_equal('123 456', speak_as_digits_inherit.get_text_content.strip)\n end",
"def kase_action_with_topic_in_words(kase_or_kind, topic)\n kind = kase_or_kind.is_a?(Kase) ? kase_or_kind.kind : kase_or_kind\n result = if topic\n case kind\n when :idea then \"share an idea\".t + ' ' + (\"about %{topic}\".t % {:topic =>truncate(h(topic.name.titleize))})\n when :problem then \"report a problem\".t + ' ' + (\"about %{topic}\".t % {:topic =>truncate(h(topic.name.titleize))})\n when :question then \"ask a question\".t + ' ' + (\"about %{topic}\".t % {:topic =>truncate(h(topic.name.titleize))})\n when :praise then \"give praise\".t + ' ' + (\"about %{topic}\".t % {:topic =>truncate(h(topic.name.titleize))})\n end\n else\n case kind\n when :idea then \"share an idea\".t\n when :problem then \"report a problem\".t\n when :question then \"ask a question\".t\n when :praise then \"give praise\".t\n end\n end\n result.firstcase\n end",
"def hello_world\n if word == 'es'\n p 'Hola Mundo'\n elsif word == 'de'\n p 'Hallo Welt'\n elsif word == 'en'\n p 'Hej världen'\n else \n return 'Hello World'\n end\nend",
"def match_mixed(test)\n case test\n when 'hello'\n 'hello'\n in [a, b]\n \"a: #{a}, b: #{b}\"\n end\nend",
"def describe_paragraph(being)\n desc = ''\n continued = false\n describe(being) do |quality, key, amount|\n possessive = possessive_name_or_pronoun(being)\n possessive.capitalize! unless continued\n desc += [conjunction(continued),\n possessive,\n key,\n key.pluralize == key ? 'are' : 'is',\n strength(amount),\n quality].join(' ')\n continued = rand < 0.333 && !continued\n desc += \".\" unless continued\n end\n desc.strip\n end",
"def operation_to_message(op)\nword = case op\n when '1'\n 'Adding'\n when '2'\n 'Subtracting'\n when '3'\n 'Multiplying'\n when '4'\n 'Dividing'\n end\n\nx = \"A random line of code\"\nword\n\nend",
"def reflect(sentence)\n # TODO\nend",
"def display_winning_msg(winning_msg)\n case winning_msg\n when \"r\"\n puts \"Rock Smashes scissors\"\n when \"p\"\n puts \"Paper Wraps Rock\"\n when \"s\"\n puts \"Scissors cuts Paper\"\n end\nend",
"def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend",
"def compare(str, flag)\n after = case flag\n when :upcase\n str.upcase\n when :capitalize\n str.capitalize\n # etc, we could have a lot of 'when' clauses\n end\n\n puts \"Before: #{str}\"\n puts \"After: #{after}\"\nend",
"def borough_message(borough)\n\n case borough\n when \"Islington\"\n puts \"I'll meet you at Angel\"\n when \"Hackney\"\n puts \"I'll meet you in Stoke Newington\"\n when \"Tower Hamlets\"\n puts \"I'll meet you in whitechapel\"\n else\n puts \"You can come to Kentish Town\"\n end\n\nend",
"def hello_and_rules\n puts \"\\t\\t\\tAkinator de animales\"\n puts \"\\nNuestro avanzado sistema de IA tratara de adivinar el animal en el que piensas\"\n puts \"\\nPor los momentos solo puedes pensar en: perro, gato, loro, pollo, tortuga, ardilla, delfin, puerco, ballena o aguila\"\n puts \"\\nResponde 'si' o 'no'\"\nend",
"def determine_word_of_god(god_data)\n\tcase god_data\n\twhen 1\n\t\t:yes\n\twhen 2\n\t\t:no\n\telse\n\t\t:unknown\n\tend\nend",
"def speak_as_normal(element)\n reverse_speak_as(element, 'spell-out')\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n reverse_speak_as(element, 'digits')\n end",
"def sentence; end",
"def one_word_command\n switch = cmd.switch ? cmd.switch.downcase : nil\n switch == \"pass\" || switch == \"reload\" || switch == \"evade\"\n end",
"def k_tipobusqueda!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n\n\n\n type = K_TIPOBUSQUEDA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 461:3: ( 'like' | 'equals' | 'dif' )\n # at line 461:3: ( 'like' | 'equals' | 'dif' )\n alt_16 = 3\n case look_16 = @input.peek( 1 )\n when 0x6c then alt_16 = 1\n when 0x65 then alt_16 = 2\n when 0x64 then alt_16 = 3\n else\n raise NoViableAlternative( \"\", 16, 0 )\n\n end\n case alt_16\n when 1\n # at line 461:4: 'like'\n match( \"like\" )\n\n\n when 2\n # at line 461:11: 'equals'\n match( \"equals\" )\n\n\n when 3\n # at line 461:20: 'dif'\n match( \"dif\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n\n end",
"def afterStory(username)\n\nputs \"\n\nWould you like to hear another story?\"\n\nplayagainyesorno = gets.chomp.downcase\n\n case playagainyesorno\n when 'yes', 'yes please', 'yup'\n puts \"Great!\"\n puts \"Your choices are: Rom-Com, Cop Story, or Sci-Fi.\"\n choosestory(username)\n when 'no', 'nope', 'no way'\n puts \"\nOkay, goodbye!\"\n else\n puts \"I don't know what you said! \"\n afterStory(username)\n end\nend",
"def keyword\n 'case'\n end",
"def keyword\n 'case'\n end",
"def robot_translator(phrase)\n counter = 0\n i = 0\n first_alpha = \"abcdefghijklm\"\n while counter < phrase.length\n word_index = phrase[i]\n if word_index.upcase && word_index[first_alpha]\n puts \"bloop\"\n elsif\n word_index.upcase || word_index == \"e\"\n puts \"buzz\"\n elsif word_index.to_i\n puts \"boing\"\n else\n puts \"beep\"\n end\n counter += 1\n end\nend",
"def wookie_sentence; end",
"def setup_switch_case\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n act_result = nil\n act_hash = @acts[1]\n \n # Get valid action key\n act_hash.each do |cond, action_key|\n bool = false\n begin\n # Try to evaluate script\n bool = eval(cond)\n rescue StandardError => err\n # Blame script user if error :v\n display_error(\"[#{SEQUENCE_CASE},]\",err)\n end\n next unless bool # If condition valid\n act_result = action_key # Assign action key\n break # Break loop checking\n end\n \n # Evaluate action key\n return unless act_result\n is_array = act_result.is_a?(Array)\n \n # If nested array (triggered if first element is array)\n if is_array && act_result[0].is_a?(Array)\n act_result.each do |action|\n next unless action.is_a?(Array)\n @acts = action\n execute_sequence\n end\n # If normal array\n elsif is_array\n @acts = act_result\n execute_sequence\n else\n @acts = [:action, act_result]\n execute_sequence\n end\n end",
"def test_String_003_ToSentence\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_003_ToSentence\")\n puts2(\"#######################\")\n \n \n puts2(\"\\nA specific string...\")\n sString = \"oNCE UPON a time Long ago and far away\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n \n puts2(\"\\nFour sets of 2 pseudo words as sentences...\")\n 4.times {\n sString = random_pseudowords(2,10)\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 3 pseudo words ending in a period as sentences...\")\n 2.times {\n sString = random_pseudowords(3,10) + \".\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 4 pseudo words ending in a exclamation point as sentences...\")\n 2.times {\n sString = random_pseudowords(4,10) + \"!\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 5 pseudo words ending in a question mark as sentences...\")\n 2.times {\n sString = random_pseudowords(5,10) + \"?\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n end",
"def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\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__, 23 )\n\n end",
"def literacy_chance(odds,math)\n # odds out of 100 char is literate; IF literate, second value is odds in 100 char also numerate\n literacy_chance_roll = d(100)\n case literacy_chance_roll\n when 1..odds\n @@literacy = \"Literate\"\n @@do_math_chance = d(100)\n case do_math_chance\n when 1..math\n @@do_math = \"Yes\"\n else\n @@do_math = \"No\"\n end\n @@do_math = do_math_chance(math)\n else\n @@literacy = \"Illiterate\"\n end\nend",
"def complete_sentence(animal1, animal2)\n p \"The #{animal1} chased the #{animal2}\"\nend",
"def step1(str)\n r1,r2 = r12(str)\n r1_text = str[r1..-1]\n r2_text = str[r2..-1]\n\n case r2_text\n when /(anzas?|ic[oa]s?|ismos?|[ai]bles?|istas?|os[oa]s?|[ai]mientos?)$/i\n str[%r{#$&$}]=''\n return true\n when /(ic)?(ador([ae]s?)?|aci[óÓ]n|aciones|antes?|ancias?)$/ui\n str[%r{#$&$}]=''\n return true\n when /log[íÍ]as?/ui\n str[%r{#$&$}]='log'\n return true\n when /(uci([óÓ]n|ones))$/ui\n str[%r{#$&$}]='u'\n return true\n when /(encias?)$/i\n str[%r{#$&$}]='ente'\n return true\n end\n\n if r2_text =~ /(ativ|iv|os|ic|ad)amente$/i or r1_text =~ /amente$/i\n str[%r{#$&$}]=''\n return true\n end\n\n case r2_text\n when /((ante|[ai]ble)?mente)$/i, /((abil|i[cv])?idad(es)?)$/i, /((at)?iv[ao]s?)$/i\n str[%r{#$&$}]=''\n return true\n end\n false\n end",
"def match_with_existing_variable(lang)\n language_name = \"ruby\"\n\n case lang\n in \"Erlang\"\n puts \"Hello Joe, system working.\"\n in ^language_name\n puts \"Ruby? I hear it doesn't scale.\"\n else\n puts \"Sorry, don't know that one\"\n end\nend",
"def parse_switch(arg)\n argument = arg[1..-1].downcase\n\n # Version\n if argument =~ /^(v|-version)$/\n print_version\n end\n\n # Argument output_dir\n if argument.eql?(\"m\")\n @merge = true\n @edit_in_place=false unless @mset==true\n @mset=true\n end\n\n # In place\n if argument.eql?(\"i\")\n @edit_in_place=true\n @merge=false unless @mset==true\n end\n\n # Argument threshold\n if argument.eql?(\"t\")\n if @expecting_threshold==false\n @expecting_threshold=true\n else\n puts \"Argument threshold expected after -t switch\\n\"\n print_help\n end\n end\n\n # Arguments -H, -h, --help, -help...\n if argument =~ /^-*h+(elp)*$/i\n print_help\n end\n\n end",
"def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def test_line_missing_cmd\n alpha = 'RIT'\n assert_equal \"Missing command word (A2P or P2A): #{alpha}\", Phonetic.translate(alpha)\n end",
"def indefinite_possessive_pronoun\n return \"its\"\n end",
"def ingverb; end",
"def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end",
"def switch_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n return_value = SwitchStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal60 = nil\n expression61 = nil\n case_clause62 = nil\n default_clause63 = nil\n\n tree_for_string_literal60 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 95:5: ^( 'switch' expression ( case_clause )* ( default_clause )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal60 = match( SWITCH, TOKENS_FOLLOWING_SWITCH_IN_switch_statement_477 )\n\n tree_for_string_literal60 = @adaptor.copy_node( string_literal60 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal60, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_switch_statement_479 )\n expression61 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression61.tree )\n # at line 95:28: ( case_clause )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == CASE )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 95:28: case_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_case_clause_IN_switch_statement_481 )\n case_clause62 = case_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, case_clause62.tree )\n\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n # at line 95:41: ( default_clause )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == DEFAULT )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 95:41: default_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_default_clause_IN_switch_statement_484 )\n default_clause63 = default_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, default_clause63.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 16 )\n\n end\n \n return return_value\n end",
"def verb; end",
"def verb; end",
"def verb; end",
"def verb; end",
"def verb; end",
"def _test_text ; process_test_case(\"text\") ; end",
"def shakil_the_dog\n while true\n print \"Have a conversation with Shakil: \"\n input = gets.chomp\n\n case input\n\n when \"woof\"\n puts \"WOOF WOOF WOOF\"\n\n when \"shakil stop\", \"Shakil STOP!\"\n puts \"\"\n\n when \"meow\"\n puts \"woof woof woof woof woof\"\n\n when /treat/\n puts \"Shakil does not bark\"\n\n when \"go away\"\n break\n\n else\n puts \"woof\"\n end\n end\nend",
"def conversation\n you_say = gets.chomp\n if you_say == \"woof\"\n puts \"WOOF WOOF WOOF\"\n elsif (you_say == \"shakil stop\") || (you_say == \"Shakil STOP!\")\n puts \" \"\n elsif you_say == \"meow\"\n puts \"woof woof woof woof woof\"\n elsif you_say.include? \"treat\"\n puts \" \"\n elsif you_say == \"go away\"\n exit\n end\nend",
"def bob(sentence)\n\tif sentence.empty?\n\t\t\"Fine. Be that way!\"\n\telsif sentence == sentence.upcase && sentence != sentence.downcase\n\t\t\"Woah, chill out\"\n\telsif sentence.end_with?(\"?\")\n\t\t\"Sure\"\n\telse\n\t\t\"Whatever\"\n\t\t\n\tend\n\t\nend",
"def shodan\n\t\tprint (\"\\n\"+$lin+\"\\n\")\n\t\tprint (\"\\n Ok, you can try to test \\n (f) Test honypot ip's file \\n (h) Test target host on honypot \\n (s) Shodan search \\n (b) Back \\n\\n\")\n\t\tprint (\" --> \")\n\t\tway = gets().chomp()\n\t\tif way == \"f\" then\n\t\t\thonyf\n\t\telsif way == \"h\"\n\t\t\thonyt\n\t\telsif way == \"s\"\n\t\t\tshod\n\t\telsif way == \"b\"\n\t\t\twhiche\n\n\t\tend\n\tend",
"def test_dsl_7\n #--------------------------------------------\n show Rock - Paper - Scissors - Lizard - Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (loser Rock)\\n\" \\\n \"Rock crushes Scissors (loser Scissors)\\n\" \\\n \"Scissors decapitate Lizard (loser Lizard)\\n\" \\\n \"Lizard poisons Spock (loser Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end",
"def speak_to_grandma(input_phrase)\n if input_phrase == \"I LOVE YOU GRANDMA!\"\n \"I LOVE YOU TOO PUMPKIN!\"\n elsif input_phrase!=input_phrase.upcase && input_phrase!=\"I LOVE YOU GRANDMA!\"\n \"HUH?! SPEAK UP, SONNY!\"\n else input_phrase!=input_phrase.upcase \n \"NO, NOT SINCE 1938!\"\n end\nend",
"def win(pick_w)\n case pick_w \n when 'r' \n puts \"You: Rock | Me: Scissors\"\n when 'p'\n puts \"you: Paper | Me: Rock\"\n when 's'\n puts \"you: Scissors | Me: Paper\"\n end\nend",
"def tell_Story(paragraph)\r\n puts paragraph\r\n end",
"def switch(name, aliases, desc, long_desc, negatable)\n if negatable\n name = \"[no-]#{name}\" if name.to_s.length > 1\n aliases = aliases.map { |_| _.to_s.length > 1 ? \"[no-]#{_}\" : _ }\n end\n invocations = ([name] + aliases).map { |_| \"`\" + add_dashes(_).strip + \"`\" }.join('|')\n @io.puts header(\"#{invocations}\", 2)\n @io.puts\n @io.puts String(desc).strip\n cmd_desc = String(long_desc).strip\n @io.puts \"\\n> #{cmd_desc}\\n\" unless cmd_desc.length == 0\n @io.puts\n end",
"def jump(str)\n if str == \"treat\"\n puts \"jump up and down\"\n end\n end",
"def quotes \n case self\n when 'thunderstorm'\n puts \"Fucking thunder storm..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'thunderstorm with light rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'thunderstorm with heavy rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'light thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'ragged thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with light drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'light thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with heavy drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'drizzle'\n puts \"Meh... Just stay in bed.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can browse Tumblr & play Angrybirds.\".colorize(:blue)\n when 'light intensity drizzle'\n puts \"Global fucking warming\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Yeah, let's blame Global Warming.\".colorize(:blue)\n when 'heavy intensity drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue)\n when 'light intensity drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue)\n when 'drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'heavy intensity drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'shower rain and drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'heavy shower rain and drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'shower drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'light rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'moderate rain'\n puts \"Get your fucking umbrella\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you\".colorize(:blue)\n when 'heavy intensity rain'\n puts \"It rains cats and dogs.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You better get an umbrella my friend.\".colorize(:blue) \n when 'very heavy rain'\n puts \"It's fucking raining.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue) \n when 'extreme rain'\n puts \"Shitloads of rain is awaiting you\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You better get an umbrella my friend.\".colorize(:blue)\n when 'freezing rain'\n puts \"Fucking brain freeze.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Fuck Yeah Ice Cream!\".colorize(:blue)\n when 'light intensity shower rain'\n puts \"Get your fucking umbrella\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you.\".colorize(:blue) \n when 'shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you.\".colorize(:blue) \n when 'heavy intensity shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue) \n when 'ragged shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue) \n when 'snow'\n puts \"Holy fucking snow.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Still not ready for building that fucking snow castle.\".colorize(:blue)\n when 'light snow'\n puts \"Are you freezing fucking serious?\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can't look outside because of fucking snow.\".colorize(:blue)\n when 'heavy snow'\n puts \"Can't see because fucking snow.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Try looking outside for more information, try it...\".colorize(:blue)\n when 'sleet'\n puts \"Cold as fucking shit..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You heard it, unpack your space heater!\".colorize(:blue)\n when 'light shower sleet'\n puts \"It's getting|fucking chilly.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You heard it, unpack your space heater!\".colorize(:blue)\n when 'shower sleet'\n puts \"Frozen fucking fingers.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Can't feel my fingers any more.\".colorize(:blue)\n when 'light rain and snow'\n puts \"North fucking pole.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Nothing against the north pole, but seriously!\".colorize(:blue)\n when 'rain and snow'\n puts \"Icebergs all over your shit..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Time to get cozy and watch Titanic again!.\".colorize(:blue)\n when 'light shower snow'\n puts \"Fucking ice age.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The movie was great, the weather is not.\".colorize(:blue)\n when 'shower snow'\n puts \"Hello? yes, this is snow-man.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to build me. Look outside fancy pants.\".colorize(:blue)\n when 'heavy shower snow'\n puts \"It's fucking skiing time.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Snow every where, yay!\".colorize(:blue)\n when 'overcast clouds'\n puts \"Cloudy with a chance of....\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You thought I would say meatballs right? Stupid.\".colorize(:blue)\n when 'few clouds'\n puts \"Meh...Just stayin bed.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can browse Tumblr & play Angrybirds.\".colorize(:blue)\n when 'scattered clouds'\n puts \"It’s likea meh…kinda day\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"But you can change it with a smile :) Or drugs.\".colorize(:blue)\n when 'broken clouds'\n puts \"Fucking fifty shades of grey\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Fucking grey clouds everywhere\".colorize(:blue)\n when 'clear sky'\n puts \"It's fucking tropical.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Ice Cream is my final answer.\".colorize(:blue)\n when 'mist'\n puts \"It's justfucking grey.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Just mist & no love, but computer games\".colorize(:blue)\n when 'smoke'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'haze'\n puts \"It's fucking cloudy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'sand/ dust whirls'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'fog'\n puts \"It's fucking foggy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's getting cold outside!\".colorize(:blue)\n when 'sand'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'dust'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'volcanic ash'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you\".colorize(:blue)\n when 'squalls'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'tornado'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'cold'\n puts \"Am I allowed to say nipples?\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Because it's freezing! You get the point.\".colorize(:blue)\n when 'hot'\n puts \"So hot makin' me stoopid.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"I heard that Ryan Gosling said this.\".colorize(:blue)\n when 'windy'\n puts \"It's fucking windy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's getting cold outside!\".colorize(:blue)\n when 'hail'\n puts \"It's a wee bit nippy!\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"This is for you my Scottish friends.\".colorize(:blue)\n else\n \"\\u{3F}\" \n end\n end",
"def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend",
"def tell_Story(paragraph)\r\n puts paragraph\r\n end",
"def method_missing(m, *args, &block)\n match_data = m.match /(strong|weak)_(skills|attitudes)/\n if match_data && match_data.length >= 3\n get_answers(match_data[1], match_data[2])\n else\n super\n end\n end",
"def operation_to_message(operation)\n word = case operation\n when '1'\n 'Adding'\n when '2'\n 'Subtracting'\n when '3'\n 'Multiplying'\n when '4'\n 'Dividing'\n end\n\n x = \"A random line of code\"\n\n word\nend",
"def shakil_the_dog\n puts \"You can tell Sahkil to go away, bark, or you can even mock it by saying meow.\"\n puts \"talk to the dog\"\n puts \"program will end if you tell the dog to go away.\"\n\n while true do\n\n speech = gets.chomp\n\n case speech\n when /bark/\n puts 'woof ' * 3\n when /stop/\n puts 'Enjoy your piece'\n when /meow/\n puts 'woof ' * 5\n when /treat/\n puts 'dog is going nuts'\n when /go/\n puts 'dog leaves'\n break\n end\n end\nend",
"def test_ounce_v_ounces_ounce\r\n \tassert_equal ' ounce', @test_prospector.ounce_v_ounces(1)\r\n end",
"def onBriefingTeamSwitch _args\n \"onBriefingTeamSwitch _args;\" \n end",
"def obscene?(text)\n text.include?(\"obscenities\")\nend",
"def test_sentence_choice\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a test',\n 'This is another test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def start_conversation(person, topic)\n if topic == \"politics\"\n person.happiness -= 2\n self.happiness -= 2\n \"blah blah partisan blah lobbyist\"\n elsif topic == \"weather\"\n person.happiness += 1\n self.happiness += 1\n \"blah blah sun blah rain\"\n else \n \"blah blah blah blah blah\"\n end\n end",
"def true_love(a, b)\n p \"#{a} LOVES #{b}\"\nend",
"def word!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n\n\n type = WORD\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 45:5: ( '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\'' | '\\\"' (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\"' )\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == 0x27 )\n alt_3 = 1\n elsif ( look_3_0 == 0x22 )\n alt_3 = 2\n else\n raise NoViableAlternative( \"\", 3, 0 )\n\n end\n case alt_3\n when 1\n # at line 45:7: '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\''\n match( 0x27 )\n # at line 45:12: (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( 0x0, 0x26 ) || look_1_0.between?( 0x28, 0x5b ) || look_1_0.between?( 0x5d, 0xffff ) )\n alt_1 = 1\n elsif ( look_1_0 == 0x5c )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 45:14: ~ ( '\\\\'' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n when 2\n # at line 45:33: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n match( 0x27 )\n\n when 2\n # at line 45:50: '\\\"' (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\"'\n match( 0x22 )\n # at line 45:55: (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( 0x0, 0x21 ) || look_2_0.between?( 0x23, 0x5b ) || look_2_0.between?( 0x5d, 0xffff ) )\n alt_2 = 1\n elsif ( look_2_0 == 0x5c )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 45:57: ~ ( '\\\"' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x21 ) || @input.peek( 1 ).between?( 0x23, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n when 2\n # at line 45:76: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n match( 0x22 )\n\n end\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n\n end",
"def shakil_the_dog\n prompt = \"> \"\n puts \"What do you want to say to Shakil?\"\n print prompt\n \n while say = gets.chomp\n case say\n when \"woof\"\n puts \"WOOF WOOF WOOF\"\n print prompt\n when \"SHAKIL STOP!\".downcase\n puts \"Shakil is silent\"\n print prompt\n when \"meow\"\n puts \"woof woof woof woof woof\"\n print prompt\n when /treat/\n puts \"Shakil is silent\"\n print prompt\n when \"go away\"\n puts \"Shakil has left the building\"\n break\n else\n puts \"woof\"\n print shakil_the_dog\nend\n end\nend",
"def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end",
"def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend",
"def start_conversation(friend, topic) \n case(topic)\nwhen \"politics\" \n friend.happiness -= 2\n self.happiness -= 2\n return \"blah blah partisan blah lobbyist\"\nwhen \"weather\"\n friend.happiness += 1\n self.happiness += 1\n return \"blah blah sun blah rain\"\n#use else because it tells us if none of the above check out then do the following\nelse \n return \"blah blah blah blah blah\" \n end \nend",
"def make_switch(opts, block = nil)\n short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []\n ldesc, sdesc, desc, arg = [], [], []\n default_style = Switch::NoArgument\n default_pattern = nil\n klass = nil\n q, a = nil\n has_arg = false\n\n opts.each do |o|\n # argument class\n next if search(:atype, o) do |pat, c|\n klass = notwice(o, klass, 'type')\n if not_style and not_style != Switch::NoArgument\n not_pattern, not_conv = pat, c\n else\n default_pattern, conv = pat, c\n end\n end\n\n # directly specified pattern(any object possible to match)\n if (!(String === o || Symbol === o)) and o.respond_to?(:match)\n pattern = notwice(o, pattern, 'pattern')\n if pattern.respond_to?(:convert)\n conv = pattern.method(:convert).to_proc\n else\n conv = SPLAT_PROC\n end\n next\n end\n\n # anything others\n case o\n when Proc, Method\n block = notwice(o, block, 'block')\n when Array, Hash\n case pattern\n when CompletingHash\n when nil\n pattern = CompletingHash.new\n conv = pattern.method(:convert).to_proc if pattern.respond_to?(:convert)\n else\n raise ArgumentError, \"argument pattern given twice\"\n end\n o.each {|pat, *v| pattern[pat] = v.fetch(0) {pat}}\n when Module\n raise ArgumentError, \"unsupported argument type: #{o}\", ParseError.filter_backtrace(caller(4))\n when *ArgumentStyle.keys\n style = notwice(ArgumentStyle[o], style, 'style')\n when /^--no-([^\\[\\]=\\s]*)(.+)?/\n q, a = $1, $2\n o = notwice(a ? Object : TrueClass, klass, 'type')\n not_pattern, not_conv = search(:atype, o) unless not_style\n not_style = (not_style || default_style).guess(arg = a) if a\n default_style = Switch::NoArgument\n default_pattern, conv = search(:atype, FalseClass) unless default_pattern\n ldesc << \"--no-#{q}\"\n (q = q.downcase).tr!('_', '-')\n long << \"no-#{q}\"\n nolong << q\n when /^--\\[no-\\]([^\\[\\]=\\s]*)(.+)?/\n q, a = $1, $2\n o = notwice(a ? Object : TrueClass, klass, 'type')\n if a\n default_style = default_style.guess(arg = a)\n default_pattern, conv = search(:atype, o) unless default_pattern\n end\n ldesc << \"--[no-]#{q}\"\n (o = q.downcase).tr!('_', '-')\n long << o\n not_pattern, not_conv = search(:atype, FalseClass) unless not_style\n not_style = Switch::NoArgument\n nolong << \"no-#{o}\"\n when /^--([^\\[\\]=\\s]*)(.+)?/\n q, a = $1, $2\n if a\n o = notwice(NilClass, klass, 'type')\n default_style = default_style.guess(arg = a)\n default_pattern, conv = search(:atype, o) unless default_pattern\n end\n ldesc << \"--#{q}\"\n (o = q.downcase).tr!('_', '-')\n long << o\n when /^-(\\[\\^?\\]?(?:[^\\\\\\]]|\\\\.)*\\])(.+)?/\n q, a = $1, $2\n o = notwice(Object, klass, 'type')\n if a\n default_style = default_style.guess(arg = a)\n default_pattern, conv = search(:atype, o) unless default_pattern\n else\n has_arg = true\n end\n sdesc << \"-#{q}\"\n short << Regexp.new(q)\n when /^-(.)(.+)?/\n q, a = $1, $2\n if a\n o = notwice(NilClass, klass, 'type')\n default_style = default_style.guess(arg = a)\n default_pattern, conv = search(:atype, o) unless default_pattern\n end\n sdesc << \"-#{q}\"\n short << q\n when /^=/\n style = notwice(default_style.guess(arg = o), style, 'style')\n default_pattern, conv = search(:atype, Object) unless default_pattern\n else\n desc.push(o)\n end\n end\n\n default_pattern, conv = search(:atype, default_style.pattern) unless default_pattern\n if !(short.empty? and long.empty?)\n if has_arg and default_style == Switch::NoArgument\n default_style = Switch::RequiredArgument\n end\n s = (style || default_style).new(pattern || default_pattern,\n conv, sdesc, ldesc, arg, desc, block)\n elsif !block\n if style or pattern\n raise ArgumentError, \"no switch given\", ParseError.filter_backtrace(caller)\n end\n s = desc\n else\n short << pattern\n s = (style || default_style).new(pattern,\n conv, nil, nil, arg, desc, block)\n end\n return s, short, long,\n (not_style.new(not_pattern, not_conv, sdesc, ldesc, nil, desc, block) if not_style),\n nolong\n end",
"def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end",
"def boston_translator()\n\n\tscript_exit = false\n\n\tsystem \"clear\"\n\n\tputs \"Welcome to Boston. We can be a little hahd to undahstand, \\nso I figgahed I'd help you out.\"\n\n\twhile script_exit == false\n\t\tputs \"-------------------------------------------\"\n\t\tputs \"Whaddaya wanna do?\"\n\t\tputs \"'Lookup' a word or 'translate' somethin?\\n'Help' if you're not sure what I can do.\\nOr if you wanna leave, 'gtfo.'\"\n\t\tchoice = gets.chomp.downcase\n\n\t\tcase choice\n\n\t\twhen \"gtfo\"\n\t\t\tputs \"See ya!\"\n\t\t\tscript_exit = true\n\n\t\t\tnext\n\n\t\twhen \"translate\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Alright, what didja say?\"\n\t\t\toriginal_text = gets.chomp\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\n\t\t\toriginal_text_array = make_list(original_text)\n\t\t\t# puts original_text_array\n\n\t\t\tcapitals_array = find_store_capitals(original_text_array)\n\t\t\t# puts capitals_array\n\n\t\t\tdown_text_array = original_text_array.each {|word| word.downcase!}\n\t\t\t# puts down_text_array\n\n\t\t\tpunct_hash, bare_text = find_store_punctuation(down_text_array)[0], find_store_punctuation(down_text_array)[1]\n\t\t\t# puts punct_hash\n\t\t\t# puts bare_text\n\n\t\t\ttrans_text = word_search_replace(bare_text, $single_word_dictionary)\n\n\t\t\tfinal_text = restore_punct(restore_capitals(trans_text, capitals_array), punct_hash)\n\n\t\t\tputs \"You said: \" + back_to_string(final_text) + \"\\n\"\n\n\t\t\tnext\n\n\t\twhen \"lookup\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Whaddaya wanna lookup?\"\n\n\t\t\tboston_word = gets.chomp.downcase\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\t\t\tboston_word_singleton = boston_word.split\n\t\t\t\n\t\t\tfinal_word = word_search_replace(boston_word_singleton, $single_word_dictionary)\n\n\t\t\tif back_to_string(final_word) == boston_word\n\t\t\t\tputs \"I've nevah heard the word #{boston_word} befoah. Heh. Must not exist.\"\n\t\t\telse\n\t\t\t\tputs \"That means: \" + back_to_string(final_word)\n\t\t\tend\n\n\t\t\t\n\t\t\tnext\n\n\t\twhen \"help\"\n\t\t\tputs \"\\n\"\n\t\t\tputs \"So I'm a pretty smaht translatah. I know most of the most common English words\\nas a Bostonian would say them. \\nBasic spelling rules: ar, re, er, => ah.\\nI also know some of the words from Universal hub,\\nlike grindah, jimmies, and wicked.\\nSo test me out, and see what I know.\"\n\t\t\tputs \"\\n\"\n\n\t\telse\n\t\t\tputs \"Don't be fresh. That's not an option. Try again\" + \"\\n\"\n\n\t\t\tnext\n\n\t\tend\n\n\n\t\t\n\tend\n\t\nend",
"def match_multiple(language)\n case language\n in \"C\" | \"C++\" | \"Elm\" | \"Go\" | \"Kotlin\" | \"Rust\" | \"Swift\"\n puts \"#{language} is a statically typed language\"\n in \"Perl\" | \"JavaScript\" | \"Ruby\" | \"Lua\"\n puts \"#{language} is a dynamic language\"\n end\nend",
"def choosestory(username)\n\nstorychoice = gets.chomp.downcase\n\n case storychoice\n when 'cop story', 'cop story', 'cop', 'cop'\n puts \"\nYou have chosen Cop Story.\"\n copstory(username)\n when 'rom com', 'rom-com', 'romance', 'rom', 'romcom'\n puts \"\n\nYou have chosen Rom-Com.\"\n romcom(username)\n when 'sci fi', 'sci-fi', 'sci', 'science fiction'\n puts \"\n\nYou have chosen Sci-Fi.\"\n scifi(username)\n else\n puts \"Sorry, I don't understand!\n \nWould you like to hear a Rom-Com, Cop Story, or Sci-Fi?\"\n choosestory(username)\n end\nend",
"def essay_writer(title, topic, date, thesis, pronoun)\n if pronoun == \"female\"\n return \"#{title}. #{topic} was born in #{date}. She changed the world and is someone we should all learn about further. \n #{thesis}. #{topic} is important to the world.\"\n elsif pronoun == \"male\"\n return \"#{title}. #{topic} was born in #{date}. He changed the world and is someone we should all learn about further. \n #{thesis}. #{topic} is important to the world.\"\n else \n return \"#{title}. #{topic} was important since #{date}. It changed the world and is something we should all learn about further. \n #{thesis}. #{topic} is important to the world.\"\n end \nend"
] |
[
"0.75419617",
"0.7539772",
"0.7229998",
"0.71595824",
"0.6289475",
"0.61194956",
"0.5983515",
"0.5761694",
"0.57021093",
"0.56883323",
"0.5654398",
"0.56201804",
"0.55753523",
"0.5556518",
"0.55551314",
"0.55510956",
"0.55510956",
"0.55227166",
"0.5508784",
"0.548933",
"0.54860693",
"0.54849255",
"0.5461445",
"0.54521096",
"0.5431936",
"0.5392016",
"0.537455",
"0.5373492",
"0.53700894",
"0.5369103",
"0.53521794",
"0.534983",
"0.5345794",
"0.5345707",
"0.5338265",
"0.5337586",
"0.53373057",
"0.53348404",
"0.53341395",
"0.532862",
"0.53196865",
"0.5309322",
"0.53067756",
"0.53067756",
"0.5302848",
"0.5299734",
"0.5299213",
"0.529497",
"0.5294617",
"0.52875113",
"0.52634627",
"0.52568537",
"0.5242075",
"0.5236887",
"0.52154636",
"0.521472",
"0.5211295",
"0.520092",
"0.51951176",
"0.51924133",
"0.51883",
"0.51822823",
"0.51822823",
"0.51822823",
"0.51822823",
"0.51822823",
"0.51795626",
"0.5174982",
"0.5169577",
"0.5168824",
"0.51659924",
"0.5165004",
"0.5152644",
"0.5152532",
"0.5151293",
"0.515038",
"0.51488304",
"0.5148546",
"0.51464003",
"0.5145713",
"0.513847",
"0.5134618",
"0.51310736",
"0.5116883",
"0.51098436",
"0.510907",
"0.5108142",
"0.5096082",
"0.5096036",
"0.5089835",
"0.50890756",
"0.5085315",
"0.5084346",
"0.50829846",
"0.5073349",
"0.5073332",
"0.50642383",
"0.5063194",
"0.50589275",
"0.5057992"
] |
0.7197868
|
3
|
Initializes the bot object, loads in the external YAML data file and sets the bot's name. Raises an exception if the data loading process fails.
|
def initialize(options)
@name = options[:name] || "Unnamed Bot"
begin
@data = YAML.load(File.open(options[:data_file]).read)
rescue
raise "Can't load bot data"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(options)\n\t\t@name = options[:name] || \"Unnamed Bot\" # name = name otherwise it is an Unnamed bot\n\t\tbegin\n\t\t\t@data = YAML.load(File.read(options[:data_file]))\n\t\trescue \n\t\t\traise \"Can't load bot data\"\n\t\tend\n\tend",
"def initialize(options)\n\t\t@name = options[:name] || \"Unnamed Bot\"\n\t\tbegin\n\t\t# Load data files\n\t\t\t@data = YAML.load(File.read(options[:data_file]))\n\t\t# In case data cannot be loaded\n\t\trescue\n\t\t\traise \"Can't load bot data\"\n\t\tend\n\tend",
"def initialize(options = {})\n\t\t@name = options[:name] || \"Unnamed Bot\"\n\t\tbegin \n\t\t\t# @data = YAML.load(File.read(options[:data_file]))\n\t\t\t@data = BOT_DATA\n\t rescue\n\t \traise \"Cant load bot data\"\n\t end\n\tend",
"def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end",
"def load\n @filename = File.expand_path(file_name('feeds.yml'))\n end",
"def init\n # Guard against doing this more than once.\n unless @config.nil?\n return\n end\n\n if Config.config_files.nil?\n raise \"No configuration file provided, set LapisLazuli::WorldModule::Config.config_files\"\n end\n\n load_config(Config.config_files)\n # In case there was no config file found an empty @config needs to be set to prevent infinite looping.\n if @config.nil?\n warn 'Unable to find a configuration file, defaulting to empty config.yml.'\n @config = {}\n end\n\n @metadata = Runtime.instance.set_if(self, :metadata) do\n log.debug \"Creating metadata storage\"\n Storage.new(\"metadata\")\n end\n end",
"def load\n @bot_ip = @network.bot_ip(@config) # Helper to set bot_ip\n case @config['type']\n when 'script'\n @lang_settings = lang_settings(@config['language'])\n filename = \"#{@name}#{@lang_settings[:file_type]}\"\n load_docker(filename)\n write_script(filename)\n when 'container', 'docker'\n # load the docker container set in the config\n load_passive unless @config['listen_type'] == 'active'\n load_active if @config['listen_type'] == 'active'\n when 'api'\n load_api\n else\n raise \"Plugin: #{@name}: only 'script', 'container', and 'api' are known\"\n end\n help_load\n end",
"def initialize\n @main = {}\n @config_directory = File.expand_path \"~/.config/next_background\"\n @file = \"#{@config_directory}/config.yaml\"\n self.load\n end",
"def initialize(path)\n @data = YAML.load_file(path)\n end",
"def initialize\n @path = File.join(File.expand_path('.'), FILE_NAME)\n unless File.exist?(@path)\n @path = (ENV['ASPELLBEE_CONFIG_PATH'] || File.join(File.expand_path('~'), FILE_NAME))\n end\n @data = load_config_file\n end",
"def init\n Config.load_yaml\n Log.init\n reset\n end",
"def init_data\n Bot::DB[my_name] ||= {}\n end",
"def init_data\n Bot::DB[my_name] ||= {}\n end",
"def initialize(name)\n @name = name\n load \n end",
"def initialize(args)\n @filename = args.fetch(:filename, nil)\n @yamlstring = args.fetch(:yamlstring, nil)\n \n unless defined?(@filename) || defined?(@string)\n raise InitializationError.new \"you must give me a filename or a string of YAML to get started\"\n end\n\n \n \n \n end",
"def initialize(file = Config::DEFAULT_CONFIG_PATH)\n @started_at = (Time.now.to_f * 1e3).round\n\n @config = Config.new file\n\n init_logger\n\n log.debug 'Initializing plugin manager'\n @plugin_manager = PluginManager.new self\n\n log.debug 'bot finished initializing'\n end",
"def initialize(yaml_data, logger)\n\t\t@data = yaml_data\n\t\t@logger = logger\n\t\t@data['images_dir_under_jekyll'] ||= 'assets/img'\n\t\t@data['posts_dir_under_jekyll'] ||= '_posts'\n\t\t@data['jekyll_blog_dir'] ||= 'source'\n\t\t@data['name'] ||= 'default blog'\n\t\t@data['origin_repo_branch'] ||= 'master'\n\t\t@data['markup'] ||= 'markdown'\n\t\tDIRECTORY_KEYS.each do | key |\n\t\t\t@data[key].sub!(/\\/$/, '') # remove any trailing slashes from directory paths\n\t\tend\n\t\t@data.each do |key, value|\n\t\t\t@logger.log( \"#{@data['name']} #{key}: #{value}\" ) if @logger\n\t\tend\n\t\tconfirm_local_repo(@data)\n\tend",
"def initialize(path)\n @f = nil\n @path = path\n open_config()\n @bot = []\n parse_config(false)\n end",
"def initialize(base, name)\n @base = base\n @name = name\n \n self.data = {}\n \n self.process(name)\n self.read_yaml(base, name)\n end",
"def initialize(base, name)\n @base = base\n @name = name\n \n self.data = {}\n \n self.process(name)\n self.read_yaml(base, name)\n end",
"def load(name)\n yml_file(\"#{name}/#{environment}\") ||\n yml_file_with_key(\"#{name}\", environment) ||\n yml_file(\"#{name}/default\") ||\n yml_file_with_key(\"#{name}\", 'default') ||\n raise(NotFound.new(name, environment))\n end",
"def initialize(params={})\n if params.has_key?(:name)\n @botname = params.delete(:name)\n end\n\n @config = load_config(params)\n @run_count = 0\n\n #\n # check for command line options\n # handle resets, etc\n #\n\n at_exit do\n if !@handlers.empty? && @run_count <= 0 && skip_run? != true\n run_or_stream\n end\n \n raise $! if $!\n end\n @handlers = {}\n end",
"def init\n return if @@tone_data != nil\n if (!FileTest.exist?(TONE_DATA))\n raise StandardError.new(\"Configuration file '#{TONE_DATA}' was not found!\\n\")\n end\n \n # since this is a YAML file, we can append new keys to it.\n @@tone_data = YAML.load(File.read(TONE_DATA))\nend",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def initialize path\n @path, @weight = path, 0\n @dependencies, @permissions, = [], []\n @name = File.basename(path).to_sym\n load_yaml\n end",
"def load_fixtures(name)\n data = YAML.load_file File.join(File.dirname(__FILE__), \"#{name}.yml\")\n # hmm, how do I dynamically add instance variables? data.each { |k,v| @`k` = User.new data[k] }\n @user_1 = User.new data['user_1']\n @user_2 = User.new data['user_2']\n end",
"def initialize\n load_config\n @token = ENV.fetch('DISCORD_TOKEN', @config[:DISCORD_TOKEN])\n @app_id = ENV.fetch('DISCORD_APP_ID', @config[:DISCORD_APP_ID])\n @bot = my_bot\n @bot.info \"The first few characters of the discord token are: #{@token[0, 5]}\"\n @bot.info \"App_id is: #{@app_id}\"\n end",
"def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end",
"def load()\n\n checkFileExists()\n loadConfigs()\n checkConfigs() \n end",
"def read!\n file = root + FILENAME\n if file.exist?\n data = YAML.load(File.new(file))\n data.each do |name, value|\n self[name] = value\n end\n end\n return self\n end",
"def initialize\n check\n \n # Load names\n print \"Loading Names ... [BUSY]\"\n @mNames = (File.open(\"dat/name.dat.txt\").read).split(/\\n/)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n # Load surnames\n print \"Loading Surnames ... [BUSY]\"\n @mSurnames = (File.open(\"dat/surnames.dat.txt\").read).split(/\\n/)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n # Load words\n print \"Loading Words ... [BUSY]\"\n @mWords = (File.open(\"dat/words.dat.txt\").read).split(/\\r\\n/)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n @mDelim1 = \" \"\n @mDelim2 = \"\\n\"\n\n # Strictly here in order to have the urls to locate the files\n @mMaleNameLocation = \"\"\n @nFemaleNameLocation = \"\"\n @mDictionaryLocation = \"\"\n\n @mResult = \"\"\n @mCommand = \"\"\n\n @mIterations = 1\n end",
"def initialize(params={})\n if params.has_key?(:name)\n @botname = params.delete(:name)\n end\n\n @config = load_config(params)\n @run_count = 0\n\n #\n # check for command line options\n # handle resets, etc\n #\n\n at_exit do\n if !@handlers.empty? && @run_count <= 0 && skip_run? != true\n run!\n end\n \n raise $! if $!\n end\n @handlers = {}\n end",
"def load_yml(filename); end",
"def initialize(yaml, merge = nil)\n @id = ''\n @description = ''\n @entries = {}\n load_yaml(yaml, merge)\n end",
"def initialize app_data\n\n @options = OpenStruct.new\n @app_data = app_data\n @logger = ARINcli::Logger.new\n\n config_file_name = Config.formulate_config_file_name( @app_data )\n if File.exist?( config_file_name )\n @config = YAML.load( File.open( config_file_name ) )\n else\n @config = YAML.load( @@yaml_config )\n end\n\n configure_logger()\n end",
"def load yaml\n data = YAML::load yaml \n raise \"Cannot load YAML data\" unless data\n\n @raw = @data = @errors = @commands = nil\n @errors = data.delete('__ERRORS__')\n @commands = data.delete('__COMMANDS__')\n @raw = OpenStruct.new data\n @data = { }\n end",
"def initialize()\n @config = YAML.load_file('config.yaml')\n @puppetdb = @config['puppetdb']\n @servicenow = @config['servicenoe']\n @syslog = @config['syslog']\n end",
"def initialize(bot, data, params)\n @bot = bot\n @data = data\n @params = params\n end",
"def initialize\n @data = default_data!(load_yml_data)\n # Order is important. @browserstack relies on @proxy being set\n @proxy = ::Quke::ProxyConfiguration.new(@data[\"proxy\"] || {})\n @browserstack = ::Quke::BrowserstackConfiguration.new(self)\n end",
"def initialize()\n @config_file=\"projects.yml\"\n @config = YAML.load_file(@config_file)\n end",
"def initialize\n load_config( \"entityid.yml\" )\n end",
"def initialize\n load_config( \"entityid.yml\" )\n end",
"def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end",
"def configure\n # Users to block instead of interacting with\n self.blacklist = ['mcamargo1997']\n\n # Range in seconds to randomize delay when bot.delay is called\n self.delay_range = 1..6\n\n @userinfo = {}\n @botinfo = {\n ENV[\"BOT_NAME_1\"] => BotInfo.new(ENV[\"BOT_NAME_1\"]),\n ENV[\"BOT_NAME_2\"] => BotInfo.new(ENV[\"BOT_NAME_2\"])\n }\n end",
"def fill_from_yaml_file(filename)\n yml = File.read(File.join(User.recipes, filename), encoding: 'utf-8')\n fill_from_yaml(yml)\n @filename = filename\n end",
"def load()\n\n # Get the project root directory\n @root_dir = locate_root\n\n if File.file? File.join(@root_dir, SETTINGS_FILE)\n settings = YAML.load_file File.join(@root_dir, SETTINGS_FILE)\n @targets = settings[:targets]\n @src = settings[:src]\n @notify = settings[:notify]\n else\n puts \"No settings file found, creating one now\"\n # Settings file doesn't exist\n # Create it\n @targets = {}\n @active_target = nil\n @src = './src'\n @notify = true\n\n dump_settings\n end\n\n # Set the default target\n @targets.values.each do |target|\n # Check if this one is active\n if target.active == true\n # Set it if there is no default target set yet\n if @active_target == nil\n @active_target = target\n else\n puts \"Two active targets set. Using #{@active_target.print}\"\n end\n end\n end\n end",
"def load()\n\n # Get the project root directory\n @root_dir = locate_root\n\n if File.file? File.join(@root_dir, SETTINGS_FILE)\n settings = YAML.load_file File.join(@root_dir, SETTINGS_FILE)\n @targets = settings[:targets]\n @src = settings[:src]\n @notify = settings[:notify]\n else\n puts \"No settings file found, creating one now\"\n # Settings file doesn't exist\n # Create it\n @targets = {}\n @active_target = nil\n @src = './src'\n @notify = true\n\n dump_settings\n end\n\n # Set the default target\n @targets.values.each do |target|\n # Check if this one is active\n if target.active == true\n # Set it if there is no default target set yet\n if @active_target == nil\n @active_target = target\n else\n puts \"Two active targets set. Using #{@active_target.print}\"\n end\n end\n end\n end",
"def initialize\n create_config unless File.exists?(config_file)\n load_settings\n set_domain\n end",
"def initialize\n load_data\n end",
"def bootstrap\n STDERR.puts \"My oauth authorization URL is: #{@bot.invite_url}\"\n load_plugins\n end",
"def load!\n raise \"Source settler.yml not set. Please create one and set it by using Settler.source = <file>. When using Rails, please create a settler.yml file in the config directory.\" unless source\n\n self.config = File.exist?(source) ? YAML.load(ERB.new(File.read(source)).result).to_hash : {}\n self.config = config[namespace] || {} if namespace\n\n setting_class.build_settings! config\n setting_class.all.each{ |s| key = s.key; Settler.class.send(:define_method, key){ setting_for(key) } unless Settler.class.respond_to?(key) }\n end",
"def load(filename)\n update! YAML.load_file(filename)\n end",
"def initialize\n self.db = YAML::Store.new(DB_FILE)\n end",
"def initialize(*args)\n super\n @game = Game.new\n\n @changelog = self.load_changelog\n\n @mods = config[:mods]\n @channel_name = config[:channel]\n @settings_file = config[:settings]\n @games_dir = config[:games_dir]\n\n @idle_timer_length = config[:allowed_idle]\n @invite_timer_length = config[:invite_reset]\n\n @idle_timer = self.start_idle_timer\n\n @game_timer_minutes = nil\n @game_timer = nil\n end",
"def initialize\n configure_via_yaml\n configure_via_env\n end",
"def load_data(data_file)\n puts \"FileGenTask: Loading data from YML file [ #{data_file} ]\" if @verbose\n df = DataFile.new\n @data = df.read( data_file )\n end",
"def initialize(yaml_file = nil)\n @yaml_file = yaml_file\n end",
"def load_metadata\n version = if self.respond_to?(:chef_version)\n chef_version\n else\n Linter::DEFAULT_CHEF_VERSION\n end\n metadata_path = [version, version.sub(/\\.[a-z].*/, ''),\n Linter::DEFAULT_CHEF_VERSION].map do |version|\n metadata_path(version)\n end.find { |m| File.exist?(m) }\n @dsl_metadata ||= Yajl::Parser.parse(IO.read(metadata_path),\n symbolize_keys: true)\n end",
"def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end",
"def initialize(botname, body, webhook_url=nil)\n self.botname = botname\n self.webhook_url = webhook_url\n parsed = URI.decode_www_form(body)\n parsed.each do |p|\n # puts \"#{p[0]}=#{p[1]}\"\n if p[0] == \"command\"\n self.command = p[1]\n # puts \"command=#{self.command}\"\n end\n if p[0] == \"trigger_word\"\n # This is for trigger words, not slash commands\n self.trigger_word = p[1]\n end\n if p[0] == \"channel_name\"\n self.channel = p[1]\n end\n if p[0] == \"user_name\"\n self.username = \"@#{p[1]}\"\n # puts \"username #{username}\"\n end\n if p[0] == \"text\"\n self.text = p[1].strip\n # puts \"text=#{text}\"\n end\n if p[0] == \"response_url\" && !webhook_url \n # we get it in the post body with more recent slack apps\n self.webhook_url = p[1]\n end\n end\n if self.channel == \"directmessage\"\n self.channel = self.username\n else\n self.channel = \"\\##{self.channel}\" unless self.channel[0] == '#'\n end\n\n end",
"def load( dirname )\n\t\t\t@filename= File.join( dirname, \"ticket.yaml\" )\n\t\t\t@idstring = File.basename( dirname )[0..7]\n\t\t\tif File.file?( @filename )\n\t\t\t\t@data = YAML.load_file( @filename ) \n\t\t\tend \n\t\t\tloadComments\n\t\t\tloadAttachments\n\t\tend",
"def data_load\r\n unless $data_actors\r\n $data_actors = _clean_name_utf8(load_data(\"Data/Actors.rxdata\"))\r\n $data_classes = _clean_name_utf8(load_data(\"Data/Classes.rxdata\"))\r\n $data_enemies = _clean_name_utf8(load_data(\"Data/Enemies.rxdata\"))\r\n $data_troops = _clean_name_utf8(load_data(\"Data/Troops.rxdata\"))\r\n $data_tilesets = _clean_name_utf8(load_data(\"Data/Tilesets.rxdata\"))\r\n $data_common_events = _clean_name_utf8(load_data(\"Data/CommonEvents.rxdata\"))\r\n $data_system = load_data_utf8(\"Data/System.rxdata\")\r\n end\r\n $game_system = Game_System.new\r\n $game_temp = Game_Temp.new\r\n end",
"def load\n config = YAML.load_file @config_path\n @path = config['steam']\n end",
"def initialize(file = nil)\n @file_name = file ? file : File.join(Dir.home, '.dodona.yml')\n @config = if !File.exist? file_name\n {}\n else\n YAML.load_file file_name\n end\n @config = DEFAULTS.merge(@config)\n end",
"def load\n @yaml_parts, @ruby_parts = lookup_parts\n @data.clear\n self.yaml_parts_in_loading_order.each do |yaml_part|\n yaml_data = YAML.load_file(yaml_part)\n part_sections = File.basename(yaml_part, '.yml').split('.')\n part_sections.delete_at 0 # delete the 'en' at the beginning\n if part_sections.empty?\n @data.merge! yaml_data\n else\n begin\n target_section = @data[*part_sections]\n raise EntryNotFound unless target_section.respond_to? :merge!\n target_section.merge! yaml_data\n rescue EntryNotFound\n @data[*part_sections] = yaml_data\n end\n end\n end\n \n @ruby_parts.each do |ruby_part|\n Kernel.load ruby_part\n end\n end",
"def load!\n path = path()\n raise \"data object #{@type}:#{@id} does not exist\" unless File.directory? path\n @fields = Configuration.new path, 'metadata'\n @fields.dup.each do |k, v|\n if (cfg = @type[k])\n @fields[k] = Field.from(@repo, cfg).set(v)\n else\n warn \"unrecognised metadata #{k} = #{v.inspect}\"\n @fields[k] = v\n end\n end\n @type.each_field do |k, cfg|\n next if @fields[k]\n fieldobj = Field.from(@repo, cfg)\n if (dflt = fieldobj.default)\n @fields[k] = fieldobj.tap{|f| f.default! }\n elsif fieldobj.required?\n raise \"data object #{@type}:#{@id} missing required field #{k}\"\n end\n end\n self\n end",
"def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @dirty = true\n\n self.process(name)\n self.read_yaml(File.join(base, dir), name)\n end",
"def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n end\n\n self.data ||= {}\n end",
"def read_yaml(_base, _name, _opts = {})\n self.content = self.output = \"\"\n self.data ||= DEFAULT_DATA.dup\n end",
"def initialize(filename)\n @data_source\n @metros = Hash.new\n if !File.file?(filename)\n puts \"Files does not exit. check your path\"\n exit\n end\n file = File.read(filename)\n dataset = JSON.parse(file)\n initialize_data_source(dataset['data sources'])\n initialize_metros(dataset['metros'])\n if (dataset.has_key?('single_route'))\n initialize_routes(dataset['routes'], 1)\n else\n initialize_routes(dataset['routes'], 0)\n end\n end",
"def load(filename)\n\t\t\traise ArgumentError.new unless filename\n\n\t\t\toptions = YAML::load(IO.read(filename))\n\t\t\tif(options)\n\t\t\t\tself.configure(options)\n\t\t\tend\n\t\tend",
"def initialize_from_yaml(path)\n # FIXME: It would be a lot cleaner if the YAML library would raise an\n # exception if it fails to read the file. We'll handle it like this for now\n # load_file just returns \"false\" if it fails\n yaml_data = YAML.load_file(path)\n\n unless yaml_data.nil?\n raise InitializationError.new(\"Bad YAML format, key/value pairs expected\") unless yaml_data.kind_of?(Hash)\n\n yaml_data.each do |variable, value|\n self.store(variable, value)\n end\n end\n\n after_initialize\n dump\n end",
"def load_yml_data\n if File.exist? self.class.file_location\n # YAML.load_file returns false if the file exists but is empty. So\n # added the || {} to ensure we always return a hash from this method\n YAML.load_file(self.class.file_location) || {}\n else\n {}\n end\n end",
"def initialize\n @tree = YAML::parse(File.open(CONFIG_FILE))\n end",
"def load\n connect\n with_project do |project_id|\n file, cfg_file = args\n raise(CommandFailed, \"Usage: #{$0} datasets:load <file> <dataset config>\") unless cfg_file\n config = JSON.load open(cfg_file) rescue raise(CommandFailed, \"Error reading dataset config file '#{cfg_file}'\")\n schema = Model::Schema.new config\n Project[project_id].upload file, schema\n end\n end",
"def load #TODO: validation\n \tputs \"What game do you want to load?\"\n \tsaved_game = gets.chomp.gsub(' ', '_')\n \tsaved_game = \"#{saved_game}.yaml\"\n \tload_game(saved_game)\n end",
"def initialize\n bootstrap unless File.exist?(file)\n load_attributes\n end",
"def initialize\n\t\tpath = Pathname.new(File.dirname(__FILE__) + \"/../Preferences.yml\")\n\t\tdata = YAML.load_file(path)\n\t\t@menuAssets = MenuAssets.getInstance()\n\t\t@language = data[\"language\"]\n\t\t@resolution = data[\"resolution\"]\n\t\t@color = data[\"color\"]\n\t\t@clueHighlightColor = data[\"clueHighlightColor\"]\n\t\t@helpColor = data[\"helpColor\"]\n\tend",
"def initialize\n @data = {}\n @data_file = $config[:billing_data][:connection]\n\n @data = YAML.load_file(@data_file) if File.exist?(@data_file)\n\n @data[\"bindings\"] = {} unless @data.has_key?(\"bindings\")\n end",
"def initialize(yaml_file)\n @base = {}\n @resources = {}\n @errors = {}\n @required_response_objects = [] # Response objects that have been referenced\n @valid = true\n\n unless File.exists? yaml_file\n raise(ArgumentError, \":yaml_file must be a valid file path\")\n end\n\n @yaml = YAML.load_file(yaml_file)\n\n parse_base\n parse_resources\n #parse_response_objects\n end",
"def from_yaml\n\t\tdata = YAML.load File.read(\"save.yaml\")\n\t\t@board = Board.new(data[:board], data[:positions])\n\t\t@current_turn = data[:current_turn]\n\t\t@ai_on = data[:ai_on]\t\t\n\tend",
"def init(file)\n\t\tbegin\n\t\t\tload file\n\t\trescue => e\n\t\t\traise Disbatch::FailedLoadPluginError, file\n\t\tend\n\tend",
"def initialize(robot_dir)\n super()\n \n @robot_dir = Pathname.new(robot_dir).expand_path # The robot's source/resource directory. NEVER RUN FILES IN IT!\n @config = RobotConfiguration.new(robot_dir + 'config.xml')\n \n @ident = object_id.to_s # The guid of the robot.\n LOG.debug \"New Robot Ident: #{ident}\"\n \n build_components()\n \n @bootstrap = Waiter.new # A waiter that is used to wait until bootstrap is complete.\n @socket = nil # The socket connection to the robot process.\n @process_thread = nil # The thread that the robot process is running in. (It does a wait and only exits if the script exits)\n @process = nil # The process object for the robot process in case one needs to poke it.\n end",
"def initialize(file_path)\r\n # create if default doesn't exist?\r\n @file_descriptor = File.open(file_path, File::RDWR | File::CREAT)\r\n @file_descriptor.seek(0, IO::SEEK_SET)\r\n torrent_string = @file_descriptor.readlines.join\r\n @torrents = YAML.load(torrent_string)\r\n end",
"def initialize(api_key = nil, api_version = nil, url = nil, username = nil, password = nil, options = {})\n load_yaml\n if load_yaml\n @api_key = load_yaml['api_key']\n @api_version = load_yaml['api_version']\n @options = load_yaml['options']\n @password = load_yaml['password']\n @url = load_yaml['url']\n @username = load_yaml['username']\n else\n @api_key = api_key\n @api_version = api_version\n @options = options\n @password = password\n @url = url\n @username = username\n end\n end",
"def initialize(*args)\n\t\t\t\tsuper\n\t\t\t\t#super called in order to call the same method from the parent class and then adding our thing (next line)\n\t\t\t\t@cleverbot = ::Cleverbot::Client.new #:: means look not at this namespace but at the very top and search down.\n\t\t\tend",
"def init\n fname = path(\"init.rb\")\n load fname unless fname.nil?\n end",
"def load!\n JSON.load(File.read(@name))\n rescue JSON::ParserError => e\n raise LogFile::LoadError, e.message\n end",
"def load_from_file!\n return unless File.exists?(uservoice_configuration_file)\n\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n self.merge!(configuration[\"uservoice\"])\n end",
"def load_prompt_file\n prompt_file = \"#{prompts_dir}/#{@host_param[:type]}_prompt.yml\"\n @prompt = load_yaml_file('prompt file', prompt_file)\n end",
"def initialize\n self.reset\n\n if File.exist? SETTING_FILE\n\n # Sometimes on the _development_ environment\n # the settings file gets corrupted...\n # Well, that's a shame!\n begin\n @values = YAML::load_file SETTING_FILE\n rescue\n self.reset\n end\n\n # Strange error that sometimes appear\n # (@values becomes `false`)\n if not @values.class == Hash\n self.reset\n end\n end\n self.save\n end",
"def load(environment = nil)\n if !ENV[@env_name].nil?\n @yaml = Zlib::Inflate.inflate(\n Base64.strict_decode64(ENV[@env_name])\n )\n else\n if environment\n env_specific_file_path = \"#{@dir}/#{environment}.yml\"\n if File.exist?(env_specific_file_path)\n file_path = env_specific_file_path\n end\n end\n file_path ||= \"#{@dir}/default.yml\"\n\n @yaml = open(file_path).read\n end\n\n self\n end",
"def initialize_connection_from_file(file_path)\n raise Errno::ENOENT unless File.exists?(file_path)\n file = File.open(file_path)\n config = symbolize_keys(YAML::load(file.read))\n self.initialize_connection(config[:lobby], config[:options])\n end",
"def initialize_repository\n super\n return unless @file.exists?\n\n begin\n packages_data = @file.read\n unless packages_data.is_a?(Array)\n raise UnexpectedValueError,\n 'Could not parse package list from the repository'\n end\n rescue => e\n raise InvalidRepositoryError,\n \"Invalid repository data in #{@file.path}, \\\n packages could not be loaded: \\\n [#{e.class}] #{e.message}\"\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(nil, true)\n packages_data.each do |package_data|\n package = loader.load(package_data)\n add_package(package)\n end\n\n end",
"def load!( file )\n Yell.new Yell::Configuration.load!(file)\n end",
"def load_yaml(filename); end",
"def load!\n metadata # force lazy evaluation to occur\n\n # re-raise any exception that occurred when reading the metadata\n raise_metadata_error!\n\n load_all_files\n\n remove_ignored_files\n\n if empty?\n raise Exceptions::CookbookNotFoundInRepo, \"The directory #{cookbook_path} does not contain a cookbook\"\n end\n\n cookbook_settings\n end",
"def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend",
"def load(name)\n config_file \"#{name}\"\n end",
"def load_battle_test_database\n en_et_dm_lbd\n if FileTest.directory?(\"Data/Text/#{SES::ExternalText::Languages[0]}\")\n create_text\n end\n $game_text = load_data(\"Data/#{check_language}.rvdata2\")\n end"
] |
[
"0.771837",
"0.7648457",
"0.7572003",
"0.61225015",
"0.5986048",
"0.58580446",
"0.58363676",
"0.583599",
"0.5745516",
"0.57450503",
"0.57012063",
"0.55806094",
"0.55806094",
"0.55789787",
"0.5577239",
"0.55616033",
"0.55525935",
"0.55413663",
"0.5503913",
"0.5503913",
"0.550227",
"0.54996103",
"0.54747033",
"0.5471885",
"0.5469986",
"0.54566365",
"0.54507667",
"0.5441488",
"0.5440569",
"0.5418245",
"0.54089916",
"0.54061764",
"0.5399527",
"0.5399496",
"0.53971094",
"0.5395982",
"0.5390559",
"0.5389799",
"0.53803957",
"0.53778774",
"0.53710675",
"0.53710675",
"0.53508973",
"0.53387934",
"0.5320183",
"0.5304356",
"0.5303298",
"0.5298909",
"0.52956754",
"0.528382",
"0.5280164",
"0.52723104",
"0.526243",
"0.52578354",
"0.52575135",
"0.5256321",
"0.525606",
"0.5243947",
"0.5234108",
"0.5233469",
"0.5227949",
"0.5218809",
"0.5200622",
"0.51952416",
"0.5190176",
"0.51896924",
"0.5188878",
"0.5187152",
"0.5176091",
"0.5171557",
"0.5162835",
"0.516138",
"0.51603895",
"0.5159045",
"0.51502806",
"0.51496744",
"0.5146521",
"0.51462543",
"0.5129847",
"0.51157725",
"0.51102644",
"0.51076806",
"0.51052266",
"0.50922394",
"0.50861216",
"0.5074981",
"0.5073901",
"0.50735754",
"0.50713766",
"0.50683224",
"0.5061426",
"0.50556743",
"0.50506496",
"0.5045998",
"0.5040809",
"0.5038348",
"0.50304604",
"0.5027519",
"0.5024277",
"0.50227827"
] |
0.7728877
|
0
|
Returns a random greeting as specified in the bot's data file
|
def greeting
random_response(:greeting)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def greeting\n greetings = [\"Hello\", \"Hey\", \"Greetings\", \"Salutations\", \"Welcome\"]\n greetings[rand(greetings.size)]\n end",
"def greeting\n\t\trandom_response(:greeting)\n\tend",
"def generate_greeting\n languages = %w[French Spanish English Italian Hindi Japanese Korean Chinese Tamil Polish Dutch German Swedish]\n greetings = %w[Bonjour Hola Greetings Ciao שלום こんにちは 여보세요 你好 வணக்கம் Cześć Hallo Guten\\ Tag Hej]\n selection = rand(languages.length)\n @greeting_language = languages[selection]\n @greeting = greetings[selection]\n end",
"def greeting\n\t\t# array of greetings and offers\n\t\tgreetings = [\"Hey!\", \"Hello!\", \"Good day!\", \"Greetings!\", \"Hi!\"]\n\t\toffer = [\"Can I help you?\", \"How can I help you?\", \"Do you need help?\", \"What can I help you with?\"]\n\t\t\n\t\t# construct random sentence\n\t\tg = greetings.sample\n\t\to = offer.sample\n\t\tsentence = g + \" \" + o\n\t\t\n\t\t# return sentence\n\t\treturn sentence\n\tend",
"def greeting\n\t\trandom_response :greeting\n\tend",
"def greeting\n read_dictionary(:greeting)\n end",
"def greet(m)\n return unless m.message =~ /\\b(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}\\b/i\n greetings = ['Hello', 'Hi', 'Hola', 'Ni hao', 'Hey', 'Yo', 'Howdy']\n greeting = greetings[rand(greetings.size)]\n m.reply \"#{greeting}, #{m.user.nick}!\"\n end",
"def random_thank_you\n [\n \"Thanks for sharing. I'll post your secret anonymously soon. \" +\n \"You might want to unfollow me - I'll unfollow you, too.\",\n \"I'll post your message soon. For secrecy, you might want to unfollow me.\",\n \"Thank you! I'll post your secret soon.\"\n ].sample\n end",
"def get_greeting(user)\n greeting = @db.get_first_row(\"SELECT * FROM greetings ORDER BY RANDOM() LIMIT 1;\") if user.nil? or user.empty?\n greeting = @db.get_first_row(\"SELECT * FROM greetings WHERE user = ? ORDER BY RANDOM() LIMIT 1;\", user) unless user.nil? or user.empty?\n return \"Welcome to Nangiala, %s\" % user if greeting.nil? or greeting.empty?\n greet_id = greeting['id']\n greeting = greeting['greet']\n\n greeting.gsub!(/USER/,'%s')\n\n greeting = \"[#\"+greet_id.to_s+\"] \" + greeting % user\n return greeting\n end",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_name = message.from.nil? ? '' : ', ' + message.from.first_name\n send_message \"#{greetings.sample.capitalize}#{first_name}!\\n Enter /help for options.\"\n end",
"def greeting_hello\n answer_with_message(\"Halo bos, ada yang bisa saya bantu ?\")\n end",
"def greet\n\t\treturn \"I'm #{GOODMOOD}. How are you?\"\n\tend",
"def greeting_message()\n greeting_message = case Time.now.hour\n when 6..11 then \"Buen dia\"\n when 12..20 then \"Buenas tardes\"\n else \"Buenas noches\"\n end\n end",
"def greetings\n if @awake\n \"Hi, my name is #{full_name}\"\n else\n 'ZZZzzzZZZzzz'\n end\n end",
"def check_for_greet(cmd, nick)\n if cmd =~ /\\b(Hi|Hello|Hey|Hay|Hola|Sup|Whats up|Yo)\\b/i\n self.say \"#{@greetings[rand(@greetings.length)]}, #{nick}\"\n end\n end",
"def get_random_message()\n\t\topening = [ \"Developer Portfolio\",\n \t\t\"My Rails 4 Portfolio\",\n \t\t\"Hello World\" ]\n\n\t\tmiddle = [ \"Built from the Rails Tutorial\",\n \t\t\"Rails Apps Are Great\",\n \t\t\"Rails Twitter clone App\" ]\n\n\t\tending = [ \"Contact us if you need help.\",\n \t\t\"We are here to server you. \",\n \t\t\"Call us if you need to 412-555-1212.\"]\n\n\t\t\"#{opening[rand(3)]}\"\n\n\tend",
"def greet\n self.say \"Hello, I am #{@config[:nick]}. I am the resident uber-bot. To learn more, type '.about'.\"\n end",
"def greeting\n buffer\n line\n puts \"Welcome to the Hero Battle Simulator.\"\n puts \"Press 1 to play as a Hero. Press 2 to play as a Villain.\"\n line\n buffer\n choice = gi_integer\n if choice == 1\n hero_setup\n elsif choice == 2\n villain_setup\n else puts \"Sorry, please enter either 1 or 2.\"\n greeting\n end\n end",
"def random_morning\n @reply_morning_text.sample\n end",
"def greeting\n system 'clear'\n puts WELCOME_MESSAGE\n end",
"def greet2(name)\n hi = [\"Hello\", \"Hi\", \"Ohai\", \"ZOMG\"]\n \"#{hi.sample} #{name}!\"\nend",
"def generate_name\n names = []\n File.open(\"names.txt\").each {|str| names << str.chomp}\n @name = names[rand(names.length)]\n end",
"def say_hello\n puts \"Hello, what's your name?\"\n print \"User: \".blue\n name = gets.chomp\n bot_response(\"Hello #{name}\")\nend",
"def say_greeting\r\n greeting = \"\\t\\t Welcome to the Virtual Crazy 8-Ball game!\" +\r\n \"\\n\\n\\n\\n\\n\\n\\t To play: \" +\r\n \"\\n\\t Simply ask any question you desire to have answered and press ENTER.\" +\r\n \"\\n\\t The 8-Ball will work its magic to determine your fortune! \" +\r\n \"\\n\\t You may ask as many questions as you like and submit 'q' to end the game.\" +\r\n \"\\n\\n\\n\\n\\n\\n\\nPress Enter to continue. \\n\\n: \"\r\n print greeting\r\n end",
"def greeting\n\t\tputs \"Welcome to the Secret Number Game \\n\"\n\t\tputs \"Written by AxleMax\\n\\n\"\n\tend",
"def getSomeCoolName\n\t\tnames = File.open(\"NazwyKonferencji\").read.split(\"\\n\")\n\t\tnames[rand(names.size)]\n\tend",
"def greeting\nputs \"HELLO, BONJOUR, HOLA, GUTENTAG, HALLO, HOWDY, NAMASKAR, MERHABA\"\nend",
"def welcome\t\n\t\tputs \"Enjoy the Game #{$person.show_name}\"\n\t\tputs \"This game is about guessing a '\\Secret Number'\\ between 1-10. You have 3 attempts to identify the '\\Secret Number'\\. \n\t\t You win if you guess the '\\Secret Number'\\ withing the 3 attempts, otherwise you lose the game!\"\n\tend",
"def greeting(m, message)\n if message =~ /help/\n m.reply help_message(m.user.nick)\n else\n m.reply \"#{m.user.nick}: Thanks for asking! I did not recognize your question. Try asking me for help.\"\n end\n end",
"def create_random_name\n String.new(Faker::Games::ElderScrolls.creature)\n end",
"def random_username\n # \"batterypop-#{(rand * 10000).to_i}\"\n \"batterypop-#{Time.now.to_i}\"\n end",
"def assign_greeting\n self.greeting = generate_greeting\n end",
"def test_greeting_message\n name = \"Zigor\"\n age = 21\n expected_message = \"Hello I am #{name} and my age is #{age}. Nice to meet you!\"\n chat_bot = ChatBot.new\n chat_bot.name = name\n chat_bot.age = age\n assert_equal expected_message, chat_bot.greeting_message\n end",
"def say_greeting\n\t\tgreeting = \"\\t\\t Welcome to the Virtual Crazy 8-Ball\" +\n\t\t\"game\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nPress Enter to \" +\n\t\t\"continue. \\n\\n: \"\n\t\tprint greeting\n\tend",
"def say_greeting\r\n\t\tgreeting = \"\\t\\t Welcome to the Virtual Crazy 8-Ball\" +\r\n\t\t\"game\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\" +\r\n\t\t\"Instructions: Choose Yes or No to play the 8-Ball game!\\n\" +\r\n\t\t\"When prompted enter your question you wish to be answered.\" +\r\n\t\t\"\\n\\nPress Enter to continue. \\n\\n: \"\r\n\t\t\r\n\t\tprint greeting\r\n\tend",
"def random_mention_from_text\n @reply_mention_text.sample\n end",
"def greet\n ran_nr = rand(100)\n yield ran_nr\nend",
"def greet\n 'Ahoy Mateys!'\n end",
"def welcome\n\t\tputs \"Welcome to Hangman!\\n\\n\"\n\t\tputs \"The computer has selected a random secret word for you to guess.\\n\"\n\t\tputs \"Be careful - you have 6 incorrect guesses before you hang the man!\"\n\tend",
"def namegen\n\t# assign random line from textfile to variable\n\tcname = File.readlines('nameslist.txt').sample\n\tprint \"Name: \"+cname\n\thp = 15\n\tprint \"Hp: \", hp\nend",
"def greeting \n\t\t\"Hi my name is #{@name}\"\n\tend",
"def greeting(name)\n\t\tputs \" Hi there #{name}, how are you doing today?\"\n\tend",
"def greeting\n ver = @data.unpack(\"C\").first\n clear_data\n if ver == 5\n send_data \"\\x05\\x00\" # NO AUTHENTICATION REQUIRED\n else\n send_data \"\\x05\\xFF\" # NO ACCEPTABLE METHODS\n end\n Fiber.yield\n end",
"def random_face_emoji\n %w[cool goofy monocle sly smile think].sample\n end",
"def first_name\n @seeds[:first_name][Random.rand(0..86)]\n end",
"def welcome(greeting, options={})\n name = options[:name] || 'friend'\n punct = options[:punctuation] || '!'\n greeting + ' ' + name + punct\nend",
"def greetings\n \"Greetings. We come in peace.\"\n end",
"def greeting\n puts \"\\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\"\n puts \" ● WELCOME TO TIC TAC TOE ●\"\n puts \"★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\"\n\n puts \"\\n❉ Game Types ❉\"\n puts \"--------------------------------------------\"\n puts \">> 1 << One Player Game\"\n puts \">> 2 << Two Players Game\"\n puts \">> 0 << The computer will play against itself\"\n puts \"--------------------------------------------\"\n end",
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greeting\n puts \"Hi, my name is #{@name}.\"\n end",
"def greeting(who = nil)\n if who\n \"Hello, #{who}!\"\n else\n \"Hello!\"\n end\nend",
"def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end",
"def mk_sender\n [\"-- \", \"Med kærlig hilsen, \", \"Med venlig hilsen, \", \"MVH, \", \"Hilsen \"].sample + \"Nikolaj Lepka\\n\" +\n \"Telefon: 25 14 66 83\\n\" +\n \"Email: slench102@gmail.com\\n\" +\n \"Github: https://github.com/ElectricCoffee\\n\" +\n \"Twitter: https://twitter.com/Electric_Coffee\\n\\n\"\n end",
"def random_statement(r)\n\tcase r.rand(6).to_i\n\twhen 0\n\t\treturn \" :D\"\n\twhen 1\n\t\treturn \" Yawn. I'm tired...\"\n\twhen 2\n\t\t#Dice because it was randomly generated\n\t\treturn \" 🎲🎲🎲\"\n\twhen 3\n\t\treturn \" D:\"\n\twhen 4\n\t\treturn \" Hm.\"\n\telse\n\t\treturn \" ~_~\"\n\tend\nend",
"def retrieve_greeting(args)\n {timeMessage: Greet::Greeting.new(args).process}\n end",
"def play_greeting(user)\n begin\n sleep 1\n status = user.latest_status\n if status.nil?\n play generate_tts_file(\"Please leave me a voice mail and have a nice day\")\n elsif status.instance_of? VoiceStatus\n ahn_log.play_vm_greeting.debug user.latest_status.recording.filename\n play COMPONENTS.voicemail[\"greetings_directory\"] + user.latest_status.recording.filename\n else\n play generate_tts_file(status.stat)\n end\n rescue => err\n ahn_log.error err\n end\n\n end",
"def greeting\n puts \"Hi my name is #{@name}\"\n end",
"def sayHi\n\t\tputs(greet)\n\tend",
"def first_name_male\n FIRST_NAMES_MALE.rand\n end",
"def frase\n option = 0\n loop do\n option = (rand * 5.5).to_i\n break if option > 0\n end\n case option\n when 1\n return \"Amazing! \"\n when 2\n return \"Good roll! \"\n when 3\n return \"Incredible! \"\n when 4\n return \"Good movement! \"\n when 5\n return \"Are you cheating? \"\n end\n end",
"def first_name_female\n FIRST_NAMES_FEMALE.rand\n end",
"def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend",
"def random_ascii\n print send(all_giraffes[rand(all_giraffes.length)])\n end",
"def last_name\n @seeds[:last_name][Random.rand(0..97)]\n end",
"def welcome_message\n \"Hello! I'm #{@name} and I'm from #{@country}\"\n end",
"def greeting(morning_or_noon, name, time)\n puts \"#{morning_or_noon} #{name}, nice to meet ya. Today is #{time}!\"\nend",
"def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end",
"def random_username( givenname_full, surname )\n name_part_separator =\n UsernamePartSeparators[rand(UsernamePartSeparators.length)]\n givenname = givenname_full.split(/\\s/).join(name_part_separator)\n erb_template = ERB.new( UsernameTemplates[rand(UsernameTemplates.length)] )\n erb_template.result( binding )\n end",
"def ${pluginName}_greet_someone(greetee)\n request = Packet.create_request('${pluginName}_greet_someone')\n request.add_tlv(TLV_TYPE_GREETEE, greetee)\n response = client.send_request(request)\n response.get_tlv_value(TLV_TYPE_STRING)\n end",
"def get_invite_message(bitch_message=nil)\n name = get(\"name\").split(\" \").first # Get the first name\n id = get(\"id\")\n messages = get(\"messages\")\n bitch_message = bitch_message || messages[(rand(messages.length-1))][\"abuse\"]\n return \"#{name} says... #{bitch_message}!!\\nIs that cool with you? B*tch back!\\nInstall Yo! B*tch app from http://#{CONFIG.get(:domain)}/i/#{id}/#{name}\"\n end",
"def greeting(name)\n \"Howdy #{name}, welcome back!\"\nend",
"def generate_hero_name\n buffer\n hero = Hero.new\n line\n puts \"What is your hero's given name?\"\n line\n choice = gi_string\n hero.name = choice\n line\n puts \"#{hero.name} is the name you chose. If this is correct, press 1? Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_alter_ego(hero)\n elsif choice == 2\n generate_hero_name\n elsif choice == 3\n hero_setup\n else line \n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_name\n end\n end",
"def random_username\n word_list.sample.gsub(/[^0-9a-z]/i, '')\n end",
"def greeting(name=\"rubyist\")\n \"Welcome, #{name}! Ready to code?\"\nend",
"def play_voicemail_greeting\n user = locate_user(rdnis)\n if user\n play_greeting(user)\n record_voicemail_message(user)\n else\n play \"invalid\"\n end\n end",
"def tweet_greeting\n log \"greeting\"\n post \"Starting meitan-bot. Hello! #{Time.now.strftime('%X')}\"\n end",
"def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end",
"def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end",
"def say_name\n puts \"The hero's name is #{@name}\"\n end",
"def greeting(name)\n\tp \"hello\" + \" \" + name\nend",
"def greeting(name)\n\tp \"hello\" + \" \" + name\nend",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end",
"def greet\n Interactivity.logo\n end",
"def say_hello\n\t\"Ich bin #{@name} mit einem Wert von #{@health}.\"\n\tend",
"def random_nick() (0..8).map { rand(65..90).chr }.join'' end",
"def greeting(name)\n\tputs \"Hello \" + name + \". Have a nice day!\"\nend",
"def greeting(name)\n message = \"Hello there #{name}!\"\nend",
"def fetch(key)\n I18n.translate(\"faker.#{key}\").rand\n end",
"def greeting\n\t\t#make a greeting for both student and teacher\n\t\tputs \"Hi, my name is #{@name}!\"\n\tend",
"def inspect\n return \"This is a random text generator!\"\n end",
"def greeting(name)\n\t\"Hello, #{name}\"\nend",
"def greeting\n puts \"Welcome to the world of practical effects\"\n end",
"def greet person\n\t'Hello, ' + person + '!'\nend",
"def regreet\n\t\t# array of offers\n\t\toffer = [\"Can I help you?\", \"How can I help you?\", \"Do you need help?\", \"What can I help you with?\"]\n\t\t\n\t\t# regreet user\n\t\tsentence = \"I remember you! \" + offer.sample\n\t\t\n\t\t# return \n\t\treturn sentence\n\tend",
"def greeting\n puts 'Greetings, honorable gentleman.'\nend",
"def prompt_greeting(namehere)\n print(namehere)\n gets\nend"
] |
[
"0.79042333",
"0.7470434",
"0.7464322",
"0.7300656",
"0.72177225",
"0.71532494",
"0.68522143",
"0.67995834",
"0.66879225",
"0.6538214",
"0.65081817",
"0.65005773",
"0.64713556",
"0.6391153",
"0.63380754",
"0.6309222",
"0.6291592",
"0.62910813",
"0.62583596",
"0.62285316",
"0.62209505",
"0.6218811",
"0.62060714",
"0.61544347",
"0.61504894",
"0.6140946",
"0.6139169",
"0.6125315",
"0.6113012",
"0.61059165",
"0.6104414",
"0.6099215",
"0.6075906",
"0.6053183",
"0.6048548",
"0.60315293",
"0.60011595",
"0.59876186",
"0.59742093",
"0.5963366",
"0.59506255",
"0.5947747",
"0.5943041",
"0.59256756",
"0.5925542",
"0.59133977",
"0.5909523",
"0.59053326",
"0.5900657",
"0.58639604",
"0.5854759",
"0.5854533",
"0.5844512",
"0.5842257",
"0.58262444",
"0.58226746",
"0.5815515",
"0.581186",
"0.5810778",
"0.57952344",
"0.57851386",
"0.5784207",
"0.577828",
"0.5775706",
"0.5764523",
"0.5759253",
"0.5758286",
"0.5752657",
"0.5747704",
"0.5742519",
"0.5722239",
"0.57213384",
"0.5719803",
"0.5701119",
"0.5696425",
"0.56955993",
"0.56875396",
"0.5684566",
"0.5684566",
"0.56778336",
"0.5670606",
"0.5670606",
"0.5656443",
"0.5656443",
"0.5656443",
"0.56550896",
"0.56508124",
"0.5648273",
"0.5647986",
"0.5646753",
"0.5641346",
"0.56384295",
"0.56369555",
"0.5630563",
"0.5625866",
"0.5620278",
"0.56194466",
"0.5613657",
"0.5603811",
"0.5599051"
] |
0.7460681
|
3
|
Returns a random farewell message as specified in the bot's data file
|
def farewell
random_response(:farewell)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_random_message()\n\t\topening = [ \"Developer Portfolio\",\n \t\t\"My Rails 4 Portfolio\",\n \t\t\"Hello World\" ]\n\n\t\tmiddle = [ \"Built from the Rails Tutorial\",\n \t\t\"Rails Apps Are Great\",\n \t\t\"Rails Twitter clone App\" ]\n\n\t\tending = [ \"Contact us if you need help.\",\n \t\t\"We are here to server you. \",\n \t\t\"Call us if you need to 412-555-1212.\"]\n\n\t\t\"#{opening[rand(3)]}\"\n\n\tend",
"def farewell(m)\n return unless m.message =~ /\\b((good)?bye|adios|farewell|later|see ?(ya|you|u)|cya),? #{m.bot.nick}\\b/i\n farewells = ['Bye', 'Adios', 'Farewell', 'Later', 'See ya', 'See you', 'Take care']\n farewell = farewells[rand(farewells.size)]\n m.reply \"#{farewell}, #{m.user.nick}!\"\n end",
"def random_mention_from_text\n @reply_mention_text.sample\n end",
"def answer_magic_8ball(message)\n\trand_number = Random.new\n\trand_number = rand(0 .. 19)\n\tanswer = message[rand_number]\nend",
"def get_message\n File.open @config.data do |file|\n self[:message] = YAML.load(file).sample\n end\n end",
"def random_thank_you\n [\n \"Thanks for sharing. I'll post your secret anonymously soon. \" +\n \"You might want to unfollow me - I'll unfollow you, too.\",\n \"I'll post your message soon. For secrecy, you might want to unfollow me.\",\n \"Thank you! I'll post your secret soon.\"\n ].sample\n end",
"def random_mention(id)\n db = nil\n # Opening DB\n begin\n db = SQLite3::Database.new(POST_DATABASE_FILE)\n rescue\n error_log 'error in random_mention when opening DB to get status/words.'\n log('Get replying text from text file instead.', StatTypes::ERROR)\n return random_mention_from_text\n end\n # Get status/words from DB\n begin\n status = db.get_first_value('SELECT status FROM posts WHERE user_id = ? ORDER BY RANDOM() LIMIT 1', id)\n user_words = db.execute('SELECT word FROM words WHERE user_id = ? ORDER BY RANDOM() LIMIT ?', id, @config.num_of_users_word)\n other_words = db.execute('SELECT word FROM words ORDER BY RANDOM() LIMIT ?', @config.num_of_others_word)\n rescue\n error_log 'error in random_mention when get status/words.'\n ensure\n db.close\n end\n words = user_words + other_words\n # Initialize MeCab\n mecab = MeCab::Tagger.new\n node = mecab.parseToNode(status)\n # Generate post\n result = Array.new\n while node\n unless node.stat == 2 or node.stat == 3\n if node.posid < 36 or 67 < node.posid\n result << node.surface\n else\n if rand(100) < @config.word_replace_probability\n result << words[rand(words.size)]\n else\n result << node.surface\n end\n end\n end\n node = node.next\n end\n result.join(nil)\n end",
"def random_morning\n @reply_morning_text.sample\n end",
"def random_sleeping\n @reply_sleeping_text.sample\n end",
"def get_invite_message(bitch_message=nil)\n name = get(\"name\").split(\" \").first # Get the first name\n id = get(\"id\")\n messages = get(\"messages\")\n bitch_message = bitch_message || messages[(rand(messages.length-1))][\"abuse\"]\n return \"#{name} says... #{bitch_message}!!\\nIs that cool with you? B*tch back!\\nInstall Yo! B*tch app from http://#{CONFIG.get(:domain)}/i/#{id}/#{name}\"\n end",
"def random_csharp\n @reply_csharp_text.sample\n end",
"def pick_random\n random_word = nil\n File.open(\"words.txt\") do |file|\n file_lines = file.readlines()\n random_word = file_lines[Random.rand(0...file_lines.size())]\n end\n return random_word\n end",
"def random_departure\n @reply_departure_text.sample\n end",
"def fixture(*name)\n File.open(File.join(fixture_path, 'messages', name) + '.eml').read\n end",
"def random_number(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n random_number_max(msg, 100)\n end",
"def random_face_emoji\n %w[cool goofy monocle sly smile think].sample\n end",
"def word_generator\ntotal_words = []\nFile.open(\"5desk.txt\", \"r\") do |f|\n f.each_line do |line|\n total_words << line \n end\n end\nwords_count = 61407\nrandom_number = rand(0...words_count)\nrandom_word = total_words[random_number]\n# random_word if random_word.length >= 5\nend",
"def farewell\n\t\trandom_response(:farewell)\n\tend",
"def pick_catchphrase\n return File.readlines(File.dirname(__FILE__) + \"/static/catchphrases.txt\").sample.tr(\"\\n\",\"\")\nend",
"def fetch(key)\n I18n.translate(\"faker.#{key}\").rand\n end",
"def getSomeCoolName\n\t\tnames = File.open(\"NazwyKonferencji\").read.split(\"\\n\")\n\t\tnames[rand(names.size)]\n\tend",
"def random_line\n lines = open(@file,\"r\"){ |file| file.collect }\n lines[rand(lines.length)]\nend",
"def get_random\n begin\n all_commit_messages = repo.commits.map(&:message)\n # Return randomly-selected commit message\n return all_commit_messages[rand(all_commit_messages.length)]\n rescue Octopi::NotFound\n # No commits have been made\n puts \"No commits have been made for this repo.\"\n return nil\n end\n end",
"def random_word\n wordpair = nil\n File.foreach(\"wordlist\").each_with_index do |line, number|\n wordpair = line if rand < 1.0/(number+1)\n end\n word = Word.new(wordpair.split(':')[0], wordpair.split(':')[1])\n return word\n end",
"def random_word(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n word = LiterateRandomizer.word\n @last_words = [] if @last_words.nil?\n word = LiterateRandomizer.word while @last_words.include?(word)\n @last_words.prepend_capped(word, 5)\n msg.reply(word)\n end",
"def execute(msg)\n msg.reply(StringUtility.random_line(Variables::Constants::FORTUNE_PATH))\n end",
"def mk_sender\n [\"-- \", \"Med kærlig hilsen, \", \"Med venlig hilsen, \", \"MVH, \", \"Hilsen \"].sample + \"Nikolaj Lepka\\n\" +\n \"Telefon: 25 14 66 83\\n\" +\n \"Email: slench102@gmail.com\\n\" +\n \"Github: https://github.com/ElectricCoffee\\n\" +\n \"Twitter: https://twitter.com/Electric_Coffee\\n\\n\"\n end",
"def twist(message)\n\treturn message.split(\"\").shuffle.join\nend",
"def random_megazord\n megazords_arr = [\"Ninja Falcon Megazord\", \"Galaxy Megazord\", \"Thundersaurus Megazord\", \"Lightspeed Megazord\",\"DriveMax Megazord\", \"Wild Force Megazord\"]\n megazord = megazords_arr[rand(megazords_arr.length)]\nend",
"def random\n Client.get(\"/patterns/random\")\n end",
"def random_quote(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n quotes = Variables::NonConstants.get_quotes\n quote = quotes.sample\n @last_quotes = [] if @last_quotes.nil?\n quote = quotes.sample while @last_quotes.include?(quote)\n @last_quotes.prepend_capped(quote, 5)\n msg.reply(quote)\n end",
"def message(nickname: nil, message: nil, nicknames: nil)\n @responded = false\n\n answers = case message\n when /^!/\n return # Do not record this as a previous message\n\n when /^s\\/(.+)\\/(.*)\\/(i)?$/\n begin\n replacement = $2\n regexp = Regexp.new($1, $3)\n answer = @previous_message.to_s.gsub(regexp, replacement)\n if @previous_message && answer != @previous_message\n yield say answer\n end\n rescue RegexpError\n end\n\n\n when /^où\\b.*\\?$/i\n yield say \"dtc\"\n\n when /^qui\\b.*\\?$/i\n rand_nick = (nicknames - [botname]).sample\n yield say [\"C’est #{rand_nick} !\", \"c'est #{rand_nick}\"].sample\n\n when /\\b#{@botname}\\b.*\\?$/\n rand_nick = (nicknames - [botname]).sample\n yield say ['ouais', 'euh ouais', 'vi', 'affirmatif', 'sans doute',\n \"c'est possible\", \"j'en sais rien moi D:\", 'arf, non', 'non', 'nan',\n 'euh nan', 'negatif', 'euhh peut-être',\n \"demande à #{rand_nick}\"].sample\n\n when /\\b#{@botname}\\b/\n yield say ['3:-0', 'oui ?', '...', 'lol', 'mdr', \":')\",\n 'arf', 'shhh', ':)', '3:)', 'tg :k', \"moi aussi je t'aime\",\n \"oui oui #{nickname}\"].sample if rand(0..10) > 0\n\n when /^lu$/i\n yield say [\"tin\", \"stucru\", \"mière\"].sample\n\n when /^hein ?\\?$/i\n yield say [\"deux\", \"deux !!\"].sample\n\n when /^quoi ?\\?$/i\n yield say \"feur !\"\n\n when /^(lol|mdr|rofl|ptdr) ?!*$/i\n yield say ['lol', 'mdr', 'rofl', 'ptdr', 'haha'].sample\n\n else\n # Repeat\n if message == @previous_message and @previous_nickname != nickname \\\n and @previous_nickname != @botname\n yield say message\n else\n yield say [\":)\", \":p\", \"3:)\", \"lol\"].sample if rand(0..50).zero?\n end\n end\n\n # Remember what the person said\n if !@responded\n @previous_message = message\n @previous_nickname = nickname\n end\n end",
"def greeting\n greetings = [\"Hello\", \"Hey\", \"Greetings\", \"Salutations\", \"Welcome\"]\n greetings[rand(greetings.size)]\n end",
"def fuzz_random(host)\n print_status(\"#{host}:#{rport} fuzzing random messages\")\n 0.upto(5) do\n # TODO: is there a better way to pick this size? Should more than one be tried?\n request = SecureRandom.random_bytes(48)\n what = \"random #{request.size}-byte message\"\n vprint_status(\"#{host}:#{rport} probing with #{what}\")\n responses = probe(host, datastore['RPORT'].to_i, request)\n handle_responses(host, request, responses, what)\n Rex.sleep(sleep_time)\n end\n end",
"def pick_question\n return File.readlines(File.dirname(__FILE__) + \"/static/questions.txt\").sample.tr(\"\\n\",\"\")\nend",
"def get_notice\n @random_notice = Rails.cache.fetch('random_notifications', :expires_in => 1.minutes) do\n Notification.offset(rand(Notification.count)).select('notifications.message, notifications.status_type').first() unless Notification.count == 0\n end\n end",
"def get_game_cliche\n\t\t#initialize variable\n\t\tchosen_line = nil\n\t\t\n\t\t#Get the cliche\n\t\tFile.foreach(\"game_cliches.txt\").each_with_index do |line, number|\n\t\t\tchosen_line = line if rand < 1.0/(number+1)\n\t\tend\n\t\t\t\t\n\treturn chosen_line.chomp\n\tend",
"def rand_text(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text(length, bad)\n end\n end",
"def future_messages(person_full_name, person)\n future_messages = []\n verbs = [\"invoked\", \"called to\", \"cried out for\", \"made a sacrifice to\", \"let slip\",\n \"doorbell ditched\", \"whispered sweetly to\", \"walked over broken glass to get to\",\n \"prayed to the god of\", \"ran headlong at\", \"checked in a timebomb for\",\n \"interpolated some strings TWO TIMES for\", \"wished upon a\", \"was like, oh my god\",\n \"went all\", \"tested the concept of\"]\n future_person = Regexp.new(\"future #{person}\", Regexp::IGNORECASE)\n future_everybody = Regexp.new(\"future everybody\", Regexp::IGNORECASE)\n \n if message_id = last_message_id(person_full_name)\n candidates = Message.all(\n :message_id.gt => message_id,\n :person.not => ['Fogbugz','Subversion','GeneralZod','Capistrano','Wes'],\n :message_type => 'Text')\n candidates.each do |row|\n if row.body.match(future_person)\n verbed = verbs[rand(verbs.size)]\n future_messages << \"#{row.person} #{verbed} future #{person} at: #{bot.base_uri}/room/#{bot.room.id}/transcript/message/#{row.message_id}\"\n elsif row.body.match(future_everybody)\n verbed = verbs[rand(verbs.size)]\n future_messages << \"#{row.person} #{verbed} future everybody: \\\"#{row.body}\\\"\"\n end\n end\n end\n return future_messages\n end",
"def get_word\r\n\t # Variable initialization\r\n\t wordArray = []\r\n\t count = 0\r\n\t random_int = 0\r\n\t \r\n\t # Stores each word that is on a new line into an array\r\n\t f = File.open(\"5desk.txt\", \"r\")\r\n\t f.each_line{ |line| wordArray << line }\r\n\t f.close\r\n\t \r\n\t # Selects the random word between the desired length of between 5 and 12 characters. \r\n\t # Note that this includes an extra delimiter at the end of each word\r\n\t until wordArray[random_int].length > 5 && wordArray[random_int].length < 14 do\r\n\t random_int = Random.new.rand(0..61405)\r\n\t end\r\n\t wordArray[random_int].chomp!\r\n\tend",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def select_word\n words = File.readlines(\"5desk.txt\").select { |word| word.length.between?(5, 12) }\n words[rand(words.length)].strip\n end",
"def random_note\n notes[rand(notes.size)]\n end",
"def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend",
"def new_word\n\t\tdictionary = File.open(\"5desk.txt\", \"r\").readlines\n\t\tbegin \n\t\t\t@the_word = dictionary[rand(0..dictionary.length)]\n\t\tend while @the_word.length >= 12 || @the_word.length <=5\n\t\t@the_word\n\tend",
"def random_word\n @words.fetch(rand(@words.length)).chomp\n end",
"def get_the_email_html(message)\n # Addressage du fichier message\n message = File.read(message)\n return message\nend",
"def get_description_discord_message(event, id)\n if !File.exists?(\"#{get_tourney_dir(id)}/tourneyinfo\")\n return nil\n else\n File.open(\"#{get_tourney_dir(id)}/tourneyinfo\", \"r\") do |f|\n lines = f.read.split(\"\\n\")\n return nil if lines.length < 3\n msg_id = lines[3].split(\":\")[1].to_i\n list_channel = nil\n server_channels = event.channel.server.text_channels\n server_channels.each do |channel|\n list_channel = channel if channel.name.eql?(\"tourney-list\")\n end\n return list_channel.load_message(msg_id)\n end \n end\nend",
"def pick_slogan\n return File.readlines(File.dirname(__FILE__) + \"/static/slogans.txt\").sample.tr(\"\\n\",\"\")\nend",
"def dictionary_word\n dict = File.readlines(\"./data/5desk.txt\")\n word = dict[rand(dict.length)].strip while word.nil? || word.length <= 5 || word.length >= 12\n word\n end",
"def farewell\n\t\trandom_response :farewell\n\tend",
"def random\n beer_id = select_random_id\n Beer.find(beer_id)\n end",
"def random_word\n open('/usr/share/dict/words').read.split(/\\n/).sample\n end",
"def random_meal\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/random.php\n content = api_call('random.php')\n validate(content)\n content\n end",
"def greeting\n random_response(:greeting)\n end",
"def get_random_word(filename)\n dictFile = File.open filename\n words = dictFile.readlines.reduce([]) do |words, word|\n if word.strip!.length >= 8\n words << word\n end\n words\n end\n words[(rand words.length)]\nend",
"def send_random(event)\n # Parse message parameters\n msg = event.content\n type = parse_type(msg) || Level\n tabs = parse_tabs(msg)\n amount = [msg[/\\d+/].to_i || 1, NUM_ENTRIES].min\n\n # Retrieve list of maps\n maps = tabs.empty? ? type.all : type.where(tab: tabs)\n\n # Format and send response\n if amount > 1\n tabs = format_tabs(tabs)\n type = format_type(type).downcase.pluralize\n event << \"Random selection of #{amount} #{tabs} #{type}:\".squish\n event << format_block(maps.sample(amount).map(&:name).join(\"\\n\"))\n else\n map = maps.sample\n send_screenshot(event, map)\n end\nrescue => e\n lex(e, \"Error getting random sample.\", event: event)\nend",
"def generate_random_email\n # random_number = rand(1000000 .. 9000000)\n random_number = Time.now.getlocal.to_s.delete \"- :\"\n \"ruslan.yagudin+#{random_number}@flixster-inc.com\"\nend",
"def frase\n option = 0\n loop do\n option = (rand * 5.5).to_i\n break if option > 0\n end\n case option\n when 1\n return \"Amazing! \"\n when 2\n return \"Good roll! \"\n when 3\n return \"Incredible! \"\n when 4\n return \"Good movement! \"\n when 5\n return \"Are you cheating? \"\n end\n end",
"def generate_greeting\n languages = %w[French Spanish English Italian Hindi Japanese Korean Chinese Tamil Polish Dutch German Swedish]\n greetings = %w[Bonjour Hola Greetings Ciao שלום こんにちは 여보세요 你好 வணக்கம் Cześć Hallo Guten\\ Tag Hej]\n selection = rand(languages.length)\n @greeting_language = languages[selection]\n @greeting = greetings[selection]\n end",
"def random_pokemon_data\n id = rand(1..807)\n request(\"pokemon/#{id}\")\n end",
"def random_sentence(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n sentence = LiterateRandomizer.sentence\n @last_sentences = [] if @last_sentences.nil?\n sentence = LiterateRandomizer.sentence while @last_sentences.include?(sentence)\n @last_sentences.prepend_capped(sentence, 5)\n msg.reply(sentence)\n end",
"def recite_random_subject\n number = rand(1..@size)\n return recite_subject(number)\n end",
"def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end",
"def create_feedback_messages\n puts 'Creating FeedbackMessages for Site Admins'\n\n feedback_messages = []\n\n user_ids = User.pluck(:id)\n (1..100).each do\n random_user_id = user_ids.sample\n random_user = User.find(random_user_id)\n\n random_posting = Posting.where(\"poster_id = #{random_user.id} OR responder_id = #{random_user.id}\").sample\n\n if random_posting.nil?\n user_random_posting_id = nil\n else\n user_random_posting_id = random_posting.id\n end\n\n feedback_messages << FeedbackMessage.new(user_id: random_user.id, posting_id: user_random_posting_id,\n email: random_user.email, body: Faker::Lorem.paragraph, viewed: true)\n end\n\n FeedbackMessage.import(feedback_messages)\n end",
"def eight_ball(bot, msg = nil)\n response = @config[:eightball_responses][(rand * @config[:eightball_responses].length).to_i]\n bot.say(response)\n end",
"def get_message(birth_path_num)\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end #birth_path_num case\nend",
"def buzzword\n sample(translate('faker.company.buzzwords').flatten)\n end",
"def generate_random_characteristic\n self.characteristic = Faker::Lorem.sentences(Random.rand(1..50)).join if Random.rand(9).even?\n end",
"def create_random_name\n String.new(Faker::Games::ElderScrolls.creature)\n end",
"def getUserToReply\n followers = self::get_followers\n followers[:result][rand(followers[:result].length)]\n end",
"def random_p\n \"<p>#{texter.random_paragraph}</p>\"\n end",
"def generate_name\n names = []\n File.open(\"names.txt\").each {|str| names << str.chomp}\n @name = names[rand(names.length)]\n end",
"def get_message(birth_path_num)\n # use a case statement to display the correct meaning\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end\nend",
"def get_message(birth_path_num)\n # use a case statement to display the correct meaning\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end\nend",
"def get_message(birth_path_number)\n case birth_path_number\n when 1\n messsage = \"One is the leader. The number one indicates the ability to stand alone and is a strong vibration. Ruled by the Sun.\"\n when 2\n messsage = \"Two is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n messsage = \"Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n messsage = \"Four is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n messsage = \"Five is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n messsage = \"Six is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n messsage = \"Seven is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n messsage = \"Eight is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n messsage = \"Nine is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n messsage = \"You are not of this Earth\"\n end\nend",
"def magiceightball\n\t\t answers = [\"outlook not so good\", \"cloudy, ask again later\", \"it is meant to be\", \"you may rely on it\"]\n\t\t @result = answers[Random.rand(4)]\n\tend",
"def get_random_follow\n if !session[:user_follows]\n session[:user_follows] = client.friend_ids(current_user.get_uid_int).attrs[:ids]\n end\n\n follow_id = session[:user_follows].sample\n follow = client.user(follow_id)\n end",
"def create_random_comment\n comments.create(name: Faker::Name.name, body: Faker::Hacker.say_something_smart)\n end",
"def format_one_invoice\n index = rand(0..(@b2b_partners_list_invoices.length-1))\n\n @documentID = @b2b_partners_list_invoices[index][\"PEDC_ID_CLIENTE\"]\n @random_invoice = @b2b_partners_list_invoices[index]\nend",
"def qt_monkey_random_text \n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))' \n end",
"def get_message(birth_num)\n case birth_num\n when 1\n message = \"Your numerology number is #{birth_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"I am pretty sure that you were not born on the leap year date, because you should still get a Numerology number. Either you entered your birthddate in the incorrect format or you are not originally from Earth, you should have a number between 1-9.\"\n end\nend",
"def pbRockSmashRandomEncounter\n if rand(100)<25\n pbEncounter(EncounterTypes::RockSmash)\n end\nend",
"def random_big_string offset = rand(1..500)\n generate_string(25000 + offset)\n end",
"def body_part\n [\"heart\", \"eye\", \"stomach\", \"neck\", \"leg\", \"shoulder\", \"chest\"].sample\nend",
"def random_referral_code\n code = Rufus::Mnemo::from_integer rand(100**5)\n while referral_code_existed?(code)\n code = Rufus::Mnemo::from_integer rand(100**5)\n end\n \"#{code}\"\n end",
"def select_word\n uri = URI('https://random-word-api.herokuapp.com/word?number=5')\n words = Net::HTTP.get(uri) \n words = words.delete(\"[\").delete(\"]\").delete(\"\\\"\")\n words = words.split(\",\")\n index = rand(words.count - 1)\n return words[index]\n end",
"def random_username\n # \"batterypop-#{(rand * 10000).to_i}\"\n \"batterypop-#{Time.now.to_i}\"\n end",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def greeting\n\t\t# array of greetings and offers\n\t\tgreetings = [\"Hey!\", \"Hello!\", \"Good day!\", \"Greetings!\", \"Hi!\"]\n\t\toffer = [\"Can I help you?\", \"How can I help you?\", \"Do you need help?\", \"What can I help you with?\"]\n\t\t\n\t\t# construct random sentence\n\t\tg = greetings.sample\n\t\to = offer.sample\n\t\tsentence = g + \" \" + o\n\t\t\n\t\t# return sentence\n\t\treturn sentence\n\tend",
"def pick_secret_word\n\t\tFile.read(\"5desk.txt\").lines.select {|word| (4..9).cover?(word.size)}.sample.strip\n\tend",
"def greeting\n\t\trandom_response(:greeting)\n\tend",
"def generate_random_insert_data(num_words=nil)\n (num_words = 6 + rand(10)) if num_words.nil? || num_words.empty?\n {message: \"#{random_message(num_words.to_i)}\", username: \"#{random_username}\", post_date: \"#{current_timestamp}\"}.to_json\n end",
"def qt_monkey_random_text\n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))'\n end",
"def choose_word\n word_index = 0\n loop{\n word_index = rand(@text_file.length.to_i)\n if @text_file[word_index].length.to_i > 4 && @text_file[word_index].length.to_i < 12\n break\n end\n }\n @word = @text_file[word_index]\n end",
"def get_random_word\r\n @word_list.sample\r\n end",
"def entropy e=ENTROPY_FILE\n return rand.to_s unless File.exist? e\n if !File.exist? e\n return sha_to_b64 Digest::SHA1.hexdigest(\"#{Time.now.to_f}#{rand}-kickoff\")\n end\n File.open e, \"r\" do |f|\n return f.readlines.chomp\n end\nend",
"def create_first_text_message\n%(Today, I want to feel:\nPassionate\nEnergized\nConnected\nHopeful\nAligned\n)\n end",
"def choose_word\n @word = @lines[rand(0..(@lines.length - 1))].chomp\n choose_word if @word.length < 5 || @word.length > 12\n end"
] |
[
"0.6953912",
"0.67429435",
"0.6358108",
"0.6257348",
"0.6242795",
"0.62339854",
"0.60725987",
"0.6047887",
"0.60347754",
"0.60271317",
"0.5987562",
"0.5970796",
"0.59435695",
"0.58729434",
"0.58692855",
"0.5856846",
"0.578567",
"0.57726103",
"0.577092",
"0.57657737",
"0.57480305",
"0.5739158",
"0.5690393",
"0.5686376",
"0.5684381",
"0.564719",
"0.56446373",
"0.56334084",
"0.55725104",
"0.557205",
"0.55716103",
"0.55591094",
"0.55518013",
"0.5549952",
"0.55438185",
"0.5533456",
"0.55191845",
"0.551121",
"0.5497175",
"0.54923594",
"0.5473151",
"0.5465068",
"0.5442987",
"0.5436296",
"0.5405095",
"0.53878766",
"0.53876644",
"0.53814363",
"0.53779453",
"0.5354379",
"0.5353604",
"0.5352912",
"0.5344237",
"0.5317064",
"0.5315213",
"0.5310265",
"0.5306258",
"0.53044146",
"0.53035975",
"0.53008586",
"0.5289652",
"0.52859527",
"0.52816445",
"0.52732784",
"0.52665067",
"0.5263351",
"0.52604467",
"0.5250709",
"0.52415234",
"0.5240563",
"0.523975",
"0.5232376",
"0.5222971",
"0.5221183",
"0.5221183",
"0.52176917",
"0.52115107",
"0.5209447",
"0.5185313",
"0.5171773",
"0.5168117",
"0.516218",
"0.5159725",
"0.515739",
"0.51531565",
"0.5150604",
"0.51470304",
"0.5137988",
"0.51349276",
"0.51349276",
"0.51315343",
"0.5125956",
"0.5122068",
"0.511953",
"0.5116971",
"0.51160634",
"0.5115156",
"0.5114104",
"0.51119345",
"0.51118183"
] |
0.5912561
|
13
|
Responds to input text as given by a user
|
def response_to(input)
prepared_input = preprocess(input.downcase)
sentence = best_sentence(prepared_input)
reversed_sentence = WordPlay.switch_pronouns(sentence)
responses = possible_responses(sentence)
responses[rand(responses.length)]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def text_input; end",
"def set_text_input(input); end",
"def input_model_text(new_text)\n pending(\"proper input text method that triggers all normal events\")\n fail\n end",
"def text(text_input_handle)\n end",
"def ask(text)\n say(text)\n @bot.listen do |message|\n return message.text\n end\n end",
"def new_text_input\n end",
"def ask_input(text, color=nil, *args)\n self.ask(\"#{text}\", color, *args)\n end",
"def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end",
"def response_to(input)\nend",
"def handle_input(input)\n return \"Invalid input\" unless self.respond_to? input\n self.send input\n end",
"def send_text\n\nend",
"def on_input_ok\n @@text = @edit_window.text\n return_scene\n end",
"def user_input\n\tgets\nend",
"def get_user_input(message)\n puts message\n gets.chomp\n end",
"def get_response_for question\nprint question + \": \"\ngets.chomp\nend",
"def user_choice (text)\n\tputs text\n\tresponse = gets.strip.to_i\n\treturn response\nend",
"def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end",
"def user_input\n print \"Say your thang\"\n user_comment = get.chomp.downcase\nend",
"def handle_text(name, attrs)\n \n end",
"def start_typing(data); end",
"def start_typing(data); end",
"def handle_input(message)\n user = extract_user message\n id = message[:data][:id]\n request = message[:data][:args]\n if (term = TTY[user, id])\n term.write << request.join\n else\n message[:error] = 'Terminal does not exist.'\n end\n end",
"def process(input)\n if input == \"q\"\n puts \"Goodbye\"\n elsif input == \"tweet\"\n puts \"tweeting\"\n elsif input == \"dm\"\n puts \"direct messaging\"\n elsif input == \"help\"\n puts \"helping\"\n end\nend",
"def prompt(text)\n print text\n input = readline.chomp\n throw(:quit, lambda {return \"New Action to Render\"} ) if input == \"\"\n return input\nend",
"def read_from_console\n puts 'Enter URL, please:'\n @url = STDIN.gets.chomp\n\n puts 'Enter the name to this link, please:'\n @text = STDIN.gets.chomp\n end",
"def get_input\n #Get input from the user\nend",
"def onUserText(text, view)\r\n # The user may type in something that we can't parse as a length\r\n # so we set up some exception handling to trap that\r\n begin\r\n value = text.to_l\r\n rescue\r\n # Error parsing the text\r\n UI.beep\r\n value = nil\r\n Sketchup::set_status_text \"\", SB_VCB_VALUE\r\n end\r\n return if !value\r\n # puts \"user text = \" + value.inspect\r\n case @state\r\n when STATE_MOVING\r\n # update the offset of the window or door\r\n @offset = value\r\n find_end_points\r\n view.invalidate\r\n draw_obj\r\n Sketchup.active_model.select_tool(nil)\r\n end\r\nend",
"def user_choice_text_version\n this_here = pick_a_story\n puts \"\\n #{this_here.title}\"\n puts \"\\n\"\n Narrabot::Scraper.aesop_fable_text(this_here) if !this_here.text_and_moral\n puts this_here.text_and_moral\n puts \"\\n\"\n #puts \"Would you like me to read this story in my beautiful voice?\"\n #input = gets.chomp\n #switch = yes_or_no(input)\n #if switch == true\n # puts \"\"\n # \"#{this_here.text_and_moral}\".play (\"en\")\n #else\n # puts \"\"\n # play_and_puts(\"Okay\")\n #end\n end",
"def onUserText(text, view)\n # We only accept input when the state is 1 (i.e. getting the second point)\n # This could be enhanced to also modify the last line created if a length\n # is entered after creating a line.\n # return if not @state == 1\n # return if not @ip2.valid?\n UI.messagebox(\"#{@state}\")\n\n # The user may type in something that we can't parse as a length\n # so we set up some exception handling to trap that\n begin\n value = text.to_l\n rescue\n # Error parsing the text\n UI.beep\n puts \"Cannot convert #{text} to a Length\"\n value = nil\n Sketchup::set_status_text \"\", SB_VCB_VALUE\n end\n return if !value\n\n # Compute the direction and the second point\n pt1 = @ip1.position\n vec = @ip2.position - pt1\n if( vec.length == 0.0 )\n UI.beep\n return\n end\n vec.length = value\n pt2 = pt1 + vec\n\n # Create a line\n self.create_geometry(pt1, pt2, view)\n end",
"def type(text:)\n conn = multipart_connection(port: 8060)\n text.split(//).each do |c|\n path = \"/keypress/LIT_#{CGI::escape(c)}\"\n @logger.debug(\"Send Letter: \"+path)\n response = conn.post path\n return false unless response.success?\n end\n return true\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def request_string(options = Hash.new,&block)\n request_string_core('Enter string', 'inputbox', options, &block)\n end",
"def ask\n gets.strip\n end",
"def enter_text(textfield, text)\n append_to_script \"enter_text \\\"#{textfield}\\\" , \\\"#{text}\\\"\"\n end",
"def read_from_console\n puts 'Enter new tweet (not more than 140 signs)'\n @text = STDIN.gets.chomp[0..140]\n puts \"Sending your new tweet: #{@text.encode('UTF-8')}\"\n @@CLIENT.update(@text.encode('UTF-8'))\n puts 'Your tween has been sent'\n end",
"def listen\n\t\t# Before starting we need to get the users name from the user.\n\t\tputs \"Enter your username:\"\n\t\t# Start a new thread that will wait for user input and then\n\t\t# send it onto the server.\n\t\t@response = Thread.new do\n\t\t\tmsg = $stdin.gets.chomp\n\t\t\t@server.puts( msg )\n\t\t\tloop {\n\t\t\t\t# Gets input from the user.\n\t\t\t\tprint \"> \"\n\t\t\t\tmsg = $stdin.gets.chomp\n\t\t\t\t# Check if the message is a server control message crafted by the user.\n\t\t\t\t# Send error message to the user if it is. \n\t\t\t\t# Else send the message to the server for processing.\n\t\t\t\tif (msg =~ @server_message_regex )\n\t\t\t\t\tputs \"Server messages are not permitted on the client!\"\n\t\t\t\telse\n\t\t\t\t\t@server.puts( msg )\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\tend",
"def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend",
"def say\n send_text \"You just said: #{params}\"\n end",
"def handle(input)\n search(input)\n end",
"def get_user_input\n user_input_valid gets.chomp\n end",
"def prompt_text(form, answer, hint)\n form.text_field :answer, :class => 'form-control input-lg', :placeholder => hint\n end",
"def input=(input_text)\n engine.input = input_text\n end",
"def ask(string)\r\n log '', string\r\n STDIN.gets.strip\r\n end",
"def text text\n end",
"def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end",
"def get_response\nresponse = gets.chomp\nend",
"def wait_for_any_input\n Bot.on :message do |message|\n puts \"Received '#{message.inspect}' from #{message.sender}\"\n sender_id = message.sender['id']\n show_humour_replies(sender_id, HUMOUR)\n end\nend",
"def get_input(*msg)\n print *msg\n return gets.strip\n end",
"def manage\n case text\n when /\\A\\/start/\n Dialogue.new(@patient).welcome(chat_id)\n else\n contact.nil? ? phone_number = nil : phone_number = contact_phone_number\n if valid(phone_number)\n init_user\n else\n Dialogue.new(@patient).send_not_allowed(chat_id)\n end\n end\n end",
"def prompt(text)\n @output += %(#{text}\\n)\n print text\n STDIN.gets\n end",
"def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend",
"def get_user_selection(message)\n print message\n gets.chomp\nend",
"def instructions_for_manually_handling_alert(text)\n <<-TXT\n This alert/prompt/confirm wasn't automatically handled:<br><br>\n #{text}<br><br>\n How to proceed?<br><br>\n <form action='/confirm_alert'>\n <input type='submit' value='confirm'>\n <input type='text' name='text' placeholder='add text'>\n </form><br>\n <form action='/deny_alert'>\n <input type='submit' value='deny'>\n </form>\n TXT\n end",
"def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end",
"def process\n if @patient.nil?\n # patient needs to log in\n Authenticator.new(@message, @patient).manage\n else\n # when user is logged in save his input text\n Dialogue.new(@patient).save_patient_reply(text)\n\n # dispatch in function of user state and text input\n aasm_state = @patient.aasm_state\n\n case aasm_state\n when 'idle'\n manage_idle(text)\n\n when 'questionnaires'\n manage_questionnaires(text)\n\n else # 'responding'\n manage_responding(text)\n\n end\n\n end\n end",
"def validate_text(text, request_mode = :get)\n return validate({:text => text}, request_mode)\n end",
"def onUserText(text, view)\n # The user may type in something that we can't parse as a length\n # so we set up some exception handling to trap that\n begin\n value = text.to_l\n rescue\n # Error parsing the text\n UI.beep\n value = nil\n Sketchup.set_status_text '', SB_VCB_VALUE\n end\n return unless value\n case @state\n when 1\n # update the width\n vec = @pts[1] - @pts[0]\n if vec.length > 0.0\n vec.length = value\n @pts[1] = @pts[0].offset(vec)\n view.invalidate\n increment_state\n end\n when 2\n # update the height\n vec = @pts[3] - @pts[0]\n if vec.length > 0.0\n vec.length = value\n @pts[2] = @pts[1].offset(vec)\n @pts[3] = @pts[0].offset(vec)\n increment_state\n end\n end\n end",
"def ask(question)\n ui.ask question\n end",
"def ask message\nprint message\nSTDIN.gets.chomp\nend",
"def reply msg\n\t\t# get message from user\n\t\trep = @@client.message(msg)\n\t\t# handle the message\n\t\tputs handle_message(rep)\n\t\t\n\t\t# interactive Wit\n\t\t#@@client.interactive(method(:handle_message))\n\tend",
"def req_name\n\t\tputs \"What is your name?\"\n\t\t@name = gets.chomp\n\tend",
"def input_text(id, chars_max=0, default=nil)\n # check to see if in own window\n if $game_temp.text_input_start == 99\n # only do below if in its own window\n if $game_temp.message_text != nil\n return false\n end\n @message_waiting = true\n $game_temp.message_proc = Proc.new { @message_waiting = false }\n $game_temp.message_text = ''\n $game_temp.text_input_start = 0\n end\n $game_temp.text_input_variable_id = id\n $game_temp.text_input_chars_max = chars_max\n $game_variables[$game_temp.text_input_variable_id] = default\n return true \n end",
"def text(string); end",
"def text(string); end",
"def listen()\r\n STDIN.gets.chomp().downcase.gsub(/[^a-z\\s]/, '')\r\nend",
"def text(text)\n @text = text\n end",
"def process_input( user, *input_strings )\n\t\tinput_strings.each do |str|\n\t\t\tcase str\n\n\t\t\twhen %r{^/(\\w+)\\s*(.*)}\n\t\t\t\tself.handle_command( user, $1, $2 )\n\n\t\t\telse\n\t\t\t\tuser.add_output( \"You>> #{str}\" )\n\t\t\t\tself.broadcast_msg_from( user, str )\n\t\t\tend\n\t\tend\n\n\t\tuser.prompt if user.connected?\n\tend",
"def client_input(client)\n client.gets.chomp\n end",
"def request(msg)\n print(msg)\n gets.chomp\n end",
"def ask_for_(thing)\n puts \"What's the #{thing}?\"\n gets.chomp\n end",
"def text(name, options={})\n param(:text, name, options)\n end",
"def ask message\n print message\n STDIN.gets.chomp\nend",
"def ask message\n print message\n STDIN.gets.chomp\nend",
"def ask message\n print message\n STDIN.gets.chomp\nend",
"def read_input(message, default = '')\n message.split(\"\\n\").each { |e| print \"#{e} \" }\n response = STDIN.gets.chomp\n response.blank? ? default : response\nend",
"def show_message_request(text, type, actions, &block); end",
"def text_field; end",
"def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend",
"def input_string; end",
"def onUserText(text, view)\n # We only accept input when the state is 1 (i.e. getting the second point)\n # This could be enhanced to also modify the last line created if a length\n # is entered after creating a line.\n return if not @state == 1\n return if not @ip2.valid?\n \n # The user may type in something that we can't parse as a length\n # so we set up some exception handling to trap that\n begin\n value = text.to_l\n rescue\n # Error parsing the text\n UI.beep\n puts \"Cannot convert #{text} to a Length\"\n value = nil\n Sketchup::set_status_text \"\", SB_VCB_VALUE\n end\n return if !value\n\n # Compute the direction and the second point\n pt1 = @ip1.position\n vec = @ip2.position - pt1\n if( vec.length == 0.0 )\n UI.beep\n return\n end\n vec.length = value\n pt2 = pt1 + vec\n\n # Create a line\n self.create_geometry(pt1, pt2, view)\n self.reset(view)\nend",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def asks_question(question)\n puts question\n gets.chomp\nend",
"def say_hello\n puts \"Hello, what's your name?\"\n print \"User: \".blue\n name = gets.chomp\n bot_response(\"Hello #{name}\")\nend",
"def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend",
"def action_not_recognize(input)\n response = WxTextResponse.new\n set_common_response response\n response.Content = WxReplyMsg.get_msg_by_key 'help'\n response\n end",
"def enterText(someText)\n object = waitForObject(@symbolicName)\n object.text = \"\"\n type(waitForObject(@symbolicName), someText)\n Log.AppendLog(@@logCmd.type(self, someText))\n end",
"def menu\n puts \"Hello, are you a returning client? (Y/N)\"\n response = gets.chomp.downcase\nend",
"def get_name\n ask(\"give me a name to submit to local arena\") { |q|\n q.validate = /\\w+/\n }\nend",
"def receive_input\n input = ''\n controls = %w(a s d w)\n until controls.include?(input)\n input = STDIN.getch\n abort 'escaped' if input == \"\\e\"\n end\n input\n end",
"def read_user_input(message, default = \"\", show_input = true)\n print interpolate_message(message, default)\n show_input ? gets : silent_command { gets }\n ($_.chomp.empty?) ? default.chomp : $_.chomp\n end",
"def user_input\n gets.chomp\nend",
"def user_input\n gets.chomp\nend",
"def handlelogin\n\t\tif $chatserver.reservename @edit.getText\n\t\t\t\n\t\t\t#the name was not yet taken, so we notify the\n\t\t\t#ChatApp object of the name\n\t\t\t@app.name= @edit.getText\t\n\t\t\t\n\t\t\t#accept makes the dialog quit\n\t\t\taccept()\n\t\t\t\n\t\t\t#to make things simpler for the user, we set the\n\t\t\t#focus on the chat input WLineEdit\n\t\t\t@app.setfocus\n\t\telse\n\t\t\t\n\t\t\t#well, the requested name was already taken\n\t\t\t#so suggest a new one, and set it in the WLineEdit, too\n\t\t\tsuggested=$chatserver.suggestname @edit.getText\n\t\t\t@message.setText \"sorry, that name is taken, but \" +suggested+ \" is free.\"\n\t\t\t@edit.setText suggested\n\t\t\t\n\t\tend\n\n\t\n\t\n\tend",
"def send_message(text)\n end",
"def get_response(name)\n puts `clear`\n puts \"*** Welcome to #{name} ****\"\n puts \"Please select one of the choices below.\"\n print \"a(d)d user, (l)ist of all animals, (g)ive animal, (a)doption a pet, (c)lient list, (e)dit animal, edit (u)ser, (q)uit: \"\n gets.chomp.downcase\nend",
"def coming_soon_message\n puts \"Feature coming soon!\"\n puts \"Return to main? (y)es (e)xit Votersim\"\n\n @input = gets.chomp.downcase\n\n case @input\n when \"y\"\n prompt_user_for_initial_choices\n when \"e\"\n exit\n else\n coming_soon_message\n end\n end",
"def get_user_input\n gets.strip\nend",
"def get_input message\n\n puts message\n input = gets.chomp.downcase\n\nend",
"def request_user_name\n puts \"Please enter your name: \"\n name = gets.chomp\n end"
] |
[
"0.73320746",
"0.7157467",
"0.7041897",
"0.6928743",
"0.6844111",
"0.6514488",
"0.6500375",
"0.6428982",
"0.6405315",
"0.6320323",
"0.6285531",
"0.62815255",
"0.62593013",
"0.625168",
"0.6176133",
"0.6174668",
"0.61628026",
"0.6137685",
"0.60880244",
"0.6085792",
"0.6085792",
"0.60795444",
"0.60596526",
"0.6055881",
"0.60285133",
"0.6028329",
"0.6020952",
"0.6014982",
"0.6013064",
"0.5979052",
"0.59707284",
"0.59707284",
"0.59707284",
"0.5964238",
"0.5962121",
"0.5960563",
"0.59527177",
"0.59298193",
"0.5927232",
"0.59181046",
"0.5903395",
"0.59032893",
"0.5886054",
"0.58839643",
"0.5883803",
"0.58801484",
"0.5873572",
"0.58724725",
"0.5870928",
"0.5850219",
"0.58472776",
"0.58345366",
"0.58287597",
"0.5826331",
"0.5821969",
"0.58203316",
"0.5816517",
"0.5806926",
"0.5802515",
"0.5796219",
"0.5795815",
"0.57915634",
"0.5789704",
"0.5780894",
"0.5780853",
"0.5780853",
"0.5765346",
"0.57596093",
"0.57520825",
"0.5748455",
"0.5748192",
"0.57473296",
"0.57460326",
"0.5744486",
"0.5744486",
"0.5744486",
"0.5741464",
"0.57393306",
"0.5737337",
"0.573143",
"0.57303536",
"0.5723726",
"0.5719141",
"0.5715203",
"0.57151264",
"0.57071394",
"0.5706057",
"0.57058215",
"0.57047224",
"0.57038105",
"0.5697149",
"0.5693898",
"0.5681672",
"0.5681672",
"0.56795895",
"0.5675513",
"0.567259",
"0.5669551",
"0.5668382",
"0.56624216",
"0.56606066"
] |
0.0
|
-1
|
Chooses a random response phrase from the :responses hash and substitutes metadata into the phrase
|
def random_response(key)
random_index = rand(@data[:responses][key].length)
@data[:responses][key][random_index].gsub(/\[name\]/, @name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def random_response(key)\n\t\trandom_index = rand(@data[:responses][key].length)\n\t\t@data[:responses][key][random_index].gsub(/\\[name\\]/,@name)\n\tend",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input).downcase # Taking the input, processing and prepare it\n\t\tsentence = best_sentence(prepared_input) # Finding the best sentence to use based on input\n\t\tresponses = possible_responses(sentence) # Finding what responses are suitable based on the sentence\n\t\tresponses[rand(responses.length)] # Randomly picking one of the sentences.\n\tend",
"def possible_responses(sentence)\n responses = []\n\n # Find all patterns to try to match against\n @data[:responses].keys.each do |pattern|\n next unless pattern.is_a?(String)\n\n # For each pattern, see if the supplied sentence contains\n # a match. Remove substitution symbols (*) before checking.\n # Push all responses to the responses array.\n if sentence.match('\\b' + pattern.gsub(/\\*/, '') + '\\b')\n # If the pattern contains substitution placeholders,\n # perform the substitutions\n if pattern.include?('*')\n responses << @data[:responses][pattern].collect do |phrase|\n # First, erase everything before the placeholder\n # leaving everything after it\n matching_section = sentence.sub(/^.*#{pattern}\\s+/, '')\n\n # Then substitute the text after the placeholder, with\n # the pronouns switched\n phrase.sub('*', WordPlay.switch_pronouns(matching_section))\n end\n else\n # No placeholders? Just add the phrases to the array\n responses << @data[:responses][pattern]\n end\n end\n end\n\n # If there were no matches, add the default ones\n responses << @data[:responses][:default] if responses.empty?\n\n # Flatten the blocks of responses to a flat array\n responses.flatten\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input.downcase)\n\t\tsentence = best_sentence(prepared_input)\n\t\treversed_sentense = Wordplay.switch_pronouns(sentence)\n\t\tresponses = possible_responses(sentence)\n\t\treturn responses[rand(responses.length)]\n\tend",
"def greeting\n random_response(:greeting)\n end",
"def forecast_future(question, responses)\n random_key = responses.keys[rand(responses.size)]\n puts responses[random_key].sample\nend",
"def response\n\t\tputs @answers[rand(@answers.length - 1)]\n\tend",
"def response_generator number\n case number\n when 1\n \"It is certain\"\n when 2\n \"It is decidedly so\"\n when 3\n \"Without a doubt\"\n when 4\n \"Yes definitely\"\n when 5\n \"You may rely on it\"\n when 6\n \"As I see it yes\"\n when 7\n \"Most likely\"\n when 8\n \"Outlook good\"\n when 9\n \"Yes\"\n when 10\n \"Signs point to yes\"\n when 11\n \"Reply hazy try again\"\n when 12\n \"Ask again later\"\n when 13\n \"Better not tell you now\"\n when 14\n \"Cannot predict now\"\n when 15\n \"Concentrate and ask again\"\n when 16\n \"Don't count on it\"\n when 17\n \"My reply is no\"\n when 18\n \"My sources say no\"\n when 19\n \"Outlook not so good\"\n when 20\n \"Very doubtful\"\n end\nend",
"def greeting\n\t\trandom_response(:greeting)\n\tend",
"def greeting\n\t\trandom_response :greeting\n\tend",
"def get_response(input)\n key = RESPONSES.keys.select {|k| /#{k}/ =~ input }.sample\n /#{key}/ =~ input\n response = RESPONSES[key]\n response.nil? ? 'sorry?' : response % { c1: $1, c2: $2, c3: $3, c4: $4}\nend",
"def mock_response_with_spellcheck\n %({'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})\n end",
"def metadatas(response:)\n if response_ok?(response: response)\n parse_result(body: response.body)\n else\n Rails.logger.warn 'Dictionnaire-Academie failed in ' \\\n \"its seach for #{word}\"\n end\n end",
"def converse(prompt, responses = {})\n i, commands = 0, responses.map { |_key, value| value.inspect }.join(',')\n statement = responses.inject '' do |inner_statement, (key, value)|\n inner_statement <<\n (\n (i += 1) == 1 ?\n %(if response is \"#{value}\" then\\n) :\n %(else if response is \"#{value}\" then\\n)\n ) <<\n %(do shell script \"echo '#{key}'\"\\n)\n end\n applescript(\n %(\n tell application \"SpeechRecognitionServer\"\n set response to listen for {#{commands}} with prompt \"#{prompt}\"\n #{statement}\n end if\n end tell\n )\n ).strip.to_sym\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def ai_response_description\n case ai_response\n when 0 then \"Unable to respond\"\n when 1 then \"Reception acknowledged\"\n when 2 then \"Response to follow\"\n when 3 then \"Able to respond but currently inhibited\"\n else\n \"Reserved for future use\"\n end\n end",
"def funny_responses\n [\n 'Huh?',\n \"What's that you say?\",\n 'come again?',\n \"Sorry, I don't know that command.\"\n ]\n end",
"def error_response\n [\"I'm Sorry, I don't understand. Please try again\",\n \"Oh oh! Something went wrong. Please try again\", \n \"Um... Sorry, I don't understand. Did you input correct words?\"].sample\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def create_second_text_message(first_response)\n%(When I feel #{first_response}, I will also feel:\nCarefree\nPeaceful \nRelieved\nMellow\nRelaxed)\n end",
"def error_response\n [\"I'm Sorry, I don't understand. Please try again\",\n \"Oh oh! Something went wrong. Please try again\",\n \"Um... Sorry, I don't understand. Did you input correct words?\"].sample\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def reply_card(response)\n target_word = response.matches[0][0]\n card = create_card(target_word)\n response.reply(card)\n end",
"def pick_random_word(dictionary)\n random_num = rand(dictionary.length)\n dictionary[random_num]\n end",
"def select_word\r\n\t\t@answer = @words[rand(27)]\r\n\r\n\r\n\t\t# this would be a list of hashes\r\n\t\t@question = \"\"\r\n \t@tempque=\"\"\r\n\t\tfor x in 0..@answer.length\r\n\r\n\t\t\t@question=@question+\"#\"\r\n \t\t@tempque=@tempque+\"#\"\r\n\t\tend\r\n\t\treturn @answer\r\n\r\n\tend",
"def response_title_in_words(response, options={})\n if response.new_record?\n \"%{name} wants to add a %{type} now\".t % {\n :name => response.person ? link_to(h(response.person.username_or_name),\n person_path(response.person)) : response.sender_email,\n :type => response.class.human_name,\n }\n else\n \"%{name} replied %{time} ago\".t % {\n :name => response.person ? link_to(h(response.person.username_or_title_and_full_name), \n person_path(response.person), options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, response.person], :pcard)} : {}) : response.sender_email,\n :type => response.class.human_name,\n :time => time_ago_in_words_span_tag(response.created_at)\n }\n end\n end",
"def reply(lev, message)\n match = find_matches(lev, message).sample\n return nil unless match\n\n match[:reply] = split_and_replace_match_reply(match)\n expand_and_select_vocab!(match[:reply], @dictionary1)\n expand_name!(match[:reply], @context[:myname], @context[:usname])\n { reply: match[:reply], level: calc_reply_level(lev, match[:level]) }\n end",
"def teach(m, thing)\n thing.downcase!\n if @@learning_db.has_key? thing\n info = @@learning_db[thing]\n\n # If the entry contains pipe characters, split it into substrings delimited\n # by those pipe characters, then choose one randomly to spit back out.\n if info.match(/\\|/)\n split_entries = info.split '|'\n info = split_entries[rand(split_entries.size)]\n end\n # If the entry contatins '$who', substitute all occurrences of that string\n # with the nick of the person querying rawrbot.\n while (info.match(/\\$who/i))\n info.sub!(/\\$who/i,\"#{m.user.nick}\")\n end\n \n # If the entry contains the prefix <reply>, reply by simply saying\n # anything following it, rather than saying 'x is y'.\n if info.match(/^<reply> ?(.+)/)\n m.reply $1\n else\n m.reply \"#{thing} is #{info}.\"\n end\n else\n giveups = [\"bugger all, I dunno, #{m.user.nick}.\",\"no idea, #{m.user.nick}.\",\"dunno, #{m.user.nick}.\"]\n giveups.concat ['huh?','what?']\n giveup = giveups[rand(giveups.size)]\n m.reply \"#{giveup}\"\n end\n end",
"def send_random(event)\n # Parse message parameters\n msg = event.content\n type = parse_type(msg) || Level\n tabs = parse_tabs(msg)\n amount = [msg[/\\d+/].to_i || 1, NUM_ENTRIES].min\n\n # Retrieve list of maps\n maps = tabs.empty? ? type.all : type.where(tab: tabs)\n\n # Format and send response\n if amount > 1\n tabs = format_tabs(tabs)\n type = format_type(type).downcase.pluralize\n event << \"Random selection of #{amount} #{tabs} #{type}:\".squish\n event << format_block(maps.sample(amount).map(&:name).join(\"\\n\"))\n else\n map = maps.sample\n send_screenshot(event, map)\n end\nrescue => e\n lex(e, \"Error getting random sample.\", event: event)\nend",
"def generate_response\n if @numbers.size == 1\n @mock_response = \n \"ID: #{rand_string(32)}\" # Phone number is not given when it's the only one\n else\n @mock_response = \n @numbers.map{|number| \n \"ID: #{rand_string(32)} To: #{number}\"}.join(\"\\n\")\n end\n end",
"def random_mention_from_text\n @reply_mention_text.sample\n end",
"def generate_question(player_name)\n question = {}\n which_type = rand(0..(@question_types.size - 1))\n first_operand = rand(1..20)\n second_operand = rand(1..20)\n question_type = @question_types.keys[which_type]\n question_text = \"#{player_name}, what is #{first_operand} #{@question_types[question_type]} #{second_operand}? \"\n\n question[:text] = question_text\n question[:type] = question_type\n question[:first_num] = first_operand\n question[:second_num] = second_operand\n\n question\nend",
"def speak_to_grandma(response)\n\tif response == 'I LOVE YOU GRANDMA!'\n\t\treturn 'I LOVE YOU TOO PUMPKIN!'\n\tend\n\tif response != response.upcase() || response == ''\n\t\treturn \"HUH?! SPEAK UP, SONNY!\"\n\telse\n\t\treturn \"NO, NOT SINCE 1938!\"\n\tend\nend",
"def make_response(name, input, limit=140, sentences=(@mentions))\n # Prefer mentions\n # Turned this off for now its causing fail?\n relevant, slightly_relevant, tokenized = find_relevant(sentences, input)\n tokenized = tokenized.map {|tok| tok.gsub(/\\W/, '_')}\n tokstr = tokenized.join(\".\")\n puts \"Making response for #{tokstr} \"\n if relevant.length >= 30\n# if (relevant.length >= 100000)\n# relevant = relevant.sample(100001)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, relevant)\n make_statement(name, limit, generator)\n elsif slightly_relevant.length >= 50\n# if (slightly_relevant.length >= 100000)\n# slightly_relevant = slightly_relevant.sample(100002)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, slightly_relevant)\n make_statement(name, limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(name, input, limit, @sentences)\n else\n make_statement(name, limit)\n end\n end",
"def get_fortune\r\n randomNo = 1 + rand(10)\r\n\r\n #Assign an answer based on the randomly generated number\r\n case randomNo\r\n when 1\r\n $prediction = \"It is certain\"\r\n when 2\r\n $prediction = \"Reply hazy, try again\"\r\n when 3\r\n $prediction = \"Don't count on it\"\r\n when 4\r\n $prediction = \"Without a doubt\"\r\n when 5\r\n $prediction = \"Concentrate and ask again\"\r\n when 6\r\n $prediction = \"My sources say no\"\r\n when 7\r\n $prediction = \"You may rely on it\"\r\n when 8\r\n $prediction = \"Ask again later\"\r\n when 9\r\n $prediction = \"Very doubtful\"\r\n when 10\r\n $prediction = \"Outlook is good\"\r\n end\r\n\r\n end",
"def retrieve_riddle()\n @question = @riddles.keys.sample(1).join(' ')\n end",
"def farewell\n random_response(:farewell)\n end",
"def mock_response_with_spellcheck_collation\n %({'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})\n end",
"def address(m)\n replies = [\"#{m.user.nick}?\",'yes?','you called?','what?']\n my_reply = replies[rand(replies.size)]\n m.reply my_reply\n end",
"def random_word\n\t\tnumber = rand(@modified_dictionary.length)\n\t\t@modified_dictionary[number]\n\tend",
"def build_responses(message_source = answer_type, new_hash_wins = false)\n\n append_default unless default.nil?\n\n choice_error_str_func = lambda do\n message_source.is_a?(Array) \\\n ? '[' + message_source.map { |s| \"#{s}\" }.join(', ') + ']' \\\n : message_source.inspect\n end\n\n old_hash = @responses\n\n new_hash = { :ambiguous_completion =>\n \"Ambiguous choice. Please choose one of \" +\n choice_error_str_func.call + '.',\n :ask_on_error =>\n \"? \",\n :invalid_type =>\n \"You must enter a valid #{message_source}.\",\n :no_completion =>\n \"You must choose one of \" + choice_error_str_func.call + '.',\n :not_in_range =>\n \"Your answer isn't within the expected range \" +\n \"(#{expected_range}).\",\n :mismatch =>\n \"Your entries didn't match.\",\n :not_valid =>\n \"Your answer isn't valid (must match \" +\n \"#{@validate.inspect}).\" }\n\n @responses = new_hash_wins ? old_hash.merge(new_hash) : new_hash.merge(old_hash)\n end",
"def load_responses(parameters, survey_id)\n Question.all.each do |question|\n response = Response.new(survey_id: survey_id, question_id: question.id, choice_id: parameters[:\"#{question.id}\"])\n response.save\n end\n end",
"def generate_text_resources()\n\n # get total number of games in database\n upper_limit = JSON.parse(get_response(\"games\", \"\").body)['number_of_total_results']\n\n # generate a random id\n random_id = rand(upper_limit)\n \n # get 5 descriptions!\n description_response = JSON.parse(get_response(\n \"games\",\n \"offset=#{random_id}&limit=5&field_list=description,aliases\").body)\n\n # let's return the one's that aren't nil\n nonempty_descriptions = description_response[\"results\"].select{ |x| x[\"description\"] != nil }\n if nonempty_descriptions.empty?\n return generate_text_resources\n else\n return nonempty_descriptions\n end\nend",
"def translate(response)\n end",
"def make_response(input, limit=140, sentences=@mentions)\n # Prefer mentions\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n make_statement(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n make_statement(limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(input, limit, @sentences)\n else\n make_statement(limit)\n end\n end",
"def respond(message)\n RESPONSES.sample\n end",
"def question_statement(r)\n\tstatement = \" What do you think this one\"\n\tcase r.rand(4).to_i\n\twhen 0\n\t\tstatement << \" is?\"\n\twhen 1\n\t\tstatement << \" means?\"\n\twhen 2\n\t\tstatement << \" wants?\"\n\telse\n\t\tstatement << \" is for?\"\n\tend\n\treturn statement\nend",
"def random\n prompts = PromptDatum.all\n \n num = rand(1...prompts.length)\n\n render json: prompts[num]\n end",
"def successful_response_to\n attempts = 0\n loop do\n random_response = yield\n if random_response.success?\n return random_response\n elsif attempts > 2\n raise 'Unable to get a successful response'\n else\n assert_equal 'Declined_(General).', random_response.params.fetch('error')\n attempts += 1\n end\n end\n end",
"def random_thank_you\n [\n \"Thanks for sharing. I'll post your secret anonymously soon. \" +\n \"You might want to unfollow me - I'll unfollow you, too.\",\n \"I'll post your message soon. For secrecy, you might want to unfollow me.\",\n \"Thank you! I'll post your secret soon.\"\n ].sample\n end",
"def create_question_responses\n 10.times do\n response = Response.create(content: \"that sucks\", response_context_type: \"Question\", response_context_id: rand(1..12))\n User.find(rand(3)+1).responses << response\n end\nend",
"def farewell\n\t\trandom_response(:farewell)\n\tend",
"def learn_responses()\n return {'good' => ['Success', 'The update was successful. Followed by a space and the updated IP address. You should not attempt another update until your IP address changes.'],\n 'nochg' => ['Success', 'The supplied IP address is already set for this host. You should not attempt another update until your IP address changes.'],\n 'nohost' => ['Error', 'The hostname does not exist, or does not have Dynamic DNS enabled.'],\n 'badauth' => ['Error', 'The username / password combination is not valid for the specified host.'],\n 'notfqdn' => ['Error', 'The supplied hostname is not a valid fully-qualified domain name.'],\n 'badagent' => ['Error', 'Your Dynamic DNS client is making bad requests. Ensure the user agent is set in the request, and that youre only attempting to set an IPv4 address. IPv6 is not supported.'],\n 'abuse' => ['Error', 'Dynamic DNS access for the hostname has been blocked due to failure to interpret previous responses correctly.'],\n '911' => ['Error', 'An error happened on our end. Wait 5 minutes and retry.']}\n end",
"def create_challenge_response(cognito_response:, params:)\n if cognito_response.challenge_name == 'MFA_SETUP'\n response_hash = setup_mfa_response(cognito_response: cognito_response, params: params)\n elsif cognito_response.challenge_name.include?('_RETRY')\n cognito_response.challenge_name = cognito_response.challenge_name.gsub('_RETRY', '')\n response_hash = cognito_response.to_h\n else\n response_hash = { email: params[:email], cognito_response: cognito_response }\n end\n\n ChallengeResponse.new(response_hash)\n end",
"def say_response(speech, end_session = true, ssml: false)\n output_speech = add_speech(speech, ssml: ssml)\n { :outputSpeech => output_speech, :shouldEndSession => end_session }\n end",
"def update(response)\t\r\n\t\t@response = response\t\r\n\t\tmatched = false\r\n\t\tsaved_index = 0\r\n\r\n\t\t#Check for partial match\r\n\t\t@dictionary.each_index do |i|\r\n\t\t\tif response.include? @dictionary[i][0] and response.include? \"?\"\r\n\t\t\t\tsaved_index = i\r\n\t\t\t\tmatched = true\r\n\t\t\tend\r\n\t\tend\r\n\t\t#No partial match found, now check for a \"?\", no match, or one word response\t\t\r\n\t\tif matched\r\n\t\t\t@match_strategy.respond(saved_index)\r\n\t\telse\r\n\t\t\tif response.include? \"?\"\r\n\t\t\t\t@question_strategy.respond(saved_index)\t\t\r\n\t\t\telsif response.split(/\\s+/).length == 1\r\n\t\t\t\tgoodbye\r\n\t\t\t\t@user.delete_observer(self)\r\n\t\t\telse\r\n\t\t\t\t@change_strategy.respond(CHANGED_SUBJECT_INDEX)\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def answer_magic_8ball(message)\n\trand_number = Random.new\n\trand_number = rand(0 .. 19)\n\tanswer = message[rand_number]\nend",
"def print_response_details(response)\n # Parse the mutate response to print details about the entities that\n # were created by the request.\n suffix = \"_result\"\n response.mutate_operation_responses.each do |result|\n result.to_h.select {|k, v| v }.each do |name, value|\n if name.to_s.end_with?(suffix)\n name = name.to_s.delete_suffix(suffix)\n end\n\n puts \"Created a(n) #{::Google::Ads::GoogleAds::Utils.camelize(name)} \" \\\n \"with #{value.to_s.strip}.\"\n end\n end\nend",
"def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end",
"def random_sleeping\n @reply_sleeping_text.sample\n end",
"def markov_getreply(input='')\n if !@hal.nil?\n reply = @hal.getResponse(input)\n\n # We don't want to save every single time someone says something, so this is a hack.\n if (Time.now.sec % 2) == 0\n @hal.save\n end\n return reply\n end\n end",
"def help(response)\n output = build_help(response)\n output = filter_help(output, response)\n response.reply_privately output.join(\"\\n\")\n end",
"def help(response)\n output = build_help(response)\n output = filter_help(output, response)\n response.reply_privately output.join(\"\\n\")\n end",
"def select_word\n uri = URI('https://random-word-api.herokuapp.com/word?number=5')\n words = Net::HTTP.get(uri) \n words = words.delete(\"[\").delete(\"]\").delete(\"\\\"\")\n words = words.split(\",\")\n index = rand(words.count - 1)\n return words[index]\n end",
"def random_word\n words = @dictionary.dictionary.keys\n words[rand(words.length)]\n end",
"def reply_text\n return \"No response.\" if response.nil?\n return (not response.first.last.kind_of?(Hash) or response.first.last[\"reply_text\"].nil?) ? \"Unexpected response hash.\" : response.first.last[\"reply_text\"] if response.instance_of?(Hash)\n response_match = response.match(/\\<reply-text\\>(.+)\\<\\/reply-text\\>/) if response.instance_of?(String)\n return (response_match.nil?) ? \"Unexpected response string.\" : response_match[1] if response.instance_of?(String)\n return \"Unexpected response type.\"\n end",
"def parse_response(response)\n gimme_what_you_got = {}\n response_doc = JSON.parse(response)\n response_doc['data'].each do |id, tap|\n tap_name = id\n\n brewery = tap['brewery']\n beer_name = tap['beer']\n\n beer_type = tap['style']\n # beer_type.sub! /\\s+-\\s+/, ''\n\n # abv = beer_node.css('td')[4].children.to_s\n full_text_search = \"#{brewery} #{beer_name.to_s.gsub /(\\d+|')/, ''}\" # #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\n\n price = (tap['prices'][0].sub /\\$/, '').to_f\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n # abv: abv.to_f,\n price: price,\n search: full_text_search\n }\n end\n\n gimme_what_you_got\n end",
"def eight_ball(bot, msg = nil)\n response = @config[:eightball_responses][(rand * @config[:eightball_responses].length).to_i]\n bot.say(response)\n end",
"def random(opts = {})\n parse_response(Defcli.read_url(random_url), opts)\n end",
"def farewell\n\t\trandom_response :farewell\n\tend",
"def get_response(name)\n puts `clear`\n puts \"*** Welcome to #{name} ****\"\n puts \"Please select one of the choices below.\"\n print \"a(d)d user, (l)ist of all animals, (g)ive animal, (a)doption a pet, (c)lient list, (e)dit animal, edit (u)ser, (q)uit: \"\n gets.chomp.downcase\nend",
"def handle_response(guessers_guess, matching_indices)\n\t\tif(matching_indices.empty?)\n\t\t\t@candidate_words.delete_if {|word| word.include?(guessers_guess)}\n\t\telse\n\t\t\t@candidate_words = @candidate_words.select do |word| \n\t\t\t\tcontain_match_at_indices(word, matching_indices, guessers_guess)\n\t\t\tend\n\t\tend\n\tend",
"def magiceightball\n\t\t answers = [\"outlook not so good\", \"cloudy, ask again later\", \"it is meant to be\", \"you may rely on it\"]\n\t\t @result = answers[Random.rand(4)]\n\tend",
"def build_response(options={})\n\t\t\n\t\tresponses = []\n\n\t\tone_response = ''\n\n\t\tputs \"sample ids are:\"\n\t\tputs self.sample_ids\n\n\t\treturn responses unless sample_ids\n\n\t\tself.sample_ids.each_with_index {|sid,key|\n\t\t\tputs \"doing sample id: #{sid}\"\n\t\t\t## tests are got from the requisitions hash.\n\t\t\ttests = get_tests(sid)\n\t\t\tputs \"tests are: #{tests}\"\n\t\t\t## default sequence number is 0 (THIS MAY LEAD TO PROBLEMS.)\n\t\t\tsequence_number = \"#{key.to_s}\"\n\n\t\t\t## default patient id:\n\t\t\tpatient_id = \"abcde#{Time.now.to_i.to_s}\"\n\t\t\t\n\t\t\tpatient = Patient.new({:sequence_number => sequence_number, :patient_id => patient_id})\n\t\t\t\n\t\t\torder = Order.new({:sequence_number => patient.sequence_number, :specimen_id => sid, :tests => tests, :priority => \"R\"})\n\n\t\t\tresponses << (patient.build_response(options) + order.build_response(options.merge({sequence_number: self.sequence_number, carrier_number: self.carrier_number, position_number: self.position_number, sample_type: self.sample_type, container_type: self.container_type})))\n\n\t\t}\n\n\t\tputs \"responses are:\"\n\t\tputs responses.to_s\n\n\t\treturn responses\n\t\t\n\tend",
"def deaf_grandma2\n puts \"Say something to grandma!\"\n your_response = gets.chomp\n \n while your_response != your_response.upcase\n puts \"HUH?! SPEAK UP SONNY!\"\n your_response = gets.chomp\n end\n \n while your_response != \"BYE BYE BYE\"\n puts \"NO, NOT SINCE #{rand(1930..1951)}\"\n your_response = gets.chomp\n end\n \n puts \"Okay, you can go then. Don't miss me if I am dead.\"\nend",
"def response_metadata=(_); end",
"def generate_greeting\n languages = %w[French Spanish English Italian Hindi Japanese Korean Chinese Tamil Polish Dutch German Swedish]\n greetings = %w[Bonjour Hola Greetings Ciao שלום こんにちは 여보세요 你好 வணக்கம் Cześć Hallo Guten\\ Tag Hej]\n selection = rand(languages.length)\n @greeting_language = languages[selection]\n @greeting = greetings[selection]\n end",
"def responses\n {\n 'multiple_choice_answers' => self.multiple_choice_answers,\n 'open_response_answers' => self.open_response_answers,\n 'image_question_answers' => self.image_question_answers,\n 'external_links' => self.interactive_run_states\n }\n end",
"def prompt(key, prompt_text, **options, &block)\n answer = Answer.new\n answer.instance_eval(&block)\n\n help = help(**options)\n prompt = \"<bold>#{prompt_text}</bold>#{\" (#{help})\" if help}: \".colourise\n @data[key] = answer.run(@block.call(prompt))\n raise InvalidResponse if @data[key].nil? && options[:required]\n @data[key]\n rescue InvalidResponse => error\n puts \"<red>Invalid response</red> (#{error.message}), try again.\".colourise\n retry\n end",
"def random_departure\n @reply_departure_text.sample\n end",
"def random(tg,faulty,replacements,n)\n get_mappings(faulty,replacements).sample\nend",
"def pick_secret_word\n @word = dictionary.sample\n word\n end",
"def response_example(*v)\n set_example('response', v)\n end",
"def match_http_response_text(check,http_response_text)\n\n # first convert to intrigue uri format\n\n # grab headers\n header_part = http_response_text.split(/\\n\\n/).first\n body_part = http_response_text.split(/\\n\\n/).last\n\n headers = header_part.split(\"\\n\");\n body = body_part\n\n # TODO - fix to only grab content!!!!\n cookies = headers.select{|x| x =~ /^set-cookie:(.*)/i }\n\n ### grab the page attributes\n match = body.match(/<title>(.*?)<\\/title>/i)\n title = match.captures.first if match\n\n match = response.body.match(/<meta name=\\\"?generator\\\"? content=\\\"?(.*?)\\\"?\\/?>/i)\n generator = match.captures.first.gsub(\"\\\"\",\"\") if match\n\n # rest is a response\n # save title\n # save Cookies\n # save scripts ?\n data = {\n \"details\" => {\n \"hidden_response_data\" => body,\n \"headers\" => headers,\n \"cookies\" => cookies,\n \"generator\" => generator,\n \"title\" => title\n }\n }\n\n match_uri_hash(check,data)\n end",
"def response_to_macros(response)\n parsed_json = JSON.pretty_generate(JSON.parse(response.body))\n # this is an array of hashes (nested to infinite T_T)\n recipe_data = JSON.parse(parsed_json)\n\n # Loop through ingredients\n recipe_data.each do |ingredient|\n ingr_data = ingredient[\"nutrition\"]\n\n # # Loop through nutrition array of hashes\n ingr_data[\"nutrients\"].each do |nutrient|\n # Sum calories\n if nutrient[\"title\"] == \"Calories\"\n @recipe_hash[:total_cal] += nutrient[\"amount\"].to_f\n # Sum proteins\n elsif nutrient[\"title\"] == \"Protein\"\n @recipe_hash[:total_prot] += nutrient[\"amount\"].to_f\n # Sum carbs\n elsif nutrient[\"title\"] == \"Carbohydrates\"\n @recipe_hash[:total_carbs] += nutrient[\"amount\"].to_f\n # Sum fat\n elsif nutrient[\"title\"] == \"Fat\"\n @recipe_hash[:total_fat] += nutrient[\"amount\"].to_f\n end\n end\n end\n end",
"def parse_response(body)\n # Handling first response\n if INITIAL_FEELINGS.include? body\n @answers.push(body)\n create_response(create_second_text_message(body))\n # Handling second response\n elsif FOLLOWUP_FEELINGS.include? body\n @answers.push(body)\n if (@answers.length >= 1)\n create_response(\"Feel #{@answers[0]} and #{@answers[1]} throughout the day!\")\n else\n create_response(\"Empower youself with these feelings throughout the day. You can do it.\")\n end\n else\n create_response(\"We're not sure how to reply, please follow up with a valid feeling.\")\n end\n end",
"def greet(m)\n return unless m.message =~ /\\b(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}\\b/i\n greetings = ['Hello', 'Hi', 'Hola', 'Ni hao', 'Hey', 'Yo', 'Howdy']\n greeting = greetings[rand(greetings.size)]\n m.reply \"#{greeting}, #{m.user.nick}!\"\n end",
"def deaf_grandma\n puts \"Say something to grandma!\"\n your_response = gets.chomp\n \n while your_response != your_response.upcase\n puts \"HUH?! SPEAK UP SONNY!\"\n your_response = gets.chomp\n end\n \n puts \"NO, NOT SINCE #{rand(1930..1951)}\"\nend",
"def random_statement(r)\n\tcase r.rand(6).to_i\n\twhen 0\n\t\treturn \" :D\"\n\twhen 1\n\t\treturn \" Yawn. I'm tired...\"\n\twhen 2\n\t\t#Dice because it was randomly generated\n\t\treturn \" 🎲🎲🎲\"\n\twhen 3\n\t\treturn \" D:\"\n\twhen 4\n\t\treturn \" Hm.\"\n\telse\n\t\treturn \" ~_~\"\n\tend\nend",
"def set_responses\n\t\t@responses = Response.where(question_id: params[:id] ) rescue nil\n\tend",
"def update_responses(responses)\n\n ui_hash = []\n\n responses.each do |key, value|\n question = survey.question(key)\n response = response(key)\n\n next if value.nil? || question.nil?\n\n if question.type == :none || question.type == :repeater\n answer = question.answers.first\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: answer.id.to_s,\n answer.value_key => value.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :one\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(value).id.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :any\n value.each do |item|\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(item).id.to_s,\n autocompleted: true\n ))\n end\n end\n end\n\n update_from_ui_hash(Hash[ui_hash.map.with_index { |value, i| [i.to_s, value] }])\n end",
"def get_response\r\n if @letter.size != 1\r\n puts \"Invalid input, try again\"\r\n elsif @secret_word_letters.include? @letter\r\n puts \"Yes! This word does include #{@letter}!\"\r\n elsif @chances > 1\r\n @chances -= 1\r\n puts \"#{@letter} is not a letter in the word. You have #{@chances} guesses left.\"\r\n else\r\n lost\r\n end\r\n end",
"def phrase_select\n PHRASES.sample\n end",
"def get_response_for question\nprint question + \": \"\ngets.chomp\nend",
"def prepare_phrases\n text_array, prepared = @text.split, []\n 3.times do |time|\n prepared << random_phrase(text_array)\n end\n prepared\n end",
"def random_morning\n @reply_morning_text.sample\n end",
"def add_response\n puts \"===== ADD A NEW INPUT/RESPONSE =====\".yellow\n puts \"What question would you like to add?: \".yellow\n q = gets.chomp\n puts \"What response would you like for #{q}?: \".yellow\n a = gets.chomp\n\tRESPONSES[q] = a\n puts \"Response added!\".yellow\n puts \"==================================\".yellow\nend",
"def weighted_random(lastword)\n # If word has no words in its dictionary (last word in source text file)\n # have it pick a random word to display instead.\n @dictionary.dictionary.fetch(lastword, NULL_OBJECT).sample\n end"
] |
[
"0.72853094",
"0.6784648",
"0.6619443",
"0.6593563",
"0.6586191",
"0.6484881",
"0.63402075",
"0.6267631",
"0.6192105",
"0.6165832",
"0.60533893",
"0.60341126",
"0.590889",
"0.58956814",
"0.5831062",
"0.57584804",
"0.5692721",
"0.5670045",
"0.5644329",
"0.56239384",
"0.5616981",
"0.5615235",
"0.5613929",
"0.5613929",
"0.560765",
"0.5597333",
"0.5584376",
"0.5565953",
"0.55647737",
"0.55305725",
"0.54993844",
"0.5487363",
"0.5486269",
"0.546915",
"0.5463836",
"0.54580915",
"0.5445706",
"0.54268414",
"0.5426834",
"0.5406183",
"0.5396374",
"0.53932005",
"0.5381699",
"0.5359431",
"0.5347214",
"0.53455925",
"0.53156376",
"0.5311975",
"0.5294585",
"0.52695936",
"0.5268032",
"0.52595913",
"0.52109617",
"0.5202661",
"0.5191274",
"0.51909083",
"0.5186314",
"0.518478",
"0.5184056",
"0.5169827",
"0.516919",
"0.5168826",
"0.51607215",
"0.5158777",
"0.5158777",
"0.5156635",
"0.5156081",
"0.51512074",
"0.5149908",
"0.5149291",
"0.5139259",
"0.51387095",
"0.51353824",
"0.5130012",
"0.5118692",
"0.5111857",
"0.50974804",
"0.5093166",
"0.5091927",
"0.5090193",
"0.5079902",
"0.50780076",
"0.507468",
"0.50674",
"0.506403",
"0.5060749",
"0.50602317",
"0.50587934",
"0.50567985",
"0.5056031",
"0.50512135",
"0.50425154",
"0.5041182",
"0.50395143",
"0.50382286",
"0.50338405",
"0.5029499",
"0.502475",
"0.50176316",
"0.5016026"
] |
0.73591137
|
0
|
Performs preprocessing tasks upon all input to the bot
|
def preprocess(input)
perform_substitutions(input)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preprocess(input); end",
"def pre_process\n end",
"def preprocess_input(input)\nend",
"def pre_process(message)\n end",
"def process_input(raw_input)\n @engine.inject_command(normalized_input(raw_input), self)\n @engine.execute_pending_commands\n end",
"def processed_input!\n unknown_handling :process\n not_researched_handling :process\n self\n end",
"def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end",
"def _pre_process\n @pre_processor = @league.pre_processor.new(@data_feed_file).start\n\n if @pre_processor.errored?\n _output_errors(@pre_processor, 'preprocessing')\n else\n _output_success(@pre_processor, 'preprocessing')\n end\n end",
"def post_process\n end",
"def preprocess(&block); end",
"def preprocess(input)\n\t\tperform_substitutions(input)\n\tend",
"def preprocess_input(input)\n input\nend",
"def process!\n end",
"def pre_process(expectations, source)\n\t\tsource\n\tend",
"def post_process; end",
"def before_processing\n end",
"def doPreprocess(followersIds)\n end",
"def process_input\n if state.user_input == :star\n input_star\n elsif state.user_input == :star2\n input_star2\n elsif state.user_input == :target\n input_target\n elsif state.user_input == :target2\n input_target2\n elsif state.user_input == :remove_wall\n input_remove_wall\n elsif state.user_input == :remove_wall2\n input_remove_wall2\n elsif state.user_input == :add_hill\n input_add_hill\n elsif state.user_input == :add_hill2\n input_add_hill2\n elsif state.user_input == :add_wall\n input_add_wall\n elsif state.user_input == :add_wall2\n input_add_wall2\n end\n end",
"def input_handler\n STDIN.read.split(\"\\n\").each do |line|\n process_line(line)\n end\n end",
"def process\n return 'OK' if @email.to.first[:token] == 'example'\n return process_image if @email.to.first[:token] == 'flyers'\n\n token = ReplyToken.find(@email.to.first[:token])\n\n case token.reply_type\n when 'participation_request'\n process_participation_request(token)\n when 'conversation'\n process_conversation(token)\n when 'comment'\n process_comment(token)\n when 'community'\n process_community_reply(token)\n end\n\n track_reply(token)\n\n token.use!\n end",
"def process_input\n if state.current_input == :star\n input_star\n elsif state.current_input == :target\n input_target\n elsif state.current_input == :remove_wall\n input_remove_wall\n elsif state.current_input == :add_wall\n input_add_wall\n end\n end",
"def process\n end",
"def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end",
"def process_input\n if @process == 'directory'\n process_directory\n elsif @process == 'file'\n process_compiled_file\n elsif @process == 'zip'\n process_zip_file\n elsif @process == 'zip-stream'\n process_zip_stream\n end\n end",
"def process\n if @patient.nil?\n # patient needs to log in\n Authenticator.new(@message, @patient).manage\n else\n # when user is logged in save his input text\n Dialogue.new(@patient).save_patient_reply(text)\n\n # dispatch in function of user state and text input\n aasm_state = @patient.aasm_state\n\n case aasm_state\n when 'idle'\n manage_idle(text)\n\n when 'questionnaires'\n manage_questionnaires(text)\n\n else # 'responding'\n manage_responding(text)\n\n end\n\n end\n end",
"def rules(user, command, processed, dest, files = [], rules_file = \"\")\n from = user.name\n display_name = user.profile.display_name\n\n load \"#{config.path}/rules/general_rules.rb\"\n \n if general_rules(user, command, processed, dest, files, rules_file)\n return true\n else\n begin\n case command\n\n # help: ----------------------------------------------\n # help: `go to sleep`\n # help: it will sleep the bot for 5 seconds\n # help: command_id: :go_to_sleep\n # help:\n when /\\A\\s*go\\sto\\ssleep/i\n save_stats :go_to_sleep\n if answer.empty?\n ask \"do you want me to take a siesta?\"\n else\n case answer\n when /yes/i, /yep/i, /sure/i\n answer_delete\n respond \"I'll be sleeping for 5 secs... just for you\"\n respond \"zZzzzzzZZZZZZzzzzzzz!\"\n react :sleeping\n sleep 5\n unreact :sleeping\n react :sunny\n when /no/i, /nope/i, /cancel/i\n answer_delete\n respond \"Thanks, I'm happy to be awake\"\n else\n respond \"I don't understand\"\n ask \"are you sure you want me to sleep? (yes or no)\"\n end\n end\n\n # help: ----------------------------------------------\n # help: `run something`\n # help: It will run the process and report the results when done\n # help: command_id: :run_something\n # help:\n when /\\Arun something/i\n save_stats :run_something\n if has_access?(:run_something, user)\n react :runner\n\n process_to_run = \"ruby -v\"\n process_to_run = (\"cd #{project_folder} &&\" + process_to_run) if defined?(project_folder)\n stdout, stderr, status = Open3.capture3(process_to_run)\n unreact :runner\n if stderr == \"\"\n if stdout == \"\"\n respond \"#{display_name}: Nothing returned.\"\n else\n respond \"#{display_name}: #{stdout}\"\n end\n else\n respond \"#{display_name}: #{stdout} #{stderr}\"\n end\n end\n \n # Emoticons you can use with `react` command https://www.webfx.com/tools/emoji-cheat-sheet/\n \n # Examples for respond, respond_thread and respond_direct\n # # send 'the message' to the channel or direct message where the command was written\n # respond \"the message\"\n # # send 'the message' privately as a direct message to the user that sent the command\n # respond_direct \"the message\"\n # # same thing can be done:\n # respond \"the message\", :direct\n # # send 'the message' opening a thread\n # respond_thread \"the message\"\n # # same thing can be done:\n # respond 'the message', :on_thread\n # # send 'the message' to a specific channel name\n # respond \"the message\", 'my_channel'\n # # send 'the message' to a specific channel id\n # respond \"the message\", 'CSU34D33'\n # # send 'the message' to a specific user as direct message\n # respond \"the message\", '@theuser'\n # # send 'the message' to a specific user id as direct message\n # respond \"the message\", 'US3344D3'\n\n # Example sending blocks https://api.slack.com/block-kit\n # my_blocks = [\n # { type: \"context\",\n # elements:\n # [\n # { type: \"plain_text\", :text=>\"\\tInfo: \" },\n # { type: \"image\", image_url: \"https://avatars.slack-edge.com/2021-03-23/182815_e54abb1dd_24.jpg\", alt_text: \"mario\" },\n # { type: \"mrkdwn\", text: \" *Mario Ruiz* (marior) \" }\n # ]\n # }\n # ]\n # respond blocks: my_blocks\n\n # Example downloading a file from slack\n # if !files.nil? and files.size == 1 and files[0].filetype == 'yaml'\n # require 'nice_http'\n # http = NiceHttp.new(host: \"https://files.slack.com\", headers: { \"Authorization\" => \"Bearer #{config[:token]}\" })\n # http.get(files[0].url_private_download, save_data: './tmp/')\n # end\n\n # Examples sending a file to slack:\n # send_file(to, msg, filepath, title, format, type = \"text\")\n # send_file(dest, 'the message', \"#{project_folder}/temp/logs_ptBI.log\", 'title', 'text/plain', \"text\")\n # send_file(dest, 'the message', \"#{project_folder}/temp/example.jpeg\", 'title', 'image/jpeg', \"jpg\")\n else\n unless processed\n dont_understand()\n end\n return false\n end\n return true\n rescue => exception\n @logger.fatal exception\n respond \"Unexpected error!! Please contact an admin to solve it: <@#{config.admins.join(\">, <@\")}>\"\n return false\n end\n end\nend",
"def process\n if command = AVAILABLE_COMMANDS.find { |command_class| command_class.new(@user, @message).should_start? }\n command.new(@user, @message).start\n else\n BotCommand::Undefined.new(@user, @message).start\n end\n end",
"def call(input)\n process(input)\n end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def post_process\n bind_files\n make_tasks\n end",
"def next_preprocessing(save = false)\n first_preprocessing(save) if save\n next_task(nil, save)\n end",
"def process(*)\n end",
"def dispatch(input)\n continue = true\n commands = input.split(\" \")\n case commands[0].downcase\n when \"store\"\n continue = process_store(commands[1..-1])\n when \"factory\"\n continue = process_factory(commands[1..-1])\n when \"quit\"\n continue = process_quit\n when \"resources\"\n continue = process_resources\n when \"project\"\n continue = process_projects(commands[1..-1])\n when \"produce\"\n continue = process_production(commands[1..-1])\n when \"pick\"\n continue = process_pick(commands[1..-1])\n when \"next\"\n continue = process_next\n when \"save\"\n continue = process_save\n when \"scheduling\"\n continue = process_scheduling\n else\n puts \"unknown command: #{input}\"\n end\n return continue\n end",
"def run_and_transform; end",
"def process!\n events.each(&:process!)\n end",
"def pre_task\n end",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end",
"def postprocess\n return false if @@processed\n @@processed = true # Make sure this runs only once\n\n # Parses:\n # commands do\n # allow :kill \n # allow :custom_script, '/full/path/2/custom_script'\n # allow :git_clone, '/usr/bin/git', 'clone'\n # end\n # \n # * Tells Routines to force_array on the command name.\n # This is important b/c of the way we parse commands \n self.allow.each do |cmd|\n cmd, *args = *cmd\n \n ## Currently disabled\n ##raise AlreadyDefined.new(:commands, cmd) if @@allowed.member?(cmd)\n ##@@allowed << cmd\n \n # We can allow existing commands to be overridden but we\n # print a message to STDERR so the user knows what's up.\n if Rye::Cmd.can?(cmd)\n Rudy::Huxtable.ld \"Redefining #{cmd}\" if Rudy::Huxtable.global.verbose > 2\n end\n \n if args.last.is_a?(Proc)\n block = args.pop\n Rye::Cmd.add_command(cmd, nil, *args, &block)\n else\n # If no path was specified, we can assume cmd is in the remote path so\n # when we add the method to Rye::Cmd, we'll it the path is \"cmd\".\n path = args.shift || cmd.to_s\n \n raise PathNotString.new(:commands, cmd) if path && !path.is_a?(String)\n \n Rye::Cmd.add_command cmd, path, *args\n \n end\n \n \n ## We cannot allow new commands to be defined that conflict use known\n ## routines keywords. This is based on keywords in the current config.\n ## NOTE: We can't check for this right now b/c the routines config\n ## won't necessarily have been parsed yet. TODO: Figure it out!\n ##if Caesars.known_symbol_by_glass?(:routines, cmd)\n ## raise ReservedKeyword.new(:commands, cmd)\n ##end\n \n end\n \n ## NOTE: We now process command blocks as Procs rather than individual commands.\n ## There's currently no need to ForceRefresh here\n ##raise Caesars::Config::ForceRefresh.new(:routines)\n end",
"def read_and_process\n process(read)\n end",
"def before_perform\n @outdir = job.job_dir.to_s\n @basename = File.join(job.job_dir, job.jobid)\n @infile = @basename+\".in\" \n # still has to be generated\n @outfile = @basename+\".frags\"\n params_to_file(@infile, 'sequence_input', 'sequence_file')\n @informat = params['informat'] ? params['informat'] : 'fas'\n @predict_ta = params['ta']\n reformat(@informat, \"fas\", @infile)\n @commands = []\n \n \n end",
"def process(*)\n end",
"def process(*)\n end",
"def process(message, recipient)\n Astrotrain.callback(:pre_processing, message, self)\n Transport.process(message, self, recipient)\n \n end",
"def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end",
"def process(raw_input)\n clean_input, verbosity = sanitize_input raw_input\n\n if clean_input.length > 0\n command = find_command(clean_input) || @modes.current_mode.dynamic_command(clean_input) || @modes.global_mode.command_not_found\n user_args = extract_user_args command, clean_input\n command_ctx = build_context(command, user_args, verbosity)\n args = resolve_args(command, command_ctx)\n\n command.method.call(*args)\n end\n end",
"def process_input(line)\n case line\n when /^:((.+?)(?:!.+?)?) INVITE \\S+ :(\\S+)/i\n handle :incoming_invite, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+) :?\\001ACTION (.+?)\\001$/i\n handle :incoming_act, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcp, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?(.+?)$/i\n handle :incoming_msg, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcpreply, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?(.+?)$/i\n handle :incoming_notice, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) MODE (\\S+?) :?(\\S+?)(?: (.+?))?$/i\n handle :incoming_mode, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) JOIN :?(\\S+?)$/i\n handle :incoming_join, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PART (\\S+?)(?: :?(\\S+?)?)?$/i\n handle :incoming_part, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) KICK (\\S+?) (\\S+?) :?(.+?)$/i\n handle :incoming_kick, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/i\n handle :incoming_quit, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) NICK :?(\\S+?)$/i\n handle :incoming_nick, $1, $2, $3\n when /^PING :?(.+?)$/i\n handle :incoming_ping, $1\n when /^:((.+?)(?:!.+?)?) (\\d{3})\\s+(\\S+?) (.+?)$/i\n handle_numeric($3.to_i, $1, $2, $4, $5)\n else\n handle :incoming_miscellany, line\n end\n end",
"def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend",
"def processor; end",
"def perform_processing_run(faids)\n perform_analysis(faids)\n perform_processing!\n end",
"def run\n case\n when settings['pipe']\n process_pipe\n when settings.rest.size > 0\n settings.rest.each do |path|\n process_file(path)\n end\n else\n process_stdin\n end\n exit(0)\n end",
"def before_processing_hook(msg, connection)\n original_action = request.action\n task = request[:task]\n\n begin\n if [\"run_and_wait\", \"run_no_wait\"].include?(original_action) && task\n request.action = task\n\n begin\n authorization_hook(request) if respond_to?(\"authorization_hook\")\n rescue\n raise(RPCAborted, \"You are not authorized to run Bolt Task %s\" % task)\n end\n\n audit_request(request, connection)\n end\n ensure\n request.action = original_action\n end\n end",
"def process_rules\n @rules.each do |rule|\n rule.process(@commands, @vars)\n end\n\n @commands.uniq!\n end",
"def prep\n ssh_session do |session|\n @results['prep'] = _recursor(@config['prep'],session)\n end\n @log.info \"FINISHED PREP STEPS....\"\n end",
"def process\n process_moves\n reassign_team_sets\n reset_quantitative_data\n #notify\n end",
"def processa_tudo\n processa_us\n processa_de\n processa_frmt\n processa_eth\n processa_eos\n processa_bc\n end",
"def rules(from, command, processed, jid_user)\n if @testing\n puts \"#{from}: #{command}\"\n if @questions.keys.include?(from)\n context = @questions[from]\n @questions[from] = command\n command = context\n end\n end\n firstname = from.split(\" \").first\n case command\n\n # help: echo SOMETHING\n # help: repeats SOMETHING\n # help:\n when /echo\\s(.+)/i\n respond $1, jid_user\n\n # help: go to sleep\n # help: it will sleep the bot for 10 seconds\n # help:\n when /go\\sto\\ssleep/i\n unless @questions.keys.include?(from)\n ask(\"do you want me to take a siesta?\", command, from, jid_user)\n else\n case @questions[from]\n when /yes/i, /yep/i, /sure/i\n respond \"zZzzzzzZZZZZZzzzzzzz!\", jid_user\n respond \"I'll be sleeping for 10 secs... just for you\", jid_user\n sleep 10\n when /no/i, /nope/i, /cancel/i\n @questions.delete(from)\n respond \"Thanks, I'm happy to be awake\", jid_user\n else\n respond \"I don't understand\", jid_user\n ask(\"are you sure do you want me to sleep? (yes or no)\", \"go to sleep\", from, jid_user)\n end\n end\n else\n unless processed\n resp = %w{ what huh sorry }.sample\n respond \"#{firstname}: #{resp}?\", jid_user\n end\n end\nend",
"def run\n #possible loop\n unformatted_cards = TextParser.run(@file)\n card_factory(unformatted_cards)\n View.game_intro\n View.print_definition\n user_input = get_user_input\n evaluate_user_input(user_input)\n end",
"def process\n proccess_contacts_imports\n proccess_attendance_imports\n process_fnz_imports\n proccess_crm_imports\n process_planning_imports\n process_mailing_imports\n end",
"def process_input( user, *input_strings )\n\t\tinput_strings.each do |str|\n\t\t\tcase str\n\n\t\t\twhen %r{^/(\\w+)\\s*(.*)}\n\t\t\t\tself.handle_command( user, $1, $2 )\n\n\t\t\telse\n\t\t\t\tuser.add_output( \"You>> #{str}\" )\n\t\t\t\tself.broadcast_msg_from( user, str )\n\t\t\tend\n\t\tend\n\n\t\tuser.prompt if user.connected?\n\tend",
"def process!\n\n # Apply state logic and rules— stored and primed in this instance.\n # This ensures all instance variables are setup and defined for the\n # view functions to utilize.\n thinker unless @thinked.present?\n\n # Mark this instance as having thinked already.\n # We will use this at various points to ensure this instance\n # has been processed.\n @thinked = true\n end",
"def run input, params = {}\n @klass.new(input, options).process\n end",
"def process\n save_as(:processing)\n perform_checks\n initiate_delivery\n capture_payment\n save_as(:processed)\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def process(input)\n\n str = convert(input)\n # Sanitize strings.\n str = sanitize(str)\n # Mark the beginning of the text.\n if not @inside_input\n str = \"#{BEGIN_MARKER}\\n#{str}\\n\"\n @inside_input = true\n else\n str = str + \"\\n\"\n end\n @mutex.synchronize { @enqueued_tokens += 1 }\n @pipe.print(str)\n end",
"def process(input = nil)\n if input.nil?\n input = STDIN\n end\n\n input.each_line do |line|\n detect_filename_in line\n parse line if @filename\n end\n\n if input.is_a? IO\n puts result_as(Suspiciouss::Result::PlainText)\n else\n result_as(Suspiciouss::Result::Markdown)\n end\n end",
"def process\n process_setting_specs\n process_shard_specs\n process_connection_specs\n end",
"def pre_execute_checks\n validate_terraform_installed\n ensure_output_directory\n Dir.chdir(@opts.get(:input_dir)) do\n puts '=> Fetching modules...'\n tf_get\n end\n end",
"def preprocess(groups)\n end",
"def after_processing\n end",
"def process\n # no-op\n end",
"def process(options); end",
"def run_input_thread; end",
"def process(input)\n add_input(input)\n flush_context_stack\n end",
"def run_preprocessors\n @passages.each_key do |k|\n # HAML\n if @passages[k][:tags].include? 'haml'\n @passages[k][:content] = Haml::Engine.new(@passages[k][:content], HAML_OPTIONS).render\n @passages[k][:tags].delete 'haml'\n end\n # Coffeescript\n if @passages[k][:tags].include? 'coffee'\n @passages[k][:content] = CoffeeScript.compile(@passages[k][:content], COFFEESCRIPT_OPTIONS)\n @passages[k][:tags].delete 'coffee'\n end\n # SASS / SCSS\n if @passages[k][:tags].include? 'sass'\n @passages[k][:content] = Sass::Engine.new(@passages[k][:content], :syntax => :sass).render\n end\n if @passages[k][:tags].include? 'scss'\n @passages[k][:content] = Sass::Engine.new(@passages[k][:content], :syntax => :scss).render\n end\n end\n end",
"def perform(params)\n Commands::Processor.init(params).run\n end",
"def process_msgs\n end",
"def call(input)\r\n process(*input)\r\n end",
"def process\n # no-op by default\n end",
"def before_processing_hook(msg, connection); end",
"def process!(email, subject, body)\n if user.email == email\n story = stories.build :title=>subject, :body=>body\n story.save\n else\n writer = User.find_by_email email\n if writer\n ask = writer.asks.find_by_question_id question.id\n if ask\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n else\n ask = writer.asks.build :question=>question\n if ask.save\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n end\n end\n else\n writer = User.new :name=>email.split('@').first, :email=>email\n password = writer.reset_password\n if writer.save\n UserMailer.welcome(writer, password).deliver\n ask = writer.asks.build :question=>question\n if ask.save\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n end\n end\n end\n end\n \n if writer\n user.reads writer\n writer.reads user\n end\n \n story\n end",
"def process_input\n\n while movement = connection.gets.chomp\n begin\n parse movement\n end\n end\n end",
"def preprocess\n true\n end",
"def process_defn exp\n process_all exp.body\n end",
"def prepare_for_processing\r\n\t\tbegin\r\n\t\t\t@rate_tree = YAML.load(File.read(@options['rate_tree_yaml'])) #if File.exist?(@options['rate_tree_yaml'])\r\n\t\trescue\r\n\t\t\traise \"Error loading rate file.\\nPlease ensure you load rates before processing transactions\"\r\n\t\t\t\r\n\t\tend\r\n\t\t\r\n\t\tbegin\r\n\t\t\t@bin_tree = YAML.load(File.read(@options['bin_tree_yaml'])) #if File.exist?(@options['bin_tree_yaml'])\r\n\t\trescue\r\n\t\t\traise \"Error loading BIN file.\\nPlease ensure you load the BINs before processing transactions\"\r\n\t\tend\r\n\t\t\r\n\t\tget_client_folder #must come before load_profile\r\n\t\tload_profile\r\n\t\tset_reset_instance_variables\r\n\tend",
"def process(args)\n args\n end",
"def preproc; end",
"def process(input)\n if input == \"q\"\n puts \"Goodbye\"\n elsif input == \"tweet\"\n puts \"tweeting\"\n elsif input == \"dm\"\n puts \"direct messaging\"\n elsif input == \"help\"\n puts \"helping\"\n end\nend",
"def before_perform\n \n @basename = File.join(job.job_dir, job.jobid)\n @seqfile = @basename+\".in\"\n params_to_file(@seqfile, 'sequence_input', 'sequence_file')\n @commands = []\n @informat = params['informat'] ? params['informat'] : 'fas'\n reformat(@informat, \"fas\", @seqfile)\n @informat = \"fas\"\n\n @maxpsiblastit = params['maxpsiblastit']\n @maxhhblitsit = params['maxhhblitsit']\n @ss_scoring = \"-ssm \" + params[\"ss_scoring\"]\n @ptot = \"-T \" + params[\"ptot\"]\n @pself = \"-P \" + params[\"pself\"]\n @mergerounds = \"-mrgr \" + params[\"mergerounds\"]\n @mact = \"-mapt1 \" + params[\"mact\"] + \" -mapt2 \" + params[\"mact\"] + \" -mapt3 \" + params[\"mact\"]\n @domm = params[\"domm\"].nil? ? \"-domm 0\" : \"\" \n \n @maxlines = \"20\"\n @v = 1\n \n end",
"def post_process(answer)\n answer\n end",
"def process(statements); end",
"def processInput( user, *inputStrings )\n\t\tinputStrings.each {|str|\n\t\t\tcase str\n\n\t\t\twhen %r{^/(\\w+)\\s*(.*)}\n\t\t\t\thandleCommand( user, $1, $2 )\n\n\t\t\telse\n\t\t\t\tuser.addOutput( \"You>> #{str}\" )\n\t\t\t\tbroadcastMsgFrom( user, str )\n\t\t\tend\n\t\t}\n\n\t\tuser.prompt if user.connected?\n\tend",
"def postprocess(groups)\n end",
"def processors(*args)\n preprocessors(*args)\n end"
] |
[
"0.6466349",
"0.64644665",
"0.64398235",
"0.6390602",
"0.6235506",
"0.60365945",
"0.60285026",
"0.595726",
"0.59250295",
"0.59217334",
"0.5908038",
"0.58805287",
"0.5863677",
"0.5779307",
"0.5761706",
"0.57403475",
"0.5695637",
"0.5661843",
"0.5655688",
"0.56481344",
"0.5627099",
"0.5623121",
"0.5617212",
"0.56168836",
"0.5583087",
"0.55646217",
"0.55489033",
"0.5536067",
"0.5504129",
"0.5504129",
"0.5504129",
"0.5504129",
"0.5504129",
"0.5504129",
"0.5504129",
"0.5504129",
"0.54924095",
"0.54868555",
"0.54805505",
"0.5479372",
"0.54677266",
"0.5426226",
"0.5416779",
"0.5412848",
"0.5405345",
"0.53880465",
"0.5384791",
"0.5366497",
"0.5366497",
"0.5354111",
"0.5351784",
"0.53395903",
"0.53323126",
"0.53290874",
"0.53183293",
"0.5303905",
"0.5302406",
"0.52980965",
"0.5293609",
"0.5291437",
"0.5289823",
"0.5281201",
"0.5277773",
"0.5265763",
"0.52595097",
"0.5241645",
"0.5238746",
"0.52386016",
"0.5236035",
"0.5232809",
"0.522431",
"0.5218864",
"0.5218555",
"0.52080035",
"0.5206712",
"0.52004576",
"0.51969486",
"0.51969486",
"0.519405",
"0.51912063",
"0.51910317",
"0.51885045",
"0.51861566",
"0.518148",
"0.5180123",
"0.51627207",
"0.5148624",
"0.514437",
"0.5134025",
"0.51320785",
"0.51319677",
"0.51233524",
"0.51127875",
"0.5107451",
"0.51064557",
"0.5105184",
"0.5104337",
"0.50868285",
"0.5083693",
"0.50834495"
] |
0.58195215
|
13
|
Substitutes words and phrases on supplied input as dictated by the bot's :presubs data
|
def perform_substitutions(input)
@data[:presubs].each { |s| input.gsub!(s[0], s[1]) }
input
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend",
"def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end",
"def word_substituter(tweet)\n newtweet = tweet.split \n dictionary.each do |phrase, subs|\n newtweet.map! do |word|\n if word == phrase\n word = subs\n elsif \n word == phrase.capitalize\n word = subs\n else \n word = word\n end\n end\n end \n newtweet.join(\" \")\nend",
"def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend",
"def word_substituter(tweet)\n short_tweet = tweet.split.map do |word|\n if dictionary.keys.include?(word)\n dictionary[word]\n else\n word\n end\n end\n short_tweet.join(\" \")\nend",
"def get_user_input \n @story_keywords.each do |word|\n puts \"Enter a #{word}\"\n new_word = gets.chomp\n @story_template = replace_string word, new_word\n end \n end",
"def word_substituter(tweet)\n new_arr = []\n tweet_arr = tweet.split\n keys_arr = dictionary.keys\n tweet_arr.each do |word|\n if keys_arr.include?(word)\n new_arr << dictionary[word]\n else\n new_arr << word\n end\n end\n return new_arr.join(\" \")\nend",
"def word_substituter(tweet)\n tweet.split.map { |word| \n dictionary[word.downcase] || word }.join(\" \")\n end",
"def word_substituter(tweet)\n dictionary_hash = {\n \"hello\" =>'hi',\n \"to\" => '2', \"two\" => '2', \"too\" => '2' ,\n \"for\"=>'4', \"four\" =>'4',\n 'be' => 'b',\n 'you' => 'u',\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\n\n tweet_split = tweet.split(\" \")\n counter = 0\n tweet_split.each do |word|\n # puts \"************************word:#{word}\"\n # puts \"************************#{dictionary_hash}\"\n if dictionary_hash[word.downcase] == nil\n #do nothing\n else\n tweet_split[counter] = dictionary_hash[word.downcase]\n end\n counter += 1\n end\n # puts \"#{tweet_split}\"\n tweet_split.join(\" \")\nend",
"def word_substituter(tweet)\n tweet.split(\" \").map do |word| # 1\n if dictionary.keys.include?(word.downcase)\n word = dictionary[word.downcase] # 2\n else\n word\n end\n end.join(\" \") # 3\nend",
"def word_substituter(tweet)\n tweet.split.collect do |word|\n if dictionary.keys.include?(word.downcase)\n word = dictionary[word.downcase]\n else\n word\n end\n end.join(\" \")\nend",
"def word_substituter(string)\n# dictionary.has_key(\"hello\") == true\n replace= []\n \n replace << string.split.each do |word| \n if dictionary.has_key?(\"#{word}\") == true\n word.replace(dictionary[\"#{word}\"])\n else word\n \n end\n \n end \n replace.flatten.join(\" \")\nend",
"def bulk_tweet_shortener(tweets) \n tweets.each do |phrase|\n puts word_substituter(phrase)\n end\nend",
"def word_substituter(tweet)\n\ntweet_array = tweet.split(/ /)\ndictionary_keys = dictionary.keys\nshort_tweet_array = []\n tweet_array.each do |x|\n #for every x in array that matches dictionary.key replace with the value\n if dictionary_keys.include?(x.downcase) == true\n # look for x as key and substitute it for the values in short_tweet_array\n short_tweet_array.push(dictionary.values_at(x.downcase))\n else\n short_tweet_array.push(x)\n end\n end\nshort_tweet_array.flatten!\nshort_tweet_array.join(\" \")\n\nend",
"def word_substituter(tweet_string)\n tweet_array = tweet_string.split(\" \")\n dictionary.keys.each do |word|\n tweet_array.map! { |w| w.downcase == word ? dictionary[word] : w }\n end\n tweet_array.join(\" \")\nend",
"def word_substituter (tweet=\"some thing need to be shorten, like two too\")\n tweet= tweet.strip\n temp_a = tweet.split(\" \")\n words_can_b_sh = dictionary.keys\n #puts words_can_b_sh\n temp = \"\"\n# puts temp_a\n temp_a.each do |word|\n if words_can_b_sh.include?(word.downcase)\n temp << dictionary[word.downcase]\n else\n temp << word\n end\n temp << \" \"\n end\n temp.strip\nend",
"def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end",
"def word_substituter(tweet_string)\n\n dictionary_hash = dictionary\n tweet_to_array = tweet_string.split\n back_to_tweet = \"\"\n\n tweet_to_array.each_with_index do |word, index|\n dictionary.each do |full, truncated|\n if full.to_s == word\n tweet_to_array[index] = truncated\n end\n end\n end\n back_to_tweet = tweet_to_array.join(\" \")\n return back_to_tweet\n\nend",
"def word_substituter(tweet)\n tweetarr = tweet.split(' ')\n newtweet = []\n tweetarr.each do |word|\n if dictionary.key?(word.capitalize) \n newtweet << dictionary[word.capitalize].to_s\n \n else \n newtweet << word\n end\n \n end\n tweetstr = newtweet.join(' ')\n \n return tweetstr\nend",
"def find_replacement_translations(locale, variant_words, translations)\n pp \"Processing #{locale} strings\"\n unchanged = []\n to_be_replaced = []\n variant_words.each do |dict|\n current = dict[:source]\n origin = dict[:origin]\n replacement = dict[:target]\n # keeping a tally of how many will not change due to both current\n # and replacement being the same\n if current == replacement\n unchanged << { current: current, replacement: replacement }\n next\n end\n if current == '--'\n t = translations.where('copy LIKE ?', \"%#{origin}%\")\n puts \"#{t.count} strings found in #{locale} for #{origin}\"\n else\n t = translations.where('copy LIKE ?', \"%#{current}%\")\n puts \"#{t.count} strings found in #{locale} for #{current}\"\n end\n # t = translations.where(source_copy: source)\n # count = t.count\n # t = t.concat(fuzzy_match)\n unless (t.nil? or t.empty?) && current[0] != replacement[0]\n # pp \"#{current[0]} matched #{replacement[0]}\"\n t.each do |row|\n # exact match with word boundaries around the word\n # this will prevent words being part of ids/classes\n # and it will also prevent words like \"Unenroll\"\n # it's looking for \"enroll\"\n unless row.copy.match(/#{current}\\b/)\n next\n end\n if current[0] == replacement[0]\n pp \"#{current} will be replaced with #{replacement}\"\n end\n rep = {\n locale: locale,\n source: row.source_copy,\n current: row.copy,\n replacement: row.copy && row.copy.gsub(current, replacement),\n id: row.id,\n word: replacement,\n }\n if rep[:current] != rep[:replacement]\n puts \"Current and replacmeent match: #{rep[:current]} == #{rep[:replacement]}\"\n begin\n if rep[:replacement].strip_html_tags == rep[:replacement]\n to_be_replaced << rep\n else\n pp \"Stripped #{rep[:replacement]} and didn't add to list\"\n end\n end\n end\n end\n end\n end\n puts \"Ignoring: #{unchanged.size} strings\"\n puts \"Changing: #{to_be_replaced.size} strings\"\n to_be_replaced\nend",
"def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend",
"def translate(phrase)\n #split phrase into words\n word_array = phrase.split ' '\n #to_pig each word\n answer_array = word_array.map {|word| to_pig(word)}\n #join words back together\n answer = answer_array.join ' '\nend",
"def censor(tweet, list_of_phrases)\n list_of_phrases.each { |phrase| tweet.gsub! phrase, \"CENSORED\" }\n puts tweet\nend",
"def word_substituter(tweet) \n\tfinal_tweet_array = []\n\ttweet_array = tweet.split(\" \")\n\tkeys = dictionary.keys\n\ttweet_symbols = []\n\ttweet_array.each do |word|\n\t\ttweet_symbols << word.to_sym\n\tend\n\tshortened_tweet_array = []\n\ttweet_symbols.each do |symbol|\n\t\tif keys.include?(symbol)\n\t\t\tsymbol = dictionary[symbol]\n\t\t\tshortened_tweet_array << symbol\n\t\telse\n\t\t\tshortened_tweet_array << symbol\n\t\tend\n\tend\n\tshortened_tweet_array.each do |symbol|\n\t\tfinal_tweet_array << symbol.to_s\n\tend\n\tfinal_tweet_array.join(\" \")\nend",
"def subs(input, the_story)\n subbed = the_story.gsub(\"lion\", input).gsub(\"r\", \"rrr\")\n return subbed\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n output = word_substituter(tweet)\n puts output\n end\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each { |x| puts word_substituter(x)}\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def word_substituter(tweet) \n tweet_array = tweet.split\n \n # Iterate through tweet array, comparing with dictionary\n tweet_array.collect! do |word|\n dictionary().each do |key,val|\n if word == key || word == key.capitalize\n word = val\n end\n end\n word\n end\n \n # Convert array back to string\n tweet_array.join(\" \")\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each { |tweet|\n puts word_substituter(tweet)\n }\nend",
"def update!(**args)\n @words = args[:words] if args.key?(:words)\n end",
"def bulk_tweet_shortener(tweets)\n # puts tweets\n tweets.each {|tweet| puts word_substituter(tweet)}\nend",
"def translate(input_word)\n input_word.gsub(self.match_word, self.replacement_word)\n end",
"def boston_translator()\n\n\tscript_exit = false\n\n\tsystem \"clear\"\n\n\tputs \"Welcome to Boston. We can be a little hahd to undahstand, \\nso I figgahed I'd help you out.\"\n\n\twhile script_exit == false\n\t\tputs \"-------------------------------------------\"\n\t\tputs \"Whaddaya wanna do?\"\n\t\tputs \"'Lookup' a word or 'translate' somethin?\\n'Help' if you're not sure what I can do.\\nOr if you wanna leave, 'gtfo.'\"\n\t\tchoice = gets.chomp.downcase\n\n\t\tcase choice\n\n\t\twhen \"gtfo\"\n\t\t\tputs \"See ya!\"\n\t\t\tscript_exit = true\n\n\t\t\tnext\n\n\t\twhen \"translate\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Alright, what didja say?\"\n\t\t\toriginal_text = gets.chomp\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\n\t\t\toriginal_text_array = make_list(original_text)\n\t\t\t# puts original_text_array\n\n\t\t\tcapitals_array = find_store_capitals(original_text_array)\n\t\t\t# puts capitals_array\n\n\t\t\tdown_text_array = original_text_array.each {|word| word.downcase!}\n\t\t\t# puts down_text_array\n\n\t\t\tpunct_hash, bare_text = find_store_punctuation(down_text_array)[0], find_store_punctuation(down_text_array)[1]\n\t\t\t# puts punct_hash\n\t\t\t# puts bare_text\n\n\t\t\ttrans_text = word_search_replace(bare_text, $single_word_dictionary)\n\n\t\t\tfinal_text = restore_punct(restore_capitals(trans_text, capitals_array), punct_hash)\n\n\t\t\tputs \"You said: \" + back_to_string(final_text) + \"\\n\"\n\n\t\t\tnext\n\n\t\twhen \"lookup\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Whaddaya wanna lookup?\"\n\n\t\t\tboston_word = gets.chomp.downcase\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\t\t\tboston_word_singleton = boston_word.split\n\t\t\t\n\t\t\tfinal_word = word_search_replace(boston_word_singleton, $single_word_dictionary)\n\n\t\t\tif back_to_string(final_word) == boston_word\n\t\t\t\tputs \"I've nevah heard the word #{boston_word} befoah. Heh. Must not exist.\"\n\t\t\telse\n\t\t\t\tputs \"That means: \" + back_to_string(final_word)\n\t\t\tend\n\n\t\t\t\n\t\t\tnext\n\n\t\twhen \"help\"\n\t\t\tputs \"\\n\"\n\t\t\tputs \"So I'm a pretty smaht translatah. I know most of the most common English words\\nas a Bostonian would say them. \\nBasic spelling rules: ar, re, er, => ah.\\nI also know some of the words from Universal hub,\\nlike grindah, jimmies, and wicked.\\nSo test me out, and see what I know.\"\n\t\t\tputs \"\\n\"\n\n\t\telse\n\t\t\tputs \"Don't be fresh. That's not an option. Try again\" + \"\\n\"\n\n\t\t\tnext\n\n\t\tend\n\n\n\t\t\n\tend\n\t\nend",
"def bulk_tweet_shortener(array)\n replace= []\n \n array.each do |string|\n replace << string.split.each do |word| \n if dictionary.has_key?(\"#{word}\") == true\n word.replace(dictionary[\"#{word}\"])\n else word\n end\n end\n \n end \n\n replace.collect do |tweet| puts tweet.join(\" \") end\nend",
"def prepare_phrases\n text_array, prepared = @text.split, []\n 3.times do |time|\n prepared << random_phrase(text_array)\n end\n prepared\n end",
"def translate(text,dictonary)\nend",
"def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end",
"def replace_string keyword, user_word\n #loop through keywords here\n @story_template.gsub(\"[#{keyword}]\", user_word) # We have to add the [] staples back in so that the story_template function below works \n end",
"def bulk_tweet_shortener(tweet_array)\n new_tweet = \"\"\n tweet_array.each do |string|\n new_tweet = word_substituter(string)\n puts new_tweet\n end\nend",
"def autocorrect(input)\n input.gsub(/\\b(you+|u)\\b/, 'your sister')\nend",
"def translate text\n split_arr = text.split(\" \")\n split_arr_trans = split_arr.map { |word| \n (@@found_dict.key? word) ? @@found_dict[word] : (@@found_dict[word]=process_word(word); @@found_dict[word])\n }\n return split_arr_trans.join(\" \")\n end",
"def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0..1] << \"ay\" \n else\n word[1..-1] << (word[0] << \"ay\") \n end\n }\n words.join(\" \")\n\nend",
"def stuff(input)\n\twords = input.split(\" \")\n\n\twords.each do |x| \n\t\tif x == 'the' || x == 'of' || x == 'and' || x == 'is' || x == 'a'\n\t\t\telse\n\t\t\t\t@acronym << x.to_s.chars.first.upcase + \".\"\n\t\tend\n\tend\nend",
"def word_substituter(tweet)\n\n # Splits up the tweet with the space \" \" delimiter into an array of words\n tweet_array = tweet.split(\" \")\n # local_dictionary stores a copy of the dictionary in a variable within this method to be operated upon\n local_dictionary = dictionary\n # tweet_index is used to iterate through the tweet_array with #each_with_index\n tweet_index = 0\n # shortened_tweet is the return value of this method\n shortened_tweet = \"\"\n\n\n # Iterates through tweet_array\n tweet_array.each_with_index do |tweet_word, tweet_index|\n\n # Iterates through local_dictionary hash\n local_dictionary.each do |dictionary_key, dictionary_value|\n # Converts each dictionary key to a string to be compared to tweet_word\n # Converts each tweet_word in all lowercase letters for consistency\n # If tweet_word is equal to dictionary_key, replace it with the corresponding value\n if dictionary_key.to_s == tweet_word.downcase\n tweet_array[tweet_index] = dictionary_value\n end\n end # Iterates through local_dictionary hash\n\n # Increment tweet_index\n tweet_index += 1\n end # Iterates through tweet_array\n\n # Joins tweet_array back into a string\n shortened_tweet = tweet_array.join(\" \")\n\n ####################### Testing returns below\n # tweet_array\n # binding.pry\n # Return value of this method is string shortened_tweet\n shortened_tweet\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def modify_text(book_text, string_values)\n string_values.each do |search_string, change_string|\n regex = %r[#{search_string}]\n book_text = book_text.gsub(regex, change_string)\n end\n\n return book_text\nend",
"def bulk_tweet_shortener(array_tweet)\n array_tweet.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n # each element in tweet_array is the tweet string which\n # the word_substituter method can work on\n end\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def autocorrect(input)\n input.gsub(/(\\byou+\\b|\\bu\\b)/i, 'your sister')\nend",
"def bulk_tweet_shortener (tweets)\n if(tweets.size > 0)\n tweets.each do |tweet_each|\n puts word_substituter(tweet_each)\n end\n end\nend",
"def translate_word word\n # Don't translate short words\n return word if word.size == 1\n\n # Handle specific words\n dictionary = {\n 'AWESOME' => 'ERSUM',\n 'BANANA' => 'BERNERNER',\n 'BAYOU' => 'BERU',\n 'FAVORITE' => 'FRAVRIT',\n 'FAVOURITE' => 'FRAVRIT',\n 'GOOSEBUMPS' => 'GERSBERMS',\n 'LONG' => 'LERNG',\n 'MY' => 'MAH',\n 'THE' => 'DA',\n 'THEY' => 'DEY',\n 'WE\\'RE' => 'WER',\n 'YOU' => 'U',\n 'YOU\\'RE' => 'YER',\n\n 'awesome' => 'ersum',\n 'banana' => 'bernerner',\n 'bayou' => 'beru',\n 'favorite' => 'fravrit',\n 'favourite' => 'fravrit',\n 'goosebumps' => 'gersberms',\n 'long' => 'lerng',\n 'my' => 'mah',\n 'the' => 'da',\n 'they' => 'dey',\n 'we\\'re' => 'wer',\n 'you' => 'u',\n 'you\\'re' => 'yer',\n\n 'Awesome' => 'Ersum',\n 'Banana' => 'Bernerner',\n 'Bayou' => 'Beru',\n 'Favorite' => 'Fravrit',\n 'Favourite' => 'Fravrit',\n 'Goosebumps' => 'Gersberms',\n 'Long' => 'Lerng',\n 'My' => 'Mah',\n 'The' => 'Da',\n 'They' => 'Dey',\n 'We\\'re' => 'Wer',\n 'You' => 'U',\n 'You\\'re' => 'Yer',\n }\n\n return dictionary[word] if dictionary.key? word\n \n # Before translating, keep a reference of the original word\n original_word = \"\"\n original_word << word\n\n word.upcase!\n\n # Drop vowel from end of words. Keep it for short words, like \"WE\"\n word.sub!(/[AEIOU]$/, '') if original_word.size > 2\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # Reduce adjacent vowels to one\n word.gsub!(/[AEIOUY]{2,}/, 'E') # TODO: Keep Y as first letter\n\n # DOWN -> DERN\n word.gsub!(/OW/, 'ER')\n\n # PANCAKES -> PERNKERKS\n word.gsub!(/AKES/, 'ERKS')\n\n # The mean and potatoes: replace vowels with ER\n word.gsub!(/[AEIOUY]/, 'ER') # TODO: Keep Y as first letter\n\n # OH -> ER\n word.gsub!(/ERH/, 'ER')\n\n #MY -> MAH\n word.gsub!(/MER/, 'MAH')\n\n #FALLING -> FERLIN\n word.gsub!('ERNG', 'IN')\n\n #POOPED -> PERPERD -> PERPED\n word.gsub!('ERPERD', 'ERPED')\n\n #MEME -> MAHM -> MERM\n word.gsub!('MAHM', 'MERM')\n\n # Keep Y as first character\n # YES -> ERS -> YERS\n word = 'Y' + word if original_word[0] == 'Y'\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # YELLOW -> YERLER -> YERLO\n if original_word.end_with?('LOW') && word.end_with?('LER')\n word.sub!(/LER$/, 'LO')\n end\n\n # Resolve case\n return word.downcase if original_word[0] >= 'a' and original_word[0] <= 'z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n return word[0] + word[1..-1].downcase if original_word[0] >= 'A' and original_word[0] <= 'Z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n\n return word\n\nend",
"def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def bulk_tweet_shortener(tweet_array)\n tweet_array.each do |tweet|\n #binding.pry\n puts word_substituter(tweet)\n end\nend",
"def autocorrect(string)\n\tword_array = string.split\n\tword_array.map! {|w| w.gsub(/^you+\\b|^u\\b/i, \"your sister\")}.join(\" \")\nend",
"def update!(**args)\n @confidence = args[:confidence] if args.key?(:confidence)\n @transcript = args[:transcript] if args.key?(:transcript)\n @words = args[:words] if args.key?(:words)\n end",
"def all_phrases\n mario\n toadstool\n link\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def madlib(words)\n words = { noun: nil, verb: nil, adjective: nil, adverb: nil }\n \n words.each do |key, value|\n print \"=> Choose your #{key}: \"\n words[key] = gets.chomp\n end\n\n puts \"Your #{words[:adjective]} #{words[:noun]} wants to #{words[:adverb]}\" +\n \" #{words[:verb]}. LOL.\"\nend",
"def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend",
"def all_phrases ()\n puts mario\n puts toadstool\n puts link\nend",
"def preprocess(input)\n perform_substitutions(input)\n end",
"def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end",
"def translate(sentence)\r\n words = sentence.split(\" \")\r\n words.collect! do |a|\r\n if(a =~ /\\w\\.\\.\\.\\w/) #matching e.g \"yes...no\"\r\n morewords = a.split(\"...\")\r\n ##\r\n #alternative: allows for recursion, but loses accuracy since \"a...b\" becomes \"a ... b\"\r\n #probably some non-messy way to make it work, and be less redundant too\r\n #\r\n #morewords.insert(1, \"...\")\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + \"...\" + pig(morewords[1], 1)\r\n elsif(a =~ /\\w\\W\\w/ and !(a =~ /'/)) #matching e.g. \"steins;gate\", \"ninety-nine\", but not \"it's\"\r\n nonletter = a.scan(/\\W/)[0]\r\n morewords = a.split(/\\W/)\r\n #morewords.insert(1, nonletter)\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + nonletter + pig(morewords[1], 1)\r\n elsif(a[0..1].match(/qu/)) #quiet = ietquay\r\n pig(a, 2)\r\n elsif(a[0..2].match(/sch|.qu/)) #school = oolschay, square = aresquay\r\n pig(a, 3)\r\n else\r\n x = a.index(/[AaEeIiOoUu]/) #starts with other consonant(s) or a vowel; find the first vowel\r\n if(!(x.nil?)) #found at least one vowel\r\n pig(a, x) \r\n else #x is nil, no vowels found\r\n a.index(/[[:alpha:]]/) ? pig(a, 1) : a #if it contains letters, attempt to process; otherwise, do nothing\r\n end\r\n end\r\n end\r\n return words.join(\" \")\r\nend",
"def update!(**args)\n @edited_word = args[:edited_word] if args.key?(:edited_word)\n @probability = args[:probability] if args.key?(:probability)\n end",
"def build_variant_replacements(variant_words)\n # first check if the number of words in a given set is not 7\n # (meaning doesn't include all source/target for each locale + source)\n invalid_variant_words = variant_words.select { |words| words.count != 7 }\n unless invalid_variant_words.empty?\n pp \"Found Invalid Variants: #{invalid_variant_words}\"\n raise Exception.new(\"Found Invalid Variants: #{invalid_variant_words.count}\")\n end\n locale_words = { 'en-GB' => [], 'en-CA' => [], 'en-AU' => [], }\n variant_words.each do |source, gb_source, gb_target, ca_source, ca_target, au_source, au_target|\n puts \"A single row below:\"\n puts \"#{source}, #{gb_source}, #{gb_target}, #{ca_source}, #{ca_target}, #{au_source}, #{au_target}\"\n locale_words['en-GB'] << { origin: source, source: gb_source, target: gb_target }\n # puts locale_words['en-GB']\n locale_words['en-CA'] << { origin: source, source: ca_source, target: ca_target }\n pp locale_words\n # puts locale_words['en-CA']\n locale_words['en-AU'] << { origin: source, source: au_source, target: au_target }\n # puts locale_words['en-AU']\n end\n locale_words\nend",
"def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend",
"def update!(**args)\n @glossary = args[:glossary] if args.key?(:glossary)\n @ignore_case = args[:ignore_case] if args.key?(:ignore_case)\n end",
"def bulk_tweet_shortener(array_of_tweets)\n array_of_tweets.each do |tweet|\n single_tweet = word_substituter(tweet)\n puts single_tweet\n end\nend",
"def bulk_tweet_shortener(array)\n array.each do |tweet|\n puts word_substituter(tweet)\n end\n #binding.pry\nend",
"def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def create_phrases\n pinwheel = %w{ | / - \\\\ }\n puts \"Creating keys for locale : #{@locale}\"\n _keys_and_values = yml_to_keys_and_values\n _keys_and_values.each_with_index do |(key, value), index|\n percentage = ((index + 1).to_f / _keys_and_values.length * 100).to_i\n print \"\\b\" * 50, \"Progress: #{percentage}% - #{index + 1}/#{_keys_and_values.length} \", pinwheel.rotate!.first\n\n _key = key.to_s.split('.')[1..-1] * '.'\n next if whitelisted?(_key)\n phrasing_phrases.find_or_initialize_by(key: _key).tap do |pp|\n pp.value = value\n pp.save\n end\n end\n puts 'Done.'\n end",
"def test_mixed_pronouns\n assert_equal(\"you gave me life\",\n WordPlay.switch_pronouns(\"i gave you life\"))\n\n assert_equal(\"i am not what you are\",\n WordPlay.switch_pronouns(\"you are not what i am\"))\n end",
"def danish(text)\n p text.sub(/\\b(apple|cherry|blueberry)\\b/, 'danish')\nend",
"def typoglycemiaSentence(input)\n words = input.split(' ')\n words.map! { |x| typoglycemiaWord(x) }\n words.join(\" \")\nend",
"def translate(str)\n\n words = str.split(\" \")\n\n translated_words = words.collect do |word|\n if (\"aeiou\").include?(word[0]) then\n word + \"ay\"\n elsif (word[0..1]).include?(\"qu\") then\n word[2..-1] + word[0..1] + \"ay\"\n elsif (word[0..2]).include?(\"qu\") then\n word[3..-1] + word[0..2] + \"ay\"\n else\n n = word.index(/[aeiou]/)\n word[n..-1] + word[0..n-1] + \"ay\"\n end\n end\n\n translated_words.join(\" \")\nend",
"def personalise campaign, person={}\n #your code here\n campaign.gsub!\"<NAME>\", person[:name]\n campaign.gsub!\"<CITY>\", person[:city]\n campaign.gsub!\"<FAVOURITE PRODUCTS>\", person[:favourite_product]\n return campaign\nend",
"def translate(word)\n split_words = word.split(' ')\n words = []\n vowels = %w[a e i o u]\n split_words.each do |word|\n word = qu_in_word(word)\n if vowels.include?(word[0])\n words.push(word + 'ay')\n else\n count = 0\n word.length.times do |number|\n vowels.include?(word[number]) ? break : count += 1\n end\n words.push(word[count..-1] + word[0..(count - 1)] + 'ay')\n end\n end\n words.join(' ')\nend",
"def set_words\n @en_word = params[:en] && English.find_by(name: params[:en].downcase)\n @ru_word = params[:ru] && Russian.find_by(name: params[:ru].downcase)\n end",
"def speak_to_grandma(input_phrase)\n if input_phrase == \"I LOVE YOU GRANDMA!\"\n \"I LOVE YOU TOO PUMPKIN!\"\n elsif input_phrase!=input_phrase.upcase && input_phrase!=\"I LOVE YOU GRANDMA!\"\n \"HUH?! SPEAK UP, SONNY!\"\n else input_phrase!=input_phrase.upcase \n \"NO, NOT SINCE 1938!\"\n end\nend",
"def update!(**args)\n @language = args[:language] if args.key?(:language)\n @sentences = args[:sentences] if args.key?(:sentences)\n @tokens = args[:tokens] if args.key?(:tokens)\n end",
"def update!(**args)\n @display_text = args[:display_text] if args.key?(:display_text)\n @ssml = args[:ssml] if args.key?(:ssml)\n @text_to_speech = args[:text_to_speech] if args.key?(:text_to_speech)\n end",
"def update!(**args)\n @display_text = args[:display_text] if args.key?(:display_text)\n @ssml = args[:ssml] if args.key?(:ssml)\n @text_to_speech = args[:text_to_speech] if args.key?(:text_to_speech)\n end",
"def cartmans_phrase(words)\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def bulk_tweet_shortener(tweets)\n tweets.collect do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def update!(**args)\n @clean_text = args[:clean_text] if args.key?(:clean_text)\n @info_string = args[:info_string] if args.key?(:info_string)\n @snippet = args[:snippet] if args.key?(:snippet)\n @text = args[:text] if args.key?(:text)\n end",
"def update\n words = params['replacelist'].split(/\\s+/)\n words << '?' if words.length.odd? #ensure even-number length to make a hash\n replacelist = Hash[*words]\n Setting['replacelist'] = replacelist\n Setting['blacklist'] = params['blacklist'].split(/[\\r\\n]+/)\n redirect_to :controller => 'admin/keywords', :action => :index\n end",
"def process_phrase_for_word_count\n # remove punctuation\n @phrase.gsub!(/[^0-9a-z ,]/i, '')\n \n # remove list\n @phrase.gsub!(/[,]/, ' ')\n \n # lowercase everything\n @phrase.downcase!\n \n end",
"def translate(arr)\n vowels = %w{a e i o u y}\n consonants = %w{b c d f g h j k l m n p q r s t v w x y z}\n\n a = arr.split.map do |word| \n if vowels.include?(word[0])\n word + \"ay\"\n elsif word[0..1] == \"qu\"\n word[2..-1] + \"quay\"\n elsif word[0..2] == \"sch\"\n word[3..-1] + \"schay\"\n elsif word[0..2] == \"squ\"\n word[3..-1] + \"squay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1]) && consonants.include?(word[2])\n word[3..-1] + word[0..2] + \"ay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + \"ay\"\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + \"ay\"\n end\n end\n\n a.join(\" \")\nend"
] |
[
"0.68777394",
"0.67341346",
"0.67172587",
"0.6672194",
"0.6643442",
"0.6517552",
"0.6492399",
"0.6474987",
"0.6468659",
"0.64544314",
"0.64428633",
"0.64399314",
"0.6407532",
"0.63612056",
"0.6349674",
"0.63430846",
"0.6334027",
"0.6243357",
"0.62378657",
"0.6188131",
"0.6142148",
"0.6131859",
"0.6098076",
"0.60933363",
"0.6029246",
"0.60274065",
"0.6012846",
"0.60101604",
"0.60101604",
"0.59925807",
"0.59922224",
"0.59727305",
"0.5952588",
"0.59497726",
"0.5937343",
"0.5919049",
"0.5913332",
"0.5908445",
"0.5880458",
"0.5873947",
"0.58644193",
"0.5845874",
"0.581043",
"0.57934225",
"0.57850885",
"0.5782494",
"0.57758904",
"0.5756431",
"0.5746808",
"0.57348984",
"0.57137156",
"0.57118523",
"0.57106763",
"0.57000846",
"0.56857055",
"0.5678585",
"0.5678585",
"0.5678585",
"0.5677833",
"0.56544465",
"0.56544465",
"0.5652222",
"0.56349325",
"0.5624802",
"0.56121886",
"0.56121886",
"0.56060153",
"0.55970305",
"0.55725414",
"0.55705374",
"0.5567342",
"0.5562915",
"0.55475324",
"0.5541435",
"0.55387115",
"0.5537718",
"0.55368984",
"0.55331194",
"0.55032796",
"0.5503248",
"0.5503248",
"0.5503248",
"0.5498621",
"0.5488145",
"0.54837376",
"0.5472028",
"0.5467268",
"0.54667944",
"0.54639655",
"0.5463352",
"0.5458763",
"0.5456469",
"0.5439259",
"0.5439259",
"0.54354006",
"0.5434791",
"0.5428556",
"0.5425503",
"0.54254067",
"0.54223275"
] |
0.7240941
|
0
|
Using the single word keys from :responses, we search for the sentence that uses the most of them, as it's likely to be the 'best' sentence to parse
|
def best_sentence(input)
hot_words = @data[:responses].keys.select do |k|
k.class == String && k =~ /^\w+$/
end
WordPlay.best_sentence(input.sentences, hot_words)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def possible_responses(sentence)\n responses = []\n\n # Find all patterns to try to match against\n @data[:responses].keys.each do |pattern|\n next unless pattern.is_a?(String)\n\n # For each pattern, see if the supplied sentence contains\n # a match. Remove substitution symbols (*) before checking.\n # Push all responses to the responses array.\n if sentence.match('\\b' + pattern.gsub(/\\*/, '') + '\\b')\n # If the pattern contains substitution placeholders,\n # perform the substitutions\n if pattern.include?('*')\n responses << @data[:responses][pattern].collect do |phrase|\n # First, erase everything before the placeholder\n # leaving everything after it\n matching_section = sentence.sub(/^.*#{pattern}\\s+/, '')\n\n # Then substitute the text after the placeholder, with\n # the pronouns switched\n phrase.sub('*', WordPlay.switch_pronouns(matching_section))\n end\n else\n # No placeholders? Just add the phrases to the array\n responses << @data[:responses][pattern]\n end\n end\n end\n\n # If there were no matches, add the default ones\n responses << @data[:responses][:default] if responses.empty?\n\n # Flatten the blocks of responses to a flat array\n responses.flatten\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input).downcase # Taking the input, processing and prepare it\n\t\tsentence = best_sentence(prepared_input) # Finding the best sentence to use based on input\n\t\tresponses = possible_responses(sentence) # Finding what responses are suitable based on the sentence\n\t\tresponses[rand(responses.length)] # Randomly picking one of the sentences.\n\tend",
"def response_to(input)\n\t\tprepared_input = preprocess(input.downcase)\n\t\tsentence = best_sentence(prepared_input)\n\t\treversed_sentense = Wordplay.switch_pronouns(sentence)\n\t\tresponses = possible_responses(sentence)\n\t\treturn responses[rand(responses.length)]\n\tend",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def make_response(input, limit=140, sentences=@mentions)\n # Prefer mentions\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n make_statement(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n make_statement(limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(input, limit, @sentences)\n else\n make_statement(limit)\n end\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n \n if sentences.equal?(@sentences)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @unigrams[tiki].nil?\n @unigrams[tiki].each do |ref|\n sentences << @sentences[ref[0]]\n end\n end\n end\n elsif sentences.equal?(@mentions)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @mention_unigrams[tiki].nil?\n @mention_unigrams[tiki].each do |ref|\n sentences << @mentions[ref[0]]\n end\n end\n end\n end\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant, tokenized]\n end",
"def make_response(input, limit = 140, sentences = @sentences)\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n make_statement(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n make_statement(limit, generator)\n else\n make_statement(limit)\n end\n end",
"def top_scoring_words\n @dictionary.each_with_object([]) do |cur_word, words_found|\n return words_found if words_found.length >= WORDS_TO_FIND\n\n words_found << cur_word if letters_present_for cur_word\n end\n end",
"def determine_correctness\n answer = self.question.answer\n \t#Upcase to take care of all capitalization issues\n \tresponse = self.content.upcase\n\n \tanswer = answer.split(', ')\n\n \t#Score Keeping\n \tscore = 0\n \tscore_incremental = 1.0/answer.length\n \t\n \t#Determining how many of keywords are in response\n \tanswer.each do |correct_word|\n \t\tcorrect_word = correct_word.upcase\n \t\tif response.include?(correct_word)\n \t\t\tscore += score_incremental\n \t\tend\n \tend\n \tself.correctness = score\n end",
"def kase_responses_count_in_words(kase)\n I18n.t(\"{{count}} recommendation\", :count => kase.responses_count).titleize\n end",
"def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).call\n answer = search_result.to_array # Here we can decide what output we need\n\n \"\".tap do |str|\n if answer[0].present?\n people = answer[0].map(&:full_name).join(\", \")\n skills = answer[1].map(&:title).join(\", \")\n str << \"Your first choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[2].present?\n people = answer[2].map(&:full_name).join(\", \")\n skills = answer[3].map(&:title).join(\", \")\n str << \"\\nYour second choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[4].present?\n people = answer[4].map(&:full_name).join(\", \")\n skills = answer[5].map(&:title).join(\", \")\n str << \"\\nYour third choice(s): #{people}. They know about: #{skills}.\"\n end\n\n str << \"No results, maybe try another combination of keywords?\" if str.blank?\n end\n end",
"def make_response(name, input, limit=140, sentences=(@mentions))\n # Prefer mentions\n # Turned this off for now its causing fail?\n relevant, slightly_relevant, tokenized = find_relevant(sentences, input)\n tokenized = tokenized.map {|tok| tok.gsub(/\\W/, '_')}\n tokstr = tokenized.join(\".\")\n puts \"Making response for #{tokstr} \"\n if relevant.length >= 30\n# if (relevant.length >= 100000)\n# relevant = relevant.sample(100001)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, relevant)\n make_statement(name, limit, generator)\n elsif slightly_relevant.length >= 50\n# if (slightly_relevant.length >= 100000)\n# slightly_relevant = slightly_relevant.sample(100002)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, slightly_relevant)\n make_statement(name, limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(name, input, limit, @sentences)\n else\n make_statement(name, limit)\n end\n end",
"def get_nouns_from_parser_response(s)\n nouns = []\n noun = \"\"\n s.each_line do |line|\n (word, pos) = line.split\n next if word =~ /\\|/\n if pos =~ /NN/\n if noun == \"\"\n noun = word\n else\n noun += \" \" + word\n end\n else\n nouns.push(noun) unless noun == \"\"\n noun = \"\"\n end\n end\n nouns.map! { |n| n.downcase }\n # Remove the language versions of the title found in the wiki text page\n nouns.reject { |n| n =~ /\\saf$|\\sam$|\\sar$|\\sast$|\\saz$|\\sbn$|\\sbe$|\\sbg$|\\sbs$|\\sbr$|\\sca$|\\scs$|\\scy$|\\sda$|\\sde$|\\set$|\\sel$|\\ses$|\\seo$|\\seu$|\\sfa$|\\shif$|\\sfo$|\\sfr$|\\sfy$|\\sgl$|\\sgu$|\\sko$|\\shi$|\\shr$|\\sio$|\\sid$|\\sia$|\\sis$|\\sit$|\\shy$|\\she$|\\sjv$|\\skn$|\\ska$|\\skk$|\\ssw$|\\sku$|\\sky$|\\sla$|\\slv$|\\slb$|\\slt$|\\shu$|\\smk$|\\sml$|\\smr$|\\sms$|\\smn$|\\smy$|\\sml$|\\sne$|\\snew$|\\sja$|\\sno$|\\snn$|\\snl$|\\soc$|\\spnb$|\\snds$|\\spl$|\\spt$|\\sro$|\\squ$|\\sru$|\\ssa$|\\ssco$|\\ssq$|\\ssi$|\\ssimple$|\\ssk$|\\ssl$|\\ssr$|\\ssh$|\\sfi$|\\ssv$|\\stl$|\\sta$|\\ste$|\\sth$|\\str$|\\suk$|\\sur$|\\svi$|\\swar$|\\syo$|\\sbat$|\\szh$/ }\n end",
"def calculate_match_probability\n # two heuristics: \n # 1 is are their multiple words in term_text? if so, mark as probable\n # if not, does it match the anchor regexp? if so, mark as probable\n # else, mark as improbable\n \n # multiple words?\n anchor_regexp = \"(featuring|plus|the|presents|with|plus|and|\\,|\\&|[()]|\\/|\\:|\\-|^|$)\"\n nix_regexp = \"parking|\\svs\\.?\\s\" \n if artist_name=~/#{nix_regexp}/i\n self.match_probability=\"unlikely\"\n return nil\n end\n text=term_text.strip\n if text[\" \"]\n self.match_probability=\"likely\"\n return \"multpl\"\n end\n if artist_name=~/#{anchor_regexp}\\s*#{text}\\s*#{anchor_regexp}/i\n self.match_probability=\"likely\"\n return \"regexp\"\n end\n# if artist_name=~/#{anchor_regexp}\\s+?#{text}\\s+?#{anchor_regexp}/i\n# match_probability=\"likely\"\n# return \"regexp\"\n# end\n self.match_probability=\"unlikely\"\n return nil\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def valid_sentence(string, dictionary)\n #Create a global variable to be able to access throughout\n $process = {}\n final_sentences = []\n sentences(string, dictionary).each do |array|\n set = array.split(\" \")\n if dictionary_words?(set) && verb_present?(set) && noun_articles_present?(set)\n final_sentences << array\n end\n end\n final_sentences.sort!\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def word_with_most_repeats(sentence)\n\nend",
"def word_with_most_repeats(sentence)\n\nend",
"def word_with_most_repeats(sentence)\nend",
"def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end",
"def score\n url = \"https://wagon-dictionary.herokuapp.com/#{params['word']}\"\n @letters = params['letters'].split\n user_serialized = open(url).read\n user = JSON.parse(user_serialized)\n if user['found'] == true\n @answers = 'Well done!'\n elsif included?(params['word'], @letters)\n @answers = 'Valid word but try to speak a better English!'\n else\n @answers = 'You can do better'\n end\n end",
"def valid_sentence(str, dictionary)\n $processing = {}\n final_result = []\n sentences(str, dictionary).each do |a|\n set = a.split(\" \")\n if all_words_valid?(set) && verb_correct?(set) && noun_articles_correct?(set)\n final_result << a\n end\n end\n final_result.sort! #This can be returned without any sort but it added because it looks cool.\n end",
"def suggestions\n suggest_response['suggest'].values.first[q]['suggestions']\n .uniq { |s| s['term'].downcase }\n .sort_by { |s| (-s['weight']) * 100 + s['term'].length }\n .take(5)\n end",
"def known(words)\n temp = words.find_all {|k| @dictionary.key?(k) } \n res = temp.sort_by do |word|\n @dictionary[word]\n end\n return res.reverse\n #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def find_the_best_words(rack)\n # A hash to store our word and its score\n word_scores = {}\n # Loop through our list of valid words\n valid_words(rack).each do |word|\n # Store our score matched to the key of our word\n word_scores[word] = word_score(word, rack)\n end\n # Puts our first 10 word scores sorted from highest to lowest\n word_scores.sort_by { |_key, value| -value}.first(10).to_h.each { |key, value| p \"#{key}: #{value}\"}\nend",
"def get_response(input)\n key = RESPONSES.keys.select {|k| /#{k}/ =~ input }.sample\n /#{key}/ =~ input\n response = RESPONSES[key]\n response.nil? ? 'sorry?' : response % { c1: $1, c2: $2, c3: $3, c4: $4}\nend",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map(&:downcase).include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def correct_words\n self.student_responses.select { |x| x.correct }.collect { |x| x.word_id }.uniq\n end",
"def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end",
"def preserve_best_sentences(data)\n puts \"For each word with multiple examples below, choose the best selection:\"\n\n total_words = data.count { |d| d[:sentences].size > 1 }\n curr_word = 0\n data.select { |d| d[:sentences].size > 1 }.map! do |d|\n curr_word += 1\n puts \"#{curr_word} of #{total_words}: #{d[:word]} (#{d[:pronounciation]})\"\n d[:sentences].each_with_index do |s, i|\n puts \"#{i + 1}.\\t#{s[0]}\"\n puts \"\\t#{s[1]}\"\n end\n n = get_selection_number(\"Best sentence: \", 1, d[:sentences].size)\n selection = d[:sentences][n - 1]\n d[:sentences] = [ [ selection[0], selection[1] ] ]\n d\n end\n\n puts \"\\nDone.\"\nend",
"def test_sentence_choice\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a test',\n 'This is another test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test',\n WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend",
"def mock_response_with_spellcheck\n %({'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})\n end",
"def top_words\n\t\ttgr = EngTagger.new\n\t\tdesc_string = @desc_array.join(\" \").downcase.delete \".\"\n\n\t\t#Adds parts of speech to each word in the descriptions\n\t\ttagged = tgr.add_tags(desc_string)\n\t\t#Collects all words tagged as nouns or noun phrases with the number of times they occur\n\t\tnouns = tgr.get_noun_phrases(tagged)\n\t\t#collects all words tagged as adjectives with the number of times they occur\n\t\tadj = tgr.get_adjectives(tagged)\n\t\tif nouns #prevents app from breaking with invalid username\n\t\t\t@valid_username = true\n\t\t\t#Combines noun phrases and adjectives into one hash\n\t\t\twords = nouns.merge(adj)\n\t\t\t#Removes some meaningless words as keys. Didn't remove them earlier because I imagine some could potentially still be useful in noun phrases\n\t\t\twords = words.except(\"beer\", \"brew\", \"flavor\", \"first\", \"character\", \"finish\", \"color\", \"style\", \"taste\", \"aroma\", \"aromas\", \"brewery\", \"brewing\", \"%\", \"other\", \"one\", \"perfect\", \"bottle\", \"flavors\", \"abv\", \"profile\", \"new\", \"notes\", \"great\", \"delicious\", \"beers\", \"such\", \"alcohol\")\n\t\t\t#Exclude words with count of 2 (for now) or fewer\n\t\t\tvalid_keys = []\n\t\t\twords.each do |k,v| \n\t\t\t\tif v > 2\n\t\t\t\t\tvalid_keys.push(k)\n\t\t\t\tend\t\n\t\t\tend\n\t\t\twords.slice!(*valid_keys)\n\t\t\t#Converts hash into array and sorts with highest value first\n\t\t\t@words_array = words.sort {|k,v| v[1]<=>k[1]}\n\t\t\t@words_array = @words_array.first(60)\n\t\t\tbubble_chart_hack\n\t\telse\n\t\t\t@valid_username = false\n\t\tend\n\tend",
"def get_all_words_popularity(options = {})\n options.symbolize_keys!\n send(\"get_all_words_popularity\", \n options[:keyphrases] || [],\n options[:case] || \"case_distinct\",\n !!options[:include_misspellings],\n !!options[:include_plurals],\n options[:adult_filter] || \"off\",\n options[:max] || 0,\n options[:timeout] || 0)\n end",
"def search_example_sentences_for_word\n word_forms = self.extract_verb_forms\n search_hits = [] # Put example sentence object hits in this array\n word_forms.each do |wf|\n search = ExampleSentence.solr_search do\n fulltext wf\n end\n if search.results.any?\n search_hits << search.results\n search_hits.uniq # Filter out any duplicate hits\n exs = self.example_sentences.to_a\n potential_exs = exs + search_hits # Create an array of the hits combined with the existing example sentences\n potential_exs.delete_if do |example|\n exs.include?(example) # Discard the matched example if it already exists in the self.example_sentences array\n end\n correct_matches = self.remove_errant_matches_from(potential_exs) # Prevent surface matches only from being added to the Word's example sentences\n self.example_sentences << correct_matches # Add on the new, unique example sentences found.\n return potential_exs\n else\n puts \"No matches found\"\n end\n end\n end",
"def metadatas(response:)\n if response_ok?(response: response)\n parse_result(body: response.body)\n else\n Rails.logger.warn 'Dictionnaire-Academie failed in ' \\\n \"its seach for #{word}\"\n end\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end",
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def test_sentence_choice\n assert_equal('This is a great test', \n WordPlay.best_sentence(['This is a test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test', WordPlay.best_sentence(['This is a great test'],\n %w{still the best}))\n end",
"def search_words(query)\n query = query.downcase\n\n if query.contains_japanese?\n words = search_words_by_literals(query, 50)\n\n else\n words = search_words_by_senses(query, 50)\n\n if words.size <= 10\n extra_words = []\n\n extra_words += search_words_by_literals(query.hiragana, 20)\n extra_words += search_words_by_literals(query.katakana, 20)\n extra_words.sort! { |w1, w2| w1.score <=> w2.score }\n\n words += extra_words\n end\n end\n\n words\n end",
"def all_phrases\n mario\n toadstool\n link\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def sentence_commonality(sentence)\n probability_of_ngrams(common_ngrams_from_sentence(sentence))\n end",
"def match_words_yandex\n eng_size= @eng_sentence.length - 1\n collision= false\n updated= false\n\n (0..eng_size).each { |eng_index|\n if !@used_eng[eng_index]\n eng_word= @eng_sentence[eng_index]\n translations= @all_translations[eng_word]\n rus_indexes= []\n translations.each do |translation|\n rus_indexes+= matches_infinitives(translation)\n end\n rus_indexes.uniq!\n if rus_indexes.size == 1\n updated= true\n @used_eng[eng_index]= true\n @used_rus[rus_indexes[0].rus_index]= true\n @translation_eng_to_rus[eng_index]= rus_indexes[0].translation\n else\n collision|= rus_indexes.size > 1\n end\n end\n }\n\n if collision && updated\n match_words_yandex\n end\n end",
"def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def respond(data_store, input, context)\n response_sentences = []\n\n @tagger.get_sentences(input).each do |sentence|\n response = []\n\n # select a random sentence from our 'sentence structure' table\n random_sentence = data_store.execute('SELECT * FROM post_sentences ORDER BY RANDOM() LIMIT 1').flatten.first\n tag(@tagger, random_sentence.titleize) do |token, tag|\n if should_replace(tag)\n response_token = nil\n\n # attempt to find bias tokens for this tag\n sentence.downcase.remove_punctuation.split.each do |input_token|\n query = 'SELECT * FROM post_tokens WHERE token=? AND tag=?'\n results = data_store.execute(query, [input_token, tag])\n puts \"#{input_token}, #{tag}: #{results.flatten.first}\"\n unless results.empty? || response.join.include?(input_token)\n response_token = results.flatten.first\n break\n end\n end\n\n # select a random word with the same tag our current token\n query = 'SELECT * FROM post_tokens WHERE tag=? ORDER BY RANDOM() LIMIT 1'\n response_token = data_store.execute(query, [tag]).flatten.first if response_token.nil?\n\n # default to the random sentence's token if we can't find anything else\n response_token = token if response_token.nil?\n else\n response_token = token\n end\n\n # add a space before our token, unless our token is punctuation\n response_token = \" #{response_token}\" unless tag.start_with?('PP')\n\n response << response_token\n end\n\n response_sentences << response.join.strip\n end\n\n return response_sentences.join(' ').strip\n end",
"def how_many\n # Validate the sentence begins with \"How many Credits is\".\n curr_token = get_next_token\n if curr_token.type != \"CREDITS\"\n raise @err_class, \"How many of what?\"\n end\n curr_token = get_next_token\n if curr_token.type != \"IS\"\n raise @err_class, \"How many Credits do what?\"\n end\n\n # Insert HOWMANY & GALNUMBER nodes into AST\n curr_node = @node_class.new(\"HOWMANY\", nil, [], true, false)\n @ast.insert(curr_node)\n curr_node = @node_class.new(\"GALNUMBER\", nil, [], false, false)\n @ast.insert(curr_node, @ast.seek({:name => \"HOWMANY\"}))\n \n # Validate the rest of the sentence\n prev_token = nil\n curr_token = get_next_token\n while curr_token.type != \"QUESTION\"\n if curr_token.type != \"VARIABLE\"\n raise @err_class, \"I don't know what #{curr_token.value} is!\"\n end\n prev_token = curr_token\n curr_token = get_next_token\n if curr_token.type == \"QUESTION\"\n prev_token.type = \"COMMODITY\"\n curr_node = @node_class.new(\"COMMODITY\", prev_token.value, [], false, true)\n @ast.insert(curr_node, @ast.seek({:name => \"HOWMANY\"}))\n else\n prev_token.type = \"GALNUM\"\n curr_node = @node_class.new(\"GALNUMERAL\", prev_token.value, [], false, true)\n @ast.insert(curr_node, @ast.seek({:name => \"GALNUMBER\"}))\n end\n end\n\n handle_end\n end",
"def names_of_people_better_at_english_than_maths(results_set)\nend",
"def matched_words\n _matched_words\n end",
"def word_with_most_repeats(sentence)\n words = sentence.split\n\n hash = {}\n\n words.each do |word|\n hash[word] = count_repeats(word)\n end\n\n max = hash.values.max\n\n ties = hash.select {|k, v| v == max }.first.first\n\n\n\n\nend",
"def best_match(name)\n matches = Name.with_correct_spelling.where(search_name: name)\n return matches.first if matches.any?\n\n matches = Name.with_correct_spelling.where(text_name: name)\n accepted = matches.reject(&:deprecated)\n matches = accepted if accepted.any?\n nonsensu = matches.reject { |match| match.author.start_with?(\"sensu \") }\n matches = nonsensu if nonsensu.any?\n matches.first\n end",
"def searching_single(phrase)\n analyse_result(Ca::SimilarTest.mechanize_work(phrase), phrase)\n end",
"def names_of_people_who_failed_english(results_set)\nend",
"def senses\n _response_word.fetch(\"senses\", [])\n end",
"def find_concepts( s )\n jump_count = 0 #prevent matched word from matching again\n ret = []\n return ret if s.blank?\n \n words = s.scan(LanguageModel::PTN_TERM).map{|w|w.downcase}\n 0.upto(words.length-1) do |i| #foreach word in sentence\n h = @ch\n if jump_count > 0 then jump_count-=1 ; next end\n \n i.upto(words.length-1) do |j| #foreach word try matching with concept table\n #p \" >Checking words[#{i},#{j}] = #{w}\"\n w = words[j] #'current word\n wn = words[j+1] if j+1 < words.length # next word\n if !h[w] # no concept is matched\n break \n elsif h[w].class == Hash #many concepts are matched\n # Next Word doesn't match & key was found\n if !h[w][wn] && h[w][:_key_]\n if block_given?\n yield h[w][:_key_] , words[i..j].join(' ')\n else\n #puts \"Found: #{words[i..j].join(' ')}\"\n ret << [h[w][:_key_], words[i..j].join(' ')]\n end\n break\n else #Move to Next Word\n jump_count += 1\n h = h[w]\n end\n elsif h[w].class == Fixnum #one concept is matched\n if block_given?\n yield h[w] , words[i..j].join(' ')\n else\n #puts \"Found: #{words[i..j].join(' ')}\"\n ret << [h[w], words[i..j].join(' ')]\n end\n break\n else\n error \"[ConceptStorage#find_concept] Invalid value #{h[w].inspect}\"\n end\n end#do\n end#do\n ret\n end",
"def api_other_options(variable)\n url_auto = \"https://wagon-dictionary.herokuapp.com/autocomplete/#{variable}\"\n auto_dictionary_serialized = open(url_auto).read\n auto_words = JSON.parse(auto_dictionary_serialized)\n\n sorted_words = auto_words['words'].max_by(auto_words['words'].length) { |word| word.length }\n return sorted_words\nend",
"def reply(input, limit = 140, sentences = @mentions)\n # Prefer mentions\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n update(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n update(limit, generator)\n else\n update(limit)\n end\n end",
"def get_suggestion(query) \n oauth = OAuth.new(:consumer_key => self.consumer_key, \n :consumer_secret => self.consumer_secret) \n signed_url = oauth.sign build_query(query)\n\n response = http_client.get(signed_url)\n response_hash = MultiJson.decode(response.body)\n \n suggestion = get_suggestion_from_response(response_hash)\n\n return nil unless suggestion\n return nil if suggestion.downcase == query.downcase\n\n return suggestion\n rescue ::YBossSpell::Error, ::HTTPClient::TimeoutError, ::MultiJson::LoadError => e\n Rails.logger.error(\"YBossSpell: #{e.inspect}\") \n return false\n end",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def how\n curr_token = get_next_token\n if curr_token.type == \"MANY\"\n how_many\n elsif curr_token.type == \"MUCH\"\n how_much\n else\n raise @err_class, \"I don't know what you're talking about!\"\n #raise @err_class, \"It's in how!\"\n end\n end",
"def extract_keyword_sentiment\n # Build the request URL for the API call\n endpoint = BASE_URL + \"calls/url/URLGetRankedNamedEntities\"\n request_params = options.to_query\n request_url = [endpoint, request_params].join(\"?\")\n\n # Make the request\n @response = HTTParty.get request_url\n\n # If results are returned, traverse the response and return keyword data\n # Keyword data is in @response[\"results\"][\"keywords\"][\"keyword\"] as of 6/12/14\n %w( results entities entity ).reduce(response) do |data, key|\n return nil unless data[key]\n data = data[key]\n end\n end",
"def parse_highscoreable_by_name(msg, mappack: true)\n name = msg.split(\"\\n\")[0][NAME_PATTERN, 2]\n\n # Exact name match\n ret = ['', Level.where_like('longname', name, partial: false).to_a]\n ret[0] = \"Single name match found for #{name}\" if ret[1].size == 1\n ret[0] = \"Multiple name matches found for #{name}\" if ret[1].size > 1\n return ret if !ret[1].empty?\n\n # Exact alias match\n query = Level.joins(\"INNER JOIN level_aliases ON levels.id = level_id\")\n ret = ['', query.where_like('alias', name, partial: false).to_a]\n ret[0] = \"Single alias match found for #{name}\" if ret[1].size == 1\n ret[0] = \"Multiple alias matches found for #{name}\" if ret[1].size > 1\n return ret if !ret[1].empty?\n\n # Partial name match\n ret = ['', Level.where_like('longname', name, partial: true).to_a]\n ret[0] = \"Single partial name match found for #{name}\" if ret[1].size == 1\n ret[0] = \"Multiple partial name matches found for #{name}\" if ret[1].size > 1\n return ret if !ret[1].empty?\n\n # Closest matches\n list = Level.all.pluck(:name, :longname)\n matches = string_distance_list_mixed(name, list)\n ret = [\n \"No matches found for #{verbatim(name)}. Did you mean...\",\n matches.map{ |m| Level.find_by(name: m[0]) }\n ]\n return ret if !ret[1].empty?\n\n ['', []]\nrescue\n ['', []]\nend",
"def possible_words?(q)\n\tresults = $wordnik.search_words_new(q)[\"searchResults\"]\n\tresults.map { |w| w[\"word\"] }\nend",
"def most_common_words(messages)\n\tmost = 0\n\tmost_key = 0\n\tcommon_words = [\"the\",\"and\",\"at\",\"a\",\"is\"]\n\n\tmessages.each_pair do |key,val|\n\t\tcommon_count = 0\n\t\tcommon_words.each{|word| common_count += val.count(\" #{word} \")}\n\n\t\tif common_count > most\n\t\t\tmost = common_count\n\t\t\tmost_key = key\n\t\tend\n\tend\n\n\treturn most_key\nend",
"def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end",
"def names_of_people_who_passed_english(results_set)\nend",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def corrections\n #For each word to be looked at\n $words.each do |word_array|\n #If the word is misspelled attempt corrections\n possible_matches = Array.new\n if word_array[1] == false\n #Sets word to the actual word, instead of array pair\n word = word_array[0]\n # Get lexicon searching vars\n first_char = word[0]\n len = word.length\n\n ##Find words with similar letters\n #Saves the length of the word for eaiser access\n size = word.length\n #Iterates over words with matching starting letter and length +- 1\n $lexicon[first_char][len].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n # only check shorter words if length is greater than 1\n if len > 1\n $lexicon[first_char][len-1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n end\n\n $lexicon[first_char][len+1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n #Iterate over the possible matches, taking the match with the highest percentage\n #Hash to hold similarity\n similarity = Hash.new(0.0)\n possible_matches.each do |word_to_compare|\n similarity[word_to_compare] = match_percentage word, word_to_compare\n end\n\n best_match = ''\n similarity.each do |match|\n if match[1] > similarity[best_match]\n best_match = match[0]\n end\n end\n $correction[word] = best_match\n end\n end\nend",
"def repeats(sentence)\n\n words = sentence.split\n hash = {}\n\n words.each do |word|\n hash[word] = count(word)\n end\n\n greatest_value = hash.sort_by{|k, v| v}.last.last\n\n hash.select{|k,v|v=greatest_value}.first.first\n\nend",
"def highest_score_from(words)\n contestants = words.map{ |word| [word, score_word(word)] }.to_h\n\n winning_word = {word: \"\", score: 0}\n\n contestants.each do |word, score|\n if score > winning_word[:score]\n winning_word = {word: word, score: score}\n elsif score == winning_word[:score] \n if winning_word[:word].length == 10\n next\n elsif word.length == 10\n winning_word = {word: word, score: score}\n elsif word.length < winning_word[:word].length\n winning_word = {word: word, score: score}\n end\n end \n end\n return winning_word\nend",
"def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\n end",
"def parse\n parse_results = []\n @words.each_index do |i|\n i.upto(@words.size - 1) do |j|\n phrase = Phrase.new(@words[i..j])\n unless phrase_has_definitely_been_checked?(phrase, @existing_article_titles)\n break unless @repository.try_this_phrase_or_longer?(phrase)\n matching_articles = @repository.find_matching_articles(phrase)\n matching_articles.each do |matching_article|\n parse_results << [phrase.to_s, matching_article]\n end\n end\n end\n end\n parse_results = clean_results(parse_results, @existing_article_titles)\n end",
"def find_words(words)\n search_results = SearchResults.new\n \n general = Vector.new\n must_match = Vector.new\n must_not_match = Vector.new\n not_found = false\n \n extract_words_for_searcher(words.join(' ')) do |word|\n case word[0]\n when ?+\n word = word[1,99]\n vector = must_match\n when ?-\n \t word = word[1,99]\n vector = must_not_match\n else\n \t vector = general\n end\n \n index = @dict.find(word.downcase)\n if index\n vector.add_word_index(index)\n else\n not_found = true\n \t search_results.add_warning \"'#{word}' does not occur in the documents\"\n end\n end\n \n if (general.num_bits + must_match.num_bits).zero? \n search_results.add_warning \"No valid search terms given\"\n elsif not not_found\n res = []\n @document_vectors.each do |entry, (dvec, mtime)|\n score = dvec.score_against(must_match, must_not_match, general)\n res << [ entry, score ] if score > 0\n end\n \n res.sort {|a,b| b[1] <=> a[1] }.each {|name, score|\n search_results.add_result(name, score)\n }\n \n search_results.add_warning \"No matches\" unless search_results.contains_matches\n end\n search_results\n end",
"def analyzed_best_bet_query(query)\n analyzed_query = JSON.parse(@client.get_with_payload(\n \"_analyze?analyzer=best_bet_stemmed_match\", query))\n\n analyzed_query[\"tokens\"].map { |token_info|\n token_info[\"token\"]\n }.join(\" \")\n end",
"def sms_parsing(text_body)\n words = text_body.split\n action = words.slice!(0)\n symbol_set = Set.new [\"!\", \"@\", \"#\", \"$\"] #all symbols to check for\n word_set = Set.new [\"limit\"]\n while !words.empty?\n nextWord = words[0]\n symbol = nextWord[0]\n if symbol_set.member? symbol\n nextWord.slice!(0)\n case symbol #all symbols to check for here\n when \"!\"\n @sms_skills = nextWord + \" \"\n words.slice!(0)\n while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word\n @sms_skills = @sms_skills + words[0] + \" \"\n words.slice!(0)\n end\n @sms_skills.chop!\n when \"@\"\n @sms_location = nextWord + \" \"\n words.slice!(0)\n while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word\n @sms_location = @sms_location + words[0] + \" \"\n words.slice!(0)\n end\n @sms_location.chop!\n when \"#\"\n @sms_summary = nextWord + \" \"\n words.slice!(0)\n while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word or key word\n @sms_summary = @sms_summary + words[0] + \" \"\n words.slice!(0)\n end\n @sms_summary.chop!\n when \"$\"\n @sms_wage = nextWord.to_f\n words.slice!(0)\n end\n else\n if word_set.member? nextWord.downcase\n case nextWord.downcase\n when \"limit\"\n words.slice!(0)\n nextWord = words[0]\n if nextWord == nil or !is_num?(nextWord)\n sms_error(\"LIMIT must be followed by a integer number\")\n @sms_error = true\n break\n end\n @sms_limit = nextWord.to_i\n words.slice!(0)\n end\n else\n words.slice!(0)\n end\n end\n end\n if !@sms_location.nil?\n @sms_location = @sms_location.downcase.strip\n end\n if !@sms_skills.nil?\n @sms_skills = @sms_skills.downcase.strip\n end\n return action\n end",
"def process_question\n\t\t#There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n\t\tif @line.start_with? \"how many Credits is \"\n\t\t\tmain_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets glob prok Silver ?\n\t\t\tgalatic_literals = Translation.translate_question(main_question_part) #e.g from glob prok Silver gets glob prok\n\t\t\ttrademetal = TradeMetal.get_trade_metal(main_question_part) #e.g from glob prok Silver gets Silver\n\t\t\tif trademetal && galatic_literals\n\t\t\t\ttrademetal_price_credit = (galatic_literals.galactic_words_to_numeral * trademetal.unit_price).to_i\n\t\t\t\tputs \"#{galatic_literals} #{trademetal.coin_name} is #{trademetal_price_credit} Credits\"\n\t\t\t\treturn\n\t\t\tend\n\t\telsif @line.start_with? \"how much is \"\n\t\t\tmain_question_part = @line.split(\"how much is \")[1] #e.g from how much is pish tegj glob glob ? gets pish tegj glob glob ?\n\t\t\tgalatic_literals = Translation.translate_question(main_question_part) #e.g from pish tegj glob glob ? gets pish tegj glob glob\n\t\t\tif galatic_literals\n\t\t\t\tconversion_value = galatic_literals.galactic_words_to_numeral\n\t\t\t\tputs \"#{galatic_literals} is #{conversion_value}\"\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\tthrow_away_meaningless_line\n\tend",
"def final_suggestion\n longest_substring = 0\n best_suggestion = nil\n\n self.possible_suggestions.each do |suggestion|\n if suggestion.common_substring_length > longest_substring\n best_suggestion = suggestion.possible_word\n longest_substring = suggestion.common_substring_length\n end\n end\n\n best_suggestion\n end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def suggest_fuzzy(str, results=@max_results, strict=@strict_fuzzy_matching)\n str_mul = alphabet_only(str).size\n str_soundex_code = compute_soundex_code(str)\n str_2grams = ngram_list(str, 2)\n candidates = []\n\n @ngrams.sunion(*ngram_list(str)).each do |candidate|\n candidate = candidate.split(\":\")\n candidate_str = candidate[0]\n candidate_soundex_code = candidate[1]\n candidate_score = 1.0\n\n # Levenshtein distance\n lev_dist = Levenshtein.distance(str, candidate_str)\n candidate_score *= Math.exp([str_mul - lev_dist, 1].max)\n\n # Soundex\n if str_soundex_code == candidate_soundex_code\n candidate_score *= str_mul\n elsif str_soundex_code[1..-1] == candidate_soundex_code[1..-1]\n candidate_score *= (str_mul / 2).ceil\n end\n\n # Compute n-grams of size 2 shared between the two strings\n same_2grams = str_2grams & ngram_list(candidate_str, 2)\n candidate_score *= Math.exp(same_2grams.size)\n\n if candidate_score > 1\n candidates << {\n str: candidate_str,\n score: candidate_score\n }\n end\n end\n # Sort results by score and return the highest scoring candidates\n candidates = candidates.sort { |a, b| b[:score] <=> a[:score] }\n # puts candidates.take(10).map { |cand| \"#{cand[:str]} => #{cand[:score]}\" }\n # If strict fuzzy matching is used, only suggestion items with scores\n # above a certain threshold will be returned.\n if strict\n suggestions = []\n candidates.each do |cand|\n # threshold ||= candidates[0][:score] / 10\n threshold = Math.exp(str.size)\n break if suggestions.size > results || cand[:score] < threshold\n suggestions << cand\n end\n else\n suggestions = candidates.take(results)\n end\n return suggestions.map { |cand| cand[:str] }\n end",
"def handle_response(guessers_guess, matching_indices)\n\t\tif(matching_indices.empty?)\n\t\t\t@candidate_words.delete_if {|word| word.include?(guessers_guess)}\n\t\telse\n\t\t\t@candidate_words = @candidate_words.select do |word| \n\t\t\t\tcontain_match_at_indices(word, matching_indices, guessers_guess)\n\t\t\tend\n\t\tend\n\tend",
"def meaning(message)\n WORDS_MEANS_ACTION.find {|words, action| words.match(Regexp.new(message))} || []\n end",
"def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end",
"def analyzed_best_bet_query(query)\n analyzed_query = @client.indices.analyze(\n index: @index_name,\n body: {\n text: query,\n analyzer: \"best_bet_stemmed_match\",\n },\n )\n\n analyzed_query.fetch(\"tokens\", []).map { |token_info|\n token_info[\"token\"]\n }.join(\" \")\n rescue Elasticsearch::Transport::Transport::Errors::BadRequest\n \"\"\n end",
"def life_threatening_condition\n search_string = (params[:search_string] || '').upcase\n\n aconcept_set = []\n\n common_answers = Observation.find_most_common(ConceptName.find_by_name(\"Life threatening condition\").concept, search_string)\n concept_set(\"Life threatening condition\").each{|concept| aconcept_set << concept.uniq.join() rescue \"test\"}\n set = (common_answers + aconcept_set.sort).uniq\n set.map!{|cc| cc.upcase.include?(search_string)? cc : nil}\n\n set = set.sort rescue []\n render plain: (\"<li></li>\" + \"<li>\" + set.join(\"</li><li>\") + \"</li>\").html_safe\n\n end",
"def wookie_sentence; end",
"def process_question\n #There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n if @line.start_with? \"how many Credits is \"\n main_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets glob prok Silver ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from glob prok Silver gets glob prok\n trademetal = TradeMetal.get_trade_metal(main_question_part) #e.g from glob prok Silver gets Silver\n if trademetal && galatic_literals\n trademetal_price_credit = (galatic_literals.galactic_words_to_numeral * trademetal.unit_price).to_i\n puts \"#{galatic_literals} #{trademetal.coin_name} is #{trademetal_price_credit} Credits\"\n return\n end\n elsif @line.start_with? \"how much is \"\n main_question_part = @line.split(\"how much is \")[1] #e.g from how much is pish tegj glob glob ? gets pish tegj glob glob ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from pish tegj glob glob ? gets pish tegj glob glob\n if galatic_literals\n conversion_value = galatic_literals.galactic_words_to_numeral\n puts \"#{galatic_literals} is #{conversion_value}\"\n return\n end\n end\n throw_away_meaningless_line\n end",
"def analyzed_words(words)\n analyzed_words = []\n parse_words(words).each do |word|\n word_rank = @dict[word.downcase]\n\n if word_rank\n analyzed_words << { word: word, sentiment: word_rank }\n end\n end\n analyzed_words.uniq\n end",
"def funny_responses\n [\n 'Huh?',\n \"What's that you say?\",\n 'come again?',\n \"Sorry, I don't know that command.\"\n ]\n end",
"def is_relevant?(group)\n if KEYWORDS.any? { |k| group['description'].include?(k) }\n return true\n elsif KEYWORDS.any? { |k| group['name'].include?(k) }\n return true\n end\n false\nend",
"def longest_sentence(txt)\n sentence_array = txt.split('.')\n sentence_array.map! { |sentence| sentence.split('!') }\n sentence_array.flatten!\n sentence_array.map! { |sentence| sentence.split('?') }\n sentence_array.flatten!\n \n words_in_sentences = sentence_array.map { |sentence| sentence.split(' ') }\n\n longest_length = words_in_sentences[0].size\n words_in_sentences.each do |sentence|\n longest_length = sentence.size if sentence.size > longest_length\n end\n longest_sentence_array = words_in_sentences.select { |sentence| sentence.size == longest_length }[0]\n puts \"=> The longest sentence has #{longest_length} words.\"\n puts \"=> The longest sentence is:\"\n puts longest_sentence_array.join(' ')\nend",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def rhyme?(a,b)\n as = a.gsub /\\W/,\"\"\n bs = b.gsub /\\W/,\"\"\n as.to_phrase.rhymes.flatten.join(\", \").include?(bs.to_phrase.rhymes.flatten.join(\", \")) &&\n (as.length + bs.length < 140)\nend",
"def error_response\n [\"I'm Sorry, I don't understand. Please try again\",\n \"Oh oh! Something went wrong. Please try again\", \n \"Um... Sorry, I don't understand. Did you input correct words?\"].sample\n end",
"def set_counting_recommendation_strings\n @cold = \"The deck is cold. Play conservatively. There are more low cards than high cards. The dealer is less likely to bust, but so are you. Doubling down will be less useful. Blackjacks are less common.\"\n @warm = \"The deck is warm. There are more high cards than low cards. Blackjacks will be common. Doubling down when appropriate will be advantagous. The dealer is likely to bust.\"\n @hot = \"The deck is hot! Your biggest worry at this point is the dealer stealing your Blackjacks. This deck is stacked!\"\n end",
"def intelligent_guesses(num)\n word_options = File.readlines('dictionary.txt').select do |word|\n word.length == num\n end\n\n most_common_letters = {}\n word_options.join(\"\").split(\"\\n\").join(\"\").each_char do |letter|\n if most_common_letters.has_key?(letter)\n most_common_letters[letter] += 1\n else\n most_common_letters[letter] = 1\n end\n end\n\n @most_common_letters = most_common_letters\n\n end"
] |
[
"0.7121943",
"0.67639285",
"0.6570952",
"0.62986463",
"0.6152937",
"0.612665",
"0.60802275",
"0.6064807",
"0.6060163",
"0.60441655",
"0.6015933",
"0.5998066",
"0.59933066",
"0.59491307",
"0.5948895",
"0.5944669",
"0.59445024",
"0.59289426",
"0.59289426",
"0.5908157",
"0.587945",
"0.58663356",
"0.58459884",
"0.5771742",
"0.57556796",
"0.5734883",
"0.57140243",
"0.5701209",
"0.5692423",
"0.56773543",
"0.5670999",
"0.56660485",
"0.5657996",
"0.5643132",
"0.56339186",
"0.56322",
"0.56297195",
"0.5627508",
"0.5614745",
"0.5605402",
"0.5577416",
"0.5571367",
"0.55645585",
"0.5557719",
"0.5547455",
"0.5547455",
"0.554642",
"0.5530262",
"0.55236727",
"0.5490867",
"0.54902667",
"0.5482358",
"0.5472193",
"0.5467939",
"0.54582053",
"0.54536825",
"0.54509807",
"0.5437882",
"0.54361856",
"0.54360086",
"0.5419065",
"0.5415734",
"0.5400814",
"0.5395941",
"0.53917843",
"0.538832",
"0.53793657",
"0.5378445",
"0.53745925",
"0.5371033",
"0.5367856",
"0.5357013",
"0.5356969",
"0.535563",
"0.53491324",
"0.53420705",
"0.534075",
"0.5339378",
"0.53351456",
"0.5334133",
"0.53323257",
"0.533093",
"0.5327736",
"0.5326562",
"0.5325278",
"0.5323641",
"0.5322013",
"0.5310607",
"0.53094566",
"0.5306101",
"0.53059685",
"0.53010964",
"0.5295814",
"0.5292923",
"0.52915925",
"0.52884084",
"0.52856344",
"0.528378",
"0.5281181",
"0.5278105"
] |
0.71103525
|
1
|
Using a supplied sentence, go through the bot's :responses data set and collect together all phrases that could be used as responses
|
def possible_responses(sentence)
responses = []
# Find all patterns to try to match against
@data[:responses].keys.each do |pattern|
next unless pattern.is_a?(String)
# For each pattern, see if the supplied sentence contains
# a match. Remove substitution symbols (*) before checking.
# Push all responses to the responses array.
if sentence.match('\b' + pattern.gsub(/\*/, '') + '\b')
# If the pattern contains substitution placeholders,
# perform the substitutions
if pattern.include?('*')
responses << @data[:responses][pattern].collect do |phrase|
# First, erase everything before the placeholder
# leaving everything after it
matching_section = sentence.sub(/^.*#{pattern}\s+/, '')
# Then substitute the text after the placeholder, with
# the pronouns switched
phrase.sub('*', WordPlay.switch_pronouns(matching_section))
end
else
# No placeholders? Just add the phrases to the array
responses << @data[:responses][pattern]
end
end
end
# If there were no matches, add the default ones
responses << @data[:responses][:default] if responses.empty?
# Flatten the blocks of responses to a flat array
responses.flatten
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def phrases\n response[\"phrases\"]\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input).downcase # Taking the input, processing and prepare it\n\t\tsentence = best_sentence(prepared_input) # Finding the best sentence to use based on input\n\t\tresponses = possible_responses(sentence) # Finding what responses are suitable based on the sentence\n\t\tresponses[rand(responses.length)] # Randomly picking one of the sentences.\n\tend",
"def tag_sentence sentence\n @tagger ||= EngTagger.new\n res = @tagger.add_tags(sentence).ergo do |tagged|\n nouns = @tagger.get_nouns(tagged)&.keys || []\n verbs = @tagger.get_verbs(tagged)&.keys || []\n [nouns, verbs]\n end\n end",
"def says\n\t\tself.current_state.sayings.map do |phrase|\n\t\t\tif phrase.is_a?(String) \n\t\t\t\tphrase.match(/^ivr/) ? I18n.t(phrase) : phrase\n\t\t\telsif phrase.is_a?(Symbol)\n\t\t\t\tself.send(phrase)\n\t\t\tend\n\t\tend.flatten || []\n\tend",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.switch_pronouns(sentence)\n responses = possible_responses(sentence)\n responses[rand(responses.length)]\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input.downcase)\n\t\tsentence = best_sentence(prepared_input)\n\t\treversed_sentense = Wordplay.switch_pronouns(sentence)\n\t\tresponses = possible_responses(sentence)\n\t\treturn responses[rand(responses.length)]\n\tend",
"def make_response(input, limit=140, sentences=@mentions)\n # Prefer mentions\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n make_statement(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n make_statement(limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(input, limit, @sentences)\n else\n make_statement(limit)\n end\n end",
"def valid_sentence(string, dictionary)\n #Create a global variable to be able to access throughout\n $process = {}\n final_sentences = []\n sentences(string, dictionary).each do |array|\n set = array.split(\" \")\n if dictionary_words?(set) && verb_present?(set) && noun_articles_present?(set)\n final_sentences << array\n end\n end\n final_sentences.sort!\n end",
"def converse(prompt, responses = {})\n i, commands = 0, responses.map { |_key, value| value.inspect }.join(',')\n statement = responses.inject '' do |inner_statement, (key, value)|\n inner_statement <<\n (\n (i += 1) == 1 ?\n %(if response is \"#{value}\" then\\n) :\n %(else if response is \"#{value}\" then\\n)\n ) <<\n %(do shell script \"echo '#{key}'\"\\n)\n end\n applescript(\n %(\n tell application \"SpeechRecognitionServer\"\n set response to listen for {#{commands}} with prompt \"#{prompt}\"\n #{statement}\n end if\n end tell\n )\n ).strip.to_sym\n end",
"def make_response(name, input, limit=140, sentences=(@mentions))\n # Prefer mentions\n # Turned this off for now its causing fail?\n relevant, slightly_relevant, tokenized = find_relevant(sentences, input)\n tokenized = tokenized.map {|tok| tok.gsub(/\\W/, '_')}\n tokstr = tokenized.join(\".\")\n puts \"Making response for #{tokstr} \"\n if relevant.length >= 30\n# if (relevant.length >= 100000)\n# relevant = relevant.sample(100001)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, relevant)\n make_statement(name, limit, generator)\n elsif slightly_relevant.length >= 50\n# if (slightly_relevant.length >= 100000)\n# slightly_relevant = slightly_relevant.sample(100002)\n# end\n name = name + \"/\" + tokstr\n generator = SuffixGenerator.build(name, slightly_relevant)\n make_statement(name, limit, generator)\n elsif sentences.equal?(@mentions)\n make_response(name, input, limit, @sentences)\n else\n make_statement(name, limit)\n end\n end",
"def phrases(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tonly care about the phrases\n\t\t\t#\t\tthese will all have been 'spoken'\n\t\t\tnodes.collect {|node| node.phrase }\n\t\tend",
"def get_nouns_from_parser_response(s)\n nouns = []\n noun = \"\"\n s.each_line do |line|\n (word, pos) = line.split\n next if word =~ /\\|/\n if pos =~ /NN/\n if noun == \"\"\n noun = word\n else\n noun += \" \" + word\n end\n else\n nouns.push(noun) unless noun == \"\"\n noun = \"\"\n end\n end\n nouns.map! { |n| n.downcase }\n # Remove the language versions of the title found in the wiki text page\n nouns.reject { |n| n =~ /\\saf$|\\sam$|\\sar$|\\sast$|\\saz$|\\sbn$|\\sbe$|\\sbg$|\\sbs$|\\sbr$|\\sca$|\\scs$|\\scy$|\\sda$|\\sde$|\\set$|\\sel$|\\ses$|\\seo$|\\seu$|\\sfa$|\\shif$|\\sfo$|\\sfr$|\\sfy$|\\sgl$|\\sgu$|\\sko$|\\shi$|\\shr$|\\sio$|\\sid$|\\sia$|\\sis$|\\sit$|\\shy$|\\she$|\\sjv$|\\skn$|\\ska$|\\skk$|\\ssw$|\\sku$|\\sky$|\\sla$|\\slv$|\\slb$|\\slt$|\\shu$|\\smk$|\\sml$|\\smr$|\\sms$|\\smn$|\\smy$|\\sml$|\\sne$|\\snew$|\\sja$|\\sno$|\\snn$|\\snl$|\\soc$|\\spnb$|\\snds$|\\spl$|\\spt$|\\sro$|\\squ$|\\sru$|\\ssa$|\\ssco$|\\ssq$|\\ssi$|\\ssimple$|\\ssk$|\\ssl$|\\ssr$|\\ssh$|\\sfi$|\\ssv$|\\stl$|\\sta$|\\ste$|\\sth$|\\str$|\\suk$|\\sur$|\\svi$|\\swar$|\\syo$|\\sbat$|\\szh$/ }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end",
"def respond(data_store, input, context)\n response_sentences = []\n\n @tagger.get_sentences(input).each do |sentence|\n response = []\n\n # select a random sentence from our 'sentence structure' table\n random_sentence = data_store.execute('SELECT * FROM post_sentences ORDER BY RANDOM() LIMIT 1').flatten.first\n tag(@tagger, random_sentence.titleize) do |token, tag|\n if should_replace(tag)\n response_token = nil\n\n # attempt to find bias tokens for this tag\n sentence.downcase.remove_punctuation.split.each do |input_token|\n query = 'SELECT * FROM post_tokens WHERE token=? AND tag=?'\n results = data_store.execute(query, [input_token, tag])\n puts \"#{input_token}, #{tag}: #{results.flatten.first}\"\n unless results.empty? || response.join.include?(input_token)\n response_token = results.flatten.first\n break\n end\n end\n\n # select a random word with the same tag our current token\n query = 'SELECT * FROM post_tokens WHERE tag=? ORDER BY RANDOM() LIMIT 1'\n response_token = data_store.execute(query, [tag]).flatten.first if response_token.nil?\n\n # default to the random sentence's token if we can't find anything else\n response_token = token if response_token.nil?\n else\n response_token = token\n end\n\n # add a space before our token, unless our token is punctuation\n response_token = \" #{response_token}\" unless tag.start_with?('PP')\n\n response << response_token\n end\n\n response_sentences << response.join.strip\n end\n\n return response_sentences.join(' ').strip\n end",
"def senses\n _response_word.fetch(\"senses\", [])\n end",
"def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).call\n answer = search_result.to_array # Here we can decide what output we need\n\n \"\".tap do |str|\n if answer[0].present?\n people = answer[0].map(&:full_name).join(\", \")\n skills = answer[1].map(&:title).join(\", \")\n str << \"Your first choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[2].present?\n people = answer[2].map(&:full_name).join(\", \")\n skills = answer[3].map(&:title).join(\", \")\n str << \"\\nYour second choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[4].present?\n people = answer[4].map(&:full_name).join(\", \")\n skills = answer[5].map(&:title).join(\", \")\n str << \"\\nYour third choice(s): #{people}. They know about: #{skills}.\"\n end\n\n str << \"No results, maybe try another combination of keywords?\" if str.blank?\n end\n end",
"def valid_sentence(str, dictionary)\n $processing = {}\n final_result = []\n sentences(str, dictionary).each do |a|\n set = a.split(\" \")\n if all_words_valid?(set) && verb_correct?(set) && noun_articles_correct?(set)\n final_result << a\n end\n end\n final_result.sort! #This can be returned without any sort but it added because it looks cool.\n end",
"def funny_responses\n [\n 'Huh?',\n \"What's that you say?\",\n 'come again?',\n \"Sorry, I don't know that command.\"\n ]\n end",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def make_response(input, limit = 140, sentences = @sentences)\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n make_statement(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n make_statement(limit, generator)\n else\n make_statement(limit)\n end\n end",
"def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end",
"def correct_words\n self.student_responses.select { |x| x.correct }.collect { |x| x.word_id }.uniq\n end",
"def words\n sentences.map { |sentence| sentence.words.map { |word| word } } .flatten.each\n end",
"def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end",
"def responses\n participants.flat_map(&:responses)\n end",
"def message_responses(text_id)\n command = Command.new('GetSMSResponse', license_key)\n responses = Response.parse( \n command.execute({:TextID => text_id}) \n )[\"ArrayOfSmsResponse\"][\"SmsResponse\"] || []\n\n\t\t\tresponses.is_a?(Array) ? responses.collect { |r| MessageResponse.new(r) } : MessageResponse.new(responses)\n end",
"def all_phrases\n mario\n toadstool\n link\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def get_responses(entries)\n responses = entries.map do |entry|\n entry.responses\n end\n responses.flatten.compact\n end",
"def word_split(phrase, dictionary = [], output = nil)\n # Must not default output to [] or the output will be overwritten every call\n\n output = [] if output.nil?\n return output if phrase.empty?\n\n dictionary.each do |word|\n\n if phrase.start_with?(word)\n output << word\n word_split(phrase.slice(word.length..-1), dictionary, output)\n end\n\n end\n\n return output\nend",
"def metadatas(response:)\n if response_ok?(response: response)\n parse_result(body: response.body)\n else\n Rails.logger.warn 'Dictionnaire-Academie failed in ' \\\n \"its seach for #{word}\"\n end\n end",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def contextualise_greeting(username)\n customised_greeting = []\n GREETINGS['data'].each do |greeting|\n greeting = greeting.gsub('*', username)\n @sentiment.train(:greeting, greeting)\n customised_greeting << greeting\n end\n customised_greeting\n end",
"def all_phrases ()\n puts mario\n puts toadstool\n puts link\nend",
"def best_sentence(input)\n hot_words = @data[:responses].keys.select do |k|\n k.class == String && k =~ /^\\w+$/\n end\n\n WordPlay.best_sentence(input.sentences, hot_words)\n end",
"def o_words(sentence)\n select_words = sentence.split.select { |word| word.include?(\"o\") }\n return select_words\nend",
"def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def process_response(command, text)\n message_id = command[1..99]\n message = Message.find_by_id(message_id)\n#puts \"**** command=#{command}, text=#{text}, @sender.id=#{@sender.id}, message=#{message.id}\"\n if message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :response => text, :mode => 'SMS')\n end\n return I18n.t(\"sms.thanks_for_response\") \n else\n return I18n.t(\"sms.thanks_but_not_found\", :id => message_id) \n end\n return ''\n end",
"def getResponses(surveyId)\n return survey_responses.where({:survey_id => surveyId})\n end",
"def sentences\n @sentences ||= begin\n Array(grpc.sentences).map { |g| TextSpan.from_grpc g.text }\n end\n end",
"def reply(input, limit = 140, sentences = @mentions)\n # Prefer mentions\n relevant, slightly_relevant = find_relevant(sentences, input)\n\n if relevant.length >= 3\n generator = SuffixGenerator.build(relevant)\n update(limit, generator)\n elsif slightly_relevant.length >= 5\n generator = SuffixGenerator.build(slightly_relevant)\n update(limit, generator)\n else\n update(limit)\n end\n end",
"def search_example_sentences_for_word\n word_forms = self.extract_verb_forms\n search_hits = [] # Put example sentence object hits in this array\n word_forms.each do |wf|\n search = ExampleSentence.solr_search do\n fulltext wf\n end\n if search.results.any?\n search_hits << search.results\n search_hits.uniq # Filter out any duplicate hits\n exs = self.example_sentences.to_a\n potential_exs = exs + search_hits # Create an array of the hits combined with the existing example sentences\n potential_exs.delete_if do |example|\n exs.include?(example) # Discard the matched example if it already exists in the self.example_sentences array\n end\n correct_matches = self.remove_errant_matches_from(potential_exs) # Prevent surface matches only from being added to the Word's example sentences\n self.example_sentences << correct_matches # Add on the new, unique example sentences found.\n return potential_exs\n else\n puts \"No matches found\"\n end\n end\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n \n if sentences.equal?(@sentences)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @unigrams[tiki].nil?\n @unigrams[tiki].each do |ref|\n sentences << @sentences[ref[0]]\n end\n end\n end\n elsif sentences.equal?(@mentions)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @mention_unigrams[tiki].nil?\n @mention_unigrams[tiki].each do |ref|\n sentences << @mentions[ref[0]]\n end\n end\n end\n end\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant, tokenized]\n end",
"def process_sentence(msg)\n\n words = msg.split(/\\s+/)\n has_emotion = []\n\n words.each_with_index do |em,i|\n if i > 0 and @emotions.include? em\n has_emotion[i-1] = @emotions.index(em)\n words.delete_at(i)\n end\n end\n\n #msg = msg.sub(/\\b*\\s+\\W\\s+\\b*/,'')\n\n #nouns = get_context(message)\n nouns = @brain.get_topic(msg)\n\n\n\n # Loop through all words, with the index, to access elements properly\n words.each_with_index do |word,i|\n\n word.downcase!\n # We cant pair the first word, because it doesn't follow any word,\n # so instead we pair each word after the first to the previous word\n if i > 0\n\n pair_words(words[i-1],word,{ context: nouns })\n puts \"CALL # #{i}\"\n\n # Pairs emoticons to our newly created pair\n unless has_emotion.at(i) == nil\n @pair_emotion.execute(has_emotion.at(i))\n end\n end\n if i > 1\n tripair_words(words[i-2], words[i-1], word)\n\n unless has_emotion.at(i) == nil\n @tripair_emotion.execute(has_emotion.at(i),has_emotion.at(i))\n end\n end\n end\n end",
"def parse\n parse_results = []\n @words.each_index do |i|\n i.upto(@words.size - 1) do |j|\n phrase = Phrase.new(@words[i..j])\n unless phrase_has_definitely_been_checked?(phrase, @existing_article_titles)\n break unless @repository.try_this_phrase_or_longer?(phrase)\n matching_articles = @repository.find_matching_articles(phrase)\n matching_articles.each do |matching_article|\n parse_results << [phrase.to_s, matching_article]\n end\n end\n end\n end\n parse_results = clean_results(parse_results, @existing_article_titles)\n end",
"def silly_talk(sent)\n vowels = \"aeiou\"\n return_array = []\n sent.split(\" \").each do |word|\n if vowels.include?(word[-1])\n return_array << word + word[-1] \n else\n word.each_char.with_index do |char, idx|\n vowels.include?(char) ? (return_array) : () \n end\n end\n word.each_char \n end\nend",
"def words(message, command = nil)\n reply = at_nick.downcase\n command = command.downcase if command\n message.split.reject {|word| word.downcase == reply || word.downcase == command }\n end",
"def split_sentences\n #break text first by paragraph then into chunks delimited by a period\n #but these are not quite sentences yet\n chunks = (self.split(/\\n+/).map { |p| \"#{p}\\n\".split(/\\.(?:[^\\w])/) }).flatten.compact\n \n #if a sentence is split at Mr.|Ms.|Dr.|Mrs. \n #then recombine it with its remaining part and nil it to delete later\n tmp=''\n sentences = chunks.map { |c|\n ss = (tmp != '')? \"#{tmp}. #{c}\" : c\n if c.match(/(?:Dr|Mr|Ms|Mrs)$/) #what about John F. Kennedy ([A-Z])\n tmp = ss\n ss=nil\n else\n tmp = ''\n end\n ss\n } \n sentences.compact #delete nil elements\n end",
"def o_words(sentence)\n\treturn sentence.split.select { |word| word.include?('o') } \nend",
"def translate(sentence)\n\twordsArray = sentence.split(' ')\n\treturnArray = []\n\n\twordsArray.each do |e| \n\t\twhile true\n\t\t\tif e[0].match(/[aeiou]/)\n\t\t\t\te = e + 'ay'\n\t\t\t\treturnArray.push(e)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tif e[0..1].match(/qu/)\n\t\t\t\t\te = e + e[0..1]\n\t\t\t\t\te[0..1] = ''\n\t\t\t\telse\n\t\t\t\t\te = e + e[0]\n\t\t\t\t\te[0] = ''\n\t\t\t\tend\n\t\t\t\t#if e[0..2].match(/sch/)\n\t\t\t\t#puts e\n\t\t\tend\n\t\tend\n\tend\n\n\n\t#puts returnArray\n\treturn returnArray.join(' ')\nend",
"def log_sentence sentence\n sentence_cache.get_or_set(sentence) do\n engtagger_lookup(sentence).map do |word, pos|\n finalize_pos(word, pos)\n end\n end\n end",
"def generate_sentence\n # Splitting into an array is required for easily preventing duplicate vals\n sent = Drama::Constants::SENTENCES.sample.split(/\\s/)\n sent.each do |w|\n num = sent.index(w)\n sent[num] = w % {\n things: Drama::Constants::THINGS.sample,\n sites: Drama::Constants::SITES.sample,\n people: Drama::Constants::PEOPLE.sample,\n says: Drama::Constants::SAYS.sample,\n badsoft: Drama::Constants::BADSOFT.sample,\n function: Drama::Constants::FUNCTIONS.sample,\n adj: Drama::Constants::ADJECTIVES.sample,\n enormous: Drama::Constants::SIZES.sample,\n price: Drama::Constants::PRICES.sample,\n ac1: Drama::Constants::BADVERBS.sample,\n packs: Drama::Constants::PACKS.sample,\n drama: Drama::Constants::DRAMA.sample,\n code: Drama::Constants::CODE.sample,\n ban: Drama::Constants::BANS.sample,\n activates: Drama::Constants::ACTIVATES.sample\n }\n end\n\n # add_a_drama\n sent.join(' ')\n end",
"def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend",
"def o_words(sentence)\n\treturn sentence.split.select { |elem| elem.include?(\"o\")}\nend",
"def handle_response(guessers_guess, matching_indices)\n\t\tif(matching_indices.empty?)\n\t\t\t@candidate_words.delete_if {|word| word.include?(guessers_guess)}\n\t\telse\n\t\t\t@candidate_words = @candidate_words.select do |word| \n\t\t\t\tcontain_match_at_indices(word, matching_indices, guessers_guess)\n\t\t\tend\n\t\tend\n\tend",
"def array_sentences(str)\n sentences = str.split('.')\n sentences.map! do |sent|\n sent.split('?').map! do |sent2|\n sent2.split('!')\n end\n end\n sentences.flatten\nend",
"def get_context(message)\n\n nouns = []\n @determiners.each do |determiner|\n matches = message.scan(/\\b#{determiner}\\s+([\\w-]+)\\b/i)\n\n matches.each do |match|\n unless @exempt.include? match.first or @determiners.include? match.first\n nouns << match.first.downcase\n @add_noun.execute(match.first)\n puts \"Added %s\" % match.first.downcase\n end\n end\n end\n nouns = nouns.uniq\n return nouns\n end",
"def words\n @phrase = @phrase.split(' ')\n end",
"def substrings(input_text, dictionary)\n input_text.downcase!\n dictionary.each do |word|\n compare_strings(input_text, word)\n end\n return @output_hash\nend",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def random_sentence(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n sentence = LiterateRandomizer.sentence\n @last_sentences = [] if @last_sentences.nil?\n sentence = LiterateRandomizer.sentence while @last_sentences.include?(sentence)\n @last_sentences.prepend_capped(sentence, 5)\n msg.reply(sentence)\n end",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant]\n end",
"def count_words text\n words = text.split(/\\s+/) # this is still insufficiently smart\n words.reject! { |a| %r(http://t\\.co/\\w{10}).match(a) }\n\n # if this is directed at somebody, don't phrasify that part\n while words[0] =~ /^@/\n \twords.shift\n end\n\n (2..words.length).to_a.reverse.each do |howmany| \n count_some_words(words, howmany) \n end\n return @phrases\n end",
"def call\n client = @request[:twitter_client]\n\n mentions = TwitterMention.where('replied IS NOT TRUE').order(twitter_id: :desc).limit(REPLY_LIMIT).each do |mention|\n chat_response = Interactors::QueryBot.new(input: strip_mentions(mention.text)).call()\n full_text = \"#{chat_response.outputs.join(' ')}\"\n mention.update_attributes!(replied: true)\n Interactors::SendTweets.new({twitter_client: client, text: full_text, \n screen_names: [mention.screen_name], in_reply_to_status_id: mention.twitter_id}).call()\n end\n end",
"def words\n self.sentence.split('-')\n end",
"def phrase_select\n PHRASES.sample\n end",
"def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end",
"def prepare_phrases\n text_array, prepared = @text.split, []\n 3.times do |time|\n prepared << random_phrase(text_array)\n end\n prepared\n end",
"def say_response(speech, end_session = true, ssml: false)\n output_speech = add_speech(speech, ssml: ssml)\n { :outputSpeech => output_speech, :shouldEndSession => end_session }\n end",
"def complete_sentence(sentence = '', min_length: 5, max_length: 20)\n tokens = tokenize(sentence)\n puts \"tokens: #{tokens.inspect}\"\n until sentence_complete?(tokens, min_length, max_length)\n markov_state = [tokens[-2], tokens[-1]]\n tokens << @markov_model[markov_state].sample\n end\n tokens.join(' ').strip\n end",
"def load_responses(parameters, survey_id)\n Question.all.each do |question|\n response = Response.new(survey_id: survey_id, question_id: question.id, choice_id: parameters[:\"#{question.id}\"])\n response.save\n end\n end",
"def kase_responses_count_in_words(kase)\n I18n.t(\"{{count}} recommendation\", :count => kase.responses_count).titleize\n end",
"def parse_response(text, opts = {})\n opts = { :count => 1 }.merge(opts || {})\n\n return [] if opts[:count] <= 0\n\n resp = JSON.parse(text, :symbolize_names => true)\n\n results = resp[:list].map do |res|\n {\n :id => res[:defid],\n :word => res[:word],\n :author => res[:author],\n :permalink => res[:permalink],\n :definition => res[:definition].strip,\n :example => res[:example].strip,\n :upvotes => res[:thumbs_up],\n :downvotes => res[:thumbs_down],\n }\n end\n\n results.take opts[:count]\n end",
"def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end",
"def scan(stuff)\r\n # empty array of sentence\r\n sentence = []\r\n # to split user's input\r\n words = stuff.split\r\n # to do action of each word\r\n words.each do |word|\r\n # to downcase of all word first\r\n word_d = word.downcase\r\n # if there is anything corresponding to our lexicon, \r\n # we .push it back to the empty array \"sentence\"\r\n if @words.include? word_d\r\n sentence.push(Pair.new(:direction,word))\r\n elsif @verbs.include? word_d\r\n sentence.push(Pair.new(:verb,word))\r\n elsif @stop_words.include? word_d\r\n sentence.push(Pair.new(:stop,word))\r\n elsif @nouns.include? word_d\r\n sentence.push(Pair.new(:noun,word))\r\n elsif word.match(@number_pattern)\r\n sentence.push(Pair.new(:number,word.to_i))\r\n else\r\n sentence.push(Pair.new(:error,word))\r\n end\r\n end\r\n\r\n sentence\r\n end",
"def speech_recognized(object, connection, phrase)\n\t\tif @state == :DEFAULT_STATE \n\t\t\tif phrase.match(/^next/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRINextPage\") # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n \n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Gone to next page.\")\n\t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n\t\t\telsif phrase.match(/^back/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n \t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRIPreviousPage\") # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Gone to previous page.\")\n \t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n\t\t\t elsif phrase.match(/^search for (.+)/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n \t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRISearch\"+$1) # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n # return self.generate_search_response(connection.lastRefId, $1);\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok, which one do you want?\")\n \t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n \t\t\t elsif phrase.match(/^the first/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex0\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the second/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex1\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the third/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex2\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the fourth/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex3\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the fifth/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex4\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t\tend\n\t\t\t\n\t\telsif @state == :CONFIRM_STATE\n\t\t\tif phrase.match(/yes/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\t# @twitterClient.update(@tweetText) # this should probably be done in a seperate thread\n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok it has been posted to Twitter.\")\n\t\t\tend\n\t\t\tif phrase.match(/no/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok I won't send it.\")\n\t\t\tend\n\n\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Do you want me to send it?\", \"I'm sorry. I don't understand. Do you want me to send it? Say yes or no.\", true)\n\t\tend\n\n\t\tobject\n\tend",
"def responses\n @responses\n end",
"def o_words(sentence)\n words = sentence.split(' ')\n return words.select { | val | val.include?('o') }\nend",
"def error_response\n [\"I'm Sorry, I don't understand. Please try again\",\n \"Oh oh! Something went wrong. Please try again\", \n \"Um... Sorry, I don't understand. Did you input correct words?\"].sample\n end",
"def sentence_to_array (string)\n string_split = string.split('.')\n string_split.map! do |words|\n words.split('!') \n end\n string_split.flatten!\n\n string_split.map! do |words|\n words.split('?') \n end\n string_split.flatten\nend",
"def on_mention(twt)\n Random.new_seed\n\n # We load our bot here.\n bot = ai('drbmitchellphd')\n\n # The replying dataset.\n bot.learn_from_dataset 'corpuses/doctor_tweet_corpus.txt'\n\n # Delay typing to act like a human is thinking what to say.\n # Produce a mistake rate between 0.1 and 1.\n sleep Masqueraide::NLP.typing_delay(twt.text)\n\n # Check if the text is unintelligible before responding to the patient.\n if Masqueraide::NLP.unintelligible? twt.text\n rand = Random.new.rand 0.1..1\n unsure_response = []\n # Choose a random unsure sentence from the markov chain.\n if rand > 0.5\n unsure_sentences = []\n while unsure_sentences.length != 10\n sentence = bot.reply(twt.text, 140)\n if sentiment.classify_with_score(sentence)[0].to_sym == :unsure\n unsure_sentences << sentence\n end\n end\n else\n # Or use a predefined corpus.\n # Read the DM corpus and produce an unsure response.\n unsure_response = DR_UNSURE['data'].select\n end\n unsure_response = unsure_response.sample\n sleep Masqueraide::NLP.typing_delay(unsure_response) + (Random.new.rand 1..15)\n reply(twt, unsure_response)\n return\n end\n\n # TODO: sentiment on public tweets.\n\n # We must identify between :question and :conversation tweets.\n # Continue the conversation publicly, but once offered to DM privately, don't talk to the person for (Time.now + 8 hours)\n # The doctor is busy.\n\n real_reply = bot.reply(twt.text, 140)\n\n # Delay based on how long it takes to type the message. and add 1 to 30.\n # Dr. Brian Mitchell does not need to reply instantly.\n sleep Masqueraide::NLP.typing_delay(real_reply) + (Random.new.rand 1..30)\n reply(twt, brian_reply)\n end",
"def error_response\n [\"I'm Sorry, I don't understand. Please try again\",\n \"Oh oh! Something went wrong. Please try again\",\n \"Um... Sorry, I don't understand. Did you input correct words?\"].sample\n end",
"def speech_recognized(object, connection, processor)\n\t\treturn false if object == nil\n\t\treturn false if (!(object[\"class\"] == \"SpeechRecognized\") rescue true)\n\t\tphrase = \"\"\n\t\t\n\t\tobject[\"properties\"][\"recognition\"][\"properties\"][\"phrases\"].map { |phraseObj| \n\t\t\tphraseObj[\"properties\"][\"interpretations\"].first[\"properties\"][\"tokens\"].map { |token|\n\t\t\t\ttokenProps = token[\"properties\"]\n\t\t\t\t\n\t\t\t\tphrase = phrase[0..-2] if tokenProps[\"removeSpaceBefore\"]\n\t\t\t\tphrase << tokenProps[\"text\"]\n\t\t\t\tphrase << \" \" if !tokenProps[\"removeSpaceAfter\"]\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn processor.call(object, connection, phrase)\n\tend",
"def collect_untagged_responses(name, *command)\n untagged_responses = []\n\n send_command(*command).listen do |response|\n if response.is_a?(Net::IMAP::UntaggedResponse) && response.name == name\n untagged_responses << response\n\n # If we observe another tagged response completeing, then we can be\n # sure that the previous untagged responses were not relevant to this command.\n elsif response.is_a?(Net::IMAP::TaggedResponse)\n untagged_responses = []\n\n end\n end.transform do |tagged_response|\n untagged_responses\n end\n end",
"def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end",
"def words(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tcomposite the words\n\t\t\t#\t\teach node contains an array of words\n\t\t\tnodes.collect {|node| node.words }.flatten\n\t\tend",
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend",
"def translate(sentence)\r\n words = sentence.split(\" \")\r\n words.collect! do |a|\r\n if(a =~ /\\w\\.\\.\\.\\w/) #matching e.g \"yes...no\"\r\n morewords = a.split(\"...\")\r\n ##\r\n #alternative: allows for recursion, but loses accuracy since \"a...b\" becomes \"a ... b\"\r\n #probably some non-messy way to make it work, and be less redundant too\r\n #\r\n #morewords.insert(1, \"...\")\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + \"...\" + pig(morewords[1], 1)\r\n elsif(a =~ /\\w\\W\\w/ and !(a =~ /'/)) #matching e.g. \"steins;gate\", \"ninety-nine\", but not \"it's\"\r\n nonletter = a.scan(/\\W/)[0]\r\n morewords = a.split(/\\W/)\r\n #morewords.insert(1, nonletter)\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + nonletter + pig(morewords[1], 1)\r\n elsif(a[0..1].match(/qu/)) #quiet = ietquay\r\n pig(a, 2)\r\n elsif(a[0..2].match(/sch|.qu/)) #school = oolschay, square = aresquay\r\n pig(a, 3)\r\n else\r\n x = a.index(/[AaEeIiOoUu]/) #starts with other consonant(s) or a vowel; find the first vowel\r\n if(!(x.nil?)) #found at least one vowel\r\n pig(a, x) \r\n else #x is nil, no vowels found\r\n a.index(/[[:alpha:]]/) ? pig(a, 1) : a #if it contains letters, attempt to process; otherwise, do nothing\r\n end\r\n end\r\n end\r\n return words.join(\" \")\r\nend",
"def each_sentence\n ARGF.each(\"\") do |paragraph|\n words = paragraph.split(\"\\n\").map {|line| line.chomp}\n yield words\n end\nend",
"def a_turn_of_phrase(sentence)\n # code goes here\nend",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def parse(sentence)\n tokens, root = get_parse(sentence)\n base_noun_chunks = get_base_noun_chunks(tokens)\n focus = get_focus(tokens, base_noun_chunks)\n relations = get_relations(tokens, base_noun_chunks)\n \n { :tokens => tokens, # The array of token parses\n :root => root, # The index of the root word\n # The index of the focus word, \n # i.e., the one modified by a _wh_-modifier\n :focus => focus, \n :base_noun_chunks => base_noun_chunks, # the array of base noun chunks\n :relations => relations # Shortest paths between two heads\n } \n end",
"def process\n caption = response_text\n channel = channel_by_keyword\n channel_group = channel_group_by_keyword\n\n if channel || channel_group\n tmp = response_text.split\n tmp.shift\n caption = tmp.join(\" \")\n end\n\n delivery_notice = nil\n dn_responding_message_unconfigured = nil\n responding_messages_delivery = responding_messages_delivery_with_no_responses(channel, channel_group)\n\n responding_messages_delivery.each do |dn|\n unless dn.message.check_subscriber_response(response_text)\n dn_responding_message_unconfigured = dn\n next\n end\n delivery_notice = dn\n break\n end\n\n delivery_notice ||= dn_responding_message_unconfigured\n delivery_notice ||= last_sent_relevant_delivery(channel, channel_group)\n\n process_delivery_notice(\n delivery_notice,\n caption: caption,\n channel: channel,\n channel_group: channel_group,\n )\n end",
"def words\n @words_array = @phrase.split(' ')\n end",
"def split_on_sentences(speaker, string)\n aa = []\n end_index = 0\n start_index = nil\n text_length = string.length\n while true\n if end_index < text_length\n start_index = end_index\n end_index = string.index(%r{\\.|\\?|!}, end_index)\n end_index ||= text_length\n aa << string[start_index...end_index.next].strip\n end_index += 1\n end\n break unless end_index < text_length\n end\n batch_subs(speaker, aa)\n end"
] |
[
"0.6112034",
"0.6044615",
"0.60339415",
"0.59371984",
"0.5903337",
"0.5884288",
"0.5847992",
"0.57185256",
"0.5692795",
"0.5614652",
"0.55741954",
"0.55661863",
"0.55509245",
"0.55509245",
"0.5526807",
"0.5525261",
"0.550257",
"0.54948574",
"0.54942715",
"0.54906434",
"0.5456065",
"0.5434687",
"0.5427439",
"0.5405039",
"0.53806925",
"0.53756464",
"0.5373618",
"0.5347667",
"0.5339914",
"0.5338703",
"0.5337527",
"0.5337527",
"0.52538085",
"0.5239256",
"0.52240837",
"0.5196036",
"0.5193666",
"0.5185391",
"0.5175784",
"0.5159939",
"0.51552683",
"0.515004",
"0.51166266",
"0.5113634",
"0.50986207",
"0.5096383",
"0.5092537",
"0.5088141",
"0.50795877",
"0.507872",
"0.50777894",
"0.5069398",
"0.50414425",
"0.50345975",
"0.5032563",
"0.5013567",
"0.5005139",
"0.49996772",
"0.49978167",
"0.49960268",
"0.49949917",
"0.49841014",
"0.49711877",
"0.49676102",
"0.49667823",
"0.49640724",
"0.49598634",
"0.49585143",
"0.49576566",
"0.4957052",
"0.49542823",
"0.49537897",
"0.49505636",
"0.49474004",
"0.49469444",
"0.49356133",
"0.49312168",
"0.49307248",
"0.49295622",
"0.49218592",
"0.49124503",
"0.49112177",
"0.49043915",
"0.49028137",
"0.48897246",
"0.48892474",
"0.48884174",
"0.48878732",
"0.48846424",
"0.48818353",
"0.48776683",
"0.48767817",
"0.4875411",
"0.48752743",
"0.48713517",
"0.48653668",
"0.48648798",
"0.48579773",
"0.48546892",
"0.4854003"
] |
0.8276681
|
0
|
total number of hosts available for the specified zone. It is the same value as provided in the XQueryCount header in the list_hosts API method ==== Returns response: body 'count' 'status' 200 indicates success
|
def count_hosts( zone_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Zerigo::DNS::CountHosts.new,
:path => "/api/1.1/zones/#{zone_id}/hosts/count.xml"
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def count_host_templates\n get(\"zone_templates/#{id}/host_templates/count.xml\").body['count'].to_i\n end",
"def count(zone_id, version_id)\n call('domain.zone.record.count', zone_id, version_id)\n end",
"def zone_available_ip_count(zone_name, plan = nil)\n parameters = \"zone=#{zone_name}\"\n parameters << \"&plan=#{Oj.dump(plan, mode: :compat)}\" if plan\n request(:get, \"/api/zone/count_available_ips?#{parameters}\")\n end",
"def zone_count\n da_zones=zones\n count = da_zones.count\n da_zones.each{ |z| count += z.zone_count }\n count\n end",
"def hosts_count\r\n return @hosts.length\r\n end",
"def count\n\t\tputs \"Counting number of entries in the local host repository ...\"\n\t\tcnt=0\n\t\t@known_hosts.keys.map do |key|\n\t\t\tunless is_ip?(key)\n\t\t\t\tcnt=cnt+1\n\t\t\tend\n\t\tend\n\t\tputs \"Current number of entries: #{cnt}\"\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def address_count(opts = {})\n data, _status_code, _headers = address_count_with_http_info(opts)\n data\n end",
"def count\n resource = @client.send(:head, self.next, **@options)\n resource.get_response.total_records\n end",
"def icmp_count\n host_stats[:icmp].to_i\n end",
"def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end",
"def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end",
"def count\n Core::Dal::Address.count\n end",
"def count(params = {})\n @api.get(\"api/count.json\", params)\n end",
"def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end",
"def count(resource)\n list(resource.to_s,1)[\"meta\"][\"total_count\"]\n end",
"def count\n Integer(parsed_body['meta']['total_results'])\n end",
"def counts\n\t\tputs \"Counting number of IPs within the CIDR store:\" if @verbose\n\t\tcnt=0\n\t\t@known_cidr_blks.keys.map do |key|\n\t\t\tcnt=cnt+size(key)\n\t\tend\n\t\tputs \"Total number of trusted IPs: #{cnt}\" if @verbose\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def count(*vars)\n result = if vars.first.is_a?(Symbol)\n template = vars.shift\n # preserves an eventual wrapper by calling the template method\n self[:context].send(template, params(:size => 0), *vars)\n else\n Query.elastics.count_search(:get, self, *vars)\n end\n result['hits']['total']\n end",
"def count\n call_client(:count)\n end",
"def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end",
"def count\n dataset.client.count(\n index: dataset.index,\n body: dataset.body\n )[\"count\"]\n end",
"def count\n connection.zcard(key_label)\n end",
"def count\n self.at('/RETS/COUNT')['Records'].to_i\n end",
"def count\n Cim::Dal::CustomerAddress.count\n end",
"def connection_count\n request('getconnectioncount')\n end",
"def count(resource_type)\n path = '/api/' + resource_type.to_s\n response = http_get(path,{limit: '1'})\n response[\"meta\"][\"total_count\"]\n end",
"def count\n @collection.count(Scope.new(@collection, @selector, @opts))\n end",
"def total\n response[:numFound].to_s.to_i\n end",
"def list_hosts( zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::ListHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml\"\n )\n end",
"def zone_status(zone_name)\n parameters = \"zone=#{zone_name}\"\n request(:get, \"/api/zone/status?#{parameters}\")\n end",
"def count\n\t\tputs \"Counting number of entries in the CIDR cache table ...\" if @verbose\n\t\tcnt=0\n\t\t@known_cidr_blks.keys.map do |key|\n\t\t\tif is_cidr?(key)\n\t\t\t\tcnt=cnt+1\n\t\t\tend\n\t\tend\n\t\tputs \"Current number of CIDR object entries: #{cnt}\" if @verbose\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def total_entries\n populate\n return 0 if @results[:total_found].nil?\n \n @total_entries ||= @results[:total_found]\n end",
"def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end",
"def count\n sql = order_by(nil).to_sql(pagination: false)\n\n @connection.ask(\"SELECT COUNT(*) FROM (#{sql}) _total_count\", *args)\n end",
"def zcount(key, min, max)\n node_for(key).zcount(key, min, max)\n end",
"def count\n\t\tputs \"Counting number of entries in the site store table ...\"\n\t\treturn @known_sites.size\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end",
"def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end",
"def hosts_with_data(resultset)\n resultset.count { |_host, values| !values['data'].empty? }\n end",
"def count(constraints = {})\n query(constraints).count\n end",
"def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end",
"def vp_count(locked=false)\n if locked\n return @vp_lock.synchronize{@hostname2vp.length}\n else\n return @hostname2vp.length\n end\n end",
"def udp_count\n host_stats[:udp].to_i\n end",
"def count\n @tpl[:cnt]\n end",
"def failure_count(headers)\n if headers.nil? || headers['x-death'].nil?\n 0\n else\n x_death_array = headers['x-death'].select do |x_death|\n x_death['queue'] == @worker_queue_name\n end\n if x_death_array.count > 0 && x_death_array.first['count']\n # Newer versions of RabbitMQ return headers with a count key\n x_death_array.inject(0) {|sum, x_death| sum + x_death['count']}\n else\n # Older versions return a separate x-death header for each failure\n x_death_array.count\n end\n end\n end",
"def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end",
"def total\n @total ||= raw_response['response']['numFound']\n end",
"def get_domain_count\n query_push 'Command' => 'GetDomainCount'\n get_response\n end",
"def tcp_count\n host_stats[:tcp].to_i\n end",
"def total_count\n return option_for(:count) if option_for(:count)\n\n c = except(:offset, :limit, :order)\n c = c.reorder(nil)\n c = c.count\n c.respond_to?(:count) ? c.count : c\n rescue ActiveRecord::StatementInvalid => e\n if e.to_s =~ /statement timeout/\n 1_000_000\n else\n raise\n end\n end",
"def total_instances_count\n @os_aws.total_instances_count\n end",
"def count(query)\n url_chunk = if query.is_a?(Frodo::Query)\n query.include_count\n query.to_s\n else\n service[query].query.count\n end\n\n body = api_get(url_chunk).body\n\n if query.is_a?(Frodo::Query)\n body['@odata.count']\n else\n # Some servers (*cough* Microsoft *cough*) seem to return\n # extraneous characters in the response.\n # I found out that the _\\xef\\xbb\\xbf contains probably invisible junk characters\n # called the Unicode BOM (short name for: byte order mark).\n body.scan(/\\d+/).first.to_i\n end\n end",
"def zone_cost_stats(zone_name, from = nil, to = nil)\n parameters = \"zone=#{zone_name}\"\n parameters << \"&from=#{from}\" if from\n parameters << \"&to=#{to}\" if to\n request(:get, \"/api/zone/cost?#{parameters}\")\n end",
"def available_ip_address_count\n @subnet.available_ip_address_count\n end",
"def total_records\n record.records.count\n end",
"def prepared_nodes_count\n Bebox::Node.list(self.project_root, self.environment, 'prepared_nodes').count\n end",
"def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection << 'COUNT (*)'\n result = get_records raw: true, query: query\n result.first['COUNT'] rescue 0 # return_value\n end",
"def count_records(records)\n records.count(:all)\n end",
"def total_count\n count = header_str[/X-Total-Count: ([0-9]+)/, 1]\n count.present? ? count.to_i : nil\n end",
"def count(filter=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.queue_service_action_call('partner', 'count', 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",
"def failure_count(headers, delivery_info)\n if headers.nil? || headers['x-death'].nil?\n 0\n else\n queue_name = headers['x-first-death-queue'] || @queue_name_lookup[delivery_info.routing_key]\n x_death_array = headers['x-death'].select do |x_death|\n x_death['queue'] == queue_name\n end\n if x_death_array.count > 0 && x_death_array.first['count']\n # Newer versions of RabbitMQ return headers with a count key\n x_death_array.inject(0) {|sum, x_death| sum + x_death['count']}\n else\n # Older versions return a separate x-death header for each failure\n x_death_array.count\n end\n end\n end",
"def call\n res = client.get('/api/rest/v1/users.json?action=count')\n res['data']['count']\n end",
"def total_count\n total_entries\n end",
"def count\n @count\n end",
"def records_total_count\n Rails.cache.fetch('raw_count') { get_raw_records.count(:all) }\n end",
"def count\n @params[:rettype] = 'count'\n self\n end",
"def total_count\n fetch.json.[](:total_count)\n end",
"def total_count\n @all.size\n end",
"def count\n key[:schedule].zcard\n end",
"def group_count\n respond_with json_response('group_count', Group.active.count)\n end",
"def count_objects\n ObjectSpace.count_objects\n end",
"def get_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Slicehost::GetZones.new,\n :path => 'zones.xml'\n )\n end",
"def created_count(server=:default)\n server = @servers[server]\n @allocated[server].length + @available_connections[server].length\n end",
"def member_count\n if @members.nil?\n url = open(\"#{base_url}/memberslistxml\", {:proxy => true})\n REXML::Document.new(url.read).root.elements['memberCount'].text.to_i\n else\n @members.size\n end\n end",
"def all_hits_count\n return @all_results.length || 0\n end",
"def count(options={})\n defaults = { }\n options = defaults.merge(options).symbolize_keys\n total = 0\n \n if options[:until]\n total = self.countings.count(:created_at, :conditions => [\"created_at <= ?\", options[:until]], :order => \"created_at DESC\")\n else\n total = read_attribute('count')\n end\n total\n end",
"def number_of_remote_servers\n connection.servers.inject(0) do |sum, s|\n sum += 1 if server_is_proxy_type?(s) \n sum\n end\n end",
"def count\r\n @internal_list.length\r\n end",
"def address_count_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.address_count ...'\n end\n # resource path\n local_var_path = '/api/v1/addresscount'\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', 'application/xml', ])\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] || 'InlineResponse200' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#address_count\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def failure_count(headers)\n if headers.nil? || headers['count'].nil?\n 0\n else\n headers['count']\n end\n end",
"def count(query = { query: { match_all: {} } })\n client.count index: name, body: query\n end",
"def list_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Zerigo::ListZones.new,\n :path => '/api/1.1/zones.xml'\n )\n end",
"def retrieved_records\n results.count\n end",
"def countInventoryHosts(role)\n file = File.open(ENV['inventory'], \"rb\")\n input = file.read\n file.close\n if input.include? \"[#{role}]\"\n rows = input.split(\"[#{role}]\")[1].split(\"[\")[0]\n counter = rows.scan(/ansible_host/).count\n else counter = 0\n end\n return counter\n end",
"def getconnectioncount\n @api.request 'getconnectioncount'\n end",
"def count\n Driver.client[coll_name].find.count\n end",
"def available_count\n raise_if_closed!\n\n @lock.synchronize do\n @available_connections.length\n end\n end",
"def total_count(queue)\n collection.find(conditions(queue)).count\n end",
"def count\n @all.size\n end",
"def count(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:system] = true if options[:system]\n\n @party.get(\"forms/#{@id}/entries/count\", query: query)['EntryCount']\n end",
"def cluster_size\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes'].join('/')} | grep -o \"contexts\" | wc -l`\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def gpx_airport_count(gpx, airport_to_find)\n airports = Hash.from_xml(gpx).dig(\"gpx\", \"wpt\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end",
"def total_count\n object.nodes.size\n end",
"def count(what, where, options={})\n opts = @@default_options.merge(options)\n opts[:limit] = 1\n uri = assemble_uri(what, where, opts)\n begin\n doc = Hpricot(Net::HTTP.get(URI(URI.escape(uri))))\n total_results = doc.at('totalresults').inner_html.to_i\n rescue\n total_results = 0\n end\n total_results\n end",
"def records_total_count\n fetch_records.unscope(:group, :select).count(:all)\n end",
"def count\n Integer(parsed_body['Meta']['TotalCount'] || parsed_body['Meta']['ResultCount'][self.class.count_field])\n end",
"def counts\n reply.documents[0][COUNTS]\n end"
] |
[
"0.7250891",
"0.68440694",
"0.6837091",
"0.6783943",
"0.6515743",
"0.6267639",
"0.6122488",
"0.5923488",
"0.585694",
"0.5724265",
"0.57075244",
"0.5673514",
"0.56047374",
"0.5581793",
"0.5523989",
"0.54913",
"0.54732513",
"0.54730624",
"0.54643935",
"0.5456252",
"0.54331946",
"0.54160225",
"0.5394116",
"0.5379582",
"0.5359086",
"0.53429604",
"0.5342712",
"0.53208",
"0.5289109",
"0.5281429",
"0.5273741",
"0.52630097",
"0.5252915",
"0.52497566",
"0.5234849",
"0.5232357",
"0.5228827",
"0.5221408",
"0.5214696",
"0.5197156",
"0.51947236",
"0.5193341",
"0.5189496",
"0.51833737",
"0.51599586",
"0.51579845",
"0.51533324",
"0.51495385",
"0.51450187",
"0.5137389",
"0.5125885",
"0.51227707",
"0.5119494",
"0.5114671",
"0.51115793",
"0.5098741",
"0.50984186",
"0.5097875",
"0.5086021",
"0.5078657",
"0.5076298",
"0.50759906",
"0.50754744",
"0.5074624",
"0.50745857",
"0.50712854",
"0.50693065",
"0.5066566",
"0.5062418",
"0.5062271",
"0.5040563",
"0.50385356",
"0.50316876",
"0.5028339",
"0.50227267",
"0.5020503",
"0.50196767",
"0.5009328",
"0.50090915",
"0.5007292",
"0.50060886",
"0.50050884",
"0.50034505",
"0.5002921",
"0.50023466",
"0.49969196",
"0.49919498",
"0.49914533",
"0.49913025",
"0.49849963",
"0.49846023",
"0.49844006",
"0.49844006",
"0.49844006",
"0.49840134",
"0.4983911",
"0.49831164",
"0.49825704",
"0.49819568",
"0.49815777"
] |
0.8165326
|
0
|
Expected date format: "MM/DD/YYYY" Time string: "HH:MM AM/PM"
|
def parse_usa_date(date, time_string = nil)
date = date.to_s.strip
# TODO: Many tests pass either a Date, a Time, or an YYYY-MM-DD formatted
# string as a parameter. This conditional will handle those cases. We should
# probably go through and clean up the tests at some point.
date = format_usa_date(Date.parse(date)) if date =~ /\A\d{4}-\d{2}-\d{2}/
return unless usa_formatted_date?(date)
date_string = Date.strptime(date, "%m/%d/%Y").to_s
date_string += " #{time_string}" if time_string
Time.zone.parse(date_string)
rescue ArgumentError
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_registration_time(date_time)\n format_time = DateTime.strptime(date_time, '%m/%d/%y %H:%M')\nend",
"def appt_date_time_formatter(time, date)\n apptHour = (time[0] + time[1]).to_i\n apptMin = (time[3] + time[4]).to_i\n if time.match(\"PM\")\n apptHour += 12\n end\n appt_date = date.split(\"-\")\n appt_date_year = appt_date[2].to_i\n appt_date_month = appt_date[0].to_i\n appt_date_day = appt_date[1].to_i\n appt_date_time = DateTime.new(appt_date_year, appt_date_month, appt_date_day, \n apptHour, apptMin)\n return appt_date_time\n end",
"def formattimeanddate(unformattedtime)\n unformattedtime.strftime('%I:%M:%S %p - %d %m %Y')\n end",
"def date_formate(date)\n return nil if date.blank?\n date.strftime('%m/%d/%Y %I:%M %p')\n end",
"def makeDate date, time\n arrDate = date.split(\"-\")\n arrTime = time.tr('A-Za-z ', '').split(\":\")\n\n #checks if the time is in PM. If yes add 12 hours to it. Special case is when its 12 AM. Need to minus 12 hours.\n if (params[:time].include? \"A\") && arrTime[0] == \"12\"\n arrTime[0] = 0\n elsif (params[:time].include? \"P\") && arrTime[0] != \"12\"\n arrTime[0] = arrTime[0].to_i + 12\n end\n\n return Time.new(arrDate[2], arrDate[1], arrDate[0], arrTime[0], arrTime[1])\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end",
"def format_of_datetimes\n # if is a right date\n if(date.match(/^(0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])[-](19|2\\d)\\d\\d$/))\n if(intime.match(/^([01][0-9]|[2][0-3])[:]([0-5][0-9])$/))\n self.initial_time = DateTime.strptime(\"#{self.date} #{self.intime}\", \"%m-%d-%Y %H:%M\") + 6.hours\n else\n self.errors.add(:initial_time, \"Initial Time: Please, enter valid time value - hh:mm\")\n end\n if(entime.match(/^([01][0-9]|[2][0-4])[:]([0-5][0-9])$/))\n self.end_time = DateTime.strptime(\"#{self.date} #{self.entime}\", \"%m-%d-%Y %H:%M\") + 6.hours\n else\n self.errors.add(:initial_time, \"Initial Time: Please, enter valid time value - hh:mm\")\n end\n else\n self.errors.add(:initial_time, \"Date: Please, enter valid date value - mm-dd-yyyy\")\n end\n end",
"def fmt_time(dt) _format_dt dt, H12_M_PM end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def datetime_format_and_existence_is_valid \n errors.add(:datetime_observation, 'datum musí být ve formátu DD.MM.YYYY') unless\n (@date =~ /\\d\\d\\.( )?\\d\\d\\.( )?\\d{4}/)# check the date's format\n errors.add(:datetime_observation, 'čas musí být ve formátu HH:MM') unless # check the time's format\n (@time =~ /^((0?[1-9]|1[012])(:[0-5]\\d){0,2}(\\ [AaPp][Mm]))$|^(([01]\\d|2[0-3])(:[0-5]\\d){0,2})$/)\n # build the complete date + time string and parse\n @datetime_str = @date + \" \" + @time\n errors.add(:datetime_observation, \"neexistuje\") if \n ((Time.zone.parse(@datetime_str) rescue ArgumentError) == ArgumentError)\n end",
"def convert_db_time(date)\n \treturn date.strftime(\"%m/%d/%Y | %I:%M %P\")\n end",
"def format_date\n begin\n self.eob_date = Date.strptime(self.unformatted_eob_date, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_eob_date.blank?\n self.dos = Date.strptime(self.unformatted_dos, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_dos.blank?\n self.check_date = Date.strptime(self.unformatted_check_date, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_check_date.blank?\n rescue\n errors.add :base, \"Invalid Date(s)\"\n end\n end",
"def format_date(date)\n am_or_pm = date.slice -2..-1\n less_stamp = date.slice(0..7)\n hour = date.slice 0..1\n hour = hour.to_i\n if am_or_pm == \"AM\"\n if hour == 12 # subtract 12\n hour = \"00\"\n puts hour << date.slice(2..7)\n else\n puts date.slice(0..7)\n end\n else\n if hour != 12\n hour = hour + 12\n hour = hour.to_s\n puts hour << date.slice(2..7)\n else\n hour = hour + 1\n hour = hour.to_s\n puts hour << date.slice(2..7)\n end\n end\nend",
"def date_format tim\n # tim.strftime '%Y/%m/%d %H:%M:%S'\n tim.strftime '%Y/%m/%d %H:%M'\nend",
"def getDateStr\n return \"\" if @line.length < 15\n tmpStr = @line[0..14]\n begin\n DateTime.strptime(tmpStr, \"%b %d %H:%M:%S\")\n out = tmpStr\n rescue\n out = \"\"\n end\n return out \n end",
"def correct_format(string)\n parts = string.split(\"-\")\n if parts[0].include?(\"AM\") then parts[0] = \"#{set_24hour(parts[0].split(\":\").first, false)}:30\" else parts[0] = \"#{set_24hour(parts[0].split(\":\").first)}:30\" end \n if parts[1].include?(\"AM\") then parts[1] = \"#{set_24hour(parts[1].split(\":\").first, false)}:30\" else parts[1] = \"#{set_24hour(parts[1].split(\":\").first)}:30\" end\n parts[2] = what_day(parts[2])\n return \"#{parts[0]}-#{parts[1]}-#{parts[2]}\"\n end",
"def conforms_to_dateTime_format(str)\n dateTimeRegex = /\\A(?:(?!0000)\\d{4})(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|3[0-1])(T([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(\\.\\d+)?(Z|(\\+|-)((0\\d|1[0-3]):[0-5]\\d|14:00)))?)?)?\\z/\n dateTimeRegex.match(str)\n end",
"def format_date(date) \r\n (date == \"mm/dd/yy\" || date == \"MM/DD/YY\" || date.blank?)? nil : Date.strptime(date, '%m/%d/%y')\r\n end",
"def time_for_string(time)\n time = time.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/)[0].sub(' ','T')\n Time.xmlschema(time)\n end",
"def format_date_time( dt )\n dt.strftime( \"%B %e, %Y %I:%M%p\" )\nend",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def date_time()\n\t\t@data.inspect\n\t\tif !@data.key?(:time) || @data[:time].empty? || !@data.key?(:date) || @data[:date].empty?\n\t\t\treturn nil\n\t\tend\n\n\t\ttime = @data[:time]\n\t\tdate = @data[:date]\n\t\ttime.gsub!(/\\.[0-9]*$/, \"\") # remove decimals\n\t\tdatetime = \"#{date} #{time} UTC\"\n\n\t\tdate = DateTime.strptime(datetime, \"%d%m%y %H%M%S %Z\")\n\t\tdate\n\tend",
"def process_date(ddtt)\n #puts \"\\nPROCESS_DATE\"\n if(ddtt)\n text_date=\"\"\n text_date = ddtt.strftime(\"%A, %d %B, %Y at %H:%m%p\")\n return text_date\n else\n return nil\n end\nend",
"def formatTime( time )\n hours = 0\n minutes = 0\n time[/(\\d+):(\\d+)/]\n hours = $1.to_i\n minutes = $2.to_i\n if time.include? \"PM\"\n if( hours!=12 )\n hours += 12\n end \n end \n if time.include? \"AM\"\n if (hours == 12)\n hours = 0\n end\n end\n # The year, month and day are irrelevant. \n return Time.local( 1, 1, 1, hours, minutes, 0)\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def set_date_string(input)\n\n now = Time.new\n date = Time.new\n\n #Handle minute notation.\n if input.downcase[-1] == \"m\" then\n date = now - (60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle hour notation.\n if input.downcase[-1] == \"h\" then\n date = now - (60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle day notation.\n if input.downcase[-1] == \"d\" then\n date = now - (24 * 60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle PowerTrack format, YYYYMMDDHHMM\n if input.length == 12 and numeric?(input) then\n return input\n end\n\n #Handle \"YYYY-MM-DD 00:00\"\n if input.length == 16 then\n return input.gsub!(/\\W+/, '')\n end\n\n #Handle ISO 8601 timestamps, as in Twitter payload \"2013-11-15T17:16:42.000Z\"\n if input.length > 16 then\n date = Time.parse(input)\n return get_date_string(date)\n end\n\n return 'Error, unrecognized timestamp.'\n\n end",
"def appointment_params\n valid = params.require(:appointment).permit(:doctor_id, :pet_id, :customer_id, :reminder, :date_of_visit, :reason_for_visit)\n date_format = \"%m/%d/%Y %I:%M %p\"\n valid[:date_of_visit] = valid[:date_of_visit] != \"\" ? DateTime.strptime(valid[:date_of_visit], date_format) : valid[:date_of_visit]\n return valid\n end",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def formatted_datetime(date_time)\n date_time.strftime(\"%a, %e %b %Y %H:%M\")\n end",
"def time_format(time)\n\t if time\n\t time.strftime(\"%d/%m/%Y %H:%M\")\n\t end\n\tend",
"def test_date_time_formatting\n\t\tskip\n\t\tobject = DateTimeStruct.new(DateTime.new(2010, 10, 5))\n\t\tpresenter = Claudia::Presenter.new object\n\t\tputs presenter.start_date\n\t\tputs presenter.start_time\n\tend",
"def format_date\n begin\n self.dos = Date.strptime(self.unformatted_dos, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_dos.blank?\n rescue\n errors.add :base, \"Invalid Date(s)\"\n return false\n end\n end",
"def approach_time_format\n \"%b %e, %Y %l:%M%p\"\n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def change_date_format\n params[:audit][:period_start] = DateTime.strptime(params[:audit][:period_start], \"%m/%d/%Y %H:%M\")\n params[:audit][:period_end] = DateTime.strptime(params[:audit][:period_end], \"%m/%d/%Y %H:%M\")\n end",
"def parse_time(time)\n if time.is_a? Time\n return Time.parse time.httpdate\n elsif time.is_a String\n return Time.parse(Time.parse(time).httpdate)\n else\n raise \"Argument Error, #{time} is not a valid time\"\n end\n end",
"def formatted_date\n Date.strptime(date, \"%m/%d/%Y\")\n end",
"def appt_date_val # Time.zone.parse (appt_start) #DateTime.strptime(appt_start, \"%y/%m/%d %H:%M\")\n errors.add(:appt_start, \"Must be in the future\") unless (appt_start > Time.now)\n errors.add(:appt_end, \"Must be after Appt Start\") unless (appt_end > appt_start)\n end",
"def parse_datetime(str)\n parts = str.scan(/.{2}/)\n year = Time.now.year.to_s[0..1] + parts[0]\n month = parts[1]\n day = parts[2]\n hour = parts[3]\n minute = parts[3]\n \"#{year}-#{month}-#{day} #{hour}:#{minute}\"\n end",
"def get_requested_at_smart_str\n if Time.current.to_date == self.requested_at.to_date\n get_formatted_time(self.requested_at)\n else\n get_formatted_datetime(self.requested_at)\n end\n end",
"def date(input, format); end",
"def dt_format\n \"%Y-%m-%d %H:%M\"\n end",
"def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else\n safe_date = self\n end\n safe_date\n end",
"def test_dttmConversions\n assert_equal('%Y-%m-%d %H:%M:%S', DataMetaForm::Dttm.toRubyFmt('yyyy-MM-dd HH:mm:ss'))\n assert_equal('%Y-%m-%d %H%M%S', DataMetaForm::Dttm.toRubyFmt('yyyy-MM-dd HHmmss'))\n assert_equal('%Y%m%d %H%M%S', DataMetaForm::Dttm.toRubyFmt('yyyyMMdd HHmmss'))\n assert_equal('%Y%m%d%H%M%S', DataMetaForm::Dttm.toRubyFmt('yyyyMMddHHmmss'))\n assert_equal('=%Y-%m-%d %H:%M:%S', DataMetaForm::Dttm.toRubyFmt('=yyyy-MM-dd HH:mm:ss'))\n assert_equal('%Y-%m-%d %H:%M:%S=', DataMetaForm::Dttm.toRubyFmt('yyyy-MM-dd HH:mm:ss='))\n assert_equal('=%Y-%m-%d %H:%M:%S=', DataMetaForm::Dttm.toRubyFmt('=yyyy-MM-dd HH:mm:ss='))\n assert_equal('=%Y-%m-%d -=- %H:%M:%S=', DataMetaForm::Dttm.toRubyFmt('=yyyy-MM-dd -=- HH:mm:ss='))\n assert_equal('%Y-%m-%d', DataMetaForm::Dttm.toRubyFmt('yyyy-MM-dd'))\n assert_equal('%H:%M:%S', DataMetaForm::Dttm.toRubyFmt('HH:mm:ss'))\n end",
"def format_date\n begin\n self.created_date = Date.strptime(self.unformatted_created_date, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_created_date.blank?\n self.fee_start = Date.strptime(self.unformatted_fee_start, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_fee_start.blank?\n self.fee_end = Date.strptime(self.unformatted_fee_end, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_fee_end.blank?\n rescue\n errors.add :base, \"Invalid Date(s)\"\n return false\n end\n end",
"def get_inspection_date\n date.strftime(\"%B %d, %Y, %I:%M %p\")\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def formatted_date datetime\n return '' if datetime.nil?\n\n datetime.strftime '%Y-%m-%d %H:%m'\n end",
"def format_datetime(date_time)\n unless !logged_in? || current_user.timezone.nil?\n date_time = date_time.in_time_zone(current_user.timezone)\n end\n #SEE Ruby-doc for options\n date_time.strftime(\"%h %d, 20%y at %l:%m%p (%Z)\") #Format: 02/28/14 11:00pm (PST)\n end",
"def typecast_time(datetime) #:nodoc:\n datetime.sub!(%r|^(\\w{2})/(\\w{3})/(\\w{4})|, '\\2 \\1 \\3')\n datetime.sub!(':', ' ')\n Time.parse(datetime)\n end",
"def show_in_strftime\n @date.strftime(\"%d/%m/%Y -- %H:%M\")\n end",
"def parse_expiration_date(gp)\n begin\n if gp[:expiration_time]\n if gp[:expiration_time] == ''\n gp[:expiration_time] = nil\n else\n gp[:expiration_time] = Date.strptime(gp[:expiration_time], \"%m/%d/%Y\")\n print gp[:expiration_time]\n end\n end\n return true\n rescue\n return false\n end\nend",
"def datetime_format\n end",
"def parse_times( times )\n case times\n when /^\\s*any\\b/i\n Hour.new(\"12 AM\")..Hour.new(\"11 PM\")\n when /^\\s*before (\\d+ [AP]M)\\b/i\n Hour.new(\"12 AM\")..Hour.new($1)\n when /^\\s*after (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new(\"11 PM\")\n when /^\\s*(\\d+ [AP]M) to (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new($2)\n when /^\\s*not available\\b/i\n nil\n else\n raise \"Unexpected availability format.\"\n end\n end",
"def validate_event_time(item)\n error(msg: 'Invalid iso8601 string', item: __method__.to_s) unless valid_iso_8601(item)\n end",
"def process_start_time\n# gimme_a_syntax_error\n if event_params[\"start_time(2i)\"].length == 1\n start_month = \"0\" + event_params[\"start_time(2i)\"]\n else\n start_month = event_params[\"start_time(2i)\"]\n end\n \n # -0600 represents the default timezone of CST\n start_time = event_params[\"start_time(1i)\"] + start_month + event_params[\"start_time(3i)\"] + \"T\" + \n event_params[\"start_time(4i)\"] + \":\" + event_params[\"start_time(5i)\"] + \"-0600\"\n begin\n return DateTime.strptime(start_time, '%Y%m%dT%H:%M%z')\n rescue ArgumentError\n flash[:error] ||= \"Start date doesn't exist\"\n return nil\n end\n end",
"def formatted_date(date)\n return '' if date.nil?\n sprintf('%d/%d/%d alle %d:%d', date.day, date.month, date.year,\n date.hour, date.min)\n end",
"def usualParser(dateTimeString, inputFormat)\n ft = formatConvertor(inputFormat)\n puts ft\n begin\n dt = DateTime.strptime(dateTimeString, ft)\n print \"#{dt}\"\n rescue\n puts \"Invalid String or String does not match the specified format\"\n end\nend",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def handle_date_parse_input(string)\n string\n end",
"def day_month_year_hour_minute\n I18n.locale.to_s == 'pt' ? \"%d/%m/%Y %H:%M\" : \"%m/%d/%Y %I:%M %P\"\n end",
"def is_valid_date?(string_date, format=\"%d/%m/%Y\")\n begin\n time = Date.strptime(string_date, format)\n rescue ArgumentError\n return false\n end\n true\n end",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate start_date and start_time\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") \n\t\t\t#variable that holds the time 12 hours from now\n\t\t\tstart_at_plus_12_hours = Time.now + (12.hours)\n\t\t\tif start_at <= Time.now\n\t\t\t\terrors.add(:start_date, \"Please do not enter a past date or past time.\")\n\t\t\t\terrors.add(:start_time, \"Please do not enter a past date or past time.\")\n\t\t\telsif start_at < start_at_plus_12_hours \n\t\t\t\terrors.add(:start_date, \"Please only enter a time 12 hours from now\")\n\t\t\tend\n\t\tend\n\tend",
"def formatted_time(time_str)\n format = '%Y-%m-%dT%H:%M:%S%Z'\n ::Time.strptime(time_str, format)\n end",
"def check_out_date\n check_out && Date.parse(check_out)\n rescue ArgumentError\n # check-out parameter is not a valid date\n end",
"def timeConversion(s)\n timeArr = s.split(\":\");\n hours = timeArr[0];\n minutes = timeArr[1];\n seconds = timeArr[2][0...-2]\n am_or_pm = timeArr[2][-2..-1]\n\n if am_or_pm == \"PM\" && hours != \"12\"\n hours = (hours.to_i + 12).to_s\n elsif am_or_pm == \"AM\" && hours == \"12\"\n hours = \"00\"\n end\n\n hours + \":\" + minutes + \":\" + seconds\nend",
"def date_value\n Time.parse(value) if value.present?\n end",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend",
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def out_of_bounds_time_format; end",
"def game_date\n Time.parse(\"#{@date.strftime(\"%m/%d/%Y\")}\")\n end",
"def parse_time_data input\n while line = input.gets\n line.chomp!\n @line_no += 1\n\n if line =~ /^[\\#;]/\n # ignore comment lines\n elsif line =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2}|\\d{4})$/\n # mm/dd/yy or mm/dd/yyyy\n handle_new_day($1, $2, $3)\n elsif line =~ /^([0-9.:]+)\\s*[-]\\s*([0-9.]+)\\s+(\\S+.*)/\n # t1 - t2 description for example:\n # 7.1-13.6 Mantis issues OR (for Jordan :)\n # 7:30-10 Mantis issues\n handle_new_entry($1, $2, $3)\n elsif line.strip.empty?\n # ignore blank lines\n else\n raise \"parse error - invalid line\"\n end\n end\n rescue Exception => e\n puts \"line #{@line_no}: #{e.message}\"\n end",
"def test_record_activity_formats_date\n timestamp1 = Time.new(2012, 1, 31, 8, 34)\n @timelog.record_activity('Arrived', timestamp1)\n timestamp2 = Time.new(2012, 1, 31, 10, 59)\n @timelog.record_activity('Reading mail', timestamp2)\n @stream.rewind\n assert_equal([{:start_time => timestamp1, :end_time => timestamp2,\n :description => 'Reading mail'}],\n @timelog.activities)\n assert_equal(\"2012-01-31 08:34: Arrived\\n\" <<\n \"2012-01-31 10:59: Reading mail\\n\",\n @stream.read)\n end",
"def admitted_at\n if get(\"ADM_DATE\")\n Time.parse get(\"ADM_DATE\")\n else\n nil\n end\n end",
"def test_date_value\n assert_match /\"2012-01-01T00:00:00.*/, value(Date.parse('2012-01-01'))\n end",
"def google_datetime(time)\n time.to_datetime.rfc3339\n end",
"def expected_format\n options[:expected_format] || 'yyyy-mm-dd'\n end",
"def initialize\n @datetime_format = '%Y%m%d %H:%M:%S'\n end",
"def common_timestring\n \"%I:%M%p %Z %a %d %B %Y\"\n end",
"def check_format\n @hour_format = session[:hour_format] || 12\n end",
"def format_date\n begin\n if !self.unformatted_dob.blank?\n self.dob = Date.strptime(self.unformatted_dob, \"%m/%d/%Y\").to_time(:utc)\n end\n if !self.unformatted_signature.blank?\n self.signature_date = Date.strptime(self.unformatted_signature, \"%m/%d/%Y\").to_time(:utc)\n end\n rescue\n errors.add :base, \"Invalid Date\"\n return false\n end\n end",
"def check_date_consistency(date_from_timepicker)\n\t\tparams_ok = true\n\t\tbegin\n\t\t\tdate_from_timepicker.to_datetime\n\t\trescue ArgumentError\n\t\t\tparams_ok = false\n\t\tend\n\n\t\tif date_from_timepicker == \"\"\n\t\t\tparams_ok = false\n\t\tend\n\t\tparams_ok\n\tend",
"def get_datetime_string(t)\n return t.strftime('%b %d, %Y %I:%M %p')\n end",
"def datetime(date)\n if date.class == String\n date = Time.parse(date)\n end\n date\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def format_datetime datetime, fmt=\"%F %H:%M %Z\"\n return unless datetime.present?\n datetime.strftime fmt if datetime\n end",
"def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend",
"def specific_time\n parse_calendar_date if self.bucket == \"specific_time\" and self.calendar\n rescue ArgumentError\n errors.add(:calendar, :invalid_date)\n end",
"def format_date\n begin\n if !self.unformatted_license_date.blank?\n self.license_date = Date.strptime(self.unformatted_license_date, \"%m/%d/%Y\").to_time(:utc)\n end\n rescue\n errors.add :base, \"Invalid Date\"\n end\n end",
"def date_parsed\n if created_at?\n Date.parse(valid_params[\"created_at\"])\n elsif updated_at?\n Date.parse(valid_params[\"updated_at\"])\n end\n end",
"def timeConversion(s)\n if s =~ /[pP]/\n r = s.chomp(\"PM\")\n r = r.split(\":\")\n if r[0] == \"12\"\n r[0] = \"12\"\n else\n r[0] = (r[0].to_i + 12).to_s\n end \n \n r = r[0] + \":\" + r[1] + \":\" + r[2]\n elsif\n if s =~ /[aA]/\n r = s.chomp(\"AM\")\n r = r.split(\":\")\n if r[0] == \"12\"\n r[0] = \"00\"\n end\n r = r[0] + \":\" + r[1] + \":\" + r[2]\n end\n end\n p r\nend",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def get_log_time(line)\n data_string = line.match(/[\\w]*[\\s]*[\\w]*[\\s]*[^\\s]*/)[0]\n # the year is not included, so this will fail if the current year is different\n # for now we'll hack it to be the current year\n date = DateTime.parse(\"#{data_string} #{REPORT_YEAR}\")\nend",
"def read_start_time(start_time)\n if start_time.is_a?(String)\n start_time.gsub!(\"/\", \"-\")\n start_time = \"20#{r[0]}-01-01\" if r = start_time.match(/^\\d{2}$/) # \"yy\"\n start_time = \"#{r[0]}-01-01\" if r = start_time.match(/^\\d{4}$/) # \"yyyy\"\n start_time = \"#{r[0]}-01\" if r = start_time.match(/^\\d{4}-\\d{1,2}$/) # \"yyyy-m\" or \"yyyy-mm\"\n start_time = Time.zone.parse(start_time)\n raise ArgumentError, \"Start time not valid\" if start_time.nil?\n end\n start_time\n end",
"def date_formatted\n Time.parse(@actioned_at).strftime(\"%c\")\n end",
"def str_to_time(st)\r\n ret = nil\r\n if st.is_a? Time then\r\n ret = st\r\n elsif st.is_a? String then \r\n begin\r\n self.allday = false\r\n ret = Time.iso8601(st) \r\n rescue \r\n self.allday = true if st =~ /\\d{4}-\\d{2}-\\d{2}/ # yyyy-mm-dd\r\n ret = Time.parse(st)\r\n end\r\n end\r\n ret\r\n end",
"def timeConversion(s)\n am_pm = s[(s.length - 2)..(s.length - 1)]\n s.gsub!(am_pm, '')\n hour = s[0..1]\n if hour == '12'\n if am_pm == 'AM'\n s[0..1] = '00'\n end\n elsif am_pm == 'PM'\n new_hour = (hour.to_i + 12).to_s\n s[0..1] = new_hour\n end\n result = s\nend"
] |
[
"0.69543517",
"0.6395716",
"0.6341991",
"0.6246984",
"0.6222652",
"0.6206912",
"0.6203109",
"0.6148219",
"0.6068987",
"0.6027255",
"0.6025781",
"0.6009908",
"0.6009268",
"0.6000338",
"0.5980418",
"0.5980075",
"0.5967324",
"0.5957498",
"0.59498614",
"0.5943719",
"0.59269905",
"0.5913092",
"0.5857455",
"0.5848839",
"0.58374953",
"0.5835044",
"0.5830078",
"0.582371",
"0.58182985",
"0.58106804",
"0.5803584",
"0.57921726",
"0.5782728",
"0.5775961",
"0.5769491",
"0.5766533",
"0.57600623",
"0.57228994",
"0.5720175",
"0.5717816",
"0.5715658",
"0.57023084",
"0.569898",
"0.56954354",
"0.5683194",
"0.56825256",
"0.5677435",
"0.56706536",
"0.56632555",
"0.56384796",
"0.5636844",
"0.5622107",
"0.5621272",
"0.5620867",
"0.56192935",
"0.5618827",
"0.5617451",
"0.56024283",
"0.560209",
"0.5577635",
"0.5577635",
"0.55750763",
"0.5565948",
"0.5563915",
"0.55467147",
"0.554486",
"0.5542023",
"0.5533212",
"0.55303794",
"0.5524858",
"0.5518301",
"0.55109704",
"0.5508451",
"0.55022705",
"0.5501228",
"0.54974586",
"0.5491749",
"0.5488776",
"0.5487863",
"0.5485054",
"0.5483576",
"0.5482665",
"0.54818743",
"0.5479471",
"0.547673",
"0.54709667",
"0.54677093",
"0.54577535",
"0.5454966",
"0.5453669",
"0.5452462",
"0.5447962",
"0.5445156",
"0.5444522",
"0.54416734",
"0.5441409",
"0.5433426",
"0.5432659",
"0.542602",
"0.5423067",
"0.54155976"
] |
0.0
|
-1
|
This is to DRY up many of the legacy places where hour/min/meridian is used in forms
|
def time_select(f, field, options_tag = {}, html_options = {})
output = f.select(:"#{field}_hour", (1..12).to_a, {}, html_options.merge("aria-label": f.object.class.human_attribute_name("#{field}_hour")))
output.safe_concat f.select(:"#{field}_min", minute_options(options_tag[:minute_step]), {}, html_options.merge("aria-label": f.object.class.human_attribute_name("#{field}_min")))
output.safe_concat f.select(:"#{field}_meridian", %w(AM PM), {}, html_options.merge("aria-label": f.object.class.human_attribute_name("#{field}_meridian")))
content_tag :div, output, class: "time-select"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def time_select_for(select_start, select_end) #bcoz time_select name is already a rails helper\n #need to map time_choices to am_pm view format and normal time save format -H\n get_time_choices(select_start, select_end, min_block).map {|t| [t.to_s(:am_pm), t]}\n end",
"def format_of_datetimes\n # if is a right date\n if(date.match(/^(0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])[-](19|2\\d)\\d\\d$/))\n if(intime.match(/^([01][0-9]|[2][0-3])[:]([0-5][0-9])$/))\n self.initial_time = DateTime.strptime(\"#{self.date} #{self.intime}\", \"%m-%d-%Y %H:%M\") + 6.hours\n else\n self.errors.add(:initial_time, \"Initial Time: Please, enter valid time value - hh:mm\")\n end\n if(entime.match(/^([01][0-9]|[2][0-4])[:]([0-5][0-9])$/))\n self.end_time = DateTime.strptime(\"#{self.date} #{self.entime}\", \"%m-%d-%Y %H:%M\") + 6.hours\n else\n self.errors.add(:initial_time, \"Initial Time: Please, enter valid time value - hh:mm\")\n end\n else\n self.errors.add(:initial_time, \"Date: Please, enter valid date value - mm-dd-yyyy\")\n end\n end",
"def datetime_local_field(name, *args)\n options = args.extract_options!.symbolize_keys!\n prepare_options(name, options)\n options[:input_group][:data].merge!({'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS+\"THH:mm\"+(options[:include_seconds] ? ':ss' : '')]}.merge(options[:data] || {}))\n append_min_max(BootstrapForm::DATE_FORMAT_RUBY+\"T%T\", options)\n args << options\n super\n end",
"def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+' ' + time_part\n end",
"def hours_field(field, options={})\n # display the value before type cast when the entered value is not valid\n if @object.errors[field].blank?\n options = options.merge(:value => format_hours(@object.send field))\n end\n text_field field, options\n end",
"def my_datetime_input_html(fragment,strfformat)\n template.send(\n :text_field_tag,\n '%s[%s_%s]' % [object_name, method, fragment.to_s],\n (value.respond_to? :strftime) ? value.strftime(strfformat) : value,\n input_html_options.merge(\n :id => fragment_id(fragment), \n :class => [\"input-small\", \"%s_picker\" % fragment.to_s].join(' '))\n )\n end",
"def handle_sy_sm_sd_h_m_s_hh_mm\n handle_sy_sm_sd_h_m_s\n handle_hh_mm\n end",
"def hour() end",
"def format_hours\n\n self.breakHours = self.breakHours[1,self.breakHours.length] if !self.breakHours.blank? && self.breakHours =~ /0[0-9]:/\n\t\tself.hours = self.hours[1,hours.length] if !self.hours.blank? && self.hours =~ /0[0-9]:/\n \n\tend",
"def to_smart_time(form = :utc)\n# 1) Research parsedate to see how it's parsing\n# 2) Refacter the parse to insert the current values from the top down,\n# as they don't exist. Ignore seconds completely unless given by the string.\n ::Time.send(\"#{form}_time\", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0})\n end",
"def handle_sy_sm_sd_h_m_s_ss_hh_mm\n handle_sy_sm_sd_h_m_s_ss\n handle_hh_mm\n end",
"def human_datetime_minute_mask\n case session[:database][:locale]\n when \"de\" then \"TT.MM.JJJJ HH:MI\"\n when \"en\" then \"YYYY-MM-DD HH:MI\"\n else \"TT.MM.JJJJ HH24:MI\" # Deutsche Variante als default\n end\n end",
"def datetime_select(method, options = {}, html_options = {})\n existing_time = @object.send(method) \n formatted_time = existing_time.to_time.strftime(\"%F %I:%M %p\") if existing_time.present?\n @template.content_tag(:div, :class => \"input-group\") do \n text_field(method, :value => formatted_time, :class => \"form-control datetimepicker\", :\"data-date-format\" => \"YYYY-MM-DD hh:mm A\") +\n @template.content_tag(:span, @template.content_tag(:span, \"\", :class => \"glyphicon glyphicon-calendar\") ,:class => \"input-group-addon\")\n end\n end",
"def check_format\n @hour_format = session[:hour_format] || 12\n end",
"def set_mtimes(times)\n pm = false\n _24hr = true\n\n times_24 = []\n now = Time.now\n \n #convert to '24hr' for consistency\n #start backwards to make sure its am or pm\n times.reverse_each do |t|\n\n hr, min = t[0].to_s.split(':', 2)\n\n #change to pm\n if (min.include?(\"pm\"))\n pm = true\n _24hr = false\n end\n\n #change from pm to am\n if (min.include?(\"am\") && !_24hr)\n pm = false\n end\n\n #only am start - hackish\n if (min.include?(\"am\") && times.length < 3)\n _24hr = false\n end\n\n if (_24hr)\n augment =0\n if (hr.to_i == 12)\n augment = 12\n end\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i - augment, min[/[0-9]+/]) + 24*60*60 #add a day\n elsif (pm)\n augment = 0\n if hr.to_i != 12\n augment = 12\n end\n t = Time.new(now.year, now.month, now.day,\n hr.to_i + augment, min[/[0-9]+/])\n\n elsif (!pm & !_24hr)\n t = Time.new(now.year, now.month, now.day,\n hr.to_i, min[/[0-9]+/])\n end\n\n=begin\n #midnight seems to be latest\n if ((!pm && min.include?(\"am\") && hr.to_i == 12) ||\n ((!pm && hr.to_i == 12)))\n \n t = Time.new(now.year, now.month, now.day,\n hr.to_i - 12, min[/[0-9]+/]) + 24*60*60 #add a day\n\n elsif (!pm && min.include?(\"am\"))\n pm = false\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i, min[/[0-9]+/])\n\n elsif (pm || min.include?(\"pm\"))\n pm = true\n augment = 0\n if (hr.to_i != 12)\n augment = 12\n end\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i + augment, min[/[0-9]+/])\n\n end\n=end\n times_24.push t\n end\n\n self.mtimes = times_24\n\n end",
"def time_format\n return :time12 if new_us_user?\n\n clock_type == '12h' ? :time12 : :time24\n end",
"def time_input(method, options)\n options = set_include_blank(options)\n date_or_datetime_input(method, options.merge(:discard_year => true, :discard_month => true, :discard_day => true))\n end",
"def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+' ' + time_part\n end",
"def date_or_datetime_input(method, options)\n position = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6, :meridie => 7 }\n i18n_date_order = ::I18n.t(:order, :scope => [:date])\n i18n_date_order = nil unless i18n_date_order.is_a?(Array)\n inputs = options.delete(:order) || i18n_date_order || [:year, :month, :day]\n inputs = [] if options[:ignore_date]\n labels = options.delete(:labels) || {}\n\n time_inputs = [:hour, :minute]\n time_inputs << :second if options[:include_seconds]\n time_inputs << :meridie if options[:twelve_hour]\n\n list_items_capture = \"\"\n hidden_fields_capture = \"\"\n\n datetime = options[:selected]\n datetime = @object.send(method) if @object && @object.send(method) # object value trumps :selected value\n datetime = options[:value] unless options[:value].blank?\n\n html_options = options.delete(:input_html) || {}\n input_ids = []\n\n (inputs + [':'] + time_inputs).each do |input|\n input_ids << input_id = generate_html_id(method, \"#{position[input]}i\")\n\n field_name = \"#{method}(#{position[input]}i)\"\n if options[:\"discard_#{input}\"]\n break if time_inputs.include?(input)\n\n hidden_value = datetime.respond_to?(input) ? datetime.send(input) : datetime\n hidden_fields_capture << template.hidden_field_tag(\"#{@object_name}[#{field_name}]\", (hidden_value || 1), :id => input_id)\n else\n opts = strip_formtastic_options(options).merge(:prefix => @object_name, :field_name => field_name, :default => datetime)\n item_label_text = labels[input] || ::I18n.t(input.to_s, :default => input.to_s.humanize, :scope => [:datetime, :prompts])\n\n if input == ':'\n list_items_capture << template.content_tag(:li, ':', :class => 'separator')\n else\n list_items_capture << template.content_tag(:li, Formtastic::Util.html_safe([\n !item_label_text.blank? ? template.content_tag(:label, Formtastic::Util.html_safe(item_label_text), :for => input_id) : \"\",\n template.send(:\"select_#{input}\", datetime, opts, html_options.merge(:id => input_id))\n ].join(\"\"))\n )\n end\n end\n end\n\n hidden_fields_capture << field_set_and_list_wrapping_for_method(method, options.merge(:label_for => input_ids.first), list_items_capture)\n end",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def parse_times( times )\n case times\n when /^\\s*any\\b/i\n Hour.new(\"12 AM\")..Hour.new(\"11 PM\")\n when /^\\s*before (\\d+ [AP]M)\\b/i\n Hour.new(\"12 AM\")..Hour.new($1)\n when /^\\s*after (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new(\"11 PM\")\n when /^\\s*(\\d+ [AP]M) to (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new($2)\n when /^\\s*not available\\b/i\n nil\n else\n raise \"Unexpected availability format.\"\n end\n end",
"def am_pm_hour_select(object, method, options = {}, html_options = {})\n\t\tselect_options = [ [\"6am\", 6], [\"7am\", 7], [\"8am\", 8], [\"9am\", 9], [\"10am\", 10], [\"11am\", 11], [\"12pm\", 12], [\"1pm\", 13], [\"2pm\", 14], [\"3pm\", 15], [\"4pm\", 16], [\"5pm\", 17], [\"6pm\", 18], [\"7pm\", 19], [\"8pm\", 20], [\"9pm\", 21], [\"10pm\", 22], [\"11pm\", 23], [\"12am\", 24], [\"1am\", 1], [\"2am\", 2], [\"3am\", 3], [\"4am\",4 ], [\"5am\", 5]]\n\t\tunless options[:start].nil?\n\t\t shift_if_needed = Proc.new{|hour, start| hour<start ? hour+24 : hour}\n\t\t select_options.sort!{|x, y| shift_if_needed.call(x.last,options[:start]) <=> shift_if_needed.call(y.last, options[:start]) }\n\t\tend\n\n\t\tobject.select(method, select_options, options = {}, html_options = {})\n\tend",
"def timepicker_options(opts)\n {:input_html => {:class => 'ui-timepicker time'}, :include_blank => false}.deep_merge(opts)\n end",
"def formatted_pickup_time\n\t\tstart_ampm = 'am'\n\t\tend_ampm = 'am'\n\t\tt = ''\n\t\tif (pickup_start_hour > 12) then\n\t\t\tt += (pickup_start_hour - 12).to_s\n\t\t\tstart_ampm = 'pm'\n\t\telse\n\t\t\tt += pickup_start_hour.to_s\n\t\tend\n\t\tif (pickup_end_hour > 12) then\n\t\t\tend_ampm = 'pm'\n\t\tend\n\t\tif pickup_start_minute != 0 then\n\t\t\tt += ':' + pickup_start_minute.to_s\n\t\tend\n\t\tif start_ampm === 'am' and end_ampm === 'pm' then\n\t\t\tt += 'am'\n\t\tend\n\t\tt += '-'\n\t\tif pickup_end_hour > 12 then\n\t\t\tt += (pickup_end_hour - 12).to_s\n\t\telse\n\t\t\tt += pickup_end_hour.to_s\n\t\tend\n\t\tif pickup_end_minute != 0 then\n\t\t\tt += ':' + pickup_end_minute.to_s\n\t\tend\n\t\tt += end_ampm\n\t\tt\n\tend",
"def datetime_input(method, options)\n options[:date_format] = :short_datetime\n case get_rule(method).visibility\n when :enabled \n return datetime_enabled(method, options)\n when :disabled \n return disabled_field(method, options)\n end\n end",
"def time_params\n if params[:twelve].present? && params[:twelve][:start_time].present? && params[:twelve][:end_time].present?\n #@start_time = Date.new(\"#{params[\"start_time(1i)\"]}\".to_i,\"#{params[\"start_time(2i)\"]}\".to_i,\"#{params[\"start_time(3i)\"]}\".to_i)\n #@end_time = Date.new(\"#{params[\"end_time(1i)\"]}\".to_i,\"#{params[\"end_time(2i)\"]}\".to_i,\"#{params[\"end_time(3i)\"]}\".to_i)\n #params.require(:twelve).permit(:start_time, :end_time)\n @start_time = params[:twelve][:start_time].to_date\n @end_time = params[:twelve][:end_time].to_date\n else\n @start_time = Date.new(Time.now.year,1,1)\n @end_time = Date.new(Time.now.year,12,31)\n flash[:notice] = \"Deverão ser preenchidas as datas de início e fim.\"\n end\n end",
"def datetimepicker_options(format, value = nil)\n datetimepicker_options = {:value => value.try(:strftime, format), :class => 'ui-timepicker'}\n end",
"def twenty_four_hour_time(meridian_time)\n parts = meridian_time.match(MERIDIAN_TIME_EXPRESSION)\n return if parts.nil?\n hour = parts[1].to_i\n minute = parts[2]\n meridian = parts[3].downcase\n hour = hour + (hour != 12 && meridian == \"pm\" ? 12 : 0)\n\n \"#{hour}:#{minute}\"\n end",
"def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index].get_tag(ScalarMinute).type\n next_tag\n end",
"def validate_with_shift_times # see alias_method_chain above\n #s_time = (start_time.hour * 2) + (start_time.min/30)\n #e_time = (params[:issue][:end_time].hour * 2) + (params[:issue][:end_time].min/30)\n\n #if (e_time<=s_time) && (e_time == 0 || e_time == 1)\n # #errors.add :due_date, :greater_than_start_date\n # end_time = Issue.time_list[e_time+48] #assuming user knows what he's doing, automatically adjusts the time to next day\n #end\n\n if self.end_time and self.start_time and self.end_time <= self.start_time\n errors.add :due_date, :greater_than_start_date\n end\n\n end",
"def date_or_datetime_input(method, options)\n position = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 }\n i18n_date_order = ::I18n.t(:order, :scope => [:date])\n i18n_date_order = nil unless i18n_date_order.is_a?(Array)\n inputs = options.delete(:order) || i18n_date_order || [:year, :month, :day]\n\n time_inputs = [:hour, :minute]\n time_inputs << [:second] if options[:include_seconds]\n\n list_items_capture = \"\"\n hidden_fields_capture = \"\"\n\n default_time = options.has_key?(:selected) ? options[:selected] : ::Time.now\n \n # Gets the datetime object. It can be a Fixnum, Date or Time, or nil.\n datetime = options[:selected] || (@object ? @object.send(method) : default_time) || default_time\n \n html_options = options.delete(:input_html) || {}\n input_ids = []\n\n (inputs + time_inputs).each do |input|\n input_ids << input_id = generate_html_id(method, \"#{position[input]}i\")\n\n field_name = \"#{method}(#{position[input]}i)\"\n if options[:\"discard_#{input}\"]\n break if time_inputs.include?(input)\n\n hidden_value = datetime.respond_to?(input) ? datetime.send(input.to_sym) : datetime\n hidden_fields_capture << template.hidden_field_tag(\"#{@object_name}[#{field_name}]\", (hidden_value || 1), :id => input_id)\n else\n opts = strip_formtastic_options(options).merge(:prefix => @object_name, :field_name => field_name, :default => datetime)\n item_label_text = ::I18n.t(input.to_s, :default => input.to_s.humanize, :scope => [:datetime, :prompts])\n\n list_items_capture << template.content_tag(:li,\n template.content_tag(:label, item_label_text, :for => input_id) <<\n template.send(:\"select_#{input}\", datetime, opts, html_options.merge(:id => input_id))\n )\n end\n end\n\n hidden_fields_capture << field_set_and_list_wrapping_for_method(method, options.merge(:label_for => input_ids.first), list_items_capture)\n end",
"def time_html( day, second, time_start_stop)\n time_html = \"\"\n \n time_html += create_select(day, second, time_start_stop, \"hour\")\n \ttime_html += create_select(day, second, time_start_stop, \"min\")\n \n return time_html.html_safe\n end",
"def form_setup\n\t\t@times = Lovs.time_array(15)\n\tend",
"def time_field(name, *args)\n options = args[0]\n options[:id] ||= @object_name + \"_#{name}\"\n script = %(\n $(document).ready(function () {\n initBootstrapTimePicker(\"#{options[:id]}\");\n });\n )\n content_tag :div, class: \"form-group\" do\n label(name, class: \"control-label col-sm-3\") +\n content_tag(:div, class: \"col-sm-6\") do\n content_tag :div, class: \"input-group bootstrap-timepicker\" do\n native_text_field(name, *args) + javascript_tag(script) +\n content_tag(:span, class: \"input-group-addon\") do\n content_tag(\"i\", class: \"fa fa-clock-o\") {}\n end\n end\n end\n end\n end",
"def select_hour(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def out_of_bounds_time_format; end",
"def time_select(time, options = {})\n raise 'No name provided to time_select' unless name = options[:name]\n time ||= Time.now\n %{\n <select id=\"#{name}.hour\" name=\"#{name}.hour\">\n #{options(:labels_values => (1..60).to_a, :selected => time.hour)} \n </select> \n <select id=\"#{name}.min\" name=\"#{name}.min\">\n #{options(:labels_values => (1..60).to_a, :selected => time.min)} \n </select>}\n end",
"def time_field(field, options={})\n options.reverse_merge!(:value => field_value(field) ? field_value(field).to_time.strftime(\"%H:%M\") : nil, :id => field_id(field))\n options[:class] = 'time_field'\n options.merge!(:class => field_error(field, options))\n @template.time_field_tag field_name(field), options\n end",
"def job_time(value)\n @form['581'] = value\n end",
"def format_time_from_hour hour\n hrs = hour.to_i\n min = ((hour - hrs) * 60.0 + 0.5).to_i\n \"%2d:%02d\" % [hrs, min]\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def fix_time_post!(params, create = false)\r\n #KS- don't do anything if there are no relevant parameters -- useful for links\r\n #that change stuff like place without having to specify all the time crud\r\n return if !create &&\r\n params[:timeperiod].nil? &&\r\n params[:dateperiod].nil? &&\r\n params[:date_year].nil? &&\r\n params[:date_month].nil? &&\r\n params[:date_day].nil? &&\r\n params[:plan_hour].nil? &&\r\n params[:plan_min].nil?\r\n\r\n today = current_timezone.now\r\n #MGS - fuzzy time option is selected\r\n if 0 != params[:timeperiod].to_i\r\n #MGS- fuzzy time\r\n time_info = params[:timeperiod].to_i\r\n else\r\n #MGS- exact time\r\n hour = params[:plan_hour]\r\n min = params[:plan_min]\r\n\r\n #MGS- we currently have little patience for incorrect times\r\n # set to TIME_DESCRIPTION_DINNER if the data looks invalid\r\n #MGS TODO- Currently dont allow 24 hr times, should we?\r\n if hour.nil? || !(1..12).include?(hour.to_i) || min.nil? || !(0..59).include?(min.to_i)\r\n time_info = Plan::TIME_DESCRIPTION_DINNER\r\n else\r\n hour = Time::correct_hour_for_meridian(hour.to_i, params[:plan_meridian])\r\n time_info = [hour, min, 0]\r\n end\r\n end\r\n #MGS - fuzzy date option is selected\r\n if 0 != params[:dateperiod].to_i\r\n if params[:dateperiod].include? \"\\/\"\r\n #MGS- handle the special case, where specific dates are included in the dateperiod dropdown\r\n date_info = ParseDate.parsedate(params['dateperiod'])\r\n else\r\n #MGS- fuzzy date\r\n date_info = params[:dateperiod].to_i\r\n end\r\n else\r\n #MGS- exact date\r\n year = params[:date_year]\r\n mon = params[:date_month]\r\n day = params[:date_day]\r\n\r\n #MGS- a bunch of datehandling here; instead of prompting user's to fix their specific dates,\r\n # we're going to try to do some pseudo-intelligent defaulting\r\n #MGS-validate year\r\n if year.nil? || year.to_i == 0\r\n #MGS- if the year is blank or some non-numeric value, default it to the current year\r\n # to_i will return 0 if called on a string that's non-numeric\r\n # if characters other than numbers are entered, we set the year to the current year\r\n year = today.year\r\n else\r\n #MGS- check the length of the year, if its 2....user must have only entered a two digit year\r\n # we'll assume they entered the last two digits of the year and handle it accordingly\r\n if (year.length == 2)\r\n year = today.year.to_s[1,2] + year\r\n elsif year.length != 4\r\n #MGS- if they only entered 1 or 3 digits for the year, they're hopeless....and getting the current year set\r\n year = today.year\r\n end\r\n end\r\n\r\n #MGS- validate month\r\n if mon.nil? || mon.to_i == 0 || !(1..12).include?(mon.to_i)\r\n mon = today.mon\r\n end\r\n #MGS- validate day\r\n if day.nil? || day.to_i == 0 || !(1..31).include?(day.to_i)\r\n day = today.day\r\n else\r\n #MGS- do something pretty simple to make sure they entered no more than the right number of days in a month\r\n # Date.civil doesn't increment the month automatically for you, so using Time.utc\r\n new_time = current_timezone.utc_to_local(Time.utc(year, mon, day, 12, 0, 0, 0))\r\n mon = new_time.mon if new_time.mon != mon\r\n day = new_time.day if new_time.day != day\r\n year = new_time.year if new_time.year != year\r\n end\r\n date_info = [year, mon, day]\r\n end\r\n\r\n @plan.set_datetime(current_timezone, date_info, time_info)\r\n end",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate start_date and start_time\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") \n\t\t\t#variable that holds the time 12 hours from now\n\t\t\tstart_at_plus_12_hours = Time.now + (12.hours)\n\t\t\tif start_at <= Time.now\n\t\t\t\terrors.add(:start_date, \"Please do not enter a past date or past time.\")\n\t\t\t\terrors.add(:start_time, \"Please do not enter a past date or past time.\")\n\t\t\telsif start_at < start_at_plus_12_hours \n\t\t\t\terrors.add(:start_date, \"Please only enter a time 12 hours from now\")\n\t\t\tend\n\t\tend\n\tend",
"def sql_datetime_minute_mask\n case session[:database][:locale]\n when \"de\" then \"DD.MM.YYYY HH24:MI\"\n when \"en\" then \"YYYY-MM-DD HH24:MI\"\n else \"DD.MM.YYYY HH24:MI\" # Deutsche Variante als default\n end\n end",
"def restaurant_time_select\n\t\ttimes = (0..23).map { |hour| [formatted_time(hour), hour] }\n\tend",
"def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash['p']\n time = ''\n time += hours[0] + minutes[0] + ' ' + ampm[0] + \"\\n\"\n time += hours[1] + minutes[1] + ' ' + ampm[1] + \"\\n\"\n time += hours[2] + minutes[2] + ' ' + ampm[2] + \"\\n\"\n time\n end",
"def ask_time\n # twelve\n end",
"def hour\n hour? ? at_hour : super\n end",
"def hours() 60 * minutes end",
"def meridiem\n hour_24 / 12\n end",
"def hour\n self.range('hour')\n end",
"def set_clocks\n now = DateTime.now\n $current_time.value = now.strftime(DateTimeFormat)\n $universal_time.value = now.new_offset.strftime(DateTimeFormat)\n $lunar_date.value = '%4d\\'%02d\\'%02d' % LunarYear.lunar_date(now.to_date)\n now\nend",
"def time_of_day(min)\n hours_num, minutes = min.divmod(60)\n hour = hours_num % 24\n format(\"%02d:%02d\", hour, minutes)\nend",
"def initialize(hour24, min, sec)\n @hour24 = hour24\n @min = min\n @sec = sec\n end",
"def get_time(integer_time_slot)\n\t\tif integer_time_slot > 60 * 12\n\t\t\tinteger_time_slot = integer_time_slot - 60 * 12\n\t\t\tminutes = integer_time_slot % 60\n\t\t\tminutes = if minutes < 10 then \"0#{minutes}\" else \"#{minutes}\" end\n\t\t\t(integer_time_slot / 60).to_s + \":\" + minutes + \" PM\"\n\t\telse\n\t\t\tminutes = integer_time_slot % 60\n\t\t\tminutes = if minutes < 10 then \"0#{minutes}\" else \"#{minutes}\" end\n\t\t\t(integer_time_slot / 60).to_s + \":\" + minutes + \" AM\"\n\t\tend\n\tend",
"def meridiem\n if self.hour > 12 || self.hour == 0\n :pm\n else\n :am\n end\n end",
"def prep_time_passed\n return \"7:34\"\n end",
"def date_input(method, options)\n options = set_include_blank(options)\n date_or_datetime_input(method, options.merge(:discard_hour => true))\n end",
"def get_hour\n self.hr.strftime(\"%H\").to_i + self.hr.strftime(\"%M\").to_d/60\n end",
"def day_month_year_hour_minute\n I18n.locale.to_s == 'pt' ? \"%d/%m/%Y %H:%M\" : \"%m/%d/%Y %I:%M %P\"\n end",
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def select_time(time, options)\n time = Time.zone.parse(time)\n base_dom_id = get_base_dom_id_from_label_tag(options[:from])\n\n find(:xpath, \".//select[@id='#{base_dom_id}_4i']\").select(time.hour.to_s.rjust(2, '0'))\n find(:xpath, \".//select[@id='#{base_dom_id}_5i']\").select(time.min.to_s.rjust(2, '0'))\n end",
"def approach_time_format\n \"%b %e, %Y %l:%M%p\"\n end",
"def build_form(form_builder, options)\n set_value_in_hash options\n value = CckForms::ParameterTypeClass::Time::date_object_from_what_stored_in_database(options[:value])\n form_element_options, form_element_html = CckForms::ParameterTypeClass::Time.default_options_for_date_time_selectors(value, options)\n form_element_options.merge!({minute_step: 5})\n form_element_html.merge!({required: options[:required]})\n ('<div class=\"form-inline\">%s</div>' % form_builder.fields_for(:value) { |datetime_builder| datetime_builder.datetime_select '', form_element_options, form_element_html})\n end",
"def initialize(time_of_day)\n match = /^([0-2]?\\d):([0-5]\\d)$/.match(time_of_day)\n raise InvalidTimeOfDayFormat if match.nil?\n @hour = match[1].to_i\n @minute = match[2].to_i\n raise InvalidTimeOfDayFormat if (@hour > HOURS_ONE_DAY) || (@hour == HOURS_ONE_DAY && @minute > 0)\n end",
"def show\n @begin = @timed_form.begin\n @countdown_remaining = @timed_form.begin\n \n a = @begin.split(\":\")\n @minutes = a[0].to_i\n @seconds= a[1].to_i\n @time_seconds = -(@minutes * 60 + @seconds) + 600\n @time_format = Time.at(@time_seconds).utc.strftime(\"%M:%S\")\n end",
"def hours ; self * 60.minutes ; end",
"def fmt_time(dt) _format_dt dt, H12_M_PM end",
"def beginning_hour=(string)\n frm.select(:id=>\"release_hour\").select(string)\n end",
"def hour\n components.hour\n end",
"def add_parsed_time_parts(m, h, i=4)\n not_parsed = h[:not_parsed] || []\n hour = m[i].to_i\n meridian = m[i+4]\n hour = hour_with_meridian(hour, /a/io.match(meridian) ? :am : :pm) if meridian\n offset = if of = m[i+5]\n convert_parsed_offset(of)\n else\n not_parsed.concat([:zone, :offset])\n Time.now.utc_offset\n end\n min = m[i+1].to_i\n sec = m[i+2].to_i\n sec_fraction = m[i+3].to_f \n not_parsed << :hour unless m[i]\n not_parsed << :min unless m[i+1]\n not_parsed << :sec unless m[i+2]\n not_parsed << :sec_fraction unless m[i+3]\n h.merge!(:parts=>[hour, min, sec, (sec_fraction/0.000001).to_i], :offset=>offset, :not_parsed=>not_parsed)\n h\n end",
"def time_hour; Time.now.hour; end",
"def time_input_parser\n\tparams[:micropost][:end_time] = parse_end_time(params[:micropost][:end_time])\n end",
"def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0\n time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')\n end\n )\n end",
"def correct_format(string)\n parts = string.split(\"-\")\n if parts[0].include?(\"AM\") then parts[0] = \"#{set_24hour(parts[0].split(\":\").first, false)}:30\" else parts[0] = \"#{set_24hour(parts[0].split(\":\").first)}:30\" end \n if parts[1].include?(\"AM\") then parts[1] = \"#{set_24hour(parts[1].split(\":\").first, false)}:30\" else parts[1] = \"#{set_24hour(parts[1].split(\":\").first)}:30\" end\n parts[2] = what_day(parts[2])\n return \"#{parts[0]}-#{parts[1]}-#{parts[2]}\"\n end",
"def shift_start_hour\n if self.start_time.hour > 2 && self.start_time.hour < 7\n errors.add(:start_time, 'must be between 7am and 2am')\n end \n end",
"def time_to_show\n \n end",
"def hour\n set_function_and_argument(:hour, nil)\n end",
"def in_international_time\n self.strftime(\"%H:%M\")\n end",
"def set_duration\n #These need to be passed on to recreate the original form should cancel then set be pressed\n @object_name = params[:object_name]\n @field_name = params[:field_name]\n @optional = params[:optional]\n @prefix = params[:prefix]\n end",
"def hour_in\n @hour_in ||= time_in.hour\n end",
"def validate_check_in_time\n validate_time(params[:check_in][:check_in_time])\n end",
"def format_time(time)\n hour = time.hour\n min = time.min\n if min >= 30\n hour += 1\n min = 0\n else\n min = 30\n end\n\n d = Time.now\n Time.new(d.year,d.month,d.day,hour,min,0)\n\n end",
"def change_time(hour,min)\n Time.strptime(\"#{hour}:#{min}\", \"%H:%M\")\n end",
"def eats_at\n if meal_time <= 11\n \"#{meal_time + 1}AM\"\n elsif meal_time > 12\n \"#{meal_time - 11}PM\"\n else\n \"Please put a number \"\n end\n end",
"def time_class; end",
"def day_hour_params\n day_hour_params = params.require(:day_hour).permit(:venue_id, :opening_time, :closing_time, :day)\n day_hour_params[:opening_time].sub!(/\\..*/,'')\n day_hour_params[:closing_time].sub!(/\\..*/,'')\n day_hour_params[:day].downcase!\n day_hour_params\n end",
"def hours\n \n end",
"def start_time_input_parser\n\tparams[:micropost][:time] = parse_start_time(params[:micropost][:time])\n end",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def day_and_time(mins)\n (Time.new(2016, 04, 10) + mins*60).strftime(\"%A %H:%M\")\nend",
"def timeofday(input)\n input = input % 1440\n hour, min = input.divmod(60)\n format('%02d:%02d', hour, min)\nend",
"def valid_time?(h, min, s)\n h += 24 if h < 0\n min += 60 if min < 0\n s += 60 if s < 0\n return unless ((0..23) === h &&\n (0..59) === min &&\n (0..59) === s) ||\n (24 == h &&\n 0 == min &&\n 0 == s)\n time_to_day_fraction(h, min, s)\n end",
"def eats_at\n if @meal_time < 12\n return \"#{@meal_time} AM\"\n elsif @meal_time > 12\n return \"#{@meal_time -12} PM\"\n elsif @meal_time==0\n return \"Midnight\"\n else\n return \"Current meal time is invalid.\"\n end\nend",
"def updateLabel(time)\n\t super(\"%02dh %02dm %02ds\" % [time.hour, time.min, time.sec]\t)\n end",
"def to_time(form = :utc)\n ::Time.send(\"#{form}_time\", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0})\n end",
"def end_time_input\n @end_time_input || end_time.try(:strftime, \"%H:%M\")\n end",
"def absolute_time_input(method, options)\n case get_rule(method).visibility\n when :enabled\n return absolute_time_enabled(method, options)\n when :disabled\n return disabled_field(method, options)\n end\n end"
] |
[
"0.6315542",
"0.60712105",
"0.6051282",
"0.5934058",
"0.5899801",
"0.5884512",
"0.5881669",
"0.58720845",
"0.5861623",
"0.5851576",
"0.5851396",
"0.58484447",
"0.5819397",
"0.5792184",
"0.5790428",
"0.57732356",
"0.5757192",
"0.57281387",
"0.57235205",
"0.5705814",
"0.56829953",
"0.56663465",
"0.56503874",
"0.564699",
"0.5615235",
"0.560054",
"0.5580996",
"0.55788016",
"0.55719787",
"0.5571651",
"0.55512",
"0.5550057",
"0.55481386",
"0.55354154",
"0.55281425",
"0.55158925",
"0.5510809",
"0.5508575",
"0.5504624",
"0.5503954",
"0.54960483",
"0.54960483",
"0.54912484",
"0.5459499",
"0.54442555",
"0.5440746",
"0.54395676",
"0.5439027",
"0.54323226",
"0.54253715",
"0.5415554",
"0.5399096",
"0.53946066",
"0.5391024",
"0.5383495",
"0.53824735",
"0.53782976",
"0.5375825",
"0.53734064",
"0.5369928",
"0.5363636",
"0.53589916",
"0.53575116",
"0.5347864",
"0.53363335",
"0.5335693",
"0.5327495",
"0.53135043",
"0.5312726",
"0.52956134",
"0.52935725",
"0.5282116",
"0.52810884",
"0.52796346",
"0.5278887",
"0.52751297",
"0.52733976",
"0.52700317",
"0.5264571",
"0.5263274",
"0.5260933",
"0.525515",
"0.524691",
"0.5244548",
"0.5241382",
"0.5237293",
"0.52360094",
"0.5229986",
"0.52264696",
"0.52255386",
"0.52225715",
"0.52193254",
"0.52161604",
"0.5215091",
"0.52115005",
"0.5207776",
"0.52040863",
"0.52025604",
"0.5199564",
"0.51947814"
] |
0.5790238
|
15
|
Check if the rule is enabled
|
def enabled?
@metadata.fetch(:enabled, true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_matching_rules_are_enabled(rule_state)\n modify_matching_rules(method(:verify_rule_exists_and_is_enabled), rule_state, nil)\n end",
"def verify_rule_exists_and_is_enabled(rule_name, _firewall_name, _data)\n raise \"Firewall rule '#{rule_name}' does not exist so cannot be enabled\" unless firewall_rule_exists?(rule_name)\n rule = parse_firewall_rule(rule_name)\n return if rule['enabled'] == 'yes'\n converge_by \"Enable firewall rule #{rule_name}\" do\n script_code = \"netsh advfirewall firewall set rule name='#{rule_name}' new enable=yes\"\n log_powershell_out('enable', script_code)\n end\n end",
"def enabled?\n true\n end",
"def enabled?; end",
"def enabled?; end",
"def rule?\n kind == :rule\n end",
"def rule_exists?\n # To Action From\n # -- ------ ----\n # 22 ALLOW Anywhere\n # 192.168.0.1 25/tcp DENY 10.0.0.0/8\n shell_out!(\"ufw status\").stdout =~ \n/^(#{@new_resource.destination}\\s)?#{port_and_proto}\\s.*(#{@new_resource.action.to_s})\\s.*#{@new_resource.source || 'Anywhere'}$/i\n end",
"def enabled?()\n #This is a stub, used for indexing\n end",
"def enabled?\n true\n end",
"def enabled?\n true\n end",
"def enabled?\n return enabled\n end",
"def enabled_checks; end",
"def enabled?\n enabled.nil? || enabled\n end",
"def measure\n return :skip if !@rule.enabled? || !@rule.validatable?\n @rule.valid?\n end",
"def enabled?\n config.roadie.enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def include?(rule)\n @rules.key?(rule)\n end",
"def enabled?\n return policy_setting.enabled\n end",
"def enabled?(*)\n true\n end",
"def enabled?\n enabled = :false\n rcstatus('-C', '-a').each_line do |line|\n case line.chomp\n when /^Runlevel: /\n enabled = :true\n when /^\\S+/ # caption of a dynamic runlevel\n enabled = :false\n when self.class::STATUSLINE\n return enabled if @resource[:name] == $1\n end\n end\n :false\n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n\n return @enabled\n\n end",
"def active?\n enabled\n end",
"def has_rule?(name)\n rules.key?(name.to_sym)\n end",
"def has_rule?(name)\n rules.key?(name.to_sym)\n end",
"def enable?\n return false if eval_shop_condition(@disable_condition)\n return true\n end",
"def enabled?\n @enabled != false\n end",
"def enabled?\n !@test_mode || @test_mode == :enabled\n end",
"def enabled?\n !!PaperTrail.config.enabled\n end",
"def manual_enabled?\n return true\n end",
"def enabled?\n !!configuration.enabled\n end",
"def protected\n match(/has\\s(enabled)\\snick\\sprotection/) ? true : false\n end",
"def enabled?\n !!@enabled\n end",
"def enable?(item)\n item.enabled?\n end",
"def enable?(item)\n item.enabled?\n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n @enabled || false\n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n inclusively { @enabled }\n end",
"def enabled?\n status == 'enabled'\n end",
"def enabled?\n if $game_system != nil && self.tag != nil &&\n $game_system.enabling_options[self.tag] == false\n return false\n end\n return true if @enabled_condition.nil?\n eval(@enabled_condition)\n end",
"def enabled?\n any?(&:enabled?)\n end",
"def valid_rule?(rule)\n RULES.key?(rule.to_sym)\n end",
"def enabled?\n if $game_system != nil && self.tag != nil &&\n $game_system.enabling_options[self.tag] == false\n return false\n end\n return true if @enabled_condition.nil?\n return eval(@enabled_condition)\n end",
"def enabled\n !false?(configuration[:enabled])\n end",
"def enabled?\n false\n end",
"def verify_rule_exists_and_is_disabled(rule_name, _firewall_name, _data)\n raise \"Firewall rule '#{rule_name}' does not exist so cannot be disabled\" unless firewall_rule_exists?(rule_name)\n rule = parse_firewall_rule(rule_name)\n return if rule['enabled'] == 'no'\n converge_by \"Disable firewall rule #{rule_name}\" do\n script_code = \"netsh advfirewall firewall set rule name='#{rule_name}' new enable=no\"\n log_powershell_out('disable', script_code)\n end\n end",
"def enabled?\n state.nonzero?\n end",
"def enabled?(hook)\n @callbacks.key? hook\n end",
"def enabled?\n false\n end",
"def use?\n inclusively { enabled? && needed? }\n end",
"def required?\n @rule == :required\n end",
"def enabled; end",
"def enabled; end",
"def enabled; end",
"def enabled; end",
"def rule_exists?\n Chef::Log.info(\"#{new_resource.name} rule_exists?\")\n # To Action From\n # -- ------ ----\n # 22 ALLOW Anywhere\n # 192.168.0.1 25/tcp DENY 10.0.0.0/8\n # 22 ALLOW Anywhere\n # 3309 on eth9 ALLOW Anywhere\n # Anywhere ALLOW Anywhere\n # 80 ALLOW Anywhere (log)\n # 8080 DENY 192.168.1.0/24\n # 1.2.3.5 5469/udp ALLOW 1.2.3.4 5469/udp\n # 3308 ALLOW OUT Anywhere on eth8\n\n to = rule_exists_to? # col 1\n action = rule_exists_action? # col 2\n from = rule_exists_from? # col 3\n\n # full regex from columns\n regex = rule_exists_regex?(to, action, from)\n\n match = shell_out!('ufw', 'status').stdout.lines.find do |line|\n # TODO: support IPv6\n return false if line =~ /\\(v6\\)$/\n line =~ regex\n end\n\n match\n end",
"def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end",
"def ok_enabled?\r\n return true\r\n end",
"def tool_enabled?(tool)\n options[\"#{tool}_enabled\"].to_i == 1\n end",
"def enable?(skill)\n return @actor.skill_can_use?(skill)\n end",
"def threshold_enabled?\n @enable_threshold\n end",
"def enabled?\n- rcfile = File.join(@@rcconf_dir, @model[:name])\n+ rcfile = self.rcfile\n if File.exists?(rcfile)\n return :true\n end\n@@ -40,8 +44,8 @@\n if not File.exists?(@@rcconf_dir)\n Dir.mkdir(@@rcconf_dir)\n end\n- rcfile = File.join(@@rcconf_dir, @model[:name])\n- open(rcfile, 'w') { |f| f << \"%s_enable=\\\"YES\\\"\\n\" % @model[:name] }\n+ rcfile = self.rcfile\n+ open(rcfile, 'w') { |f| f << \"%s_enable=\\\"YES\\\"\\n\" % @model[:name].gsub(/-/, \"_\") }\n end",
"def enabled?\n !host.nil?\n end",
"def reportable?\n enable_learner_state\n end",
"def enabled?\n exists? && cmd(\"link show up\", sudo: false).include?(name)\n end",
"def has_activate_gold_status_link?\n has_css? @activate_gold_status_link\n end",
"def enabled\n if @property_hash[:enabled].nil?\n :absent\n else\n @property_hash[:enabled]\n end\n end",
"def enabled?\n !!store[:enabled]\n end",
"def valid?\n return false if @enabled.nil?\n return false if @on_scan_repeat.nil?\n return false if @start.nil?\n true\n end",
"def enabled?(thing = nil)\n instrument(:enabled?, thing) { |payload|\n gate_values = adapter.get(self)\n\n gate = gates.detect { |gate|\n gate.open?(thing, gate_values[gate.key])\n }\n\n if gate.nil?\n false\n else\n payload[:gate_name] = gate.name\n true\n end\n }\n end",
"def enabled?\n REAPERS.include?(reaper)\n end",
"def enabled\n select(&:enabled?)\n end",
"def error_on_disabled?\n false\n end",
"def enabled!\n self\n end",
"def enable?(item)\n return true\n end",
"def enable?(item)\n return true\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled; self.settings[:enabled]; end",
"def enabled_all?; end",
"def enable?(item)\n end",
"def verify_matching_rules_are_disabled(rule_state)\n modify_matching_rules(method(:verify_rule_exists_and_is_disabled), rule_state, nil)\n end",
"def enabled?\n !@playground.collecting? || (active? && connection.is_experiment_enabled?(@id))\n end",
"def enabled?(mailing)\n dripper.run_callbacks(:before_drip, self, mailing)\n\n DripEvaluator.new(mailing).call(&@block)\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def enable?(item)\n true\n end",
"def enable?(item)\n true\n end"
] |
[
"0.70113635",
"0.6768937",
"0.66756785",
"0.6654105",
"0.6654105",
"0.6648568",
"0.6600669",
"0.6541667",
"0.6504297",
"0.6504297",
"0.64850235",
"0.6483539",
"0.6482845",
"0.64401436",
"0.6406674",
"0.6405627",
"0.6405627",
"0.6405627",
"0.6405627",
"0.6397248",
"0.6392036",
"0.63855326",
"0.6355791",
"0.6315978",
"0.6315978",
"0.63149506",
"0.6314339",
"0.63086903",
"0.63086903",
"0.63059425",
"0.63052547",
"0.63037723",
"0.6301011",
"0.6299993",
"0.6295242",
"0.6279176",
"0.6278023",
"0.62771404",
"0.62771404",
"0.62640953",
"0.62640953",
"0.62581044",
"0.62545884",
"0.62545884",
"0.62456137",
"0.62344694",
"0.61982936",
"0.6185278",
"0.6143259",
"0.6142809",
"0.61362237",
"0.6134619",
"0.6133183",
"0.6115189",
"0.61090803",
"0.61038274",
"0.6103727",
"0.60946625",
"0.60923994",
"0.60923994",
"0.60923994",
"0.60923994",
"0.6083527",
"0.6065948",
"0.6059487",
"0.60407764",
"0.6036751",
"0.6031325",
"0.60287076",
"0.6021192",
"0.5997599",
"0.59951633",
"0.59941137",
"0.5988889",
"0.59765625",
"0.5955264",
"0.594569",
"0.59358275",
"0.59320605",
"0.5930809",
"0.59270954",
"0.59173834",
"0.59173834",
"0.5914444",
"0.5914444",
"0.5914444",
"0.5913006",
"0.5892872",
"0.5888108",
"0.58875144",
"0.5883754",
"0.58762056",
"0.58745664",
"0.58745664",
"0.58745664",
"0.58745664",
"0.58745664",
"0.58745664",
"0.58745664",
"0.58739185",
"0.58739185"
] |
0.0
|
-1
|
ScrapsController > show_scrap_topic : Render scrap topic to browser
|
def show_scrap_topic
render_404 and return if @scrap_topic.nil?
@scraps = @scrap_topic.scraps if @scrap_topic
flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0
respond_to do |format|
format.html { render :action => 'scrap_topic' and return }
format.js { render :action => 'scrap_topic', :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def display_inline_scrap_topic\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end",
"def show\n load_topic\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @page_title = \"Topic Show: #{@topic.topic_name}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n \n end\n end",
"def show\n @text_topic = TextTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @text_topic }\n end\n end",
"def show\n @cultural_heritage_topic = CulturalHeritage::Topic.find(params[:id])\n @title_view = \"Temas\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_topic }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @trending_topic = TrendingTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trending_topic }\n end\n end",
"def show\n @thoughts = @topic.thoughts if @topic\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic.to_xml( :include => :thoughts ) }\n end\n end",
"def view\n get_topic(@current_id, :resolve => false)\n get_complete_topic(@current_id, :resolve => false)\n get_related_for_current\n end",
"def show\n @topic = Topic.find(params[:id])\n render 'api/v1/topics/show'\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @question_topic = QuestionTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_topic }\n end\n end",
"def show\n @search_topic = SearchTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search_topic }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forum_topic }\n end\n end",
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def show\n @topic = @board.topics.find_by_content_id(params[:id])\n \n last_reaction = @topic.content.replies.find :last\n @topic.read_reaction @current_user, last_reaction\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end",
"def show_topic_all_tests\n @topic = Topic.find_by_slug!(params[:topic_slug])\n \n if @topic\n @quizzes = Quiz.store_topic_quizzes(current_user,@topic)\n @quizzes = load_words_for_quizzes(@quizzes)\n @name = @topic.name\n else\n @quizzes = []\n end\n \n render \"show_all_tests\"\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @topicdetail = Topicdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topicdetail }\n end\n end",
"def view_replies(topic_title)\n self.h1(:class=>\"discussion_topic_subject\", :text=>topic_title).parent.button(:class=>\"discussion_show_topic_replies s3d-button s3d-link-button\").click\n \n end",
"def show\n @recommend_recommend_subject = Recommend::RecommendSubject.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_subject_path(@recommend_recommend_subject)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend_recommend_subject }\n end\n end",
"def show\n @topiccluster = Topiccluster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topiccluster }\n end\n end",
"def show\n @question = @page.questions.find(params[:id])\n session[:breadcrumbs].add \"#{@question.short_title}\"\n\n initialize_fake_app_for_preview\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def show\n respond_with @topic.posts\n end",
"def show\n @topic = Topic.find_by_name(params[:id])\n # @topic = Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @subsubtopic = Subsubtopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subsubtopic }\n end\n end",
"def show\n \t@tutorial = Tutorial.find_by_permalink(params[:id])\n @steps = @tutorial.steps\n @next = @steps[0]\n @title = \"#{@tutorial.name} - A Ruby on Rails tutorial\"\n @content = \"Building a forum application from scratch using Ruby on Rails 3\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def show\n @lda_post_topic = LdaPostTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lda_post_topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n\n if @topic.title == nil\n redirect_to serie_path(Serie.find_by_topic_id(@topic.id))\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end\n end",
"def show\n @data_topic = DataTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_topic }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @posts = Post.getTopicPosts(params)\n respond_with(@topic)\n end",
"def show\n @content_node = ContentNode.find(params[:id])\n @title = \"Viewing '#{@content_node.title}' \"\n end",
"def show\n @subtopic = Subtopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subtopic }\n end\n end",
"def index\n respond_with SeabTopic.all\n end",
"def show\n @subject = Subject.find_by_hashed_id(params[:id])\n page_title([\"Subject\", @subject.name])\n respond_to do |format|\n format.html { render :layout => 'application' }\n end\n end",
"def show\n @topic = Topic.find(params[:topic_id])\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @forum = Forum.find(params[:forum_id])\n @messages = @topic.messages.accessible_by(current_ability).page params[:page]\n @feed_link = forum_topic_url(@forum, @topic, :format => :atom)\n\n if current_user\n @topic.mark_as_read! :for => current_user\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n format.atom { render :layout => false }\n end\n end",
"def show\n @forum = Forum.find(params[:id])\n\t\t@topics = Topic.find_all_by_forum_id(@forum.id)\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forum }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n format.csv { render text: Topic.to_csv }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @post = Post.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n\n\t\t@topic = Topic.find(params[:id])\n\t\tsession[:topic_id] = @topic.id\n\n\t\treturn @topic\n\n\tend",
"def show\n @topic_comment = TopicComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_comment }\n end\n end",
"def show\n render :json => Topic.find(params[:id]) \n end",
"def show\n @topic = Topic.find(params[:id])\n @sketches = @topic.sketches.includes(:artist).order('upload_date, artists.name')\n @sketch = Sketch.new(:topic_id => @topic.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n # HTML response for the first time landing on a level, JS thereafter. \n respond_to :html, :js \n\n # begin \n @topic = Topic.find(params[:id])\n params[:id] = @topic.id\n @level = params[:forLevel].to_i\n\n # Attempt to get the paths for this topic and level. Returns nil if files not found.\n @paths = @topic.paths[@level]\n\n # Get current part, if it exists, or initialise to 0.\n @currentPart = ((p = params[:currentPart]) ? p.to_i : 0)\n path = @paths[@currentPart]\n @flatHTMLString = File.read(path)\n\n if not File.exist?(path)\n redirect_to @topic \n flash[:error] = \"Error loading #{path}\"\n return \n end \n\n # If this is the last page of the level, set the level as viewed\n if @currentPart + 1 == @paths.count\n current_user.setLevelViewed(@topic.id, @level) unless (current_user.inAdminMode || current_user.revisionMode) \n end\n\n end",
"def show\n\t\trender json:Screencast.find(params[:id])\n\tend",
"def index\n session[:return_to] = topics_path\n session[:view_style] = 'topic'\n @topics = Topic.find(:all, :conditions => 'parent_id is null')\n @topic_news = Message.find :all, :conditions => \"message_type = 'topic'\", :order => 'created_at DESC', :limit => 6\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topics }\n end\n end",
"def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"def show\n @forum = TogForum::Forum.find_by_id(params[:id]) || TogForum::Forum.top_level\n \n @order = params[:order] || 'tog_forum_topics.title' #'tog_forum_topics.current_rating'\n\n @page = params[:page] || '1'\n @asc = (params[:asc] and params[:asc] == \"desc\") ? \"asc\" : 'desc'\n\n @topics = TogForum::Topic.paginate :per_page => Tog::Config[\"plugins.tog_forum.topics.list.page.size\"],\n :page => @page,\n :conditions => ['tog_forum_topics.forum_id = ?', @forum.id],\n :order => @order + \" \" + @asc\n \n respond_to do |format|\n format.js { render :partial => \"/forums/partials/topics_paginated\" }\n format.html\n format.rss { render :rss => @forum }\n end\n end",
"def show\n render_404 and return if @scrap.nil?\n respond_to do |format|\n format.html { redirect_to show_scrap_path(@scrap.slug) and return }\n format.js { render :action => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end",
"def show\n session[:target_message_id] = params[:id]\n @topic = Topic.find_by_id params[:id]\n @messages = @topic.posts.paginate :page => params[:page]||1, :order => 'updated_at DESC'\n @message = Message.new\n session[:view_style] = 'topic'\n session[:message_type] = 'topic'\n session[:return_to] = topic_url(@topic)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @screencast = Screencast.find_by_permalink(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @screencast }\n end\n end",
"def index\n @topics = @category.topics.preload(:category)\n render 'api/v1/topics/index'\n end",
"def show\n @topic = @parent.children.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def show\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def show\n @page = params[:page] || '1'\n @asc = (params[:asc] and params[:asc] == \"desc\") ? \"asc\" : 'desc'\n\n @forum = TogForum::Forum.find(params[:id])\n @topics = TogForum::Topic.paginate :per_page => Tog::Config[\"plugins.tog_social.profile.list.page.size\"],\n :page => @page,\n :conditions => ['tog_forum_topics.forum_id = ?', @forum.id]\n \n respond_to do |format|\n format.js { render :partial => \"/forums/partials/topics_paginated\" }\n format.html\n format.rss { render :rss => @forum }\n end\n end",
"def show\n @interesting_tweets = InterestingTweet.all\n @reply = Reply.new\n render 'show_fake'\n end",
"def show\n @tweets_chosen_thread = TweetsChosenThread.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tweets_chosen_thread }\n end\n end",
"def show\n @community_topic = CommunityTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_topic }\n end\n end",
"def show\n @tweets_chosen_thread = TweetsChosenThread.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tweets_chosen_thread }\n end\n end",
"def latest_topics_rss\r\n @title = \"The Latest Discussions\"\r\n @topics = Topic.paginate_all(20, @cobrand)\r\n render :template => \"common/topics_rss\", :layout => false\r\n end",
"def show\n topic = Topic.find(params[:topic_id])\n post = topic.posts.find(params[:id])\n @presenter = PostsShowPresenter.new(topic, post)\n end",
"def show\n @student = @topic.student\n end",
"def show\n @story_text = StoryText.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story_text }\n end\n end",
"def show\n @neighborhood_topic = NeighborhoodTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood_topic }\n end\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def show\n @topic = Topic.find(params[:topic_id])\n @post = Post.find(params[:id])\n end",
"def show\n @crawler_article = CrawlerArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @topiclike = @topic.likeable.to_s.split.length\n @time = 3600 - (Time.now.min * 60 + Time.now.sec)\n\n render :template => 'home/index'\n end",
"def show\n @topic_attribute = TopicAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_attribute }\n end\n end",
"def show \n meta :title => \"Parlio - Iniciativas relacionadas con #{@topic.name}\"\n @initiatives = @topic.initiatives.paginate :per_page => 5, :page => params[:page]\n @tags = @topic.initiatives.map{|i| i.tags}.flatten.uniq\n @most_active_parliamentarians = @topic.most_active_parliamentarians\n \n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @topic }\n wants.atom { render(:layout => false) }\n end\n end",
"def show\n\n \n end",
"def show # show => display individual article as requested\n # @variable is an instance variable supaya bisa dipake di html.erb\n end",
"def show\n @reply = @topic.replies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reply }\n end\n end",
"def show\n @page_title = @tutorial.title\n @seo_keywords = @tutorial.body\n end",
"def show\n @topic = Topic.find(params[:id])\n\t\t@page = params[:page].to_i\n\t\tif (@page == 0)\n\t\t\t@posts = @topic.posts.paginate :page => :last, :order => 'created_at ASC', :per_page => 10\n\t\telse\n\t\t\t@posts = @topic.posts.paginate :page => @page, :order => 'created_at ASC', :per_page => 10\n\t\tend\n respond_to do |format|\n format.html do\n\t\t\t\tupdate_last_seen_at\n\t\t\t\t(session[:topics] ||= {})[@topic.id] = Time.now\n\t\t\t\t@topic.hit! \n\t\t\tend\n format.js do\n render :update do |page|\n page.replace_html 'posts', :partial => \"posts/list\"\n end\n end\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topics }\n end\n end",
"def show\n @story = Story.find_by_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n\n # extract the content\n extract_content\n generate_titles\n\n rescue ActiveRecord::RecordNotFound\n\n not_found and return\n\n end",
"def show\n @page_title = @recommendation.movie.title\n end",
"def show\n @title = t 'conclusion_draft_review.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n build do\n message 'Заказ покупателя детально'\n view 'consumer/asks/show'\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @software_training_class }\n end\n end",
"def index\n @class_topics = ClassTopic.all\n end",
"def show\n @title = @content.title\n end",
"def topic\n begin\n @topic = @owner.topics.find(params[:id])\n rescue render_return\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topics }\n end\n end",
"def index\n # require 'pry'\n # binding.pry\n handle_search_name\n handle_filters\n @topics = Topic.all\n end",
"def topics\n client = Comments.discourse\n @topics = client.latest_topics\n respond_to do |fmt|\n fmt.js { }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @forum = Forum.find(@topic.forum_id)\n @posts = Post.where(:topic_id => @topic.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @title = [@teach.course.to_s, @content.to_s].join(' | ')\n\n @content.visited_by(current_user)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @title = @case_study.title\n @case_studies = @case_study.find_related_tags\n @pages = Page.tagged_with(@case_study.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:case_studies:#{@case_study.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:case_studies:#{@case_study.id}\", 300, @case_study.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@case_study)}';</script></body></html>\", content_type: :html) and return\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @comments = @topic.comments\n end"
] |
[
"0.7173283",
"0.6974418",
"0.6898802",
"0.6822776",
"0.67724544",
"0.6731785",
"0.66351664",
"0.66268706",
"0.660618",
"0.6552798",
"0.6542236",
"0.6542236",
"0.6542236",
"0.6542236",
"0.65344536",
"0.65113366",
"0.6502551",
"0.64953625",
"0.64294374",
"0.6399049",
"0.63718766",
"0.635403",
"0.635403",
"0.635403",
"0.635403",
"0.6325699",
"0.62762433",
"0.6261184",
"0.6239334",
"0.62299776",
"0.6228842",
"0.6225493",
"0.621675",
"0.62166286",
"0.62140846",
"0.6206084",
"0.620035",
"0.6174664",
"0.61728793",
"0.61669874",
"0.6151562",
"0.61512774",
"0.6140883",
"0.612948",
"0.6123718",
"0.6112053",
"0.60973173",
"0.60708266",
"0.60686225",
"0.6067844",
"0.60602283",
"0.6052091",
"0.6051258",
"0.60422903",
"0.6038127",
"0.60312414",
"0.60263544",
"0.6008481",
"0.5990734",
"0.5989369",
"0.5977644",
"0.5972753",
"0.5972498",
"0.5969963",
"0.5964984",
"0.5964834",
"0.5964596",
"0.5963654",
"0.5958324",
"0.59549326",
"0.5948753",
"0.59487176",
"0.5943908",
"0.5941793",
"0.5938199",
"0.5935446",
"0.59320116",
"0.5919242",
"0.5909818",
"0.59088016",
"0.5895427",
"0.5891379",
"0.58848697",
"0.5873865",
"0.5870541",
"0.5861311",
"0.586049",
"0.5859506",
"0.58559155",
"0.5853528",
"0.5850708",
"0.58432794",
"0.58419347",
"0.5835775",
"0.5833639",
"0.5827301",
"0.5820958",
"0.58196795",
"0.5818708",
"0.58178216"
] |
0.7615448
|
0
|
ScrapsController > new_scrap_topic : Render new scrap topic form to browser
|
def new_scrap_topic
@scrap_topic = ScrapTopic.new
respond_to do |format|
format.html { return }
format.js { render :action => 'new_scrap_topic', :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_topic\n click_link 'Add Topic' \n within 'form' do\n fill_in( 'Title', with: 'Shoes' )\n fill_in( 'Description', with: 'Shoes of desire' )\n click_button 'save' \n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def show_scrap_topic\n render_404 and return if @scrap_topic.nil?\n @scraps = @scrap_topic.scraps if @scrap_topic\n\n flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0\n respond_to do |format|\n format.html { render :action => 'scrap_topic' and return }\n format.js { render :action => 'scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n return if cancelled?\n begin\n if params[:scrap][:type] == \"ParallelText\"\n @scrap = ParallelText.new(params[:scrap])\n @scrap.scrap_topic = Corpus.by_language(params[:scrap][:language_id])\n else\n if params[:scrap][:type] == \"Definition\"\n @scrap = Definition.new(params[:scrap])\n elsif params[:scrap][:type] == \"Webscrap\"\n @scrap = Webscrap.new(params[:scrap])\n elsif params[:scrap][:type] == \"Bookmark\"\n @scrap = Bookmark.new(params[:scrap])\n else\n @scrap = Note.new(params[:scrap])\n end\n if @scrap_topic.nil? or @scrap_topic.id == nil\n #Initiatlize a new scrap topic!\n @scrap.scrap_topic = init_scrap_topic(params[:scrap_topic_title], current_user.id)\n else\n #Assign existing scrap topic\n @scrap.scrap_topic = @scrap_topic\n end\n end\n @scrap.save!(current_user)\n if @scrap.class.to_s ==\"ParallelText\"\n respond_to do |format|\n format.html { redirect_to show_scrap_path(@scrap.slug) and return }\n format.js { render :action => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n else\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if !@scrap_topic.scraps.nil?; render :action => \"scrap_topic\", :layout => false and return }\n format.xml { return }\n end\n end\n \n rescue\n #\n # Re-Display On Error \n respond_to do |format|\n format.html { render :action => \"new\" and return }\n format.js { render :partial => \"scrap_form\", :layout => false and return }\n format.xml { return }\n end\n end\n end",
"def new\n @text_topic = TextTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text_topic }\n end\n end",
"def new\n @topic = Topic.new\n @channel = Channel.find(params[:channel_id])\n render template:'modals/topic-submit', layout:false\n end",
"def new\n @topic = Topic.new\n @page_title = \"New Topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = @board.topics.new\n @topic.content = Boards::DiscussionTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js { render_to_facebox }\n format.xml { render :xml => @topic }\n end\n end",
"def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @trending_topic = TrendingTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trending_topic }\n end\n end",
"def create\n @topic_form_url = forum_category_forum_topics_path(@category, @forum)\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @search_topic = SearchTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_topic }\n end\n end",
"def new\n @topic = Topic.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @question = @keyword.question_sheet.elements.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @question }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new_project\n @topic = ProjectTopic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end",
"def new\n @question_topic = QuestionTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_topic }\n end\n end",
"def post_new_topic(form)\n begin\n config.sleep_before_post\n form.submit\n rescue StandardError => err\n raise Impostor::TopicError.new(err)\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n if logged_in?\n @topic = Topic.new\n @page_title = \"Create a new topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n else\n flash[:alert] = \"You need to be logged in to add a new topic\"\n redirect_to :back\n end\n end",
"def new\n @topic = Topic.new\n\n respond_with @topic\n end",
"def new\n\n # check whether we can do this\n not_found and return unless action_allowed?( :create )\n\n # extract content\n extract_content\n generate_titles\n\n end",
"def new\n puts params\n @topic = Topic.find(params[:topic_id])\n @bookmark = Bookmark.new\n end",
"def new\n return if !scrap_user_logged_in?(true) # check if logged in!\n scrap_type = params[:type].downcase\n if !scrap_type.nil?\n @scrap = Definition.new if scrap_type == \"definition\"\n @scrap = ParallelText.new if scrap_type == \"parallel_text\"\n @scrap = Bookmark.new if scrap_type == \"bookmark\"\n @scrap = Webscrap.new if scrap_type == \"webscrap\"\n @scrap = Note.new if scrap_type == \"note\"\n end\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n @question_topic = QuestionTopic.new(params[:question_topic])\n\n respond_to do |format|\n if @question_topic.save\n format.html { redirect_to(@question_topic, :notice => 'Question topic was successfully created.') }\n format.xml { render :xml => @question_topic, :status => :created, :location => @question_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n if logged_in?\n @question = Question.new\n @question.correct_flag=0\n @topics = Topic.find_by_sql('Select * from topics order by title asc')\n if params[:question_headline] != nil\n @text = params[:question_headline]\n end\n respond_to do |format|\n format.html # new.html.erb\n \n end\n else\n \n redirect_to :controller => 'account', :action => 'login'\n end\n \n end",
"def get_new_topic_form(page)\n raise Impostor::MissingTemplateMethodError.new(\"get_new_topic_form must be implemented\")\n end",
"def create\n @trending_topic = TrendingTopic.new(params[:trending_topic])\n\n respond_to do |format|\n if @trending_topic.save\n format.html { redirect_to @trending_topic, notice: 'Trending topic was successfully created.' }\n format.json { render json: @trending_topic, status: :created, location: @trending_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trending_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subtopic = Subtopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subtopic }\n end\n end",
"def new\n @recommend_recommend_subject = Recommend::RecommendSubject.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_subject_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_subject }\n end\n end",
"def new\n @lda_post_topic = LdaPostTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lda_post_topic }\n end\n end",
"def create\n @seab_topic = SeabTopic.new(seab_topic_params)\n\n respond_to do |format|\n if @seab_topic.save\n format.html { redirect_to @seab_topic, notice: 'Seab topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @seab_topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @seab_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if (params[:question_id])\n @question = Element.find(params[:question_id])\n else\n type, style = params[:question_type].split(':')\n @question = type.constantize.create!(params[:question].merge(:style => style))\n end\n @keyword.question_page.elements << @question\n\n respond_to do |wants|\n if !@question.new_record?\n wants.html do\n flash[:notice] = t('ma.questions.create.notice')\n redirect_to(:back) \n end\n wants.xml { render :xml => @question, :status => :created, :location => @question }\n wants.js\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n wants.js\n end\n end\n end",
"def new\n @showdown = Showdown.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @showdown }\n end\n end",
"def new\n @data_topic = DataTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_topic }\n end\n end",
"def create_scrap_topic\n @scrap_topic = ScrapTopic.new\n @scrap_topic.title = params[:scrap_topic][:title].strip\n @scrap_topic.user_id = current_user.id\n begin\n ScrapTopic.transaction do\n tag = Tag.find_or_create_by_name(params[:scrap_topic][:title].strip)\n @scrap_topic.save!\n respond_to do |format|\n format.html do\n flash[:notice] = 'Topic successfully created'[:msg_topic_created]\n redirect_to scrap_topic_path(@scrap_topic.slug)\n end\n format.js { show_scrap_topic and return }\n format.xml { return }\n end\n end\n rescue\n respond_to do |format|\n format.html { render :action => 'new_scrap_topic' and return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end\n end",
"def create\n @text_topic = TextTopic.new(params[:text_topic])\n\n respond_to do |format|\n if @text_topic.save\n format.html { redirect_to(@text_topic, :notice => 'Text topic was successfully created.') }\n format.xml { render :xml => @text_topic, :status => :created, :location => @text_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @text_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n topic_breadcrums({\"display_text\": \"Create Topic\"})\n @topic = Topic.new(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to topics_url, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subsubtopic = Subsubtopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subsubtopic }\n end\n end",
"def create_topic\r\n @debate.create_topic(params[:topic])\r\n redirect_to :action => \"index\"\r\n end",
"def new\n @topic_group = TopicGroup.find_by_id(params[:topic_group_id])\n @iteration = Iteration.find_by_id(params[:iteration_id])\n #@element = Element.new\n \n #respond_with(@element, @topic_group, @iteration, @element)\n \n end",
"def new\n @submit_text = \"Create Post\"\n @node = Node.new(:title => params[:title])\n @topic_id = params[:topic_id]\n @source_id = params[:source_id]\n\n # Set path to redirect to after node is created.\n\n flash[:page_to_redirect_to] = request.referer\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def add_topic\n self.button(:id=>\"discussion_add_topic\").click\n wait_for_ajax(2) #\n #@browser.wait_until { @browser.h1(:class=>\"discussion_topic_subject\").parent.button(:text=>\"Reply\").present? }\n end",
"def create\n @search_topic = SearchTopic.new(params[:search_topic])\n\n respond_to do |format|\n if @search_topic.save\n flash[:notice] = 'SearchTopic was successfully created.'\n format.html { redirect_to(@search_topic) }\n format.xml { render :xml => @search_topic, :status => :created, :location => @search_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new \n @study = Study.new\n @project = Project.find(params[:project_id])\n @ready_for_studies = Project.is_ready_for_studies(params[:project_id])\n @key_questions = KeyQuestion.where(:project_id=>params[:project_id]).order(\"question_number ASC\")\n # return an array telling us whether or not each question is represented by a form\n # will be a hash: qid -> true/false\n @available = KeyQuestion.has_extraction_form_assigned(@key_questions)\n #added this line in case the user is coming from Home\n session[:project_id] = params[:project_id] \n\n # Get and set bread crumb to current page\n urlhistory = session[:urlhistory]\n if urlhistory.nil?\n urlhistory = Breadcrumb.new\n end\n urlhistory.setCurrentPage(\"New Study\",\"New Study\",\"/projects/\"+@project.id.to_s+\"/studies/new\")\n session[:urlhistory] = urlhistory\n\n render :layout=>\"application\"\n end",
"def start_new_topic\n @topic = Topic.new\n @post = Post.new\n\n if params[:submit_button] \n begin\n if params[:is_anonymous] == 'on' then\n anon_value = true\n else\n anon_value = false\n end\n @topic.name = params[:name]\n @topic.is_anonymous = anon_value\n @topic.user_id = logged_in_user.id\n \n if not @topic.valid?\n raise_after_msg 'error', :title=>@topic.errors.on('name')\n end\n \n\n @post.user_id = @topic.user_id\n @post.is_first_post = true\n @post.is_anonymous = anon_value\n @post.body = params[:body]\n\n if not @post.valid?\n flash[:title] = @topic.name\n raise_after_msg 'error', :title=>@post.errors.on('body')\n end\n\n @owner.topics << @topic\n @topic.posts << @post\n Syndicate::story_for(logged_in_user,'newtopic',:type=>\"newtopic\",:context=>@owner,:locals=>{:topic_id=>@topic.id})\n fb_redirect_to :controller => 'discussion', :action => 'topics', :cn => params[:cn], :cid => params[:cid]\n return\n rescue Exception=>e\n p e.message\n p flash.inspect\n fb_redirect_to :controller => 'discussion', :action => 'start_new_topic', :cn => params[:cn], :cid => params[:cid]\n return\n end\n else\n @topic.name = flash[:title]\n @post.body = flash[:body]\n end\n end",
"def storyslam_submit\n @story = Story.find(params[:id]) \n @submission = Submission.new(:title => @story.title,\n :subtitle => @story.subtitle,\n :genre1 => @story.genre1,\n :genre2 => @story.genre2,\n :content => @story.final_draft.map(&:content).join(\"\\n\\n\"),\n :user_id => current_user.id,\n :story_id => @story.id)\n @submission.save\n render :layout => \"application\"\n end",
"def create\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_topic = CulturalHeritage::Topic.new(params[:cultural_heritage_topic])\n @title_view = \"Temas\"\n respond_to do |format|\n if @cultural_heritage_topic.save\n format.html { redirect_to(@cultural_heritage_topic, :notice => 'Se ha creado correctamente el tema.') }\n format.xml { render :xml => @cultural_heritage_topic, :status => :created, :location => @cultural_heritage_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cultural_heritage_topic.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def new\n @topic = current_user.topics.build()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def admin_new\n\t\t@topic = Topic.new\n\t\t#@topic.name = params[:new_topic] #Topic textbox for new topic\n\t\t@topic.save\n\tend",
"def create_topic\n @debate.create_topic(params[:topic])\n redirect_to :action => \"index\"\n end",
"def new\n @topiccluster = Topiccluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topiccluster }\n end\n end",
"def new\n @topic_comment = TopicComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic_comment }\n end\n end",
"def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end",
"def create\n @topic = @board.topics.new\n\n @topic.content = Boards::DiscussionTopic.new(params[:boards_discussion_topic])\n respond_to do |format|\n if @topic.content.save\n flash[:notice] = 'Nieuwe discussie was succesvol gestart'\n @topic.user = current_user\n @topic.category = \"topic\"\n @topic.save\n \n format.html { redirect_to(board_discussion_topic_path(@board, @topic.content)) }\n format.xml { render :xml => @topic, :status => :created, :location => board_discussion_topic_path(@board, @topic.content) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @topic = current_user.topics.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @post = @topic.posts.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n if @topic.save\n forum = Forum.find(@topic.forum_id)\n redirect_to forum;\n else\n render action: \"new\" \n end\n\n end",
"def create\n builder_or_text = frm.radio(:value=>\"1\", :name=>\"authorIndexForm:_id29\").set?\n\n frm.button(:value=>\"Create\").click\n\n if builder_or_text == true\n EditAssessment.new(@browser)\n else\n # Need to add Markup page class, then add the reference here.\n end\n\n end",
"def new\n @topic = Topic.new\n @super_categories = Topic.ordered_roots\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end",
"def new\n @topic_attribute = TopicAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic_attribute }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software_training_class }\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@topic, :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@topic, :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @topic = Topic.find(params[:topic_id])\n @post = Post.new\n end",
"def new\n @screen = Screen.new\n @screen.topic_id = params[:topic_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @screen }\n end\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def client_new_doc\n data = params\n cid = current_company.id\n @return_path = data[:return_path]\n @return_path = request.headers['HTTP_REFERER'] if @return_path.blank?\n @matter = Matter.scoped_by_company_id(cid).find(params[:id])\n @document_home = DocumentHome.new\n @document = @document_home.documents.build\n @mapable_id = data[:id]\n @mapable_type = 'Matter'\n @task= MatterTask.scoped_by_company_id(cid).find(data[:task_id] ) if data[:task_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_home }\n end\n end",
"def create\n @topic = Topic.new\n @topic.topic_name = params[:topic][:topic_name].titleize\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @topic = Topic.new\n @topic.content_pack_id = params[:content_pack_id]\n @content_pack = ContentPack.find(params[:content_pack_id])\n render :layout => false\n end",
"def new\n page_title(\"New Experiment\")\n \n @experiment = Experiment.new\n page_group(current_user.group)\n \n @calendars = self.calendars_select_array()\n @locations = self.locations_select_array()\n self.use_markdown_editor = true\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @experiment }\n end\n end",
"def new\n @tweets_chosen_thread = TweetsChosenThread.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweets_chosen_thread }\n end\n end",
"def new\n @tweets_chosen_thread = TweetsChosenThread.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweets_chosen_thread }\n end\n end",
"def new\n @question = @page.questions.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subtopic = Subtopic.new(params[:subtopic])\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render json: @subtopic, status: :created, location: @subtopic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n if @topic.save\n redirect_to @topic,notice: 'Тема создана'\n else\n render 'new'\n end\n\n #respond_to do |format|\n # if @topic.save\n # format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n # format.json { render json: @topic, status: :created, location: @topic }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @topic.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def new\n @mush_crawler = MushCrawler.new\n @crawler_template = CrawlerTemplate::Crawler_Template\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n @topickey = Topickey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topickey }\n end\n end",
"def new\n\t\t# no code needed here; all handled in the view\n\tend",
"def new\n @page_title = 'Create Army'\n respond_to do |format|\n format.html # render new.html.erb\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:success] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @class_topic = ClassTopic.new(class_topic_params)\n\n respond_to do |format|\n if @class_topic.save\n format.html { redirect_to @class_topic, notice: 'Class topic was successfully created.' }\n format.json { render :show, status: :created, location: @class_topic }\n else\n format.html { render :new }\n format.json { render json: @class_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Read form\n @topic = Topic.new(params[:topic])\n @instance = @topic.course_instance\n @course = @instance.course\n @is_teacher = @course.has_teacher?(current_user)\n\n # Check writing permissions\n #authorize_level @course.feedback_write_permission or return\n authorize! :create, @topic\n\n @topic.moderation_status = (@course.moderate && !@is_teacher && @topic.visibility == 'public') ? 'pending' : 'published'\n @topic.action_status = 'unanswered'\n @topic.nick = 'Anonymous' if @topic.nick.blank?\n\n # User\n if logged_in? && !@topic.anonymous\n #@topic.anonymous = (@topic.nick != current_user.name)\n @topic.user = current_user\n @topic.nick = current_user.name\n end\n\n # Save topic\n unless @topic.save\n flash[:error] = 'Failed to send feedback'\n render :action => \"new\"\n return\n end\n\n if @topic.moderation_status == 'pending'\n flash[:success] = t(:added_to_queue)\n else\n flash[:success] = t(:topic_opened)\n end\n\n # Email notification\n @instance.notify_subscribers_later\n\n redirect_to topic_index_path(@course.code, @instance.path)\n end",
"def new\n @community_topic = CommunityTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @community_topic }\n end\n end"
] |
[
"0.6986612",
"0.69399065",
"0.68541425",
"0.68117905",
"0.6781969",
"0.6774142",
"0.6752361",
"0.66998386",
"0.66387737",
"0.6631269",
"0.6629747",
"0.6596712",
"0.65840435",
"0.655308",
"0.653429",
"0.6531935",
"0.6494144",
"0.6494144",
"0.6494144",
"0.6494144",
"0.6494144",
"0.64788216",
"0.64674443",
"0.64572746",
"0.6428133",
"0.6428133",
"0.6428133",
"0.6428133",
"0.6428133",
"0.64276665",
"0.6426123",
"0.6409696",
"0.64096725",
"0.6388236",
"0.6383231",
"0.63732976",
"0.6360416",
"0.63430864",
"0.63419306",
"0.6322514",
"0.63007605",
"0.62916285",
"0.62860096",
"0.627111",
"0.62599707",
"0.62551665",
"0.6242884",
"0.6242565",
"0.62419105",
"0.6241459",
"0.62380284",
"0.62236035",
"0.6218397",
"0.62067527",
"0.61833566",
"0.6178157",
"0.6177062",
"0.61763865",
"0.615971",
"0.615914",
"0.6151469",
"0.61411595",
"0.6133582",
"0.612809",
"0.6122311",
"0.61198705",
"0.6115872",
"0.60982376",
"0.60963005",
"0.60924965",
"0.6090152",
"0.607993",
"0.60760725",
"0.60673267",
"0.6065025",
"0.6065025",
"0.6062927",
"0.6059054",
"0.6054798",
"0.605292",
"0.60517275",
"0.6048476",
"0.6047791",
"0.60430044",
"0.60430044",
"0.6038997",
"0.60347635",
"0.6027246",
"0.60230285",
"0.6022158",
"0.60196036",
"0.60196036",
"0.60189325",
"0.6015132",
"0.6014941",
"0.6014493",
"0.60131484",
"0.6011318",
"0.60084677",
"0.6005206"
] |
0.783379
|
0
|
ScrapsController > create_scrap_topic : Create new scrap topic and render to browser
|
def create_scrap_topic
@scrap_topic = ScrapTopic.new
@scrap_topic.title = params[:scrap_topic][:title].strip
@scrap_topic.user_id = current_user.id
begin
ScrapTopic.transaction do
tag = Tag.find_or_create_by_name(params[:scrap_topic][:title].strip)
@scrap_topic.save!
respond_to do |format|
format.html do
flash[:notice] = 'Topic successfully created'[:msg_topic_created]
redirect_to scrap_topic_path(@scrap_topic.slug)
end
format.js { show_scrap_topic and return }
format.xml { return }
end
end
rescue
respond_to do |format|
format.html { render :action => 'new_scrap_topic' and return }
format.js { render :action => 'new_scrap_topic', :layout => false and return }
format.xml { return }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n return if cancelled?\n begin\n if params[:scrap][:type] == \"ParallelText\"\n @scrap = ParallelText.new(params[:scrap])\n @scrap.scrap_topic = Corpus.by_language(params[:scrap][:language_id])\n else\n if params[:scrap][:type] == \"Definition\"\n @scrap = Definition.new(params[:scrap])\n elsif params[:scrap][:type] == \"Webscrap\"\n @scrap = Webscrap.new(params[:scrap])\n elsif params[:scrap][:type] == \"Bookmark\"\n @scrap = Bookmark.new(params[:scrap])\n else\n @scrap = Note.new(params[:scrap])\n end\n if @scrap_topic.nil? or @scrap_topic.id == nil\n #Initiatlize a new scrap topic!\n @scrap.scrap_topic = init_scrap_topic(params[:scrap_topic_title], current_user.id)\n else\n #Assign existing scrap topic\n @scrap.scrap_topic = @scrap_topic\n end\n end\n @scrap.save!(current_user)\n if @scrap.class.to_s ==\"ParallelText\"\n respond_to do |format|\n format.html { redirect_to show_scrap_path(@scrap.slug) and return }\n format.js { render :action => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n else\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if !@scrap_topic.scraps.nil?; render :action => \"scrap_topic\", :layout => false and return }\n format.xml { return }\n end\n end\n \n rescue\n #\n # Re-Display On Error \n respond_to do |format|\n format.html { render :action => \"new\" and return }\n format.js { render :partial => \"scrap_form\", :layout => false and return }\n format.xml { return }\n end\n end\n end",
"def create\n topic_breadcrums({\"display_text\": \"Create Topic\"})\n @topic = Topic.new(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to topics_url, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_topic\r\n @debate.create_topic(params[:topic])\r\n redirect_to :action => \"index\"\r\n end",
"def create\n @trending_topic = TrendingTopic.new(params[:trending_topic])\n\n respond_to do |format|\n if @trending_topic.save\n format.html { redirect_to @trending_topic, notice: 'Trending topic was successfully created.' }\n format.json { render json: @trending_topic, status: :created, location: @trending_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trending_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_topic\n @debate.create_topic(params[:topic])\n redirect_to :action => \"index\"\n end",
"def create\n @question_topic = QuestionTopic.new(params[:question_topic])\n\n respond_to do |format|\n if @question_topic.save\n format.html { redirect_to(@question_topic, :notice => 'Question topic was successfully created.') }\n format.xml { render :xml => @question_topic, :status => :created, :location => @question_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@topic, :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@topic, :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @text_topic = TextTopic.new(params[:text_topic])\n\n respond_to do |format|\n if @text_topic.save\n format.html { redirect_to(@text_topic, :notice => 'Text topic was successfully created.') }\n format.xml { render :xml => @text_topic, :status => :created, :location => @text_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @text_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @seab_topic = SeabTopic.new(seab_topic_params)\n\n respond_to do |format|\n if @seab_topic.save\n format.html { redirect_to @seab_topic, notice: 'Seab topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @seab_topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @seab_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_topic!\n fora.post_new_topic\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:success] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n unless simple_captcha_valid?\n flash[:error] = \"invalid captcha code\"\n redirect_to :action => \"new\" \n return\n end\n @topic = Topic.new(params[:topic])\n @topic.user_id = current_user.id\n @topic.ip = get_client_ip request\n\n respond_to do |format|\n if @topic.save\n create_activity current_user.id, \"Topic\", @topic.id\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to topic_posts_path(@topic.id) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = current_user.topics.build(params[:topic])\n @encounter = Encounter.find(session[:encounter_key])\n\n\n respond_to do |format|\n if @topic.save\n session[:topic_key] = @topic.id\n format.html { redirect_to encounter_path(@encounter), notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\t\t@topic = Topic.new(set_topic_attributes)\n\n\t\tif(@topic.save)\n\t\t\tflash[:success] = \"Tópico criado com sucesso\"\n\t\t\treturn redirect_to @topic\n\t\telse\n\t\t\t#nothing to do\n\t\tend\n\n\tend",
"def create\n @topic_form_url = forum_category_forum_topics_path(@category, @forum)\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n klass = params[:project_topic] ? ProjectTopic : Topic\n topic_params = params[:project_topic] || params[:topic]\n title = params[:project_topic] ? 'Project Topic' : 'Topic'\n @topic = klass.new(topic_params)\n @topic.creator = current_user\n @topic.presenter = current_user\n respond_to do |format|\n if @topic.save\n format.html { redirect_to redirect_path , notice: \"#{title} was successfully created.\" }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render 'form' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = @board.topics.new\n\n @topic.content = Boards::DiscussionTopic.new(params[:boards_discussion_topic])\n respond_to do |format|\n if @topic.content.save\n flash[:notice] = 'Nieuwe discussie was succesvol gestart'\n @topic.user = current_user\n @topic.category = \"topic\"\n @topic.save\n \n format.html { redirect_to(board_discussion_topic_path(@board, @topic.content)) }\n format.xml { render :xml => @topic, :status => :created, :location => board_discussion_topic_path(@board, @topic.content) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @search_topic = SearchTopic.new(params[:search_topic])\n\n respond_to do |format|\n if @search_topic.save\n flash[:notice] = 'SearchTopic was successfully created.'\n format.html { redirect_to(@search_topic) }\n format.xml { render :xml => @search_topic, :status => :created, :location => @search_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to topics_path, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data_topic = DataTopic.new(params[:data_topic])\n\n respond_to do |format|\n if @data_topic.save\n format.html { redirect_to @data_topic, notice: 'Data topic was successfully created.' }\n format.json { render json: @data_topic, status: :created, location: @data_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @forum.topics.create!(params[:topic])\n format.html { redirect_to forum_path(@forum), notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n if @topic.save\n redirect_to @topic,notice: 'Тема создана'\n else\n render 'new'\n end\n\n #respond_to do |format|\n # if @topic.save\n # format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n # format.json { render json: @topic, status: :created, location: @topic }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @topic.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @topic = Topic.new\n @topic.topic_name = params[:topic][:topic_name].titleize\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n requires! :title\n requires! :body\n requires! :node_id\n\n raise AccessDenied.new(\"The current user does not have permission to create Topic.\") unless can?(:create, Topic)\n\n @topic = current_user.topics.new(title: params[:title], body: params[:body])\n @topic.node_id = params[:node_id]\n @topic.save!\n\n render \"show\"\n end",
"def create\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_topic = CulturalHeritage::Topic.new(params[:cultural_heritage_topic])\n @title_view = \"Temas\"\n respond_to do |format|\n if @cultural_heritage_topic.save\n format.html { redirect_to(@cultural_heritage_topic, :notice => 'Se ha creado correctamente el tema.') }\n format.xml { render :xml => @cultural_heritage_topic, :status => :created, :location => @cultural_heritage_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cultural_heritage_topic.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def create\n @subtopic = Subtopic.new(params[:subtopic])\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render json: @subtopic, status: :created, location: @subtopic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = current_user.topics.build()\n @topic.title = params[:title]\n @topic.user_id = current_user.id\n @topic.user_email = current_user.email\n\n respond_to do |format|\n if @topic.save!\n format.html { redirect_to topics_url, :notice => 'topic was successfully created.' }\n format.json { render :json => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @class_topic = ClassTopic.new(class_topic_params)\n\n respond_to do |format|\n if @class_topic.save\n format.html { redirect_to @class_topic, notice: 'Class topic was successfully created.' }\n format.json { render :show, status: :created, location: @class_topic }\n else\n format.html { render :new }\n format.json { render json: @class_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.create(topic_params)\n current_user.topics.push(@topic)\n \n respond_with @topic\n end",
"def create\n @topic = current_user.topics.build(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @alternate_title.save\n format.html { redirect_to topic_url(@alternate_title.topic), notice: 'Alternate Title was successfully created.' }\n format.json { render action: 'show', status: :created, location: @alternate_title }\n else\n format.html { redirect_to admin_path }\n format.json { render json: @alternate_title.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forum_topic = Forum::Topic.new(forum_topic_params)\n\n respond_to do |format|\n if @forum_topic.save\n format.html { redirect_to @forum_topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forum_topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @forum_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = current_user.topics.build(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to [:admin, @topic], notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n row = @ws.num_rows()+1\n\n respond_to do |format|\n if @topic.save\n @ws[row,1] = @topic.id\n @ws[row,2] = @topic.topic\n @ws[row,3] = @topic.subject.subject\n @ws[row,4] = @topic.seab_sub_topic.topic\n @ws[row,5] = @topic.description\n @ws.save()\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article_topic = ArticleTopic.new(article_topic_params)\n\n respond_to do |format|\n if @article_topic.save\n format.html { redirect_to @article_topic, notice: 'Article topic was successfully created.' }\n format.json { render :show, status: :created, location: @article_topic }\n else\n format.html { render :new }\n format.json { render json: @article_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_new_topic\n @topic = Topic.new\n @post = Post.new\n\n if params[:submit_button] \n begin\n if params[:is_anonymous] == 'on' then\n anon_value = true\n else\n anon_value = false\n end\n @topic.name = params[:name]\n @topic.is_anonymous = anon_value\n @topic.user_id = logged_in_user.id\n \n if not @topic.valid?\n raise_after_msg 'error', :title=>@topic.errors.on('name')\n end\n \n\n @post.user_id = @topic.user_id\n @post.is_first_post = true\n @post.is_anonymous = anon_value\n @post.body = params[:body]\n\n if not @post.valid?\n flash[:title] = @topic.name\n raise_after_msg 'error', :title=>@post.errors.on('body')\n end\n\n @owner.topics << @topic\n @topic.posts << @post\n Syndicate::story_for(logged_in_user,'newtopic',:type=>\"newtopic\",:context=>@owner,:locals=>{:topic_id=>@topic.id})\n fb_redirect_to :controller => 'discussion', :action => 'topics', :cn => params[:cn], :cid => params[:cid]\n return\n rescue Exception=>e\n p e.message\n p flash.inspect\n fb_redirect_to :controller => 'discussion', :action => 'start_new_topic', :cn => params[:cn], :cid => params[:cid]\n return\n end\n else\n @topic.name = flash[:title]\n @post.body = flash[:body]\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n @topic.author = current_user\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = \"Topic was successfully created.\"\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def topic_create(topic)\n @topic = topic\n @board = topic.board\n @user = topic.author\n @mail = @user.email\n @link = board_topic_url(@board, @topic)\n @greeting = \"Hi\"\n\n @subject = \"您已成功在Board: #{@board.name}內新增了一篇Topic~\"\n\n mail to: @mail, subject: @subject\n end",
"def create\n @topic = Topic.find(params[:topic_id])\n @topic_answer = @topic.topic_answers.build(topic_answer_params)\n\n respond_to do |format|\n if @topic_answer.save\n format.html { redirect_to @topic, notice: 'Topic answer was successfully created.' }\n format.json { render :show, status: :created, location: @topic_answer }\n else\n @topic_answers = @topic.get_answers(params[:page])\n format.html { render \"topics/show\" }\n format.json { render json: @topic_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n topic = Topic.new(topic_params)\n if topic.save\n response_data = {\n status: 'success',\n txt: ['質問を投稿しました!'],\n }\n else\n response_data = {\n status: 'error',\n txt: topic.errors.full_messages,\n }\n end\n render json: response_data\n end",
"def create\n @newsletter_topic = NewsletterTopic.new(newsletter_topic_params)\n\n if @newsletter_topic.save\n render :show, status: :created, location: @newsletter_topic\n else\n render json: @newsletter_topic.errors, status: :unprocessable_entity\n end\n end",
"def create\n parameters = topic_params\n parameters[:user_id] = current_user.id\n @topic = Topic.new(parameters)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @citation_topic = CitationTopic.new(citation_topic_params)\n\n respond_to do |format|\n if @citation_topic.save\n format.html { redirect_to :back, notice: 'Citation topic was successfully created.' }\n format.json { render json: @citation_topic, status: :created, location: @citation_topic }\n else\n format.html { redirect_to :back, notice: 'Citation topic was NOT successfully created.' }\n format.json { render json: @citation_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n c_id = params[:course_id]\n Topic.create(:course_id => c_id, :name => params[:topic][:name])\n redirect_to course_topics_path(:id => c_id)\n end",
"def create\n @topic = Topic.new(params[:topic])\n @topic.user_id = current_user.id\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subsubtopic = Subsubtopic.new(params[:subsubtopic])\n\n respond_to do |format|\n if @subsubtopic.save\n format.html { redirect_to(@subsubtopic, :notice => 'Subsubtopic was successfully created.') }\n format.xml { render :xml => @subsubtopic, :status => :created, :location => @subsubtopic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subsubtopic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subtopic = Subtopic.new(subtopic_params)\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render :show, status: :created, location: @subtopic }\n else\n format.html { render :new }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n client = Mastodon::REST::Client.new(base_url: ENV[\"MASTODON_URL\"], bearer_token: ENV[\"ACCESS_TOKEN\"])\n \n @topic = Topic.new(topic_params)\n @topic.user_id = current_user.id\n\n respond_to do |format|\n if @topic.save\n response = client.create_status(\"新しいトピック:#{@topic.title} が作成されました!\")\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n topic = Topic.find(sub_topic_params[:topic_id])\n @sub_topic = topic.sub_topics.build(sub_topic_params)\n\n respond_to do |format|\n if @sub_topic.save\n format.html { redirect_to @sub_topic, notice: 'Sub topic was successfully created.' }\n format.json { render :show, status: :created, location: @sub_topic }\n else\n format.html { render :new }\n format.json { render json: @sub_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = @category.topics.new(topic_params)\n authorize @topic\n\n if @topic.save\n render 'api/v1/topics/show', status: :created\n else\n render json: @topic.errors, status: :unprocessable_entity\n end\n end",
"def add_topic\n click_link 'Add Topic' \n within 'form' do\n fill_in( 'Title', with: 'Shoes' )\n fill_in( 'Description', with: 'Shoes of desire' )\n click_button 'save' \n end\n end",
"def create_topic(topic_name,question_bank_id,tenant_id)\n topic = Topic.find_by_name_and_question_bank_id(topic_name,question_bank_id)\n if topic.nil? or topic.blank?\n topic = Topic.new\n topic.name = topic_name\n topic.question_bank_id = question_bank_id\n topic.tenant_id = tenant_id\n topic.save\n end\n return topic\n end",
"def create\n \n begin\n @topic = Topic.new(params[ \"topic\" ]) \n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n \n \n logger.info log_hash \"Topic\", @topic.attributes\n \n # noting fatal happened with the 'new'\n respond_to do |format|\n begin \n if @topic.save\n format.xml { render :xml => successRsp }\n else\n format.xml { render :xml => errorRsp( @topic.errors.to_xml ) }\n end\n rescue Exception => e \n format.xml { render :xml => errorRsp( \"xx-\" + e.message ) }\n end\n end\n end",
"def create\n @dataset = Dataset.new(params[:dataset])\n prep_dataset_form\n @dataset.save!\n publish_press_item(\"New dataset added: #{@dataset.title}\")\n\n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully created.'\n wants.html { redirect_to(@dataset) }\n wants.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n end\n end",
"def show_scrap_topic\n render_404 and return if @scrap_topic.nil?\n @scraps = @scrap_topic.scraps if @scrap_topic\n\n flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0\n respond_to do |format|\n format.html { render :action => 'scrap_topic' and return }\n format.js { render :action => 'scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n @topic = Topic.new(params[:topic])\n @topic.user = current_user\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(:controller => :start, :action => :index, :id => @topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @topicdetail = Topicdetail.new(params[:topicdetail])\n\n respond_to do |format|\n if @topicdetail.save\n format.html { redirect_to(@topicdetail, :notice => t('topicdetail.title2')+\" \"+t('created')) }\n format.xml { render :xml => @topicdetail, :status => :created, :location => @topicdetail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topicdetail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tag_topic = TagTopic.new(tag_topic_params)\n\n respond_to do |format|\n if @tag_topic.save\n format.html { redirect_to @tag_topic, notice: 'Tag topic was successfully created.' }\n format.json { render :show, status: :created, location: @tag_topic }\n else\n format.html { render :new }\n format.json { render json: @tag_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = current_user.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic03 = Topic03.new(topic03_params)\n\n respond_to do |format|\n if @topic03.save\n format.html { redirect_to @topic03, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic03 }\n else\n format.html { render :new }\n format.json { render json: @topic03.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.friendly.find(params[:topic_id])\n @post = @topic.posts.new(post_params)\n @post.user_id = current_user.id\n @post.topic_id = @topic.id\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to topic_posts_path(@topic), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document_topic_sub_topic = DocumentTopicSubTopic.new(document_topic_sub_topic_params)\n\n respond_to do |format|\n if @document_topic_sub_topic.save\n format.html { redirect_to @document_topic_sub_topic, notice: 'Document topic sub topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document_topic_sub_topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @document_topic_sub_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Read form\n @topic = Topic.new(params[:topic])\n @instance = @topic.course_instance\n @course = @instance.course\n @is_teacher = @course.has_teacher?(current_user)\n\n # Check writing permissions\n #authorize_level @course.feedback_write_permission or return\n authorize! :create, @topic\n\n @topic.moderation_status = (@course.moderate && !@is_teacher && @topic.visibility == 'public') ? 'pending' : 'published'\n @topic.action_status = 'unanswered'\n @topic.nick = 'Anonymous' if @topic.nick.blank?\n\n # User\n if logged_in? && !@topic.anonymous\n #@topic.anonymous = (@topic.nick != current_user.name)\n @topic.user = current_user\n @topic.nick = current_user.name\n end\n\n # Save topic\n unless @topic.save\n flash[:error] = 'Failed to send feedback'\n render :action => \"new\"\n return\n end\n\n if @topic.moderation_status == 'pending'\n flash[:success] = t(:added_to_queue)\n else\n flash[:success] = t(:topic_opened)\n end\n\n # Email notification\n @instance.notify_subscribers_later\n\n redirect_to topic_index_path(@course.code, @instance.path)\n end",
"def create\n @topic = Topic.new(params[:topic])\n if @topic.save\n forum = Forum.find(@topic.forum_id)\n redirect_to forum;\n else\n render action: \"new\" \n end\n\n end",
"def create\n @thred = Thred.new(params[:thred])\n @thred.user_id = current_user\n @thred.topic_id = session[:topic_id]\n \n respond_to do |format|\n if @thred.save\n format.html { redirect_to(topic_path(@thred.topic_id)) }\n\tflash[:notice] = 'Thread was successfully created.'\n format.xml { render :xml => @thred, :status => :created, :location => @thred }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @thred.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lda_post_topic = LdaPostTopic.new(params[:lda_post_topic])\n\n respond_to do |format|\n if @lda_post_topic.save\n format.html { redirect_to @lda_post_topic, notice: 'Lda post topic was successfully created.' }\n format.json { render json: @lda_post_topic, status: :created, location: @lda_post_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lda_post_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if (params[:question_id])\n @question = Element.find(params[:question_id])\n else\n type, style = params[:question_type].split(':')\n @question = type.constantize.create!(params[:question].merge(:style => style))\n end\n @keyword.question_page.elements << @question\n\n respond_to do |wants|\n if !@question.new_record?\n wants.html do\n flash[:notice] = t('ma.questions.create.notice')\n redirect_to(:back) \n end\n wants.xml { render :xml => @question, :status => :created, :location => @question }\n wants.js\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n wants.js\n end\n end\n end",
"def create\n @company_forum = CompanyForum.find_by_id(params[:company_forum_id])\n @company_forum_topic = @company_forum.company_forum_topics.build(company_forum_topic_params)\n\n respond_to do |format|\n if @company_forum_topic.save\n format.html { redirect_to company_forum_company_forum_topic_path(@company_forum, @company_forum_topic), notice: 'Company forum topic was successfully created.' }\n format.json { render json: @company_forum_topic, status: :created, location: @company_forum_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company_forum_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topics = Topic.order(:created_at).reverse_order\n @topic = Topic.new(topic_params)\n @topic.user_id = current_user.id\n respond_to do |format|\n if @topic.save\n #format.html { redirect_to topic_path(@topic) }\n format.js { render :index }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @topic = Topic.new(topic_params)\n @topic.user_id = current_user.id\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @news_topic = NewsTopic.new(news_topic_params)\n @news_topic.context.gsub!(\"\\n\", '</br>')\n @news_topic.short_context.gsub!(\"\\n\", '</br>')\n @news_topic.creator = current_user\n\n respond_to do |format|\n if @news_topic.save\n format.html { redirect_to news_topics_path, :notice => 'News topic was successfully created.' }\n format.json { render :show, :status => :created, :location => @news_topic }\n else\n format.html { render :new }\n format.json { render :json => @news_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_topic = Api::V1::Topic.new(api_v1_topic_params)\n\n respond_to do |format|\n if @api_v1_topic.save\n format.html { redirect_to @api_v1_topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_topic }\n else\n format.html { render :new }\n format.json { render json: @api_v1_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.new(topic_params)\n @content_pack = ContentPack.find(params[:content_pack_id])\n respond_to do |format|\n if @topic.save\n @topics = @content_pack.topics\n end\n format.js\n end\n end",
"def create\n @topic02 = Topic02.new(topic02_params)\n\n respond_to do |format|\n if @topic02.save\n format.html { redirect_to @topic02, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic02 }\n else\n format.html { render :new }\n format.json { render json: @topic02.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_project\n @topic = ProjectTopic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end",
"def create\n @user_topic = UserTopic.new(user_topic_params)\n\n respond_to do |format|\n if @user_topic.save\n format.html { redirect_to @user_topic, notice: 'User topic was successfully created.' }\n format.json { render :show, status: :created, location: @user_topic }\n else\n format.html { render :new }\n format.json { render json: @user_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Making sure only signed in users can access\n # if user_signed_in?\n topic = Topic.create(topic_params)\n if topic.valid?\n render json: topic\n else\n render json: topic.errors, status: :unprocessable_entity\n end\n # else\n # render status: 403, plain: 'Please Sign In to Access'\n # end\n end",
"def create\n @topic = @forum.topics.new(params[:topic])\n @topic.user = current_user\n p = @topic.posts.first\n p.user = current_user\n p.topic = @topic\n p.save!\n \n respond_to do |format|\n if @topic.save\n format.html { render :action => \"show\", :notice => \"Topic successfully created\" }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @screencast = Screencast.new(params[:screencast])\n \n p \"Sam - 1\"\n IssueMailer.issue_created(@screencast).deliver\n p \"Sam - 2\"\n \n\n respond_to do |format|\n if @screencast.save\n format.html { redirect_to @screencast, notice: 'Screencast was successfully created.' }\n format.json { render json: @screencast, status: :created, location: @screencast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @screencast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @body=params[:body]\n @title=params[:title]\n @part_id=params[:part].keys[0]\n if @body.length<1 || @title.length<3\n #render :new, :part=>@part_id\n redirect_to '/topics/new?part='+params[:part].keys[0].to_s, notice: 'Body or Title is empty'\n return\n end\n @topic=Topic.new\n @topic.part_id=@part_id\n @topic.user_id=session[:user_id]\n @topic.title=@title\n @topic.save\n @post=Post.new\n @post.topic_id=@topic.id\n @post.user_id=session[:user_id]\n @post.body=@body;\n @post.save \n redirect_to '/topics/'+@topic.id.to_s, notice: 'Topic successfully created'\n end",
"def create\n @topic_comment = TopicComment.new(params[:topic_comment])\n\n respond_to do |format|\n if @topic_comment.save\n flash[:notice] = 'TopicComment was successfully created.'\n format.html { redirect_to(@topic_comment) }\n format.xml { render :xml => @topic_comment, :status => :created, :location => @topic_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subtopics_question = SubtopicsQuestion.new(subtopics_question_params)\n\n respond_to do |format|\n if @subtopics_question.save\n format.html { redirect_to @subtopics_question, notice: 'Subtopics question was successfully created.' }\n format.json { render :show, status: :created, location: @subtopics_question }\n else\n format.html { render :new }\n format.json { render json: @subtopics_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_topic payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post TOPICS, payload )\n\t\t\t\tend",
"def create\n @quiz = Quiz.new(quiz_params.merge(topic: Topic.first))\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to topic_quiz_path(@quiz, @quiz.topic), notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: topic_quiz_path(@quiz, @quiz.topic) }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@story = Story.new(story_params)\n\n\t\tif @story.save\n\n\t\t\t#lets add a flash of content to tell the user we've added this\n\t\t\tflash[:success] = \"You've added a link! yeeehaaa!!!!\"\n\n\t\t\t#go back to homepage\n\t\t\tredirect_to root_path\n\n\t\telse\n\t\t\trender \"new\"\n\n\n\n\t\tend\n\n\tend",
"def create\n #@topic = Topic.new(topic_params)\n @topic = current_user.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic.student = current_user\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n\t@topic = Topic.new(params[:topic]) \n\t@topic.published = !(current_user.role.contributor?)\n\t@topic.user_id = current_user.id \n\trespond_to do |format|\n\t if @topic.save\n\t\tif params[:avatar] && params[:avatar][:avatar_img]\n\t\t @avatar = Avatar.create(:avatar_img => params[:avatar][:avatar_img], :topic_id => @topic.id)\n\t\tend\n\t\tif params[:commit] == \"Lagre\"\n\t\t format.html { redirect_to edit_topic_path(@topic), notice: I18n.t(\"topics.create_flash\") }\n\t\t format.json { render json: edit_topic_path(@topic), status: :created, location: @topic }\n\t\telse\n\t\t format.html { redirect_to topic_path(@topic), notice: I18n.t(\"topics.create_flash\") }\n\t\t format.json { render json: @topic, status: :created, location: @topic }\n\t\tend\n\t else \n\t\t@topic.locations.build\n\t\t@topic.references.build \n\t\tformat.html { render action: \"new\" }\n\t\tformat.json { render json: @topic.errors, status: :unprocessable_entity }\n\t end\n\tend\n end",
"def new\n @topic = Topic.new\n @page_title = \"New Topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def create_topic\n raise NotImplementedError.new\n end",
"def create\n @recommend_recommend_subject = Recommend::RecommendSubject.new(params[:recommend_recommend_subject])\n\n respond_to do |format|\n if @recommend_recommend_subject.save\n format.html { redirect_to @recommend_recommend_subject, notice: 'Recommend subject was successfully created.' }\n format.json { render json: @recommend_recommend_subject, status: :created, location: @recommend_recommend_subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @neighborhood_topic = NeighborhoodTopic.new(params[:neighborhood_topic])\n\n respond_to do |format|\n if @neighborhood_topic.save\n format.html { redirect_to @neighborhood_topic, notice: 'Neighborhood topic was successfully created.' }\n format.json { render json: @neighborhood_topic, status: :created, location: @neighborhood_topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if args.length != 2\n error \"Kafka name and topic required\"\n end\n name, urls = attachment(args)\n create_topic(urls, args.last)\n display(\"Creating topic #{args.last}..\")\n display\n get_topics(urls, name)\n end"
] |
[
"0.77216476",
"0.7318679",
"0.72042066",
"0.7189846",
"0.7126289",
"0.7122961",
"0.7110386",
"0.7031366",
"0.7031366",
"0.7017458",
"0.7017458",
"0.70102733",
"0.7008804",
"0.6986532",
"0.6983561",
"0.6973378",
"0.696002",
"0.69316626",
"0.6923276",
"0.6884412",
"0.68751824",
"0.68659246",
"0.6836311",
"0.6832536",
"0.6825045",
"0.68038166",
"0.67954385",
"0.67931885",
"0.6788625",
"0.6784321",
"0.6778941",
"0.67717373",
"0.6759285",
"0.67423224",
"0.6718364",
"0.67096955",
"0.6704225",
"0.6693899",
"0.6690957",
"0.66908145",
"0.66806775",
"0.6673202",
"0.6652347",
"0.66382873",
"0.6620133",
"0.6614976",
"0.6612358",
"0.6595796",
"0.6590932",
"0.65823627",
"0.65806365",
"0.65804505",
"0.657872",
"0.65764785",
"0.65718514",
"0.657156",
"0.6562377",
"0.6556844",
"0.6555674",
"0.6545025",
"0.65438926",
"0.6530628",
"0.6528555",
"0.65283656",
"0.6523739",
"0.6514081",
"0.65139854",
"0.6509441",
"0.650791",
"0.6506346",
"0.65061843",
"0.6505563",
"0.65049446",
"0.64977604",
"0.6471278",
"0.6451576",
"0.6450844",
"0.64495903",
"0.6436999",
"0.64263755",
"0.6418164",
"0.6411662",
"0.640609",
"0.6399932",
"0.6397748",
"0.63877094",
"0.63849103",
"0.6383877",
"0.6382979",
"0.63820076",
"0.63719875",
"0.6366725",
"0.63558763",
"0.63519657",
"0.6349247",
"0.6344412",
"0.63437885",
"0.63371986",
"0.63326085",
"0.63317996"
] |
0.7519294
|
1
|
ScrapsController > edit_scrap_topic : Render edict scrap topic form to browser
|
def edit_scrap_topic
if can_modify_scrap_topic?
respond_to do |format|
format.html { return }
format.js { render :action => 'edit_scrap_topic', :layout => false and return }
format.xml { return }
end
else
render_401 and return
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit\n frm.button(:value=>\"Edit\").click\n AddEditAnnouncements.new(@browser)\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def edit\n respond_to do |format|\n format.html { render :action => \"edit\" and return }\n format.js { render :partial => \"scrap_form\", :layout => false and return }\n format.xml { return }\n end\n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def add_topic\n click_link 'Add Topic' \n within 'form' do\n fill_in( 'Title', with: 'Shoes' )\n fill_in( 'Description', with: 'Shoes of desire' )\n click_button 'save' \n end\n end",
"def edit\r\n \r\n end",
"def edit\n \n end",
"def edit\n curs\n @forumtalk = Forumtalk.find(params[:id])\n @forumtheme = @forumtalk.forumtheme\n end",
"def update\n respond_to do |format|\n if @seab_topic.update(seab_topic_params)\n format.html { redirect_to @seab_topic, notice: 'Seab topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seab_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n require_admin\n if request.post? # pass in the entire object you want to edit\n #over-write the data of the existing question\n #title, text, etc.\n #lookup the existing object in the db, edit the values, and save it.\n \n @question = Question.find(edit_question_params[:id]) #inbound data object with the 3 params\n @question.title = edit_question_params[:title]\n @question.text = edit_question_params[:text]\n @question.forum_id = edit_question_params[:forum_id]\n @question.keywords = edit_question_params[:keywords]\n @question.save() # save the db!\n \n #send the user back to the view_question with hte question id we just saved\n redirect_to controller:\"qa\", action:\"view_question\", id:@question.id\n #returns the form\n else # handles the get request which is to return a single question\n @question = Question.find(Integer(params[\"id\"]))\n end\n end",
"def edit_form\n\t\titem_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n\t\tdiv_item(item_text, \"iteminformation\")\n\tend",
"def edit\r\n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n # Renders the edit form\n end",
"def edit\n #Nothing necessary\n end",
"def update\n @topic = Topic.find(params[:id])\n row = @topic.id+1\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n @ws[row,2] = @topic.topic\n @ws[row,3] = @topic.subject.subject\n @ws[row,4] = @topic.seab_sub_topic.topic\n @ws[row,5] = @topic.description\n @ws.save()\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @quality_rating_field = QualityRatingField.find(params[:id])\n\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t@has_study_data = QualityRatingField.has_study_data(@extraction_form.id)\t\n @editing_rtg=true\n end",
"def edit\n\n end",
"def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend",
"def update\n if params[:cancel]\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n return # redisplay the scrap inline\n end\n return if !scrap_user_logged_in? # check if logged in!\n old = @scrap.attributes.to_yaml\n @scrap.update_attributes(params[:scrap])\n mod = @scrap.attributes.to_yaml\n begin\n @scrap.save!(current_user) if mod != old\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n rescue\n #\n # Re-Display On Error\n edit and return\n end\n end",
"def edit\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n @sub_id = params[:sub_id]\n @update_span = params[:update]\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { }\n end\n end",
"def edit\n set_article\n end",
"def edit_page(obj)\n page do\n t = String.new\n form_attr = form_attributes(:action=>url_for(\"update/#{model.primary_key_value(obj)}\"))\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:edit, request).each do |column|\n col_opts = column_options_for(:edit, request, obj, column)\n if html = model.edit_html_for(obj, column, :edit, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Update', :class=>'btn btn-primary')\n end\n if model.supported_action?(:delete, request)\n t << Forme.form(form_attributes(:action=>url_for(\"delete/#{model.primary_key_value(obj)}\")), form_opts) do |f|\n f.button(:value=>'Delete', :class=>'btn btn-danger')\n end\n end\n t << association_links(obj)\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def update\n @post = Post.find(params[:id])\n @user = @post.user\n @topic = @post.topic\n\n # form values\n @post.title = params[:post][:title]\n @post.content = params[:post][:content]\n\n # preview?\n if !params[:preview].nil?\n # breadcrumbs\n add_breadcrumb \"Home\", :root_path\n if !@topic.forum.ancestors.empty?\n for ancestor in @topic.forum.ancestors\n add_breadcrumb ancestor.title, forum_path(ancestor)\n end\n add_breadcrumb @topic.forum.title, forum_path(@topic.forum.id)\n add_breadcrumb @topic.title, topic_path(@topic)\n end\n render :action => \"new\"\n # save post\n else\n if @post.save\n redirect_to topic_path(@post.topic_id)\n end\n end\n end",
"def edit\n render partial: \"vocabulary_terms/form\",\n locals: { vocabulary: @term.vocabulary,\n term: @term }\n end",
"def update\n @text_topic = TextTopic.find(params[:id])\n\n respond_to do |format|\n if @text_topic.update_attributes(params[:text_topic])\n format.html { redirect_to(@text_topic, :notice => 'Text topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @text_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @topic.update(topic_params)\n redirect_to @topic, notice: 'Topic was successfully updated.'\n else\n render :edit\n end\n end",
"def edit\n\t\t\n\tend",
"def edit\n puts \".............. >>> extraction_form_armms_controller::edit \"\n @extraction_form_arm = ExtractionFormArm.find(params[:id])\n\t@extraction_form = ExtractionForm.find(@extraction_form_arm.extraction_form_id)\n\t@project = Project.find(@extraction_form.project_id)\n \t@efid = @extraction_form_arm.extraction_form_id\n @editing = true\n end",
"def edit\n render partial: \"vocabularies/form\",\n locals: { vocabulary: @vocabulary }\n end",
"def update_scrap_topic\n # Not allowed for now\n render_401 and return\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.6503634",
"0.6389094",
"0.6389094",
"0.6387619",
"0.6355652",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62204975",
"0.61806214",
"0.61793846",
"0.61702603",
"0.61455226",
"0.6139189",
"0.61268145",
"0.6121512",
"0.61197984",
"0.61197984",
"0.61197984",
"0.61197984",
"0.61197984",
"0.61197984",
"0.61197984",
"0.60909253",
"0.6077226",
"0.60751134",
"0.60623515",
"0.6045423",
"0.60413456",
"0.60112363",
"0.6001414",
"0.6000016",
"0.5993761",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59880584",
"0.59854263",
"0.5984767",
"0.59828275",
"0.59737754",
"0.59659016",
"0.5963423",
"0.59568465",
"0.5956284",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746",
"0.59538746"
] |
0.69367373
|
0
|
ScrapsController > update_scrap_topic : Update scrap topic and render to browser NOT IMPLEMENTED!
|
def update_scrap_topic
# Not allowed for now
render_401 and return
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit_scrap_topic\n if can_modify_scrap_topic?\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'edit_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n else\n render_401 and return\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n row = @topic.id+1\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n @ws[row,2] = @topic.topic\n @ws[row,3] = @topic.subject.subject\n @ws[row,4] = @topic.seab_sub_topic.topic\n @ws[row,5] = @topic.description\n @ws.save()\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic_breadcrums({\"display_text\": \"Update Topic\"})\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to topics_url, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_scrap_topic\n render_404 and return if @scrap_topic.nil?\n @scraps = @scrap_topic.scraps if @scrap_topic\n\n flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0\n respond_to do |format|\n format.html { render :action => 'scrap_topic' and return }\n format.js { render :action => 'scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n @content_pack = @topic.content_pack\n @topics = @content_pack.topics\n end\n format.js\n end\n end",
"def update\n @topic.update_attributes!(topic_params)\n json_response(@topic)\n end",
"def update\n respond_with @topic.update(topic_params)\n end",
"def update_topic\n forum_topic.updated_at = Time.now\n forum_topic.save!\n end",
"def update\n Post.suspended_delta do\n @topic.update_attributes(params[:topic])\n end\n if @topic.errors.empty?\n flash[:notice] = \"Topic Updated Successfully\"\n redirect_to @topic.forum\n else\n render :action => 'edit'\n end\n end",
"def update\n if params[:cancel]\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n return # redisplay the scrap inline\n end\n return if !scrap_user_logged_in? # check if logged in!\n old = @scrap.attributes.to_yaml\n @scrap.update_attributes(params[:scrap])\n mod = @scrap.attributes.to_yaml\n begin\n @scrap.save!(current_user) if mod != old\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n rescue\n #\n # Re-Display On Error\n edit and return\n end\n end",
"def update\n respond_to do |format|\n if @seab_topic.update(seab_topic_params)\n format.html { redirect_to @seab_topic, notice: 'Seab topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seab_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trending_topic = TrendingTopic.find(params[:id])\n\n respond_to do |format|\n if @trending_topic.update_attributes(params[:trending_topic])\n format.html { redirect_to @trending_topic, notice: 'Trending topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trending_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic_params = params[:project_topic] || params[:topic]\n title = params[:project_topic] ? 'Project Topic' : 'Topic'\n params[:project_topic] ? load_project_topic : load_topic\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to redirect_path, notice: \"#{title} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render 'form' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question_topic = QuestionTopic.find(params[:id])\n\n respond_to do |format|\n if @question_topic.update_attributes(params[:question_topic])\n format.html { redirect_to(@question_topic, :notice => 'Question topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = \"Topic was successfully updated.\"\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @text_topic = TextTopic.find(params[:id])\n\n respond_to do |format|\n if @text_topic.update_attributes(params[:text_topic])\n format.html { redirect_to(@text_topic, :notice => 'Text topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @text_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @search_topic = SearchTopic.find(params[:id])\n\n respond_to do |format|\n if @search_topic.update_attributes(params[:search_topic])\n flash[:notice] = 'SearchTopic was successfully updated.'\n format.html { redirect_to(@search_topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @search_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @newsletter_topic.update(newsletter_topic_params)\n render :show, status: :ok, location: @newsletter_topic\n else\n render json: @newsletter_topic.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @class_topic.update(class_topic_params)\n format.html { redirect_to @class_topic, notice: 'Class topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_topic }\n else\n format.html { render :edit }\n format.json { render json: @class_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to forum_topic_path(@forum,@topic), notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@forum) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_topic.update(sub_topic_params)\n format.html { redirect_to @sub_topic, notice: 'Sub topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_topic }\n else\n format.html { render :edit }\n format.json { render json: @sub_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@sudoku = Sudoku.find(params[:id])\n @get_sudoku_topic = SudokuTopic.new(params[:sudoku_topic])\n # @get_sudoku_topic.topic=\"test update by code\"\n @get_sudoku_topic.save\n\n\n respond_to do |format|\n if @sudoku.update_attributes(params[:sudoku_topic])\n format.html { redirect_to @sudoku, notice: 'Sudoku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document_topic_sub_topic.update(document_topic_sub_topic_params)\n format.html { redirect_to @document_topic_sub_topic, notice: 'Document topic sub topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document_topic_sub_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @topic.update_attributes(topic_params)\n flash[:success] = \"Topic updated\"\n redirect_to forum_topic_path(@forum, @topic)\n else\n render 'edit'\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to(@topic, :notice => 'Topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:success] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote_topic.status == VoteTopic::STATUS[:nw]\n params[:vote_topic][:status] = VoteTopic::STATUS[:revised]\n end\n if @vote_topic.update_attributes(params[:vote_topic])\n #increase edit count so we can refresh the user owned vote_topics cache\n @vote_topic.poster.increment!(:edit_count, 1)\n flash[:success] = 'VoteTopic was successfully updated.'\n #kill the cache\n Rails.cache.delete(\"vt_#{@vote_topic.id}\")\n @saved = true\n #todo figure out where to redirect\n format.html {redirect_back_or_default root_path}\n # format.html { redirect_to scoped_vote_topic_path(@vote_topic.category, @vote_topic)}\n format.xml { head :ok }\n format.js{}\n else\n @edit = true\n @saved = false\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote_topic.errors, :status => :unprocessable_entity }\n format.js{render :action => \"edit\"}\n end\n end\n end",
"def update\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_topic = CulturalHeritage::Topic.find(params[:id])\n @title_view = \"Temas\"\n respond_to do |format|\n if @cultural_heritage_topic.update_attributes(params[:cultural_heritage_topic])\n format.html { redirect_to(@cultural_heritage_topic, :notice => 'Se ha actualizado correctamente el tema.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cultural_heritage_topic.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update!(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company_forum_topic = CompanyForumTopic.find(params[:id])\n\n respond_to do |format|\n if @company_forum_topic.update_attributes(company_forum_topic_params)\n format.html { redirect_to @company_forum_topic, notice: 'Company forum topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_forum_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params) \n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @topic.topic_type.nil?\n @topic.topic_type = :yesno\n end\n \n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to \"/#{@topic.permalink}\", success: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update(params_topic)\n render json: topic, status: 200\n else\n render json: topic.errors, status: 422\n end\n\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to group_topic_path(:id => @topic.id), notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @topic.update(topic_params)\n redirect_to category_topic_path(params[:category_id], @topic)\n flash['success'] = 'sukces'\n else\n redirect_to category_topic_path(params[:category_id], @topic)\n flash['error'] = 'coś poszło nie tak'\n end\n end",
"def update\n respond_to do |format|\n if @forum_topic.update(forum_topic_params)\n format.html { redirect_to @forum_topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @forum_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to(@topic, :notice => 'Topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update_attributes(topic_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => topic.errors}, :status => :unprocessable_entity\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n if @topic.update_attributes(params[:topic])\n redirect_to @topic, notice: 'Тема изменена.'\n else\n render action: \"edit\"\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n expire_front \n\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to topics_path, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featured_topic.update(featured_topic_params)\n else\n format.json { render json: @featured_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @topic.update(topic_params)\n redirect_to @topic, notice: 'Topic was successfully updated.'\n else\n render :edit\n end\n end",
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update\n respond_to do |format|\n if @api_v1_topic.update(api_v1_topic_params)\n format.html { redirect_to @api_v1_topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_topic }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n authorize @topic\n\n if @topic.update(topic_params)\n render 'api/v1/topics/show', status: :success\n else\n render json: @topic.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to forum_path(:id => @forum), notice: 'Topic was successfully updated.' }\n format.mobile { redirect_to forum_path(:id => @forum), notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article_topic.update(article_topic_params)\n format.html { redirect_to @article_topic, notice: 'Article topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_topic }\n else\n format.html { render :edit }\n format.json { render json: @article_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subtopic.update(subtopic_params)\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully updated.' }\n format.json { render :show, status: :ok, location: @subtopic }\n else\n format.html { render :edit }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @topic = current_user.topics.find(params[:lesson][:topic_id])\n # @course = @topic.courses.first\n\n # @lesson.title = 'New Lesson (rename)' if params[:title] = ''\n respond_to do |format|\n if @lesson.update(lesson_update)\n format.html { redirect_to course_topic_lesson_path(@lesson.topic.course, @lesson.topic, @lesson), notice: 'Lesson was updated created.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to [@pool, @topic], notice: 'Topic was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data_topic = DataTopic.find(params[:id])\n\n respond_to do |format|\n if @data_topic.update_attributes(params[:data_topic])\n format.html { redirect_to @data_topic, notice: 'Data topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n if @topic.update_attributes(params[:topic])\n forum = Forum.find(@topic.forum_id);\n redirect_to forum\n else\n render action: \"edit\" \n end\n end",
"def update\n @subtopic = Subtopic.find(params[:id])\n\n respond_to do |format|\n if @subtopic.update_attributes(params[:subtopic])\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic_answer.update(topic_answer_params)\n format.html { redirect_to @topic_answer.topic, notice: 'Topic answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic_answer }\n else\n format.html { render :edit }\n format.json { render json: @topic_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: '編集が完了しました' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @discussion_topic = Boards::Topics::DiscussionTopic.find(params[:id])\n\n respond_to do |format|\n if @discussion_topic.update_attributes(params[:discussion_topic])\n flash[:notice] = 'Boards::Topics::DiscussionTopic was successfully updated.'\n format.html { redirect_to(@discussion_topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def set_topic\n @topic = Topic.find(params[:topic_id])\n end",
"def change_current_topic\n @channel = ChannelDecorator.find(params[:id])\n @channel.update_attributes(params[:channel])\n @message = @channel.current_topic_change_messages.create text: @channel.current_topic, user: current_user\n @message = MessageDecorator.decorate @message\n\n respond_with @channel\n end",
"def update\n @topic = Topic.get(params[:topic_id])\n redirect_to [@topic.forum.forum_group, @topic.forum], :notice => \"Not allowed!\" unless current_user.can_write(@topic.forum)\n @reply = Reply.get(params[:id])\n\n respond_to do |format|\n if @reply.update(params[:reply])\n format.html { redirect_to(@topic, :notice => 'Reply was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def update\n\n # @topic = current_user.topics.find(topic_params)\n @topic = current_user.topics.find(params[:id])\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def update\n respond_to do |format|\n if @topic02.update(topic02_params)\n format.html { redirect_to @topic02, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic02 }\n else\n format.html { render :edit }\n format.json { render json: @topic02.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag_topic.update(tag_topic_params)\n format.html { redirect_to @tag_topic, notice: 'Tag topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_topic }\n else\n format.html { render :edit }\n format.json { render json: @tag_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def display_inline_scrap_topic\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end",
"def update\n requires! :title\n requires! :body\n requires! :node_id\n\n raise AccessDenied unless can?(:update, @topic)\n\n if @topic.lock_node == false || can?(:lock_node, @topic)\n # Only admin can change node, when it's has been locked\n @topic.node_id = params[:node_id]\n\n if @topic.node_id_changed? || can?(:lock_node, @topic)\n # Lock node when admin update\n @topic.lock_node = true\n end\n end\n @topic.title = params[:title]\n @topic.body = params[:body]\n @topic.save!\n\n render \"show\"\n end",
"def set_topic\n @topic = Topic.friendly.find(params[:topic_id])\n end",
"def update!(**args)\n @topics = args[:topics] unless args[:topics].nil?\n @next_page_token = args[:next_page_token] unless args[:next_page_token].nil?\n end",
"def update\n respond_to do |format|\n if @citation_topic.update(citation_topic_params)\n format.html { redirect_to :back, notice: 'Citation topic was successfully updated.' }\n format.json { render json: @citation_topic, status: :ok, location: @citation_topic }\n else\n format.html { redirect_to :back, notice: 'Citation topic was NOT successfully updated.' }\n format.json { render json: @citation_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_topic.update(user_topic_params)\n format.html { redirect_to @user_topic, notice: 'User topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_topic }\n else\n format.html { render :edit }\n format.json { render json: @user_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to [@user, @topic], notice: '成功更新' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_topic(org_unit_id, topic_id, content_topic) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/topics/#{topic_id}\"\n payload = {\n 'Title' => \"\",\n 'ShortTitle' => \"\",\n 'Type' => 0,\n 'TopicType' => 0,\n 'StartDate' => nil,\n 'EndDate' => nil,\n 'DueDate' => nil,\n 'IsHidden' => nil,\n 'IsLocked' => false,\n 'OpenAsExternalResource' => nil, # Added with LE v1.6 API\n 'Description' => nil,\n 'MajorUpdate' => nil, # Added with LE v1.12 API\n 'MajorUpdateText' => \"\", # Added with LE v1.12 API\n 'ResetCompletionTracking' => nil # Added with LE v1.12 API\n }.merge!(content_topic)\n check_content_topic_validity(content_topic)\n _put(query_string, payload)\nend",
"def toggle_privacy\n\n #handle array of topics\n # @topics = Topic.where(id: params[:topic_ids])\n @topics.update_all(private: params[:private], forum_id: params[:forum_id])\n @topics.each{|topic| topic.update_pg_search_document}\n bulk_post_attributes = []\n\n @topics.each do |topic|\n if topic.forum_id == 1\n bulk_post_attributes << {body: I18n.t(:converted_to_ticket), kind: 'note', user_id: current_user.id, topic_id: topic.id}\n flash[:notice] = I18n.t(:converted_to_ticket)\n else\n bulk_post_attributes << {body: I18n.t(:converted_to_topic, forum_name: topic.forum.name), kind: 'note', user_id: current_user.id, topic_id: topic.id}\n flash[:notice] = I18n.t(:converted_to_topic, forum_name: topic.forum.name)\n end\n\n # Calls to GA\n tracker(\"Agent: #{current_user.name}\", \"Moved to #{topic.forum.name}\", @topic.to_param, 0)\n end\n\n # Bulk insert notes\n Post.bulk_insert values: bulk_post_attributes\n\n @topic = @topics.last\n @posts = @topic.posts.chronologic\n\n fetch_counts\n get_all_teams\n get_tickets_by_status\n\n\n # respond_to do |format|\n # format.js {\n if params[:topic_ids].count > 1\n render 'index'\n else\n render 'update_ticket', id: @topic.id\n end\n # }\n # end\n\n end"
] |
[
"0.6591119",
"0.64784265",
"0.6426784",
"0.63999075",
"0.6395567",
"0.6357706",
"0.6332408",
"0.63239807",
"0.63239354",
"0.6258436",
"0.6236693",
"0.62352145",
"0.62208545",
"0.6215314",
"0.6213119",
"0.6212678",
"0.6205931",
"0.6199405",
"0.6181844",
"0.6180103",
"0.6145935",
"0.612575",
"0.6114156",
"0.61127234",
"0.6105586",
"0.61036015",
"0.6085917",
"0.60816747",
"0.60785484",
"0.6075508",
"0.60709906",
"0.60615104",
"0.60615104",
"0.60615104",
"0.60615104",
"0.60615104",
"0.60583067",
"0.60579294",
"0.60579294",
"0.60579294",
"0.60579294",
"0.60579294",
"0.60571414",
"0.6050456",
"0.6034673",
"0.6034673",
"0.6034673",
"0.6034673",
"0.6028843",
"0.60227716",
"0.6021204",
"0.60141873",
"0.60125077",
"0.6009565",
"0.6008885",
"0.6008496",
"0.599604",
"0.59951323",
"0.599481",
"0.59919435",
"0.5988537",
"0.5986055",
"0.5983501",
"0.5983341",
"0.59792054",
"0.59661746",
"0.5965193",
"0.5965193",
"0.59630924",
"0.59600055",
"0.59586674",
"0.59570223",
"0.59553254",
"0.5942904",
"0.5942439",
"0.59300387",
"0.5928893",
"0.5927446",
"0.5919099",
"0.5911382",
"0.59098065",
"0.5897823",
"0.58933496",
"0.589002",
"0.58860457",
"0.58749425",
"0.58749425",
"0.585838",
"0.5856408",
"0.5845632",
"0.58371294",
"0.58346707",
"0.5834569",
"0.58331084",
"0.5826975",
"0.5826897",
"0.5812066",
"0.58087325",
"0.58032644",
"0.57924557"
] |
0.7629243
|
0
|
ScrapsController > show : Render scrap to browser, right now only used by ParallelText scraps
|
def show
render_404 and return if @scrap.nil?
respond_to do |format|
format.html { redirect_to show_scrap_path(@scrap.slug) and return }
format.js { render :action => "scrap", :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scrap\n target_url = CGI.unescape(params[:target_url])\n css_selector = CGI.unescape(params[:css_selector])\n @element_id = params[:ele_id]\n\n @scrapped_text = QuickScrapper.scrap(target_url, css_selector)\n first_word_index = params[:first_word_index] || 0\n last_word_index = params[:last_word_index] || -1\n\n @scrapped_text = @scrapped_text.split[first_word_index..last_word_index].join(\" \")\n render :text => \"jQuery('#{@element_id}').html('#{@scrapped_text}');\"\n end",
"def show\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrape }\n end\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraper }\n end\n end",
"def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"def scrape\n end",
"def show\n @crawler = Crawler.find(params[:id])\n end",
"def show\n @crawl_result = Crawl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def show\n\t\t#no need b/c we just show all at once\n\tend",
"def show\n @stories = @comic.stories\n @previous_comic = Comic.previous_comic(@comic.volume, @comic.issue, @comic.annual)\n @next_comic = Comic.next_comic(@comic.volume, @comic.issue, @comic.annual)\n if request.xhr?\n render layout: false\n end\n end",
"def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end",
"def show\n page = ShowBlock.new(self).run(&Proc.new)\n finish_show(page)\n end",
"def render max_pages = 10\n SuperCrawler::Render.console( @crawl_results, max_pages )\n end",
"def create\n @crawled_site = WebCrawlers.new(\"http://wiprodigital.com/\")\n render :show\n end",
"def show\n\tcnv = ODT_to_XHTML.new\n\txmldata = cnv.get_html(@document.content, @document.styles)\n\t@head = xmldata[:head].get_text(\"style\")\n\t@body = xmldata[:body].to_s.sub(/<body>/,\"<div class=\\\"document\\\">\").sub(/<\\/body>/,\"</div>\")\n end",
"def show\n json_response(@browser)\n end",
"def show\n\n \n end",
"def crawler_page\n open(crawler_url)\n end",
"def show\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def show() end",
"def show() end",
"def show() end",
"def show\n\t\t end",
"def scrape_it\n \n end",
"def show\n\n # extract the content\n extract_content\n generate_titles\n\n rescue ActiveRecord::RecordNotFound\n\n not_found and return\n\n end",
"def show\n setup_download_list\n render partial: \"browse_#{view_type}\"\n end",
"def index\n @scraping_pages = ScrapingPage.all\n end",
"def show\n # Get the html, svg, css, and js code to render\n @code = get_article_code\n\n # The default layouts are not added as this page will be\n # embeded in an iframe\n render layout: false\n end",
"def show\n smartrender\n end",
"def show\n smartrender\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def show \r\n end",
"def display_inline_scrap_topic\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end",
"def show\n @title = @case_study.title\n @case_studies = @case_study.find_related_tags\n @pages = Page.tagged_with(@case_study.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:case_studies:#{@case_study.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:case_studies:#{@case_study.id}\", 300, @case_study.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@case_study)}';</script></body></html>\", content_type: :html) and return\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n render \"show\"\n @results = @trivium.results\n @questions = @trivium.questions\n end",
"def scrape()\n scrapeForCurrentData\n end",
"def index\n @scraps = Scrap.all\n end",
"def show\n @serial_works = @series.serial_works.find(:all, :include => :work, :conditions => ['works.posted = ?', true], :order => :position).select{|sw| sw.work.visible(User.current_user)}\n # sets the page title with the data for the series\n @page_title = \"\"\n if logged_in? && !current_user.preference.work_title_format.blank?\n @page_title = current_user.preference.work_title_format\n @page_title.gsub!(/FANDOM/, @series.allfandoms.collect(&:name).join(', '))\n @page_title.gsub!(/AUTHOR/, @series.allpseuds.collect(&:byline).join(', '))\n @page_title.gsub!(/TITLE/, @series.title)\n else\n @page_title = @series.title + \" - \" + @series.allpseuds.collect(&:byline).join(', ') + \" - \" + @series.allfandoms.collect(&:name).join(', ')\n end\n @page_title += \" [#{ArchiveConfig.APP_NAME}]\"\n end",
"def show\n render_default_format(@our_works, true, 200)\n rescue Exception => e\n puts e.inspect\n end",
"def show\n #not needed for our implementation\n end",
"def show\n @search = Search.find(params[:id])\n @search_run = SearchRun.new\n\n\t\t# if params[:search_result]\n\n # search_terms =\n # if params[:search_result][:use_description_terms] == '1'\n # @search.description.split(' ')\n # else\n # []\n # end\n\n # search_results = @search.scan(params[:search_result][:selector], search_terms)\n\n # search_run = SearchRun.new(search_url: @website.search_url, selector: params[:search_result][:selector])\n # @search.search_runs << search_run\n\n # search_results.each do |result|\n # url = result[:url]\n\n # url = @website.base_url + result[:url] if result[:url].start_with?('/')\n\n # search_run.search_run_results << SearchRunResult.new(text: result[:text], url: url)\n # end\n\t\t# end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @search }\n end\n end",
"def show\n @crawler_template = CrawlerTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crawler_template }\n end\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n # \n end",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def show\n render_default_format(@work, true, 200)\n rescue Exception => e\n puts e.inspect\n end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @results = @report.results\n end",
"def show\n @results = @report.results\n end",
"def index\n @scraping_html_elements = ScrapingHtmlElement.all\n end",
"def scrape_text\n\n end",
"def show\n \t\n end",
"def show\n \t\n end",
"def show\n @crawler_receive = CrawlerReceive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_receive }\n end\n end",
"def show\n @crawler_article = CrawlerArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def show\n\n p \"---------\"\n p @contents\n\n end",
"def show ; end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end"
] |
[
"0.67932236",
"0.66783774",
"0.6636916",
"0.6622841",
"0.65262365",
"0.65173715",
"0.6498611",
"0.64275295",
"0.63732743",
"0.63636744",
"0.6354494",
"0.63435",
"0.6343397",
"0.63291085",
"0.6305021",
"0.63038",
"0.62529355",
"0.6230974",
"0.6214712",
"0.6199106",
"0.6199106",
"0.6199106",
"0.6179113",
"0.6176453",
"0.6152027",
"0.6151406",
"0.61458343",
"0.6129177",
"0.6120092",
"0.6120092",
"0.6118715",
"0.6109148",
"0.610005",
"0.609583",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.60830265",
"0.6046534",
"0.6038828",
"0.60318923",
"0.60122603",
"0.6011672",
"0.60036033",
"0.5995655",
"0.59935045",
"0.5992106",
"0.5992106",
"0.5992056",
"0.5991972",
"0.5985311",
"0.59830725",
"0.59715754",
"0.59715754",
"0.59655666",
"0.5955786",
"0.5945991",
"0.5945991",
"0.5937148",
"0.5931329",
"0.59231627",
"0.592121",
"0.59165627",
"0.59165627",
"0.59165627",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365",
"0.5909365"
] |
0.6803512
|
0
|
ScrapsController > new : Render new scrap form to browser
|
def new
return if !scrap_user_logged_in?(true) # check if logged in!
scrap_type = params[:type].downcase
if !scrap_type.nil?
@scrap = Definition.new if scrap_type == "definition"
@scrap = ParallelText.new if scrap_type == "parallel_text"
@scrap = Bookmark.new if scrap_type == "bookmark"
@scrap = Webscrap.new if scrap_type == "webscrap"
@scrap = Note.new if scrap_type == "note"
end
respond_to do |format|
format.html { return }
format.js { render :action => 'new', :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraper }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def new\n @mush_crawler = MushCrawler.new\n @crawler_template = CrawlerTemplate::Crawler_Template\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def new\n @crawl_result = Crawl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def create\n @scrape = Scrape.new(params[:scrape])\n\n respond_to do |format|\n if @scrape.save\n @scrape.scrape\n format.html { redirect_to @scrape, notice: 'Scrape was successfully created.' }\n format.json { render json: @scrape, status: :created, location: @scrape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraping_page = ScrapingPage.new(scraping_page_params)\n\n #--- Set url and new mechanize ---#\n url = @scraping_page.page_url\n uri = URI.parse(url) # ex) https://example.com/ -> set \"example.com\"\n agent = Mechanize.new\n page = agent.get(url)\n\n #--- Set title ---#\n title = page.title if page.respond_to?(:title) # For undefiend page.title method error (ex: RSS or missing title meta tag WebSite).\n title = \"#{title} #{uri.host}\"\n @scraping_page.title = title\n\n #--- Set charset ---#\n @scraping_page.charset = set_charset(page.body)\n\n #--- Obey robots.txt ---#\n robotex = Robotex.new \"Crawler\"\n @scraping_page.is_robots_allowed = robotex.allowed?(url)\n\n #--- Set scraping HTML file name ---#\n @scraping_page.directory_path = create_directory(url) # concerns/file_savable.rb\n\n respond_to do |format|\n if @scraping_page.save\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully created.' }\n format.json { render :show, status: :created, location: @scraping_page }\n else\n format.html { render :new }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraping_html_element = ScrapingHtmlElement.new(scraping_html_element_params)\n\n respond_to do |format|\n if @scraping_html_element.save\n format.html { redirect_to @scraping_html_element, notice: 'Scraping html element was successfully created.' }\n format.json { render :show, status: :created, location: @scraping_html_element }\n else\n format.html { render :new }\n format.json { render json: @scraping_html_element.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @scraping_algorithm = ScrapingAlgorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def new\n @scrape_order = ScrapeOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrape_order }\n end\n end",
"def create\n @scraper = Scraper.new(params[:scraper])\n\n respond_to do |format|\n if @scraper.save\n format.html { redirect_to @scraper, notice: 'Scraper was successfully created.' }\n format.json { render json: @scraper, status: :created, location: @scraper }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraper = Scraper.new(params[:scraper])\n\n respond_to do |format|\n if @scraper.save\n format.html { redirect_to(@scraper, :notice => 'Scraper was successfully created.') }\n format.xml { render :xml => @scraper, :status => :created, :location => @scraper }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scraper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @page = Page.new\n # render new.html.erb\n end",
"def new\n @page = Page.new\n # render new.html.erb\n end",
"def create\n @crawler = Crawler.new(params[:crawler])\n if @crawler.save\n redirect_to(edit_crawler_path(@crawler), :notice => 'Crawler was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def new\n @crawler_receive = CrawlerReceive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_receive }\n end\n end",
"def new\n\t\t# no code needed here; all handled in the view\n\tend",
"def new\n @paste = Paste.new\n @parsers = Parser.all(:order => 'display_name')\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @dataset = Dataset.new\n prep_dataset_form\n \n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @dataset }\n end\n end",
"def create\n @newsscraper = Newsscraper.new(newsscraper_params)\n\n respond_to do |format|\n if @newsscraper.save\n format.html { redirect_to @newsscraper, notice: 'Newsscraper was successfully created.' }\n format.json { render :show, status: :created, location: @newsscraper }\n else\n format.html { render :new }\n format.json { render json: @newsscraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_with(page)\n end",
"def create\n @webscrape = Webscrape.new(webscrape_params)\n\n respond_to do |format|\n if @webscrape.save\n format.html { redirect_to @webscrape, notice: 'Webscrape was successfully created.' }\n format.json { render :show, status: :created, location: @webscrape }\n else\n format.html { render :new }\n format.json { render json: @webscrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breakdown = Breakdown.new\n prepFormVariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breakdown }\n end\n end",
"def new\n\n # check whether we can do this\n not_found and return unless action_allowed?( :create )\n\n # extract content\n extract_content\n generate_titles\n\n end",
"def new\n # CREATES NEW PAGE ONLY IN MEMORY NO IN DATABASE\n @page = Page.new\n # renders the form\n end",
"def new\n @screw = Screw.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @screw }\n end\n end",
"def create\n @crawled_site = WebCrawlers.new(\"http://wiprodigital.com/\")\n render :show\n end",
"def new\n @pages = Page.new\n #renders new.html.erb\n end",
"def new\n @recipe_page = RecipePage.new\n end",
"def new\n @page_title = 'Create Army'\n respond_to do |format|\n format.html # render new.html.erb\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n format.js { render nothing: true }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page = Page.find_by_title('Huren bij Xposers')\n end",
"def new\n @crawler_article = CrawlerArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to admin_crawlers_url }\n else\n format.html { render :new }\n end\n end\n end",
"def new\n @page = Page.new\n respond_with(@page)\n end",
"def new\n @page = Page.new\n respond_with(@page)\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @cheer = Cheer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheer }\n end\n end",
"def new\n @page = Page.new\n #render :new - app/views/pages/new.html.erb\n end",
"def new\n @scrobble = Scrobble.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrobble }\n end\n end",
"def new\n @selector_site = SelectorSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selector_site }\n end\n end",
"def new\n @recycling_site = RecyclingSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recycling_site }\n end\n end",
"def new_page(obj, opts={})\n page do\n form_attr = form_attributes(:action=>url_for(\"create\"))\n Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:new, request).each do |column|\n col_opts = column_options_for(:new, request, obj, column)\n if html = model.edit_html_for(obj, column, :new, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Create', :class=>'btn btn-primary')\n end\n end\n end",
"def new\n @spit = Spit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spit }\n end\n end",
"def new\n @squishee_cup = SquisheeCup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @squishee_cup }\n end\n end",
"def new\n @sprint = Sprint.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @page = Page.new\n # render :new app/views/pages/new.html.erb\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n render\n end",
"def new\n render\n end",
"def new\n render\n end",
"def new\n render\n end",
"def create\n @page = Scraper.fetch(params[:page][:url])\n\n if @page\n redirect_to @page\n else\n flash[:error] = \"Failed to fetch url! Please check the url and try again.\"\n redirect_to :action => :new\n end\n end",
"def new\n @webpage = Webpage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @webpage }\n end\n end",
"def new\n # render new.html\n end",
"def new\n @page_title = \"Web Design & Development Price Calculator\"\n @page_description = \"Free onsite SEO with every new website built with Web Design Stories. We specialize in small companies sector, build your brand and become one of the successful companies.\"\n @page_keywords = 'Web Design Calculator, Website calculator, web development price calculator, price calculator website, website, calculator'\n \n @breadcrumb = \"New Website\"\n @website = Website.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @website }\n end\n end",
"def new\n respond_with(@page = Page.new)\n end",
"def new\n @occurrence = @course.occurrences.new\n \n render :layout => !request.xhr?\n end",
"def new\n @page = Page.new\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @clinic = Clinic.new\n @packages = Package.all\n @pageType = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinic }\n end\n end",
"def new\n @crowd = Crowd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crowd }\n end\n end",
"def new\n @title = \"Create a Company\"\n @company = Company.new\n render :layout => false\n end",
"def new\n @search_page = SearchPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_page }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @scrap = @user.scraps.build\n authorize! :create, @scrap\n end",
"def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @research_item = ResearchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @research_item }\n end\n end",
"def new\n @question = @keyword.question_sheet.elements.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @question }\n end\n end",
"def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end",
"def new\n render(\n :new,\n layout: false,\n locals: local_vars.merge(\n all_clinics: Renalware::Pathology::Clinic.for_algorithm,\n all_consultants: Renalware::Pathology::Consultant.ordered,\n all_templates: Renalware::Pathology::Requests::Request::TEMPLATES\n )\n )\n end",
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def new\n @sifter = Sifter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sifter }\n end\n end",
"def new\n \t@contact = Contact.new\n @page = Page.find(4)\n bootstrap_page\n end",
"def new\n render 'new'\n end",
"def new\n @robot = Robot.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @robot }\n end\n end",
"def create\n @spider = Spider.new(spider_params)\n\n respond_to do |format|\n if @spider.save\n format.html { redirect_to @spider, notice: 'Spider was successfully created.' }\n format.json { render :show, status: :created, location: @spider }\n else\n format.html { render :new }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software_training_class }\n end\n end",
"def new\n @breakdown = Breakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @breakdown }\n end\n end",
"def new\n @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n render \"new\"\n end",
"def new\n render \"new\"\n end",
"def create_webform(title, fields, browser = @browser)\n browser.navigate.to($config['sut_url'] + create_webform_url)\n Log.logger.debug(\"Entering new webform title '#{title}'\")\n fields.each{|fieldname|\n self.add_webform_component(fieldname)\n }\n self.add_webform_title(title)\n message = self.save_webform(browser)\n return message\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n \t@client = Client.new\n @page_title = \"Registration\"\n end",
"def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @researcher }\n end\n end",
"def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @scanner = Scanner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scanner }\n end\n end",
"def new\n @crawler_template = CrawlerTemplate.new\n if params[:mall_id]\n @crawler_template.mall_id = params[:mall_id]\n end\n \n if params[:brand_id]\n @crawler_template.brand_id = params[:brand_id]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crawler_template }\n end\n end",
"def visit_new_page(model, **opt, &block)\n visit_action_page(model, :new, **opt, &block)\n end",
"def new\n @test_page = TestPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_page }\n end\n end",
"def new\n @travel = Travels::Travel.new\n\n respond_to do |format|\n format.html # new.html.rb\n end\n end",
"def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @pageview = Pageview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pageview }\n end\n end"
] |
[
"0.76355785",
"0.74854714",
"0.7358928",
"0.7008288",
"0.7008288",
"0.69642407",
"0.69047505",
"0.6857759",
"0.6790858",
"0.67562354",
"0.67333525",
"0.669947",
"0.6681327",
"0.667842",
"0.66541934",
"0.66541934",
"0.6627337",
"0.65997744",
"0.65436876",
"0.6542903",
"0.6517276",
"0.6515267",
"0.65064675",
"0.6474309",
"0.64723414",
"0.6471722",
"0.64461535",
"0.64407057",
"0.64397204",
"0.64274836",
"0.642717",
"0.6403239",
"0.63725585",
"0.63653916",
"0.6359973",
"0.6345358",
"0.6337705",
"0.6337705",
"0.6336609",
"0.6336609",
"0.6336609",
"0.6336415",
"0.6333865",
"0.6332968",
"0.63121855",
"0.63113505",
"0.63105834",
"0.6306643",
"0.6270516",
"0.62591434",
"0.6230152",
"0.62245166",
"0.62190306",
"0.6210749",
"0.6210749",
"0.6210749",
"0.6210749",
"0.62076926",
"0.6203996",
"0.61964285",
"0.6186146",
"0.6185916",
"0.61749774",
"0.61706334",
"0.61638284",
"0.6160053",
"0.6154383",
"0.6151912",
"0.6145044",
"0.6145044",
"0.61429733",
"0.61242473",
"0.61213875",
"0.6119138",
"0.61152107",
"0.6111977",
"0.6110707",
"0.6107009",
"0.6103429",
"0.6103232",
"0.60998327",
"0.60979396",
"0.60969347",
"0.60949355",
"0.60888046",
"0.6087089",
"0.6083983",
"0.6083983",
"0.6073909",
"0.60710675",
"0.60704476",
"0.6068832",
"0.60658205",
"0.60616785",
"0.6061278",
"0.60576165",
"0.6055147",
"0.6054743",
"0.6049103",
"0.6045406"
] |
0.72693706
|
3
|
ScrapsController > create : Create the new scrap and render it to browser
|
def create
return if cancelled?
begin
if params[:scrap][:type] == "ParallelText"
@scrap = ParallelText.new(params[:scrap])
@scrap.scrap_topic = Corpus.by_language(params[:scrap][:language_id])
else
if params[:scrap][:type] == "Definition"
@scrap = Definition.new(params[:scrap])
elsif params[:scrap][:type] == "Webscrap"
@scrap = Webscrap.new(params[:scrap])
elsif params[:scrap][:type] == "Bookmark"
@scrap = Bookmark.new(params[:scrap])
else
@scrap = Note.new(params[:scrap])
end
if @scrap_topic.nil? or @scrap_topic.id == nil
#Initiatlize a new scrap topic!
@scrap.scrap_topic = init_scrap_topic(params[:scrap_topic_title], current_user.id)
else
#Assign existing scrap topic
@scrap.scrap_topic = @scrap_topic
end
end
@scrap.save!(current_user)
if @scrap.class.to_s =="ParallelText"
respond_to do |format|
format.html { redirect_to show_scrap_path(@scrap.slug) and return }
format.js { render :action => "scrap", :layout => false and return }
format.xml { return }
end
else
respond_to do |format|
format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }
format.js { @scraps = @scrap_topic.scraps if !@scrap_topic.scraps.nil?; render :action => "scrap_topic", :layout => false and return }
format.xml { return }
end
end
rescue
#
# Re-Display On Error
respond_to do |format|
format.html { render :action => "new" and return }
format.js { render :partial => "scrap_form", :layout => false and return }
format.xml { return }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @scrape = Scrape.new(params[:scrape])\n\n respond_to do |format|\n if @scrape.save\n @scrape.scrape\n format.html { redirect_to @scrape, notice: 'Scrape was successfully created.' }\n format.json { render json: @scrape, status: :created, location: @scrape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraper = Scraper.new(params[:scraper])\n\n respond_to do |format|\n if @scraper.save\n format.html { redirect_to @scraper, notice: 'Scraper was successfully created.' }\n format.json { render json: @scraper, status: :created, location: @scraper }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraper = Scraper.new(params[:scraper])\n\n respond_to do |format|\n if @scraper.save\n format.html { redirect_to(@scraper, :notice => 'Scraper was successfully created.') }\n format.xml { render :xml => @scraper, :status => :created, :location => @scraper }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scraper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @webscrape = Webscrape.new(webscrape_params)\n\n respond_to do |format|\n if @webscrape.save\n format.html { redirect_to @webscrape, notice: 'Webscrape was successfully created.' }\n format.json { render :show, status: :created, location: @webscrape }\n else\n format.html { render :new }\n format.json { render json: @webscrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newsscraper = Newsscraper.new(newsscraper_params)\n\n respond_to do |format|\n if @newsscraper.save\n format.html { redirect_to @newsscraper, notice: 'Newsscraper was successfully created.' }\n format.json { render :show, status: :created, location: @newsscraper }\n else\n format.html { render :new }\n format.json { render json: @newsscraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crawler = Crawler.new(params[:crawler])\n if @crawler.save\n redirect_to(edit_crawler_path(@crawler), :notice => 'Crawler was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def create\n @scraping_page = ScrapingPage.new(scraping_page_params)\n\n #--- Set url and new mechanize ---#\n url = @scraping_page.page_url\n uri = URI.parse(url) # ex) https://example.com/ -> set \"example.com\"\n agent = Mechanize.new\n page = agent.get(url)\n\n #--- Set title ---#\n title = page.title if page.respond_to?(:title) # For undefiend page.title method error (ex: RSS or missing title meta tag WebSite).\n title = \"#{title} #{uri.host}\"\n @scraping_page.title = title\n\n #--- Set charset ---#\n @scraping_page.charset = set_charset(page.body)\n\n #--- Obey robots.txt ---#\n robotex = Robotex.new \"Crawler\"\n @scraping_page.is_robots_allowed = robotex.allowed?(url)\n\n #--- Set scraping HTML file name ---#\n @scraping_page.directory_path = create_directory(url) # concerns/file_savable.rb\n\n respond_to do |format|\n if @scraping_page.save\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully created.' }\n format.json { render :show, status: :created, location: @scraping_page }\n else\n format.html { render :new }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scrape = Scrape.new(scrape_params)\n @scrape.user = current_user\n\n respond_to do |format|\n if @scrape.save\n ScrapeData.new.delay.perform(@scrape.id)\n format.html { redirect_to @scrape, notice: 'Scrape was successfully created.' }\n format.json { render :show, status: :created, location: @scrape }\n else\n format.html { render :new }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spider = Spider.new(spider_params)\n\n respond_to do |format|\n if @spider.save\n format.html { redirect_to @spider, notice: 'Spider was successfully created.' }\n format.json { render :show, status: :created, location: @spider }\n else\n format.html { render :new }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraping_html_element = ScrapingHtmlElement.new(scraping_html_element_params)\n\n respond_to do |format|\n if @scraping_html_element.save\n format.html { redirect_to @scraping_html_element, notice: 'Scraping html element was successfully created.' }\n format.json { render :show, status: :created, location: @scraping_html_element }\n else\n format.html { render :new }\n format.json { render json: @scraping_html_element.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n format.js { render nothing: true }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n return if !scrap_user_logged_in?(true) # check if logged in!\n scrap_type = params[:type].downcase\n if !scrap_type.nil?\n @scrap = Definition.new if scrap_type == \"definition\"\n @scrap = ParallelText.new if scrap_type == \"parallel_text\"\n @scrap = Bookmark.new if scrap_type == \"bookmark\"\n @scrap = Webscrap.new if scrap_type == \"webscrap\"\n @scrap = Note.new if scrap_type == \"note\"\n end\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new', :layout => false and return }\n format.xml { return }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraper }\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to admin_crawlers_url }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @page = Scraper.fetch(params[:page][:url])\n\n if @page\n redirect_to @page\n else\n flash[:error] = \"Failed to fetch url! Please check the url and try again.\"\n redirect_to :action => :new\n end\n end",
"def create\n @crawl_result = Crawl.new(params[:crawl_result])\n\n respond_to do |format|\n if @crawl_result.save\n format.html { redirect_to(@crawl_result, :notice => 'Crawl result was successfully created.') }\n format.xml { render :xml => @crawl_result, :status => :created, :location => @crawl_result }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @crawl_result.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def create\n @crawled_site = WebCrawlers.new(\"http://wiprodigital.com/\")\n render :show\n end",
"def create\n @mush_crawler = MushCrawler.new(params[:mush_crawler])\n\n respond_to do |format|\n if @mush_crawler.save\n flash[:notice] = 'MushCrawler was successfully created.'\n format.html { redirect_to(@mush_crawler) }\n format.xml { render :xml => @mush_crawler, :status => :created, :location => @mush_crawler }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mush_crawler.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @scrape_order = ScrapeOrder.new(params[:scrape_order])\n\n respond_to do |format|\n if @scrape_order.save\n format.html { redirect_to(scrape_orders_path, :notice => 'Scrape order was successfully created.') }\n format.xml { render :xml => @scrape_order, :status => :created, :location => @scrape_order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scrape_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize Unscraped\n @unscraped = Unscraped.new(unscraped_params)\n @unscraped.user = current_user\n\n respond_to do |format|\n if @unscraped.save\n @unscraped.create_activity :create, owner: current_user\n format.html { redirect_to @unscraped, notice: 'Unscraped was successfully created.' }\n format.json { render :show, status: :created, location: @unscraped }\n else\n format.html { render :new }\n format.json { render json: @unscraped.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def create\n @scraping_algorithm = ScrapingAlgorithm.new(params[:scraping_algorithm])\n\n respond_to do |format|\n if @scraping_algorithm.save\n format.html { redirect_to @scraping_algorithm, notice: 'Scraping algorithm was successfully created.' }\n format.json { render json: @scraping_algorithm, status: :created, location: @scraping_algorithm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraping_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crawl_request = CrawlRequest.new(crawl_request_params)\n\n if @crawl_request.save\n render json: @crawl_request, status: :created, location: @crawl_request\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end",
"def create\n @crawl_request = CrawlRequest.new(crawl_request_params)\n\n if @crawl_request.save\n render json: @crawl_request, status: :created, location: @crawl_request, :include => :urls\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end",
"def new\n @scrap = @user.scraps.build\n authorize! :create, @scrap\n end",
"def create\n @cheer = Cheer.new(params[:cheer])\n\n respond_to do |format|\n if @cheer.save\n format.html { redirect_to @cheer, notice: 'Cheer was successfully created.' }\n format.json { render json: @cheer, status: :created, location: @cheer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cheerup = Cheerup.new(cheerup_params)\n\n respond_to do |format|\n if @cheerup.save\n format.html { redirect_to @cheerup, notice: 'Cheerup was successfully created.' }\n format.json { render :show, status: :created, location: @cheerup }\n else\n format.html { render :new }\n format.json { render json: @cheerup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @get_started_page.brand = website.brand\n respond_to do |format|\n if @get_started_page.save\n format.html { redirect_to([:admin, @get_started_page], notice: '\"Get Started\" page was successfully created.') }\n format.xml { render xml: @get_started_page, status: :created, location: @get_started_page }\n website.add_log(user: current_user, action: \"Created get_started_page: #{@get_started_page.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @get_started_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scrapper = Scrapper.new(scrapper_params)\n @scrapper.save\n # f = File.open(Dir.pwd+\"/Additional Docs/SportsPages/BBC Test Data.html\")\n # f = File.open(Dir.pwd+@scrapper.url)\n # doc = Nokogiri::HTML(f)\n doc = Nokogiri::HTML(open(@scrapper.url))\n \n competition = Competition.find_or_create_by(name: scrapper_add_params[:competition])\n\n dateArray = doc.css('table.table-stats')#Date is contain in a super class\n dateArray.each do |dateElement|\n matchArray = dateElement.css('tr.preview')#Get all the match instances for the date\n split_date = dateElement.css('caption').text[38..-1].split\n year = split_date[3].to_i\n month = DateTime::MONTHNAMES.index(split_date[2])\n day = split_date[1][0...-2].to_i\n matchArray.each do |matchElement|\n \n hometeam = Team.find_or_create_by(name: matchElement.css('.team-home a').text.strip)\n awayteam = Team.find_or_create_by(name: matchElement.css('.team-away a').text.strip)\n\n kickoff = matchElement.css('.kickoff').text.strip\n hour = kickoff[0...-3].to_i\n minute = kickoff[-2..-1].to_i\n\n fixture = Fixture.find_or_create_by(hometeam_id: hometeam.id, awayteam_id: awayteam.id, competition_id: competition.id )\n fixture.date = DateTime.new(year,month,day,hour,minute,0)\n fixture.scrapper_id = @scrapper.id\n\n fixture.save\n end\n end\n # f.close\n respond_to do |format|\n if @scrapper.save\n format.html { redirect_to @scrapper, notice: 'Scrapper history was successfully created.' }\n format.json { render :show, status: :created, location: @scrapper }\n else\n format.html { render :new }\n format.json { render json: @scrapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @crawl_result = Crawl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def create\n @scrape_config = ScrapeConfig.new(scrape_config_params)\n\n respond_to do |format|\n if @scrape_config.save\n format.html { redirect_to @scrape_config, notice: 'Scrape config was successfully created.' }\n format.json { render :show, status: :created, location: @scrape_config }\n else\n format.html { render :new }\n format.json { render json: @scrape_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } }\n scraped_article = JSON.parse(response.body)\n @article.update({\n :title => scraped_article['title'],\n :byline => scraped_article['byline'],\n :excerpt => scraped_article['excerpt'],\n :content_html => scraped_article['content'],\n :readerable => scraped_article['readerable'],\n :scraped_at => DateTime.now\n })\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @screencast = Screencast.new(params[:screencast])\n\n respond_to do |format|\n if @screencast.save\n format.html { redirect_to(@screencast, :notice => 'Screencast was successfully created.') }\n format.xml { render :xml => @screencast, :status => :created, :location => @screencast }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @screencast.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @dataset = Dataset.new(params[:dataset])\n prep_dataset_form\n @dataset.save!\n publish_press_item(\"New dataset added: #{@dataset.title}\")\n\n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully created.'\n wants.html { redirect_to(@dataset) }\n wants.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n end\n end",
"def create\r\n\r\n\r\n end",
"def create\n @page.brand = website.brand\n respond_to do |format|\n if @page.save\n format.html { redirect_to([:admin, @page], notice: 'Page was successfully created.') }\n format.xml { render xml: @page, status: :created, location: @page }\n website.add_log(user: current_user, action: \"Created page: #{@page.title}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sprint.save\n\n respond_with(@sprint)\n end",
"def new\n @mush_crawler = MushCrawler.new\n @crawler_template = CrawlerTemplate::Crawler_Template\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def create\n redirect_to pages_path\n end",
"def create\n @crawler_article = CrawlerArticle.new(params[:crawler_article])\n\n respond_to do |format|\n if @crawler_article.save\n flash[:notice] = 'CrawlerArticle was successfully created.'\n format.html { redirect_to(@crawler_article) }\n format.xml { render :xml => @crawler_article, :status => :created, :location => @crawler_article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @crawler_article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n i = Item.new\n i.title = params[\"title\"]\n i.description = params[\"desc\"]\n i.save\n redirect_to recommendations_url\n end",
"def create\n # sleep 2 # Wait for Windows to catch up!\n @page = Page.new(params[:page])\n \n @comic.last_updated = Time.now\n @comic.pages << @page \n \n respond_to do |format|\n if @page.save\n @comic.save\n flash[:notice] = 'Page was successfully created.'\n format.html { redirect_to edit_page_path(:comic_id => @comic.alias, :id => @page) }\n format.xml { head :created, :location => page_url(:comic_id => @comic.alias, :id => @page) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors.to_xml }\n end\n end\n end",
"def create\n @sprinkle = Sprinkle.new(sprinkle_params)\n\n respond_to do |format|\n if @sprinkle.save\n format.html { redirect_to @sprinkle, notice: 'Sprinkle was successfully created.' }\n format.json { render :show, status: :created, location: @sprinkle }\n else\n format.html { render :new }\n format.json { render json: @sprinkle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_page = TestPage.new(params[:test_page])\n\n respond_to do |format|\n if @test_page.save\n format.html { redirect_to @test_page, notice: 'Test page was successfully created.' }\n format.json { render json: @test_page, status: :created, location: @test_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @training_class.brand_id = website.brand_id\n respond_to do |format|\n if @training_class.save\n format.html { redirect_to([:admin, @training_class], notice: 'Training class was successfully created.') }\n format.xml { render xml: @training_class, status: :created, location: @training_class }\n website.add_log(user: current_user, action: \"Created training class\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @training_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spit = Spit.new(params[:spit])\n\n respond_to do |format|\n if @spit.save\n format.html { redirect_to(@spit, :notice => 'Spit was successfully created.') }\n format.xml { render :xml => @spit, :status => :created, :location => @spit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_scrap\n @scrap = Scrap.find(params[:id])\n end",
"def create\n @sprint = @project.sprints.create(:name => \"Unnamed sprint\")\n\n render @sprint\n end",
"def create\n @create_rock = CreateRock.new(create_rock_params)\n\n respond_to do |format|\n if @create_rock.save\n format.html { redirect_to @create_rock, notice: 'Rock was successfully created.' }\n format.json { render :show, status: :created, location: @create_rock }\n else\n format.html { render :new }\n format.json { render json: @create_rock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recycling_site = RecyclingSite.new(params[:recycling_site])\n\n respond_to do |format|\n if @recycling_site.save\n flash[:notice] = 'RecyclingSite was successfully created.'\n format.html { redirect_to(@recycling_site) }\n format.xml { render :xml => @recycling_site, :status => :created, :location => @recycling_site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recycling_site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:notice] = 'The website was successfully added.' if website.save\n respond_with(website)\n end",
"def create\n @newspage = Newspage.new(params[:newspage])\n\n respond_to do |format|\n if @newspage.save\n format.html { redirect_to @newspage, notice: 'Newspage was successfully created.' }\n format.json { render json: @newspage, status: :created, location: @newspage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newspage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n # check whether we can do this\n not_found and return unless action_allowed?( :create )\n\n # extract content\n extract_content\n generate_titles\n\n end",
"def create\n @sitelink = Sitelink.new(sitelink_params)\n\n respond_to do |format|\n if @sitelink.save\n format.html { redirect_to @sitelink, notice: 'Sitelink was successfully created.' }\n format.json { render :show, status: :created, location: @sitelink }\n else\n format.html { render :new }\n format.json { render json: @sitelink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @scrape_order = ScrapeOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrape_order }\n end\n end",
"def new\n @scrobble = Scrobble.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrobble }\n end\n end",
"def create\n end",
"def create\n @squishee_cup = SquisheeCup.new(params[:squishee_cup])\n\n respond_to do |format|\n if @squishee_cup.save\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully created.' }\n format.json { render json: @squishee_cup, status: :created, location: @squishee_cup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scrobble = Scrobble.new(params[:scrobble])\n @scrobble.citation ||= Citation.find_in_params(params)\n @scrobble.user = @current_user\n\n respond_to do |format|\n if @scrobble.save\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully created.' }\n format.json { render json: @scrobble, status: :created, location: @scrobble }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n end",
"def create\n # render plain: params[:company].inspect\n @company = Company.new(company_params) # Company.create() = Company.new() + Company.save\n \n if @company.save\n redirect_to @company\n else\n render 'new'\n end\n end",
"def create\n new_stuff\n @style.attributes = params[:style]\n @page.attributes = params[:page]\n respond_to do |format|\n if @style.save\n flash[:notice] = 'Style was successfully created.'\n format.html { redirect_to style_url(@style) }\n format.xml { head :created, :location => style_url(@style) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @style.errors.to_xml }\n end\n end\n end",
"def create\r\n end",
"def create\n \n end",
"def create\n\t\tpre_new\n\t\t@page.save!\n\t\tflash[:notice] = 'New Page was successfully saved.'\n\t\tredirect_to @page.sitepath\n\t#rescue NoMethodError\n\t#\trender :action=>:new\n\trescue ActiveRecord::RecordInvalid\n\t\trender :action=>:new\n\trescue\n\t\tflash.now[:error] = 'An error occurred while trying to save your new Page.'\n\t\trender :action=>:new\n\tend",
"def create\n @scrub = Scrub.new(scrub_params)\n\n respond_to do |format|\n if @scrub.save\n format.html { redirect_to @scrub, notice: 'Scrub was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scrub }\n else\n format.html { render action: 'new' }\n format.json { render json: @scrub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully created.') }\n format.xml { render :xml => @sitio, :status => :created, :location => @sitio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to @sitio, notice: 'Sitio was successfully created.' }\n format.json { render json: @sitio, status: :created, location: @sitio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spltrain = Spltrain.new(spltrain_params)\n\n respond_to do |format|\n if @spltrain.save\n format.html { redirect_to @spltrain, notice: 'Spltrain was successfully created.' }\n format.json { render :show, status: :created, location: @spltrain }\n else\n format.html { render :new }\n format.json { render json: @spltrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # params[:book] --> inspect the html file then you can see the name as name=book[title] and name=book[author]\n # Book.create(params[:book]) # create and save it in db\n @book=Book.new(book_params)# create instant or copy \n # it take book_params method to checked\n \n # save it to database\n if @book.save \n redirect_to books_path # go to books path\n else\n render action: \"new\" # back to the action new\n end\n end",
"def create\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.create(params[:comic_page])\n\n\n respond_to do |format|\n if @comic_page.save\n format.html { redirect_to @comic, notice: 'Comic page was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n if @page.save\n redirect url(:page, @page)\n else\n render :new\n end\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n @sitelink = Sitelink.new(params[:sitelink])\n @preferredpages = Preferredpage.find(:all)\n\n respond_to do |format|\n if @sitelink.save\n flash[:notice] = 'Sitelink was successfully created.'\n format.html { redirect_to(@sitelink) }\n format.xml { render :xml => @sitelink, :status => :created, :location => @sitelink }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sitelink.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @screw = Screw.new(params[:screw].permit(:size, :length, :threading, :drawer_ids, :drawers, :barcode))\n @screw.drawer_ids = params[:screw][:drawer_ids]\n @screw.save\n\n respond_to do |wants|\n if @screw.save\n flash[:notice] = 'Screw was successfully created.'\n wants.html { redirect_to(@screw) }\n wants.xml { render :xml => @screw, :status => :created, :location => @screw }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @screw.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \turl = Url.create(params[:url])\n \t\n \tredirect_to urls_path\n end",
"def create\n @crawler_template = CrawlerTemplate.new(params[:crawler_template])\n\n respond_to do |format|\n if @crawler_template.save\n @crawler_template.sync_mall_shop\n format.html { redirect_to new_crawler_template_path, notice: 'Crawler template was successfully created.' }\n format.json { render json: @crawler_template, status: :created, location: @crawler_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crawler_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spiel = Spiel.new(params[:spiel])\n\n respond_to do |format|\n if @spiel.save\n format.html { redirect_to @spiel, notice: 'Spiel was successfully created.' }\n format.json { render json: @spiel, status: :created, location: @spiel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spiel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n require 'open-uri'\n @site = Site.find_or_initialize_by(site_params)\n if @site.save\n #render text: @site\n redirect_to site_path(@site)\n else\n redirect_to :back, :flash => {:error => @site.errors[:url]}\n end\n end",
"def create\n respond_to do |format|\n begin\n @page = Page.create_page!\n format.html { redirect_to \"/#{@page.request_id}/inspect\", notice: t('pages.create.success') }\n format.json { render action: 'show', status: :created, location: @page }\n rescue => e\n format.html { render action: 'index' }\n format.json { render json: {:message => \"create page error\"}, status: :unprocessable_entity }\n end\n end\n end",
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n @dossier = Dossier.new(dossier_params)\n @dossier.sheets.new(template: 'summary')\n respond_to do |format|\n if @dossier.save\n format.html { redirect_to @dossier, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @dossier }\n else\n format.html { render :new }\n format.json { render json: @dossier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @scraping_algorithm = ScrapingAlgorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def create\n @research_item = ResearchItem.new(params[:research_item])\n\n respond_to do |format|\n if @research_item.save\n format.html { redirect_to @research_item, :notice => 'Research item was successfully created.' }\n format.json { render :json => @research_item, :status => :created, :location => @research_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @research_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def new\n @page = Page.find_by_title('Huren bij Xposers')\n end",
"def create\n url = params['url']\n doc = Crawl::PageHandler.fetch_page(url)\n page_data = Crawl::PageHandler.parse_page(url, doc)\n page = Page.create(url: url,\n chksum: Zlib.crc32(url),\n parsed: page_data.to_json)\n render json: { url: page[:url],\n chksum: page[:chksum],\n parsed: page[:parsed] }\n end",
"def create\n @situacoes_juridica = SituacoesJuridica.new(params[:situacoes_juridica])\n\n respond_to do |format|\n if @situacoes_juridica.save\n format.html { redirect_to(@situacoes_juridica, :notice => 'Situação jurídica cadastrada com sucesso.') }\n format.xml { render :xml => @situacoes_juridica, :status => :created, :location => @situacoes_juridica }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @situacoes_juridica.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @scrapping_datum = ScrappingDatum.new(scrapping_datum_params)\n\n respond_to do |format|\n if @scrapping_datum.save\n format.html { redirect_to @scrapping_datum, notice: 'Scrapping datum was successfully created.' }\n format.json { render :show, status: :created, location: @scrapping_datum }\n else\n format.html { render :new }\n format.json { render json: @scrapping_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n #Page.create(Title: 'fhf', body: 'hfuhf')\n @page = Page.new(pages_params)\n\n if @page.save\n redirect_to pages_path\n else \n render :new\n\n end\n end",
"def create\n @sitting = Sitting.new(sitting_params)\n\n respond_to do |format|\n if @sitting.save\n format.html { redirect_to @sitting, notice: 'Sitting was successfully created.' }\n format.json { render :show, status: :created, location: @sitting }\n else\n format.html { render :new }\n format.json { render json: @sitting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spieler = Spieler.new(params[:spieler])\n\n respond_to do |format|\n if @spieler.save\n format.html { redirect_to @spieler, notice: 'Spieler was successfully created.' }\n format.json { render json: @spieler, status: :created, location: @spieler }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spieler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sprint = Sprint.new(params[:sprint])\n\n respond_to do |format|\n if @sprint.save\n flash[:notice] = 'Sprint was successfully created.'\n format.html { redirect_to(@sprint) }\n format.xml { render :xml => @sprint, :status => :created, :location => @sprint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sprint.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.80744475",
"0.7778039",
"0.76924783",
"0.76104885",
"0.74438995",
"0.73362845",
"0.7316132",
"0.72897065",
"0.719924",
"0.7188424",
"0.7180798",
"0.71475816",
"0.7122113",
"0.70296085",
"0.70077854",
"0.68395853",
"0.67626953",
"0.6747307",
"0.6736169",
"0.6679923",
"0.66522884",
"0.66069245",
"0.6583846",
"0.64581084",
"0.64581084",
"0.6458012",
"0.64323986",
"0.6414022",
"0.6365885",
"0.6352404",
"0.63444376",
"0.63376504",
"0.6326846",
"0.63186204",
"0.6311557",
"0.62992513",
"0.6288168",
"0.6262731",
"0.62298477",
"0.6220104",
"0.621735",
"0.6200125",
"0.6178612",
"0.6172237",
"0.6161137",
"0.6148969",
"0.6148732",
"0.61369854",
"0.61345655",
"0.6133678",
"0.6130034",
"0.6126966",
"0.61249214",
"0.6122602",
"0.6110174",
"0.6102224",
"0.6101035",
"0.6091293",
"0.60889465",
"0.6084768",
"0.60798246",
"0.60793763",
"0.6077545",
"0.6075673",
"0.60748786",
"0.6073489",
"0.60701305",
"0.6062898",
"0.6057277",
"0.60571975",
"0.6054361",
"0.6044115",
"0.60430014",
"0.60296917",
"0.60261154",
"0.60216075",
"0.60215443",
"0.601502",
"0.601502",
"0.601502",
"0.600955",
"0.60078",
"0.60032356",
"0.60028714",
"0.6001685",
"0.6000741",
"0.6000728",
"0.59981626",
"0.5991876",
"0.5980354",
"0.59792703",
"0.5969679",
"0.59693426",
"0.5968731",
"0.59673125",
"0.59600204",
"0.595742",
"0.595435",
"0.5949657",
"0.5948124"
] |
0.6914642
|
15
|
ScrapsController > edit : Updates current scrap and renders it to browser
|
def edit
respond_to do |format|
format.html { render :action => "edit" and return }
format.js { render :partial => "scrap_form", :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n if @scrape.update_attributes(params[:scrape])\n format.html { redirect_to @scrape, notice: 'Scrape was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scrap.update(scrap_params)\n format.html { redirect_to @scrap, notice: 'Scrap was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrap }\n else\n format.html { render :edit }\n format.json { render json: @scrap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n if @scraper.update_attributes(params[:scraper])\n format.html { redirect_to @scraper, notice: 'Scraper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:cancel]\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n return # redisplay the scrap inline\n end\n return if !scrap_user_logged_in? # check if logged in!\n old = @scrap.attributes.to_yaml\n @scrap.update_attributes(params[:scrap])\n mod = @scrap.attributes.to_yaml\n begin\n @scrap.save!(current_user) if mod != old\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n rescue\n #\n # Re-Display On Error\n edit and return\n end\n end",
"def update\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n if @scraper.update_attributes(params[:scraper])\n format.html { redirect_to(@scraper, :notice => 'Scraper was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scraper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scrape.update(scrape_params)\n ScrapeData.new.delay.perform(@scrape.id)\n format.html { redirect_to @scrape, notice: 'Scrape was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrape }\n else\n format.html { render :edit }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scraping_page.update(scraping_page_params)\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully updated.' }\n format.json { render :show, status: :ok, location: @scraping_page }\n else\n format.html { render :edit }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n \n end",
"def update\n respond_to do |format|\n if @webscrape.update(webscrape_params)\n format.html { redirect_to @webscrape, notice: 'Webscrape was successfully updated.' }\n format.json { render :show, status: :ok, location: @webscrape }\n else\n format.html { render :edit }\n format.json { render json: @webscrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scrap\n @scrap = Scrap.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @scraping_html_element.update(scraping_html_element_params)\n format.html { redirect_to @scraping_html_element, notice: 'Scraping html element was successfully updated.' }\n format.json { render :show, status: :ok, location: @scraping_html_element }\n else\n format.html { render :edit }\n format.json { render json: @scraping_html_element.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @newsscraper\n respond_to do |format|\n if @newsscraper.update(newsscraper_params)\n format.html { redirect_to @newsscraper, notice: 'Newsscraper was successfully updated.' }\n format.json { render :show, status: :ok, location: @newsscraper }\n else\n format.html { render :edit }\n format.json { render json: @newsscraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\n end",
"def edit\n board_games\n locate_board_game\n title_collection\n render :edit\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to admin_crawlers_url }\n else\n format.html { render :edit }\n end\n end\n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\r\n \r\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit\r\n end",
"def edit\n load_data\n end",
"def edit\n #Nothing necessary\n end",
"def edit\n @newscast = Newscast.shod(params[:id])\n end",
"def update\n run List::Update do |result|\n flash[:notice] = \"#{result['model'].todo} has been saved\"\n return redirect_to list_path(result['model'].id)\n end\n\n render cell(List::Cell::Edit, @form), layout: true\n end",
"def update\n # if this is a preview action then create a temp entry and render update js\n # with preview items\n if params[:commit] == 'Preview'\n original_retailer = Retailer.find(params[:id])\n\n # create a new retailer with the same attributes of the original then update\n # it from the supplied hash.\n @retailer = Retailer.new(original_retailer.attributes)\n @retailer.assign_attributes(params[:retailer])\n\n @normal_item = Retailer.scrape(@retailer.normal_item_url, @retailer)\n @sale_item = Retailer.scrape(@retailer.sale_item_url, @retailer)\n render 'preview'\n else\n @retailer = Retailer.find(params[:id])\n @retailer.update_attributes(params[:retailer])\n if @retailer.save\n render 'update'\n else\n render 'edit'\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def update\n\t\t\t#get the train from the DB\n\t\t\t@train = Train.find(params[:id])\n\t\t\t#update the train with params from browser\n\t\t\tif @train.update(train_params)\n\t\t\t\tredirect_to trains_url\n\t\t\telse\n\t\t\t\trender :edit\n\t\t\tend\n\t\tend",
"def update\n @scrape_order = ScrapeOrder.find(params[:id])\n\n respond_to do |format|\n if @scrape_order.update_attributes(params[:scrape_order])\n format.html { redirect_to(scrape_orders_path, :notice => 'Scrape order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scrape_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to @crawler, notice: 'Crawler was successfully updated.' }\n format.json { render :show, status: :ok, location: @crawler }\n format.js { render nothing: true }\n else\n format.html { render :edit }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n id = params[:id]\n @rock = Rock.find(id)\nend",
"def update\n respond_to do |format|\n if @spider.update(spider_params)\n format.html { redirect_to @spider, notice: 'Spider was successfully updated.' }\n format.json { render :show, status: :ok, location: @spider }\n else\n format.html { render :edit }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n yield if block_given?\n save\n end",
"def edit \n end",
"def edit \n end",
"def edit\n # Renders the edit form\n end",
"def edit\n @page = Page.find(params[:id])\n #render the edit form\n end",
"def edit\n render\n end",
"def edit\n render\n end",
"def edit\n \t@item = Item.find(params[:id])\n \t@cupboards = Cupboard.all\n end",
"def edit\n\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to @crawler, notice: 'Crawler was successfully updated.' }\n format.json { render :show, status: :ok, location: @crawler }\n else\n format.html { render :edit }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end",
"def render_edit_forecast\n @action = 'update_forecast'\n @caption = 'update_forecast'\n @farm_codes = Farm.find_by_sql('select distinct farm_code from farms').map { |g| [g.farm_code] }\n @seasons = Season.find_by_sql('select distinct season from seasons').map { |g| [g.season] }\n session[:forecast_id] = @forecast.id\n @content_header_caption = \"'edit forecast'\"\n render :template => \"rmt_processing/forecast/edit_forecast\", :layout => \"content\"\n end",
"def update\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n if @scraping_algorithm.update_attributes(params[:scraping_algorithm])\n format.html { redirect_to @scraping_algorithm, notice: 'Scraping algorithm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scraping_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crawl.update(crawl_params)\n format.html { redirect_to @crawl, notice: 'Crawl was successfully updated.' }\n format.json { render :show, status: :ok, location: @crawl }\n else\n format.html { render :edit }\n format.json { render json: @crawl.errors, status: :unprocessable_entity, notice: 'Crawl failed to update.' }\n end\n end\n end",
"def update\n @crawl_result = Crawl.find(params[:id])\n\n respond_to do |format|\n if @crawl_result.update_attributes(params[:crawl_result])\n format.html { redirect_to(@crawl_result, :notice => 'Crawl result was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crawl_result.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n if @cheer.update_attributes(params[:cheer])\n format.html { redirect_to @cheer, notice: 'Cheer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.7395853",
"0.73111856",
"0.7077767",
"0.7060149",
"0.70252997",
"0.67497605",
"0.6723607",
"0.66683567",
"0.6651717",
"0.65707445",
"0.65563023",
"0.6518461",
"0.6495175",
"0.64947253",
"0.6490674",
"0.6487269",
"0.6487269",
"0.6487269",
"0.6487269",
"0.6487269",
"0.6487269",
"0.6487269",
"0.6440023",
"0.64323014",
"0.64323014",
"0.64323014",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.6395976",
"0.63904744",
"0.6360251",
"0.63549054",
"0.6337234",
"0.63297826",
"0.631509",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.63021636",
"0.6295168",
"0.6280485",
"0.62800205",
"0.6275714",
"0.6274013",
"0.6272559",
"0.6269953",
"0.6269953",
"0.6261525",
"0.62506646",
"0.6249029",
"0.6249029",
"0.6233858",
"0.622942",
"0.6228311",
"0.6217302",
"0.6211926",
"0.621155",
"0.6209764",
"0.6194649",
"0.61924076",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866",
"0.61904866"
] |
0.69530123
|
5
|
ScrapsController > update : Updates current scrap and renders it to browser
|
def update
if params[:cancel]
if @scrap.class.to_s =="ParallelText"
display_inline_scrap
else
display_inline_scrap_topic
end
return # redisplay the scrap inline
end
return if !scrap_user_logged_in? # check if logged in!
old = @scrap.attributes.to_yaml
@scrap.update_attributes(params[:scrap])
mod = @scrap.attributes.to_yaml
begin
@scrap.save!(current_user) if mod != old
if @scrap.class.to_s =="ParallelText"
display_inline_scrap
else
display_inline_scrap_topic
end
rescue
#
# Re-Display On Error
edit and return
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @scrape.update(scrape_params)\n ScrapeData.new.delay.perform(@scrape.id)\n format.html { redirect_to @scrape, notice: 'Scrape was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrape }\n else\n format.html { render :edit }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scrap.update(scrap_params)\n format.html { redirect_to @scrap, notice: 'Scrap was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrap }\n else\n format.html { render :edit }\n format.json { render json: @scrap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n if @scrape.update_attributes(params[:scrape])\n format.html { redirect_to @scrape, notice: 'Scrape was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n if @scraper.update_attributes(params[:scraper])\n format.html { redirect_to @scraper, notice: 'Scraper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n if @scraper.update_attributes(params[:scraper])\n format.html { redirect_to(@scraper, :notice => 'Scraper was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scraper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @webscrape.update(webscrape_params)\n format.html { redirect_to @webscrape, notice: 'Webscrape was successfully updated.' }\n format.json { render :show, status: :ok, location: @webscrape }\n else\n format.html { render :edit }\n format.json { render json: @webscrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scraping_page.update(scraping_page_params)\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully updated.' }\n format.json { render :show, status: :ok, location: @scraping_page }\n else\n format.html { render :edit }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scraping_html_element.update(scraping_html_element_params)\n format.html { redirect_to @scraping_html_element, notice: 'Scraping html element was successfully updated.' }\n format.json { render :show, status: :ok, location: @scraping_html_element }\n else\n format.html { render :edit }\n format.json { render json: @scraping_html_element.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to @crawler, notice: 'Crawler was successfully updated.' }\n format.json { render :show, status: :ok, location: @crawler }\n format.js { render nothing: true }\n else\n format.html { render :edit }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spider.update(spider_params)\n format.html { redirect_to @spider, notice: 'Spider was successfully updated.' }\n format.json { render :show, status: :ok, location: @spider }\n else\n format.html { render :edit }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n\r\n render :update do |p|\r\n if @sprint.update_attributes(params[:sprint])\r\n data = load_sprint_stats(@sprint, [])\r\n p.replace_html \"sprint_name_#{@sprint.id}\", \"#{@sprint.name}\"\r\n p.replace_html \"sprint_percent_done_#{@sprint.id}\", :partial => \"shared/percent_done\", :locals => {:data => data}\r\n p.replace_html \"sprint_dates_and_points_#{@sprint.id}\", :partial => \"sprints/sprint_dates_and_points\", :locals => {:data => data, :sprint => @sprint}\r\n p.replace_html \"sprint_target_#{@sprint.id}\", l('sprint_description')+\":\" + @sprint.description\r\n# p.insert_html :top, \"sprint_frame_cont_#{@sprint.id}\", :partial => \"sprints/sprint\", :locals => {:sprint => @sprint}\r\n p[\"sprint_frame_cont_#{@sprint.id}\"].visual_effect :highlight, :duration => 1\r\n end\r\n end\r\n end",
"def update\r\n\r\n render :update do |p|\r\n if @sprint.update_attributes(params[:sprint])\r\n data = load_sprint_stats(@sprint, [])\r\n p.replace_html \"sprint_name_#{@sprint.id}\", \"#{@sprint.name}\"\r\n p.replace_html \"sprint_percent_done_#{@sprint.id}\", :partial => \"shared/percent_done\", :locals => {:data => data}\r\n p.replace_html \"sprint_dates_and_points_#{@sprint.id}\", :partial => \"sprints/sprint_dates_and_points\", :locals => {:data => data, :sprint => @sprint}\r\n p.replace_html \"sprint_target_#{@sprint.id}\", l('sprint_description')+\":\" + @sprint.description\r\n# p.insert_html :top, \"sprint_frame_cont_#{@sprint.id}\", :partial => \"sprints/sprint\", :locals => {:sprint => @sprint}\r\n p[\"sprint_frame_cont_#{@sprint.id}\"].visual_effect :highlight, :duration => 1\r\n end\r\n end\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to @crawler, notice: 'Crawler was successfully updated.' }\n format.json { render :show, status: :ok, location: @crawler }\n else\n format.html { render :edit }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n respond_to do |format|\n if @crawler.update(crawler_params)\n format.html { redirect_to admin_crawlers_url }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\r\n\r\n end",
"def update\n frm.button(:value=>\"Update\").click\n AssessmentTotalScores.new(@browser)\n end",
"def update\n \n end",
"def update\n\t\t\n\t\tend",
"def set_scrap\n @scrap = Scrap.find(params[:id])\n end",
"def update\n #Nothing necessary\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n \n \n \n \n end"
] |
[
"0.72798944",
"0.7273655",
"0.721352",
"0.7153968",
"0.7131865",
"0.68629223",
"0.6850184",
"0.6585177",
"0.65671057",
"0.65306187",
"0.650629",
"0.650629",
"0.65022796",
"0.65022796",
"0.65022796",
"0.65022796",
"0.6497105",
"0.64826274",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.6477269",
"0.64730185",
"0.6462631",
"0.6432053",
"0.6419231",
"0.63937086",
"0.63845605",
"0.63630927",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.632623",
"0.63256806"
] |
0.67377216
|
7
|
ScrapsController > display_inline_scrap : Renders the current scrap or scrap topic to the browser
|
def display_inline_scrap_topic
respond_to do |format|
format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }
format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => "scrap", :layout => false and return }
format.xml { return }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scrap\n target_url = CGI.unescape(params[:target_url])\n css_selector = CGI.unescape(params[:css_selector])\n @element_id = params[:ele_id]\n\n @scrapped_text = QuickScrapper.scrap(target_url, css_selector)\n first_word_index = params[:first_word_index] || 0\n last_word_index = params[:last_word_index] || -1\n\n @scrapped_text = @scrapped_text.split[first_word_index..last_word_index].join(\" \")\n render :text => \"jQuery('#{@element_id}').html('#{@scrapped_text}');\"\n end",
"def show_scrap_topic\n render_404 and return if @scrap_topic.nil?\n @scraps = @scrap_topic.scraps if @scrap_topic\n\n flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0\n respond_to do |format|\n format.html { render :action => 'scrap_topic' and return }\n format.js { render :action => 'scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"def show\n render_404 and return if @scrap.nil?\n respond_to do |format|\n format.html { redirect_to show_scrap_path(@scrap.slug) and return }\n format.js { render :action => \"scrap\", :layout => false and return }\n format.xml { return }\n end\n end",
"def display_scribd(object, alt_text_or_attribute = '', alt_text_if_paperclip = nil)\n # Resolve the right scribd ID, access key, and alt text.\n if object.respond_to?(\"scribd_id\")\n scribd_id = object.scribd_id\n scribd_ak = object.scribd_access_key\n\n alt_text = alt_text_or_attribute\n else\n scribd_id = object.send \"#{alt_text_or_attribute}_scribd_id\"\n scribd_ak = object.send \"#{alt_text_or_attribute}_scribd_access_key\"\n\n alt_text = alt_text_if_paperclip\n end\n\n begin\n # Collect a set of addParam statements to set up JS parameters for the scribd document\n # (only if they are valid).\n param_includes = options[:params].collect do |param, value|\n \"scribd_doc.addParam('#{param}', '#{value}');\" if AVAILABLE_JS_PARAMS.include?(param)\n end.compact.join(\"\\n\")\n rescue\n # Where is 'options' coming from???\n end\n\n <<-END\n <script type=\"text/javascript\" src=\"http://www.scribd.com/javascripts/view.js\"></script>\n <div id=\"embedded_flash\">#{alt_text}</div>\n <script type=\"text/javascript\">\n var scribd_doc = scribd.Document.getDoc(#{scribd_id}, '#{scribd_ak}');\n #{param_includes}\n scribd_doc.write(\"embedded_flash\");\n </script>\n END\n end",
"def display\n puts render\n end",
"def show\n @stories = @comic.stories\n @previous_comic = Comic.previous_comic(@comic.volume, @comic.issue, @comic.annual)\n @next_comic = Comic.next_comic(@comic.volume, @comic.issue, @comic.annual)\n if request.xhr?\n render layout: false\n end\n end",
"def display\r\n end",
"def display_the_page\n @page.process(request, response)\n # Add backreference to body for returning to edit page\n @response = response\n \n @response.body += '<p><a href=\"' + url_for(\n :controller => 'admin/' + CGI.escapeHTML(params[:action].pluralize), \n :id => params[:id].to_i,\n :action => 'edit'\n ) + '\">Back</a></p>'\n \n @response = nil\n\n # If this is true, Radiant will not use render more.\n @performed_render = true\n end",
"def show # show => display individual article as requested\n # @variable is an instance variable supaya bisa dipake di html.erb\n end",
"def scdisplay(id)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/shellcode/files/shellcode-#{id}.php\", {'User-Agent' => 'Shell-Storm Ruby API - Display'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tputs \"#{HC}#{FGRN}[#{FWHT}*#{FGRN}] Displaying#{FWHT}: http://shell-storm.org/shellcode/files/shellcode-#{id}.php#{FCYN}\"\n\t\tputs res.body.split(\"\\n\")[7..-13].join(\"\\n\").gsub('"', '\"').gsub('>', '>').gsub('<', '<').gsub('&', '&')\n\t\tputs \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def display\n self.print\n puts \"#{@headline} -- (Liked: #{@like_number})\"\n end",
"def show\n\n p \"---------\"\n p @contents\n\n end",
"def show\n @serial_works = @series.serial_works.find(:all, :include => :work, :conditions => ['works.posted = ?', true], :order => :position).select{|sw| sw.work.visible(User.current_user)}\n # sets the page title with the data for the series\n @page_title = \"\"\n if logged_in? && !current_user.preference.work_title_format.blank?\n @page_title = current_user.preference.work_title_format\n @page_title.gsub!(/FANDOM/, @series.allfandoms.collect(&:name).join(', '))\n @page_title.gsub!(/AUTHOR/, @series.allpseuds.collect(&:byline).join(', '))\n @page_title.gsub!(/TITLE/, @series.title)\n else\n @page_title = @series.title + \" - \" + @series.allpseuds.collect(&:byline).join(', ') + \" - \" + @series.allfandoms.collect(&:name).join(', ')\n end\n @page_title += \" [#{ArchiveConfig.APP_NAME}]\"\n end",
"def html\n @resume = Resume.find(params[:id])\n\t @resume.fix_line_break_issue\n\t @html_resume = RDiscount.new(@resume.content).to_html\t\t\t\t# Markdown only. C binary. Fast\n render :layout => \"output\"\n end",
"def display_the_page\n @page.process(request, response)\n # Add backreference to body for returning to edit page\n @response = response\n \n @response.body += '<p><a href=\"' + url_for(\n :controller => 'admin/' + params[:action], \n :id => instance_variable_get(\"@#{params[:action]}\"),\n :action => 'edit'\n ) + '\">Back</a></p>'\n \n @response = nil\n\n # If this is true, Radiant will not use render more.\n @performed_render = true\n end",
"def show\n @crawl_result = Crawl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def show\n\t\t#no need b/c we just show all at once\n\tend",
"def display_scribd(object, options = {})\n # Resolve the right scribd ID, access key, and alt text.\n if object.respond_to?(\"scribd_id\")\n scribd_id = object.scribd_id\n scribd_ak = object.scribd_access_key\n alt_text = object.alt_text\n else\n scribd_id = object.send \"#{options[:object]}_scribd_id\"\n scribd_ak = object.send \"#{options[:object]}_scribd_access_key\"\n alt_text = object.alt_text options[:object]\n end\n \n # Collect a set of addParam statements to set up JS parameters for the scribd document\n # (only if they are valid).\n if options[:params]\n params = options[:params].collect do |param, value|\n \"scribd_doc.addParam('#{param}', '#{value}');\" if AVAILABLE_JS_PARAMS.include?(param)\n end.compact.join(\"\\n\")\n end\n \n <<-END\n <div id=\\\"embedded_flash\\\">#{alt_text}</div>\n <script type=\\\"text/javascript\\\">\n var scribd_doc = scribd.Document.getDoc(#{scribd_id}, '#{scribd_ak}');\n #{params}\n scribd_doc.write(\\\"embedded_flash\\\");\n </script>\n END\n end",
"def show\n IRuby.display(self)\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def show\n\t\t@extractor = Extractor.find(params[:id])\n\t\t@latest_revision = @extractor.revisions.first(:order => \"created_at DESC\")\n\t\tif(@latest_revision) \n\t\t\t@latest_scraped_values = ScrapedValue.find_all_by_revision_id(\n\t\t\t\t@latest_revision.id,\n\t\t\t\t:include => [:annotation]\n\t\t\t)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.rss { render :layout => false }\n\t\tend\n\tend",
"def show\n\t\trender json:Screencast.find(params[:id])\n\tend",
"def render max_pages = 10\n SuperCrawler::Render.console( @crawl_results, max_pages )\n end",
"def display\n @body\n end",
"def show \r\n end",
"def show\n render_default_format(@our_works, true, 200)\n rescue Exception => e\n puts e.inspect\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show_qa_analist\n screen_name(\"Inicial-Analista-QA\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_qa_analist\" }\n format.json { head :ok }\n end\n end",
"def show\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrape }\n end\n end",
"def show() end",
"def show() end",
"def show() end",
"def scrape\n end",
"def display\n puts \"#{GtCommon.capitalize(@headline)} -- (Liked: #{@like_number}) \\n\\n\"\n puts @sentence \n end",
"def display_post\n\t\tputs \" \"\n\t\tputs \"#{@title} #{@date}\"\n\t\tputs \"----------------\"\n\t\tputs @content\n\t\tputs \"----------------\"\n\t\tputs \" \"\n\tend",
"def show\n @contents = @slide.contents\n end",
"def _display(replace)\n\t\treturn @contents._display(replace)\n\tend",
"def show\n\t\t end",
"def show\n # Get the html, svg, css, and js code to render\n @code = get_article_code\n\n # The default layouts are not added as this page will be\n # embeded in an iframe\n render layout: false\n end",
"def display\n # Don't no why i thought i would need that. or if i need this.\n end",
"def show\n @next_artwork = get_next\n @previous_artwork = get_previous\n @fbLink = \"http://helenafogelberg.se/artworks/{@artwork.id}\"\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end",
"def show\n @workout_record = WorkoutRecord.find_by_id(params[:id])\n @title = \"Workout Record For #{@workout_record.workout.name}\"\n @fb_string = parse_text_for_fb(@workout_record.workout.name, @workout_record.rounds, @workout_record.time, @workout_record.points)\n\n\n end",
"def show\n\n \n end",
"def scrape_it\n \n end",
"def show\n \n # \n end",
"def show\n @question = @page.questions.find(params[:id])\n session[:breadcrumbs].add \"#{@question.short_title}\"\n\n initialize_fake_app_for_preview\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def show ; end",
"def index\n \t#display text and links \n end",
"def show\n render_default_format(@work, true, 200)\n rescue Exception => e\n puts e.inspect\n end",
"def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end",
"def update\n if params[:cancel]\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n return # redisplay the scrap inline\n end\n return if !scrap_user_logged_in? # check if logged in!\n old = @scrap.attributes.to_yaml\n @scrap.update_attributes(params[:scrap])\n mod = @scrap.attributes.to_yaml\n begin\n @scrap.save!(current_user) if mod != old\n if @scrap.class.to_s ==\"ParallelText\"\n display_inline_scrap\n else\n display_inline_scrap_topic\n end\n rescue\n #\n # Re-Display On Error\n edit and return\n end\n end",
"def show\n page = ShowBlock.new(self).run(&Proc.new)\n finish_show(page)\n end",
"def preview\n @text = params[:deliverable][:description]\n render :partial => 'common/preview'\n end",
"def show\n @sitelink = Sitelink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitelink }\n end\n end",
"def show\n=begin\t\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.png {}\n\t\tend\n=end\n\t\trespond_with @send_queue\n end",
"def print_forecast_report\n render :inline=> %{TO DO: 1. Get report params from Gerrit<br>2. Implement automatic jasper printing <br>3. Implement functionality}, :layout=>'content'\n# <tr>\n# <td>\n# <!--Forecast columns names table-->\n# <table>\n#\n# <tr>\n# <td style='padding-top: 15px;'>\n# <label>forecast report</label>\n# </td>\n# <td >\n# <% params_hash = { \"report_type\" => \"Forecast\",\"report_user_ref\"=>\"Printed_from_Luks_Rails_server\",\"printer_name\" => \"Primo\",\"show_report\"=>\"yes\", \"reference_id\" => 1, \"reference_type\" => \"forecasts\",\"paraSeason\" => @forecast.season,\"paraFarm_code\" => @forecast.farm_code } %>\n# <%= link_to(image_tag(\"/images/view.png\", :border => 0),generate_report_parameters(params_hash),:popup => true) %>\n# </td>\n# </tr>\n# </table>\n# <!--end of Forecast columns values table-->\n# </td>\n# </tr>\n end",
"def display\n\t\ttitle\n\tend",
"def show\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def show\n @eval = Eval.find(params[:id])\n Thread.new {\n begin\n result = eval(@eval.code)\n rescue Exception => e\n result = \"OH NO: #{e}\"\n ensure\n @result = \"Current Thread:#{Thread.current}, Result: #{result}\"\n end\n }.join(10)\n respond_with(@eval)\n end",
"def show\n @title = @case_study.title\n @case_studies = @case_study.find_related_tags\n @pages = Page.tagged_with(@case_study.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:case_studies:#{@case_study.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:case_studies:#{@case_study.id}\", 300, @case_study.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@case_study)}';</script></body></html>\", content_type: :html) and return\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def show\n @crawler = Crawler.find(params[:id])\n end",
"def display document, context, crossref = true\n @display.show document, context, crossref\n\n true\n end",
"def show\n puts \"==========================\"\n puts \"SHOW\"\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraper }\n end\n end",
"def show\n\tcnv = ODT_to_XHTML.new\n\txmldata = cnv.get_html(@document.content, @document.styles)\n\t@head = xmldata[:head].get_text(\"style\")\n\t@body = xmldata[:body].to_s.sub(/<body>/,\"<div class=\\\"document\\\">\").sub(/<\\/body>/,\"</div>\")\n end",
"def display_resource(thesis)\n \"Thesis: #{thesis.title}\"\n end",
"def to_display\n content_for_state[current_page]\n end",
"def display\n puts \"Title: #{@title}\"\n puts \"Author: #{@author}\"\n puts \"Price: #{@price}\"\n end",
"def custom_display_as_html(code, file_url)\n begin\n review_scores = self.scores\n\n #********************Learning Targets******************\n code = code + \"<h2>Learning Targets</h2><hr>\"\n if review_scores[0].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\" \n end\n\n if review_scores[1].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are specific<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are specific<br/>\"\n end\n\n if review_scores[2].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n end\n\n if review_scores[3].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n end\n\n code = code + \"<br/><i>Number of Learning Targets: </i>#{review_scores[4].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/><i>Grade: </i>#{review_scores[5].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/><i>Comment: </i> <dl><dd>#{review_scores[6].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n #*******************Content************************\n code = code + \"<h2>Content</h2><hr>\"\n code = code + \"<i>File:</i>\"\n if file_url.nil?\n code = code + \"File has not been uploaded<br/>\"\n else\n code = code + file_url.to_s + \"<br/>\"\n end\n \n code = code + \"<i>Compliment:</i>\"\n code = code + \"<ul><li>#{review_scores[8].comments.gsub(/\\\"/,'"').to_s}</li><li>#{review_scores[9].comments.gsub(/\\\"/,'"').to_s}</li></ul>\"\n code = code + \"<i>Suggestion:</i>\"\n code = code + \"<ul><li>#{review_scores[10].comments.gsub(/\\\"/,'"').to_s}</li><li>#{review_scores[11].comments.gsub(/\\\"/,'"').to_s}</li></ul>\"\n\n #*******************Sources and Use of Source Material************************\n code = code + \"<h2>Sources and Use of Source Material</h2><hr>\"\n code = code + \"<br/>How many sources are in the references list?: #{review_scores[12].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/>List the range of publication years for all sources, e.g. 1998-2006: <b>#{review_scores[13].comments.gsub(/\\\"/,'"').to_s} - #{review_scores[14].comments.gsub(/\\\"/,'"').to_s}</b><br/><br/>\"\n\n if review_scores[15].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n end\n\n if review_scores[16].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n end\n\n if review_scores[17].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The citations are in APA format<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The citations are in APA format<br/>\"\n end\n\n if review_scores[18].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n end\n\n if review_scores[19].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n end\n\n if review_scores[20].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n end\n\n if review_scores[21].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The sources represent different viewpoints<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The sources represent different viewpoints<br/>\"\n end\n\n code = code + \"<br/><b>What other sources or perspectives might the author want to consider?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[22].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n \n if review_scores[23].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible. <br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible<br/>\"\n end\n\n code = code + \"<br/><b>If not, which one(s) may infringe copyrights, or what areas of text may need citations, revisions or elaboration?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[24].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n code = code + \"<br/>Please make a comment about the sources. Explain how the author can improve the use of sources in the lesson.<br/>\"\n code = code + \"<dl><dd>#{review_scores[25].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n #*******************Multiple Choice Questions************************\n code = code + \"<h2>Multiple Choice Questions</h2><hr>\"\n if review_scores[26].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n end\n\n if review_scores[27].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n end\n\n if review_scores[28].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n end\n\n if review_scores[29].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions assess the learning target(s)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions assess the learning target(s)<br/>\"\n end\n\n if review_scores[30].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n end\n\n if review_scores[31].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n end\n\n if review_scores[32].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n end\n\n if review_scores[33].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n end\n\n code = code + \"<br/><h3>Questions</h3>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[34].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[35].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[36].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[37].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[38].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[39].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[40].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[41].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[42].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[43].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[44].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[45].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n\n #*******************Rubric************************\n code = code + \"<h2>Rubric</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code +\n \"<div align=\\\"center\\\">The information selected by the author:</div><table class='general'>\n <tr>\n <th>5 - Very Important </th>\n <th>4 - Quite Important </th>\n <th>3 - Some Importance </th>\n <th>2 - Little Importance</th>\n <th>1 - No Importance </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[46].comments == \"1\"\n code = code + \"<li>Is very important for future teachers to know</li>\"\n end\n if review_scores[47].comments == \"1\"\n code = code + \"<li>Is based on researched information</li>\"\n end\n if review_scores[48].comments == \"1\"\n code = code + \"<li>Is highly relevant to current educational practice</li>\"\n end\n if review_scores[49].comments == \"1\"\n code = code + \"<li>Provides an excellent overview and in-depth discussion of key issues</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[50].comments == \"1\"\n code = code + \"<li>Is relevant to future teachers</li>\"\n end\n if review_scores[51].comments == \"1\"\n code = code + \"<li>Is mostly based on researched information</li>\"\n end\n if review_scores[52].comments == \"1\"\n code = code + \"<li>Is applicable to today's schools</li>\"\n end\n if review_scores[53].comments == \"1\"\n code = code + \"<li>Provides a good overview and explores a few key ideas</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[54].comments == \"1\"\n code = code + \"<li>Has useful points but some irrelevant information</li>\"\n end\n if review_scores[55].comments == \"1\"\n code = code + \"<li>Is half research; half the author's opinion</li>\"\n end\n if review_scores[56].comments == \"1\"\n code = code + \"<li>Is partially out-dated or may not reflect current practice</li>\"\n end\n if review_scores[57].comments == \"1\"\n code = code + \"<li>Contains good information but yields an incomplete understanding</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[58].comments == \"1\"\n code = code + \"<li>Has one useful point</li>\"\n end\n if review_scores[59].comments == \"1\"\n code = code + \"<li>Is mostly the author's opinion.</li>\"\n end\n if review_scores[60].comments == \"1\"\n code = code + \"<li>Is mostly irrelevant in today's schools</li>\"\n end\n if review_scores[61].comments == \"1\"\n code = code + \"<li>Focused on unimportant subtopics OR is overly general</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\" \n if review_scores[62].comments == \"1\"\n code = code + \"<li>Is not relevant to future teachers</li>\"\n end\n if review_scores[63].comments == \"1\"\n code = code + \"<li>Is entirely the author's opinion</li>\"\n end\n if review_scores[64].comments == \"1\"\n code = code + \"<li>Is obsolete</li>\"\n end\n if review_scores[65].comments == \"1\"\n code = code + \"<li>Lacks any substantive information</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code +\n \"<div align=\\\"center\\\">To attract and maintain attention, the lesson has:</div><table class='general'>\n <tr>\n <th>5 - Extremely Interesting </th>\n <th>4 - Quite Interesting </th>\n <th>3 - Reasonably Interesting </th>\n <th>2 - Little Interest</th>\n <th>1 - No Interest </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[66].comments == \"1\"\n code = code + \"<li>A sidebar with new information that was motivating to read/view</li>\"\n end\n if review_scores[67].comments == \"1\"\n code = code + \"<li>Many creative, attractive visuals and engaging, interactive elements</li>\"\n end\n if review_scores[68].comments == \"1\"\n code = code + \"<li>Multiple perspectives</li>\"\n end\n if review_scores[69].comments == \"1\"\n code = code + \"<li>Insightful interpretation & analysis throughout</li>\"\n end\n if review_scores[70].comments == \"1\"\n code = code + \"<li>Many compelling examples that support the main points (it \\\"shows\\\" not just \\\"tells\\\")</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[71].comments == \"1\"\n code = code + \"<li>A sidebar that adds something new to the lesson</li>\"\n end\n if review_scores[72].comments == \"1\"\n code = code + \"<li>A few effective visuals or interactive elements</li>\"\n end\n if review_scores[73].comments == \"1\"\n code = code + \"<li>At least one interesting, fresh perspective</li>\"\n end\n if review_scores[74].comments == \"1\"\n code = code + \"<li>Frequent interpretation and analysis</li>\"\n end\n if review_scores[75].comments == \"1\"\n code = code + \"<li>Clearly explained and well supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[76].comments == \"1\"\n code = code + \"<li>A sidebar that repeats what is in the lesson</li>\"\n end\n if review_scores[77].comments == \"1\"\n code = code + \"<li>An effective visual or interactive element</li>\"\n end\n if review_scores[78].comments == \"1\"\n code = code + \"<li>One reasonable (possibly typical) perspective</li>\"\n end\n if review_scores[79].comments == \"1\"\n code = code + \"<li>Some interpretation and analysis</li>\"\n end\n if review_scores[80].comments == \"1\"\n code = code + \"<li>Supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[81].comments == \"1\"\n code = code + \"<li>A quote, link, etc. included as a sidebar, but that is not in a textbox</li>\"\n end\n if review_scores[82].comments == \"1\"\n code = code + \"<li>Visuals or interactive elements that are distracting</li>\"\n end\n if review_scores[83].comments == \"1\"\n code = code + \"<li>Only a biased perspective</li>\"\n end\n if review_scores[84].comments == \"1\"\n code = code + \"<li>Minimal analysis or interpretation</li>\"\n end\n if review_scores[85].comments == \"1\"\n code = code + \"<li>At least one clear and supported point</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[86].comments == \"1\"\n code = code + \"<li>No side bar included</li>\"\n end\n if review_scores[87].comments == \"1\"\n code = code + \"<li>No visuals or interactive elements</li>\"\n end\n if review_scores[88].comments == \"1\"\n code = code + \"<li>No perspective is acknowledged</li>\"\n end\n if review_scores[89].comments == \"1\"\n code = code + \"<li>No analysis or interpretation</li>\"\n end\n if review_scores[90].comments == \"1\"\n code = code + \"<li>No well-supported points</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Credibility</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To demonstrate its credibility the lesson:</div><table class='general'>\n <tr>\n <th>5 - Completely Credible </th>\n <th>4 - Substantial Credibility </th>\n <th>3 - Reasonable Credibility </th>\n <th>2 - Limited Credibility</th>\n <th>1 - Not Credible </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[91].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources in proper APA format</li>\"\n end\n if review_scores[92].comments == \"1\"\n code = code + \"<li>Provides citations for all presented information</li>\"\n end\n if review_scores[93].comments == \"1\"\n code = code + \"<li>Readily identifies bias: both the author's own and others</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[94].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources with few APA errors</li>\"\n end\n if review_scores[95].comments == \"1\"\n code = code + \"<li>Provides citations for most information</li>\"\n end\n if review_scores[96].comments == \"1\"\n code = code + \"<li>Clearly differentiates between opinion and fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[97].comments == \"1\"\n code = code + \"<li>Cites 5 or more reputable sources</li>\"\n end\n if review_scores[98].comments == \"1\"\n code = code + \"<li>Supports some claims with citation</li>\"\n end\n if review_scores[99].comments == \"1\"\n code = code + \"<li>Occasionally states opinion as fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[100].comments == \"1\"\n code = code + \"<li>Cites 4 or more reputable sources</li>\"\n end\n if review_scores[101].comments == \"1\"\n code = code + \"<li>Has several unsupported claims</li>\"\n end\n if review_scores[102].comments == \"1\"\n code = code + \"<li>Routinely states opinion as fact and fails to acknowledge bias</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[103].comments == \"1\"\n code = code + \"<li>Cites 3 or fewer reputable sources</li>\"\n end\n if review_scores[104].comments == \"1\"\n code = code + \"<li>Has mostly unsupported claims</li>\"\n end\n if review_scores[105].comments == \"1\"\n code = code + \"<li>Is very biased and contains almost entirely opinions</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n\n code = code + \"<h3>Pedagogy</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To help guide the reader:</div><table class='general'>\n <tr>\n <th>5 - Superior </th>\n <th>4 - Effective </th>\n <th>3 - Acceptable </th>\n <th>2 - Deficient</th>\n <th>1 - Absent </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[106].comments == \"1\"\n code = code + \"<li>Specific, appropriate, observable learning targets establish the purpose of the lesson</li>\"\n end\n if review_scores[107].comments == \"1\"\n code = code + \"<li>The lesson accomplishes its established goals</li>\"\n end\n if review_scores[108].comments == \"1\"\n code = code + \"<li>Excellent knowledge and application MC questions align with learning targets and assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[109].comments == \"1\"\n code = code + \"<li>Specific and reasonable learning targets are stated</li>\"\n end\n if review_scores[110].comments == \"1\"\n code = code + \"<li>The lesson partially meets its established goals</li>\"\n end\n if review_scores[111].comments == \"1\"\n code = code + \"<li>Well constructed MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[112].comments == \"1\"\n code = code + \"<li>Reasonable learning targets are stated</li>\"\n end\n if review_scores[113].comments == \"1\"\n code = code + \"<li>The content relates to its goals</li>\"\n end\n if review_scores[114].comments == \"1\"\n code = code + \"<li>MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[115].comments == \"1\"\n code = code + \"<li>A learning target is included</li>\"\n end\n if review_scores[116].comments == \"1\"\n code = code + \"<li>Content does not achieve its goal, or goal is unclear</li>\"\n end\n if review_scores[117].comments == \"1\"\n code = code + \"<li>4 questions are included</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[118].comments == \"1\"\n code = code + \"<li>Learning target is missing/ not actually a learning target</li>\"\n end\n if review_scores[119].comments == \"1\"\n code = code + \"<li>Lesson has no goal/ content is unfocused</li>\"\n end\n if review_scores[120].comments == \"1\"\n code = code + \"<li>Questions are missing</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n code = code + \"<h3>Writing Quality</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">The writing:</div><table class='general'>\n <tr>\n <th>5 - Excellently Written </th>\n <th>4 - Well Written </th>\n <th>3 - Reasonably Written </th>\n <th>2 - Fairly Written</th>\n <th>1 - Poorly Written </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[121].comments == \"1\"\n code = code + \"<li>Is focused, organized, and easy to read throughout</li>\"\n end\n if review_scores[122].comments == \"1\"\n code = code + \"<li>Uses rich, descriptive vocabulary and a variety of effective sentence structures</li>\"\n end\n if review_scores[123].comments == \"1\"\n code = code + \"<li>Contains few to no mechanical errors</li>\"\n end\n if review_scores[124].comments == \"1\"\n code = code + \"<li>Has an effective introduction and a conclusion that synthesizes all of the material presented</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[125].comments == \"1\"\n code = code + \"<li>Is organized and flows well</li>\"\n end\n if review_scores[126].comments == \"1\"\n code = code + \"<li>Uses effective vocabulary and sentence structures</li>\"\n end\n if review_scores[127].comments == \"1\"\n code = code + \"<li>Contains a few minor mechanical errors</li>\"\n end\n if review_scores[128].comments == \"1\"\n code = code + \"<li>Has an effective introduction and conclusion based on included information</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[129].comments == \"1\"\n code = code + \"<li>Is mostly organized</li>\"\n end\n if review_scores[130].comments == \"1\"\n code = code + \"<li>Uses properly constructed sentences</li>\"\n end\n if review_scores[131].comments == \"1\"\n code = code + \"<li>Has a few distracting errors</li>\"\n end\n if review_scores[132].comments == \"1\"\n code = code + \"<li>Includes an introduction and a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[133].comments == \"1\"\n code = code + \"<li>Can be difficult to follow</li>\"\n end\n if review_scores[134].comments == \"1\"\n code = code + \"<li>Contains several awkward sentences</li>\"\n end\n if review_scores[135].comments == \"1\"\n code = code + \"<li>Has several distracting errors</li>\"\n end\n if review_scores[136].comments == \"1\"\n code = code + \"<li>Lacks either an introduction or a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[137].comments == \"1\"\n code = code + \"<li>Has minimal organization</li>\"\n end\n if review_scores[138].comments == \"1\"\n code = code + \"<li>Has many poorly constructed sentences</li>\"\n end\n if review_scores[139].comments == \"1\"\n code = code + \"<li>Has many mechanical errors that inhibit comprehension</li>\"\n end\n if review_scores[140].comments == \"1\"\n code = code + \"<li>Has neither a clear introduction nor a conclusion</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n #*******************Ratings************************\n code = code + \"<h2>Ratings</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[141].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[142].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[143].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[144].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Credibility</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[145].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[146].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Pedagogy</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[147].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[148].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Writing Quality</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[149].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[150].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n rescue\n code += \"Error \" + $! \n end \n code\nend",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end"
] |
[
"0.61379623",
"0.59060216",
"0.5880602",
"0.57654727",
"0.5665489",
"0.5661925",
"0.5659657",
"0.56046224",
"0.55786324",
"0.5577934",
"0.5569858",
"0.556565",
"0.5555811",
"0.55445313",
"0.55406237",
"0.5535658",
"0.55289745",
"0.552309",
"0.5522136",
"0.552085",
"0.5519992",
"0.5499446",
"0.54980236",
"0.54962844",
"0.548673",
"0.5484515",
"0.54647243",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5459734",
"0.5457605",
"0.5448373",
"0.54306257",
"0.54306257",
"0.54306257",
"0.5427907",
"0.5427156",
"0.5419042",
"0.54115486",
"0.5387665",
"0.53822225",
"0.53801316",
"0.53787696",
"0.5377835",
"0.5376078",
"0.5373427",
"0.53723884",
"0.53618926",
"0.5361295",
"0.53558797",
"0.53551096",
"0.5351903",
"0.53463805",
"0.53438234",
"0.5341934",
"0.53323406",
"0.5329777",
"0.53225166",
"0.5319834",
"0.53177714",
"0.5317472",
"0.5317323",
"0.5316033",
"0.5311024",
"0.5310777",
"0.5291533",
"0.5291445",
"0.52896005",
"0.52761775",
"0.5275927",
"0.5268673",
"0.5267264",
"0.5260953",
"0.52608156",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965",
"0.5256965"
] |
0.7434202
|
0
|
(scrap_topic) init_scrap_topic : Creates a scrap topic based on the new slug
|
def init_scrap_topic(title, user_id)
@scrap_topic = ScrapTopic.find_or_create_by_title(:title => title, :user_id => user_id, :parent_id => 0)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_topic\n if params[:id].nil?\n @topic = Topic.find_by(:permalink => params[:permalink])\n else\n @topic = Topic.find(params[:id])\n end\n end",
"def initialize(topic,prepend=\"\")\n @wiki ||= Wikipedia.find(prepend + topic)\n end",
"def create_topic!\n fora.post_new_topic\n end",
"def refresh_topic(topic)\n \n # Read the RSS feed from the web site.\n response = Net::HTTP.get_response(URI.parse(topic.external_uri))\n throw response.message unless response.is_a? Net::HTTPOK\n\n # Parse the feed.\n body = response.body\n if response[\"content-encoding\"] == \"gzip\"\n gzip_reader = Zlib::GzipReader.new(StringIO.new(body))\n body = gzip_reader.read\n gzip_reader.close\n end #if\n rss = nil\n begin\n rss = RSS::Parser.parse(body)\n rescue RSS::InvalidRSSError\n rss = RSS::Parser.parse(body, false)\n end\n throw \"Could not parse RSS feed.\" if rss.nil?\n\n # Copy the data for the topic itself.\n topic.name = rss.channel.title unless rss.channel.title.nil?\n topic.description = rss.channel.description\n topic.copyright = rss.channel.copyright\n \n # Copy the articles.\n ignore_count = 0\n rss.items.reverse_each do |item|\n # See if this article already exists.\n permalink = case\n when item.guid\n item.guid.content\n when item.link\n item.link\n when (item.pubDate and item.title)\n item.pubDate.strftime(\"%Y/%m/%d/\") + item.title.to_permalink\n else\n nil\n end #case\n if permalink.nil?\n ignore_count += 1\n else\n matches = topic.articles.find(:all,\n :conditions => [\"permalink = ?\", permalink],\n :order => \"posted_at DESC\")\n if matches.size > 0\n article = matches[0]\n else\n article = Article.new\n article.permalink = permalink\n topic.articles << article\n end #if\n article.subject = item.title\n article.author_name = item.author\n article.text = item.description\n article.external_uri = item.link\n if item.pubDate.nil?\n article.posted_at = Time.now.utc if article.posted_at.nil?\n else\n article.posted_at = item.pubDate.utc\n end #if\n article.save\n end #if\n end #each\n if ignore_count > 0\n log.warn \"#{ignore_count} articles were skipped \" +\n \"for topic #{topic.name}\"\n end #if\n \n # Remove old articles.\n if topic.articles.size > MAX_ARTICLES\n sorted_articles = topic.articles.find(:all, :order=>\"posted_at DESC\")\n topic.articles.delete(sorted_articles[MAX_ARTICLES..-1])\n end #if\n \n end",
"def set_topic\n @topic = Topic.friendly.find(params[:topic_id])\n end",
"def set_subtopic\n @subtopic = Subtopic.friendly.find(params[:id])\n end",
"def create_subtopic(subtopic_name,topic_id,question_bank_id,tenant_id)\n subtopic = Subtopic.find_by_name_and_topic_id_and_question_bank_id(subtopic_name,topic_id,question_bank_id)\n if subtopic.nil? or subtopic.blank?\n subtopic = Subtopic.new\n subtopic.name = subtopic_name\n subtopic.topic_id = topic_id\n subtopic.question_bank_id = question_bank_id\n subtopic.tenant_id = tenant_id\n subtopic.save\n end\n return subtopic\n end",
"def set_slug\n self.slug = KeyGenerator.generate(8) if self.slug.blank?\n end",
"def load_topic\n if @tier && id = topic_param_id\n @topic = @tier.topics.find_by_permalink_and_region_and_active(id)\n @topic_class = @topic.class if @topic\n end\n end",
"def load_topic\n if @tier && id = topic_param_id\n @topic = @tier.topics.find_by_permalink_and_region_and_active(id)\n @topic_class = @topic.class if @topic\n end\n end",
"def hook_init_chan(irc)\n c = irc.channel\n t = @topics[cn = c.name] || (@topics[cn] = [nil, nil])\n if setting_cs(irc, 'topic-preserve') { $config['plugins/topic/preserve'] }\n t[1] = read_topic(c)\n topic(c, t[0])\n else\n t[1] = t[0]\n t[0] = read_topic(c)\n end\n end",
"def create_topic(topic_name,question_bank_id,tenant_id)\n topic = Topic.find_by_name_and_question_bank_id(topic_name,question_bank_id)\n if topic.nil? or topic.blank?\n topic = Topic.new\n topic.name = topic_name\n topic.question_bank_id = question_bank_id\n topic.tenant_id = tenant_id\n topic.save\n end\n return topic\n end",
"def create_topic\n raise NotImplementedError.new\n end",
"def create_slug\n return if self.title.blank?\n tail, int = \"\", 1\n initial = convert_to_slug(self.title)\n while Post.find_by_slug(initial + tail) do \n int += 1\n tail = \"-#{int}\"\n end\n self.slug = initial + tail\n end",
"def auto_subscribe_topic\n fail NotImplementedError, 'To be implemented by the concrete topic posts controller.'\n end",
"def build_slug\n return unless new_slug_needed?\n self.slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self)\n end",
"def new_topic(t)\n topics = [ ]\n t.split(',').each { |_t|\n topic = Topic.find_or_create_by_topic(_t.downcase)\n topics << topic\n }\n return topics\n end",
"def setup\n topics.map do |t|\n topic_name = t[:name] || t['name']\n sub_opts = t.reject { |k, _| k.to_sym == :name }\n PubSubClient.upsert_subscription(topic_name, subscription_name(topic_name), sub_opts)\n end\n end",
"def new\n @topic = Topic.new(published_at: Time.now)\n end",
"def after_create_path\n url_for(@topic)\n end",
"def initialize(config, auth)\n @config = config\n @auth = auth\n self.extend eval(\"Impostor::#{config.type.to_s.capitalize}::Topic\")\n end",
"def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end",
"def create_slug\n var_slug = [title.parameterize].join(\"-\")\n self.slug = BlogPost.generate_slug(var_slug)\n end",
"def new_topic(forum, subject, message)\n @topic.new_topic(forum, subject, message)\n end",
"def set_category\n @topic = Category.friendly.find(params[:id])\n end",
"def create_topic(message, url=nil)\n url ||= message.url\n \n topic = Topic.first(:url => url)\n \n if topic.nil?\n topic = Topic.new(:source => name, :url => url)\n set_topic_name(topic)\n \n Grapevine.log.debug \"#{topic.errors.full_messages.join(',')}\" unless topic.valid?\n topic.save\n Grapevine.log.debug \"TOPIC: #{topic.name}\"\n end\n \n return topic\n end",
"def set_sub_topic\n @sub_topic = SubTopic.find(params[:id])\n end",
"def build_a_slug\n return unless new_slug_needed?\n @slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),\n :sluggable => self\n @new_friendly_id = @slug.to_friendly_id\n end",
"def new_city_topics_and_subtopics\n new_city = self\n if new_city.topics.count >= 3 # Topics already exist, so they aren't created again.\n puts \"#{new_city.name} City topics already exist.\"\n else # Topics don't exist, so new topics are created, passing in the newly created topics to subtopic.rb model to seed subtopics.\n lets_talk = new_city.topics.create(name: \"Let's Talk\", description: \"Post anything that's about improving your city and achieving positive progress within it.\", slug: \"lets-talk\")\n good_vibes = new_city.topics.create(name: \"Good Vibes\", description: \"Post anything that's uplifting, happy, or positive about your city.\")\n city_affairs = new_city.topics.create(name: \"City Affairs\", description: \"Post anything that concerns your city's bureaucracy and government: policies, laws, city council & officials, ballots, events, public departments, etc.. City Affairs is the portal for your city's government.\")\n puts \"#{new_city.name} City created new topics: #{new_city.topics.pluck(:name)}\"\n # Begin - Let's Talk Subtopics: Makes sure Let's Talk topic is empty of subtopics, then creates them if so, otherwise returns a statement.\n if lets_talk.subtopics.empty? # Let's talk is empty, so creation of its subtopics occurs\n lets_talk_subtopics = new_city.subtopics.build([\n { name: \"Help Me Out\", description: \"Post about anything you need help with amongst the boundaries of your city, ranging from accomplishing a common goal to finding your missing dog.\" },\n { name: \"Business Buzz\", description: \"Post about your business, local businesses, new businesses, small businesses. Its all of your business!\" },\n { name: \"Grinds My Gears\", description: \"Doesn't that just grind your gears? Vent and rant about the things that bug you concerning your city.\" },\n { name: \"Sports\", description: \"What's your take on local sports? High school teams, peewee football?\" }])\n lets_talk.subtopics << lets_talk_subtopics\n puts \"#{new_city.name}'s #{lets_talk.name}'s subtopics created: #{lets_talk.subtopics.pluck(:name)}.\"\n else # Let's talk already has subtopics.\n puts \"There may be an issue with the creation of #{new_city.name}'s topic, #{lets_talk.name}, and its subtopics. #{lets_talk.name} already has these subtopics: #{lets_talk.subtopics.pluck(:name)}.\"\n end # End - Let's Talk Subtopics\n # Begin - Good Vibes Subtopics: Makes sure Good Vibes topic is empty of subtopics, then creates them if so, otherwise returns a statement.\n if good_vibes.subtopics.empty? # Good Vibes is empty, so creation of its subtopics occurs\n good_vibes_subtopics = new_city.subtopics.build([\n { name: \"Good News\", description: \"Heard something about your city that just makes you feel good about it? Or something inside your city that uplifts? Spread the good news!\",},\n { name: \"Furry Friends\", description: \"You love your cat or dog. We do, too. Post about the cute creatures of your city.\" },\n { name: \"City Snaps\", description: \"Share your favorite picture of your city or anything related to it.\" },\n { name: \"Local Historian\", description: \"Your city has a lot of history. Share it and interesting stories you find buried in the past!\" }])\n good_vibes.subtopics << good_vibes_subtopics\n puts \"#{new_city.name}'s #{good_vibes.name}'s subtopics created: #{good_vibes.subtopics.pluck(:name)}.\"\n else # Good Vibes already has subtopics.\n puts \"There may be an issue with the creation of #{new_city.name}'s topic, #{good_vibes.name}, and its subtopics. #{good_vibes.name} already has these subtopics: #{good_vibes.subtopics.pluck(:name)}.\"\n end # End - GOod Vibes Subtopics:\n # Begin - Good Vibes Subtopics: Makes sure Good Vibes topic is empty of subtopics, then creates them if so, otherwise returns a statement.\n if city_affairs.subtopics.empty? # Good Vibes is empty, so creation of its subtopics occurs\n city_affairs_subtopics = new_city.subtopics.build([\n { name: \"Ballots\", description: \"Ballots and measures for your local city.\"},\n { name: \"Events\", description: \"Events in your city: townhalls, citizen gatherings, protests, zoning, official meetings, and so on.\" },\n { name: \"City Improvements\", description: \"Post about ways and means to improve you city, ranging from governmental to community reforms.\" },\n { name: \"Schools\", description: \"Discuss the happenings within your local school district. Policies, teachers, curriculum, and so on.\" }])\n city_affairs.subtopics << city_affairs_subtopics\n puts \"#{new_city.name}'s #{city_affairs.name}'s subtopics created: #{city_affairs.subtopics.pluck(:name)}.\"\n else # Good Vibes already has subtopics.\n puts \"There may be an issue with the creation of #{new_city.name}'s topic, #{city_affairs.name}, and its subtopics. #{city_affairs.name} already has these subtopics: #{city_affairs.subtopics.pluck(:name)}.\"\n end # End - GOod Vibes Subtopics:\n end \n end",
"def create_topic\n t = Topic.create(title: new_topic) if new_topic.present?\n t.update_column(:user_id, self.user_id)\n t.save\n self.topic = t\n end",
"def set_topic\n @topic = Topic.find(params[:topic_id])\n end",
"def get_new_topic_page(uri)\n begin\n self.config.agent.get(uri)\n rescue StandardError => err\n raise Impostor::TopicError.new(err)\n end\n end",
"def slug=(_arg0); end",
"def topic\n @_topic ||= request.env['loudmouth_map'][:topic_model].singularize.downcase\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_publication\n @publication = Publication.friendly.find(params[:slug])\n end",
"def set_rel_topic_sub_topic\n @rel_topic_sub_topic = RelTopicSubTopic.find(params[:id])\n end",
"def build_slug\n return unless new_slug_needed?\n @slug = slugs.new(:name => slug_text, :scope => friendly_id_config.scope_for(self))\n raise FriendlyId::BlankError unless @slug.valid?\n @new_friendly_id = @slug.to_friendly_id\n @slug\n end",
"def create_scrap_topic\n @scrap_topic = ScrapTopic.new\n @scrap_topic.title = params[:scrap_topic][:title].strip\n @scrap_topic.user_id = current_user.id\n begin\n ScrapTopic.transaction do\n tag = Tag.find_or_create_by_name(params[:scrap_topic][:title].strip)\n @scrap_topic.save!\n respond_to do |format|\n format.html do\n flash[:notice] = 'Topic successfully created'[:msg_topic_created]\n redirect_to scrap_topic_path(@scrap_topic.slug)\n end\n format.js { show_scrap_topic and return }\n format.xml { return }\n end\n end\n rescue\n respond_to do |format|\n format.html { render :action => 'new_scrap_topic' and return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end\n end",
"def topic(topic_name, &proc)\n t = create_topic(topic_name)\n proc.call(t) if proc\n t\n end",
"def topic\n load\n @topic\n end",
"def create_slug\n if new? \n \tlength = 16\n \t# Loop while slug is not unique\n \tbegin\n \t\tself.slug = (0..(length-1)).map{ rand(36).to_s(36) }.join \n \t\tobject = self.class.first(:slug => self.slug) \n \tend while(object != nil)\n end\nend",
"def auto_initialize!\n client\n topic\n end",
"def create_subtopics(city, lets_talk, good_vibes, city_affairs) \n if city.subtopics.count >= 12\n puts \"#{city.name} City already has #{city.subtopics.count} subtopics.\"\n else # Subtopics don't already exist, so they're created.\n new_city_subtopics = city.subtopics.build([\n {\n name: \"Help Me Out\",\n description: \"Post about anything you need help with amongst the boundaries of your city, ranging from accomplishing a common goal to finding your missing dog.\",\n topic_id: lets_talk.id,\n },\n {\n name: \"Business Buzz\",\n description: \"Post about your business, local businesses, new businesses, small businesses. Its all of your business!\",\n topic_id: lets_talk.id,\n },\n {\n name: \"Grinds My Gears\",\n description: \"Doesn't that just grind your gears? Vent and rant about the things that bug you concerning your city.\",\n topic_id: lets_talk.id,\n },\n {\n name: \"Sports\",\n description: \"What's your take on local sports? High school teams, peewee football?\",\n topic_id: lets_talk.id,\n },\n {\n name: \"Good News\",\n description: \"Heard something about your city that just makes you feel good about it? Or something inside your city that uplifts? Spread the good news!\",\n topic_id: good_vibes.id,\n },\n {\n name: \"Furry Friends\",\n description: \"You love your cat or dog. We do, too. Post about the cute creatures of your city.\",\n topic_id: good_vibes.id,\n },\n {\n name: \"City Snaps\",\n description: \"Share your favorite picture of your city or anything related to it.\",\n topic_id: good_vibes.id,\n },\n {\n name: \"Local Historian\",\n description: \"Your city has a lot of history. Share it and interesting stories you find buried in the past!\",\n topic_id: good_vibes.id,\n },\n {\n name: \"Ballots\",\n description: \"Ballots for your local city.\",\n topic_id: city_affairs.id,\n },\n {\n name: \"Events\",\n description: \"Events in your city: townhalls, zoning, official meetings, etc..\",\n topic_id: city_affairs.id,\n },\n {\n name: \"City Improvements\",\n description: \"Post about ways and means to improve you city, ranging from governmental to community reforms..\",\n topic_id: city_affairs.id,\n },\n {\n name: \"Schools\",\n description: \"Discuss the happenings within your local school district. Policies, teachers, curriculum, etc..\",\n topic_id: city_affairs.id,\n }\n ])\n city.subtopics << new_city_subtopics\n puts \"Created #{new_city_subtopics.count} #{city.name} Ossembly Forum Subtopics. Created Subtopics: #{new_city_subtopics.pluck(:name)} \"\n end \n end",
"def set_news_topic\n @news_topic = NewsTopic.find(params[:id])\n end",
"def generate_slug\n \tself.slug = title.parameterize\n end",
"def new\n @topic = Topic.new\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_slug\n self.slug = title.parameterize\n end",
"def autoload_scrap_data\n #\n # Get ScrapTopic identifier from the querystring\n if params[:scrap_topic_title]\n scrap_topic_title = params[:scrap_topic_title]\n elsif params[:scrap_topic_id]\n if params[:scrap_topic_id].class == Array\n scrap_topic_id = params[:scrap_topic_id][0]\n else\n scrap_topic_id = params[:scrap_topic_id]\n end\n end\n\n #\n # TRY getting @scrap_topic by id\n if scrap_topic_id.to_i > 0\n @scrap_topic = ScrapTopic.find_by_id(scrap_topic_id.to_i)\n #\n # TRY getting @scrap_topic by slug\n else\n scrap_topic_id = params[:scrap_topic_title] if params[:scrap_topic_title]\n @scrap_topic = ScrapTopic.find_by_slug_cache(scrap_topic_id)\n end\n\n #\n # TRY getting @scrap by slug/id\n if params[:id]\n if params[:id].to_i > 0\n @scrap = Scrap.find_by_id(params[:id].to_i)\n @scrap_topic = @scrap_topic if @scrap and @scrap_topic.nil?\n elsif params[:id]\n @scrap = Scrap.find_by_slug_cache(params[:id])\n @scrap_topic = @scrap_topic if @scrap and @scrap_topic.nil?\n end\n end\n\n #\n # Get @scrap_topic from @scrap if @scrap_topic not set\n @scrap_topic ||= @scrap.scrap_topic if @scrap\n return true\n end",
"def set_subtopic\n @subtopic = Subtopic.find(params[:id])\n end",
"def set_topic_name(topic)\n topic_name = ''\n \n # Find topic name from the title of the URL\n open(topic.url) do |f|\n m, topic_name = *f.read.match(/<title>(.+?)<\\/title>/)\n topic_name ||= '<unknown>'\n end\n\n topic.name = topic_name[0..250]\n end",
"def set_slug\n self.translated_in.each do |locale|\n Locomotive::Mounter.with_locale(locale) do\n # first attempt from the label\n if self._slug.blank?\n self._slug = self._label.try(:dup)\n end\n\n # from the content type itself\n if self._slug.blank?\n self._slug = self.content_type.send(:label_to_slug)\n end\n\n self._slug.permalink!\n\n self._slug = self.next_unique_slug if self.slug_already_taken?\n end\n end\n\n self.fill_with_default_slug\n end",
"def generate_slug\n self.slug = title.parameterize if title\n end",
"def setup(&block)\n @_topic = self.instance_eval(&block)\n end",
"def define_topics\n @topics = {\n 'uk' => 'UK',\n 'world' => 'World',\n 'education' => 'Education',\n 'politics' => 'Politics',\n 'health' => 'Health',\n 'science_and_environment' => 'Science and Environment',\n 'business' => 'Business',\n 'technology' => 'Technology',\n 'entertainment_and_arts' => 'Entertainment and Arts'\n }\n end",
"def set_slug\n self.slug = title.downcase.gsub(\" \", \"_\") if slug.blank?\n slug\n end",
"def set_slug\n self.slug = title.downcase.tr(\" \", \"_\") if slug.blank?\n slug\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_article_topic\n @article_topic = ArticleTopic.find(params[:id])\n end",
"def set_topic\n @topic = Admin::Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id]) if params[:id]\n @topic = Topic.find(params[:topic_id]) if params[:topic_id]\n end",
"def set_slug\n self.slug = self.title.parameterize\n end",
"def create\n # MUST REFACTOR!\n if params[:primary_category] && !params[:primary_category][:id].blank?\n parent_topic = Topic.find(params[:primary_category][:id])\n end\n if params[:super_category] && !params[:super_category][:id].blank?\n super_cat = Topic.find(params[:super_category][:id])\n parent_topic ||= super_cat\n end\n @topic = Topic.new params[:topic]\n if (super_cat.nil?)\n @topic = Topic.create(:name => params[:topic][:name])\n @topic.update_attribute(:root_id, @topic.id)\n success = true\n else\n @topic = Topic.create(:name => params[:topic][:name], :root_id => super_cat.id)\n success = true\n end\n respond_to do |format|\n if success\n # disabling moving to new super cats right now\n # @topic.update_attribute(:root_id, super_cat.id) unless super_cat.nil?\n unless parent_topic.nil?\n @topic.move_to_child_of parent_topic \n end \n flash[:notice] = \"Topic #{@topic.name} was successfully created.\"\n format.html { redirect_to([:admin, @topic]) }\n format.xml { render :xml => @topic, :status => :created, :location => [:admin, @topic] }\n else\n flash[:notice] = \"There was a problem creating this topic.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate_article_slug\n slug = \"#{title.to_s.downcase.gsub(/\\W/, '-')}-#{Time.now.to_i}\"\n self.slug = slug\n end",
"def initialize(title) #initialize the post class with a title\n @title = title\n end",
"def topic(name)\n pubsub.topic(name) || create_topic(name)\n end",
"def set_post\n @post = Post.friendly.find(params[:id])\n @topic = Topic.friendly.find(params[:topic_id])\n end",
"def check_and_set_slug\n self.slug ||= self.host&.parameterize\n end",
"def topic()\n Sensit::Api::Topic.new @http_client\n end",
"def slug_generator_class=(_arg0); end",
"def set_help_topic\n @topic = (params[:topic] || params[:id])&.to_sym\n end"
] |
[
"0.65486634",
"0.6187992",
"0.61843497",
"0.602363",
"0.6020988",
"0.6015673",
"0.5903364",
"0.59011114",
"0.58880544",
"0.58880544",
"0.5865893",
"0.5862448",
"0.5818125",
"0.58098865",
"0.57671744",
"0.56731987",
"0.56700873",
"0.56687266",
"0.56652015",
"0.5644188",
"0.5617203",
"0.5614718",
"0.5609319",
"0.5570816",
"0.555565",
"0.555372",
"0.55520725",
"0.5541774",
"0.5531463",
"0.55164737",
"0.550391",
"0.55035776",
"0.55007696",
"0.55003077",
"0.5482342",
"0.5482342",
"0.5481571",
"0.5475315",
"0.5474576",
"0.54711586",
"0.5468906",
"0.54610825",
"0.5450306",
"0.54454744",
"0.544263",
"0.54371977",
"0.5434255",
"0.5433846",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.54325724",
"0.5429834",
"0.5423033",
"0.5416035",
"0.5410225",
"0.540759",
"0.5406907",
"0.5400858",
"0.53959095",
"0.5388694",
"0.53867155",
"0.53832275",
"0.53832275",
"0.5373288",
"0.53681636",
"0.5363768",
"0.5362135",
"0.5361649",
"0.53554136",
"0.535488",
"0.53502077",
"0.5349987",
"0.5349946",
"0.5343115",
"0.53323686",
"0.5330416"
] |
0.7712068
|
0
|
(true) autoload_scrap_data : Loads scrap / scrap_topic data into request scope
|
def autoload_scrap_data
#
# Get ScrapTopic identifier from the querystring
if params[:scrap_topic_title]
scrap_topic_title = params[:scrap_topic_title]
elsif params[:scrap_topic_id]
if params[:scrap_topic_id].class == Array
scrap_topic_id = params[:scrap_topic_id][0]
else
scrap_topic_id = params[:scrap_topic_id]
end
end
#
# TRY getting @scrap_topic by id
if scrap_topic_id.to_i > 0
@scrap_topic = ScrapTopic.find_by_id(scrap_topic_id.to_i)
#
# TRY getting @scrap_topic by slug
else
scrap_topic_id = params[:scrap_topic_title] if params[:scrap_topic_title]
@scrap_topic = ScrapTopic.find_by_slug_cache(scrap_topic_id)
end
#
# TRY getting @scrap by slug/id
if params[:id]
if params[:id].to_i > 0
@scrap = Scrap.find_by_id(params[:id].to_i)
@scrap_topic = @scrap_topic if @scrap and @scrap_topic.nil?
elsif params[:id]
@scrap = Scrap.find_by_slug_cache(params[:id])
@scrap_topic = @scrap_topic if @scrap and @scrap_topic.nil?
end
end
#
# Get @scrap_topic from @scrap if @scrap_topic not set
@scrap_topic ||= @scrap.scrap_topic if @scrap
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def download_data\n subclass_must_define\n end",
"def eager_load; end",
"def eager_load; end",
"def eager_load; end",
"def load_data\n # @categories = Category.find(:all)\n # @infoitems = Expert.find(:all)\n end",
"def load_feed\n \n @url_data_params ||= {}\n response = FellowshipOne::api_request(:get, @url_data_path, @url_data_params)\n data = JSON.parse(response.body)\n @headers = response.headers\n @cacher.save_data(@class_key, data) unless @cacher.nil?\n\n return data\n end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def load_data\n @products = Product.find(:all, :conditions => ProductFilter.website_conditions(@website), :order => \"name\")\n @comment_types = CommentType.find(:all, :order => \"name\")\n @comment_statuses = CommentStatus.find(:all, :order => \"name\")\n @users = User.find(:all, :order => \"login\")\n end",
"def initialize setup\n @requests = setup[:requests]\n @response = setup[:response]\n @vos = setup[:vos]\n @related_scrapers = setup[:related_scrapers] || {}\n @is_root = setup[:is_root] \n @pager = setup[:pager] || {}\n @scrapers = setup[:scrapers] || {}\n @name = setup[:name]\n \n # load in a named helper for this scraper, or the base one\n if @name && Helper.const_defined?(@name)\n @helper = Helper.const_get(@name).new\n else \n @helper = Helper::Base.new\n end\n \n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def crawl\n update_all_feeds\n fetch_and_store_articles\n end",
"def scrap\n @titulo = self.titulo\n @cuerpo = self.cuerpo\n @autor = self.autor\n @fecha = self.fecha\n end",
"def load_pre_requisites\n if @yaml.nil?\n @log.info \"No configuration file specified --> returning.\"\n else\n build_catalog(\"staff\", @yaml[\"STAFF_CATALOG\"])\n build_catalog(\"student\", @yaml[\"STUDENT_CATALOG\"])\n @pre_requisites\n end\n end",
"def load_all; end",
"def load_all; end",
"def load_all; end",
"def initialize\n load_data\n end",
"def scrape()\n scrapeForCurrentData\n end",
"def eager_load_namespaces; end",
"def scrape\n end",
"def load()\n raise 'Cannot load trackbacks without a site defined' if site.nil?\n \n # Paginate through search\n page = 1\n duplicate_count = 0\n \n begin\n begin\n results = Topsy.search(site, :window => :realtime, :page => page, :perpage => per_page)\n rescue Topsy::InformTopsy => e\n Grapevine.log_error(\"Topsy Search (#{name})\")\n rescue Topsy::Unavailable => e\n Grapevine.log_error(\"Topsy Unavailable (Limit: #{Topsy.rate_limit.remaining} of #{Topsy.rate_limit.limit})\")\n end\n \n # Exit load if Topsy does not return results\n if results.nil?\n return\n end\n \n # Loop over links and load trackbacks for each one\n results.list.each do |item|\n # Create and append message\n message = create_message(item)\n \n if !message.nil?\n # Attempt to create a topic\n topic = create_topic(message)\n if topic.nil?\n next\n end\n\n # Skip message from a user if it's a duplicate\n if Message.first(:author => message.author, :topic => topic)\n duplicate_count += 1\n \n # Exit if we've encountered too many duplicates\n if duplicate_count > duplicate_max_count\n return\n # Otherwise continue to next item\n else\n next;\n end\n # Reset the duplicate count if we see a new tweet\n else\n duplicate_count = 0\n end\n\n # Assign topic and save message\n message.topic = topic\n message.save\n\n Grapevine.log.debug \"MESSAGE: [#{message.author}] #{message.content}\"\n end\n end\n\n page += 1\n end while results.last_offset < results.total && page < 10\n end",
"def preload_data\n DataStore.instance.insert_data('users', 'data/users.json')\n DataStore.instance.insert_data('tickets', 'data/tickets.json')\n end",
"def load_all_data\n @students = Student.all\n @employees = Employee.all\n @routes = Route.in_academic_year(academic_year_id).all(:include => :vehicle_stops)\n end",
"def download_article_data\n print \"Getting list of articles...\\n\"\n ArticleGetter.new([ARTICLE_SOURCE]).result\n end",
"def prefetch(reqs)\n end",
"def load_favoritable\n @request = request\n @resource, @id = request.path.split('/')[1,2]\n @favoritable = @resource.singularize.classify.constantize.find(@id)\n end",
"def eager_load_paths=(_arg0); end",
"def set_scraper\n @scraper = Scraper.find(params[:id])\n end",
"def initialize(db)\n @db = db\n #initialize the scraper with a database\n end",
"def load_data\n\t\tload_using_arr(train_file,train_hash,0,1)\n\t\tload_using_arr(train_file,movie_hash,1,0)\n\tend",
"def load_scraped_objects\n {}.tap do |objects|\n @store.read_multi(@store.entries).each do |properties|\n object = load_scraped_object(properties)\n objects[object._id] = object\n end\n end\n end",
"def scrapers\n @@scrapers\n end",
"def load_data(data_hash)\n super\n @url = data_hash['url']\n end",
"def before_eager_load(&block); end",
"def scrape\n scraped_articles=[]\n scraped_articles=scrape_articles(false)\n # Iterate through the API List\n scraped_articles['response']['docs'].each do |item|\n process_item (item)\n end\n end",
"def set_scrap\n @scrap = Scrap.find(params[:id])\n end",
"def request_import\n end",
"def eager_load=(_arg0); end",
"def eager_load=(_arg0); end",
"def eager_load=(_arg0); end",
"def crawler_data\n @crawler_data ||= Nokogiri::HTML(crawler_page, nil, 'utf-8')\n end",
"def initialize(data_path,script_path,titles_path)\n # @data_dir = \"public/data/\"\n \n\n # retrieve titles\n @titles = []\n \n if File.exists?(titles_path)\n @titles = get_json_data(titles_path)\n end\n \n @data = []\n \n if File.exists?(data_path)\n @data = collect_joblist(data_path,script_path)\n end\n\n end",
"def load_data(ctx, **)\n ctx[:users] = User.all\n ctx[:welcome] = 'Welcome to TRB training'\n end",
"def load_data(args={})\n args = args.to_smash\n @resources = (args.delete(:resources) || []).each do |r|\n Resource.new(r)\n end\n @events = (args.delete(:events) || []).each do |e|\n Event.new(e)\n end\n super args\n end",
"def load_atas(required)\n load_from(\"store:atas\", get_ata_words_count, required)\n end",
"def set_scraper\n @scraper = Scraper.find(params[:id])\n end",
"def load_data(data_set)\n\t\tif data_set != :u\n\t\t\tload_hashes(\"#{data_set}.base\") # training set\n\t\t\tload_test(\"#{data_set}.test\") # test set\n\t\telse\n\t\t\tload_hashes(\"#{data_set}.data\") # training set\n\t\tend\n\tend",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def preload!\n end",
"def initiate\n Scraper.initiate_scrape\n puts \"\\n\\nWelcome to Today on Crowder! To exit type 'exit'.\"\n list_articles\n end",
"def scraper\n blog.scraper\n end",
"def load_data\n @promotions = Promotion.find(:all)\n @products = Product.find(:all, :conditions => ProductFilter.website_conditions(@website))\n end",
"def load_from_server\n load_settings\n load_branding\n end",
"def get_data\n\t \thydra = Typhoeus::Hydra.hydra\n\n\t \tfirst_url = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22#{self.stock_ticker}%22)&format=json%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env\"\n\t \tsecond_url = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.keystats%20where%20symbol%20in%20(%22#{self.stock_ticker}%22)&format=json%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env\"\n\t \tthird_url = \"http://www.quandl.com/api/v1/datasets/DMDRN/#{self.stock_ticker}_ALLFINANCIALRATIOS.csv?auth_token=#{ENV['QUANDL_API_TOKEN']}\"\n\t \tfourth_url = \"http://www.quandl.com/api/v1/datasets/PSYCH/#{self.stock_ticker}_I.json?&auth_token=auth_token=#{ENV['QUANDL_API_TOKEN']}&trim_start=#{Chronic.parse(\"last week\").strftime(\"%F\")}&trim_end=#{Chronic.parse(\"today\").strftime(\"%F\")}&sort_order=desc\"\n\n\t \t(((first_url) =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]) == 0) ? first_request = Typhoeus::Request.new(first_url) : (return false)\n\t \tsecond_request = Typhoeus::Request.new(second_url) \n\t \tthird_request = Typhoeus::Request.new(third_url) \n\t \tfourth_request = Typhoeus::Request.new(fourth_url) \n\n\t \thydra.queue first_request\n\t \thydra.queue second_request\n\t \thydra.queue third_request\n\t \thydra.queue fourth_request\n\t \t\n\t \thydra.run\n\n\t\t\tfirst_request.response.options[:response_code] == 200 ? first_response = first_request.response : (return false )\n\t \tsecond_response = second_request.response\n\t \tthird_response = third_request.response \n\t \tfourth_response = fourth_request.response\n\n\t \t@quotes = JSON.parse(first_response.body) if !first_response.body.nil?\n\n\t \t@key_stats = JSON.parse(second_response.body) \n\n\t \tthird_request.response.options[:response_code] == 200 ? @quandl_data = CSV.parse(third_response.body) : @quandl_data = nil\n\n\t \tfourth_request.response.options[:response_code] == 200 ? @psych_data = JSON.parse(fourth_response.body) : @psych_data = nil\n\n\t \t@tradier = $tradier_client.quote(self.stock_ticker)\n\n\t \tmethod(:assign_yahooQuotes).call\n\t \tmethod(:assign_yahooKeyStats).call\n\t \tmethod(:assign_quandlStockData).call\n\t \tmethod(:assign_quandlPsychData).call\n\t \tmethod(:assign_databaseValues).call\n\t \tmethod(:assign_stockProfile).call\n\t \tmethod(:assign_tradierQuote).call\n\n\t end",
"def DataLoadFromFile(filename)\n file = File.new(filename)\n \n @xml_data = file\n self.ScrapAnalyse()\n end",
"def get_data\n response = fetch\n if response \n if response.header.code == \"200\"\n doc = Nokogiri::HTML(response.body)\n self.title = doc.title.to_s\n content_description = doc.xpath(\"//meta[@name='description']/@content\")\n # Some people use the wrong capitlization\n if content_description.blank?\n content_description = doc.xpath(\"/html/head/meta[@name='Description']/@content\")\n end\n unless content_description.blank?\n self.description = content_description.to_s\n end\n content_keywords = doc.xpath(\"//meta[@name='keywords']/@content\").to_s\n if content_keywords.blank?\n content_keywords = doc.xpath(\"//meta[@name='Keywords']/@content\").to_s\n end\n \n self.tag_names = content_keywords unless content_keywords.blank?\n self.data_recived_on = Time.now\n end\n self.code = response.header.code.to_i\n else\n self.code = 502\n end\n return response\n end",
"def initialize(title, url) # from first scrape data initialize == Lifecycle method in Ruby\n @title = title\n @url = url\n @@all << self if @@all.none?(self)\n end",
"def set_scrape\n @scrape = Scrape.find(params[:id])\n end",
"def load\r\n \r\n end",
"def load_sample_data(skip = {})\n Sidekiq::Client.push(\n 'class' => SampleDataWorker,\n 'queue' => 'imports',\n 'args' => [self.id, skip]\n )\n end",
"def prepare\n super\n\n self.fetch_site\n end",
"def page_load; end",
"def request_trending\n base_uri = 'http://localhost:8888/developers'\n response = RestClient.get( base_uri, { params: { language: cleaned_query_param } } )\n @data = JSON.parse(response) \n end",
"def setup_fetcher(options={})\n @fetch_base_url = options[:fetch_base_url] || \"\"\n\n @fetch_count=0\n\n\n @record_directory=options[:record_directory]\n @playback_directory=options[:playback_directory]\n\n @throttler=options[:throttler] || Nanikore::Throttler.new(options)\n end",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end",
"def google_load_feeds\n return '' if defined?(@google_load_feeds_included)\n @google_load_feeds_included = true\n (google_ajax_api_scripts + '<script type=\"text/javascript\">google.load(\"feeds\", \"1\");</script>').html_safe\n end",
"def retrieve_data\n # Define the url\n url = 'http://www.sbs.com.au/news/rss/news/science-technology.xml'\n\n # Open the url and parse the rss feed\n open(url) do |rss|\n # Start parsing\n feed = RSS::Parser.parse(rss, false)\n\n # Iterate each item and scrape information\n feed.items.each do |item|\n # If the title of thie article matches the title of the last saved article,\n # stop scraping to avoid from saving duplicates in database\n break if !@last_title.nil? && @last_title.eql?(item.title.to_s)\n\n # If thie article is already stored then ignore\n next if Article.find_by(title: item.title.to_s)\n\n # Make a template dictionary to put @articles\n temp = {\n author: nil,\n title: item.title,\n summary: item.description,\n image: nil,\n date_time: DateTime.parse(item.pubDate.to_s),\n link: item.link,\n categories: nil\n }\n\n # Put the object into articles array\n @articles << temp\n end\n end\n end",
"def load_data\n raise NotImplementedError\n end",
"def load_data(force=false)\n # Don't load data twice\n return if instance_variable_defined?(:@data_loaded) && @data_loaded && !force\n\n # Load all data\n data_sources.each { |ds| ds.use }\n load_code_snippets(force)\n load_rules\n load_items\n load_layouts\n data_sources.each { |ds| ds.unuse }\n\n # Preprocess\n setup_child_parent_links\n Nanoc3::PreprocessorContext.new(self).instance_eval(&preprocessor) unless preprocessor.nil?\n link_everything_to_site\n setup_child_parent_links\n build_reps\n route_reps\n\n # Done\n @data_loaded = true\n end",
"def load_cache\n q = @client.caches.get(:name=>name)\n @client.logger.debug \"GOT Q: \" + q.inspect\n @data = q.raw\n q\n end",
"def DataLoadFromSite(search)\n conn = Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_password)\n \n query=\"Title\" #|IMDB\"\n lang=\"fr\" # / en\"\n format=\"XML\"\n api_url=\"#{@siteurl}/scraper/API/1/Movie.Search/#{query}/#{lang}/#{format}/#{@apikey}/#{search}\"\n \n url = URI.parse(URI.escape(api_url))\n res = conn.start(url.host, url.port) {|http|\n http.get(url.path)\n }\n \n @xml_data = res.body\n self.ScrapAnalyse()\n end",
"def load\n self.class.load self # pass the loading off to the class\n end",
"def data; @data ||= fetch; end",
"def preload_data_with_threads(num_threads)\n return unless num_threads > 0\n preload_methods = active_methods.concat(options[:additional_data].keys)\n log :info, \"Preloading (#{preload_methods.size}) data requests using (#{num_threads}) threads.\"\n work_q = Queue.new\n preload_methods.each{|x| work_q.push x }\n workers = num_threads.to_i.times.map do\n Thread.new do\n begin\n while x = work_q.pop(true)\n log :debug, \"Preloading #{x}.\"\n send x\n end\n rescue ThreadError\n end\n end\n end\n workers.map(&:join); \"ok\"\n end",
"def load_data\n raise \"Data is temporarily disabled\" unless EolConfig.data?\n EOL.log_call\n # Sad that we need to load all of this for the about and glossary tabs, but\n # TODO - we can cache this, later:\n @taxon_data = []\n @range_data = []\n @data_point_uris = []\n @categories = []\n @include_other_category = @data_point_uris &&\n @data_point_uris.detect { |d| d.predicate_known_uri.nil? ||\n d.predicate_known_uri.toc_items.blank? }\n @units_for_select = []\n end",
"def init_load(url, adapter_name)\n adapter = Adapter.add_source(adapter_name, @persistence_dir)\n adapter.load( url, \n :format => :rdfxml, \n :into => :default_model )\n adapter\n end",
"def set_scraping_page\n @scraping_page = ScrapingPage.find(params[:id])\n end",
"def scrape_it\n \n end",
"def reviewer_home_setup\n\n @my_processed_reviews = DesignReview.my_processed_reviews(@logged_in_user)\n @my_unprocessed_reviews = DesignReview.my_unprocessed_reviews(@logged_in_user)\n @reviews_assigned_to_peers = DesignReview.reviews_assigned_to_peers(@logged_in_user)\n\n end",
"def load\n\n page = 1\n pages = 0\n\n loop do\n # until done\n RestClient.get CONFIG['GUARDIAN_API'], :params => { \n :format => 'json', \n :'show-fields' => 'headline,body,standfirst', \n :'show-tags' => 'all',\n :tag => '(type/article|type/minutebyminute),publication/theguardian', # only articles | minutebyminute published by the guardian\n :'from-date' => '2013-01-01',\n :'to-date' => '2013-08-08',\n :page => page,\n :'api-key' => CONFIG['GUARDIAN_CONTENT_API_KEY']\n } do |response|\n\n pages = handle_response(response)\n end\n\n # stop\n break if page == pages\n \n page = page + 1 \n end\n end",
"def load_cache\n @load_cache\n end",
"def index\n @scraping_pages = ScrapingPage.all\n end",
"def index\n @scraps = Scrap.all\n end",
"def fetch\n data = WebApi.json! \"IEconItems_#{app_id}\", 'GetSchema', 1, language: language\n\n @attributes = {}\n data[:attributes].each do |attribute|\n @attributes[attribute[:defindex]] = attribute\n @attributes[attribute[:name]] = attribute\n end\n\n @effects = {}\n data[:attribute_controlled_attached_particles].each do |effect|\n @effects[effect[:id]] = effect[:name]\n end\n\n @items = {}\n @item_names = {}\n data[:items].each do |item|\n @items[item[:defindex]] = item\n @item_names[item[:name]] = item[:defindex]\n end\n\n @item_levels = {}\n data[:item_levels].each do |item_level_type|\n @item_levels[item_level_type[:name]] = {}\n item_level_type[:levels].each do |level|\n @item_levels[item_level_type[:name]][level[:level]] = level[:name]\n end\n end if data.key? :item_levels\n\n @item_sets = {}\n data[:item_sets].each do |item_set|\n @item_sets[item_set[:item_set]] = item_set\n end\n\n @origins = []\n data[:originNames].each do |origin|\n @origins[origin[:origin]] = origin[:name]\n end\n\n @qualities = []\n data[:qualities].keys.each_with_index do |key, index|\n @qualities[index] = data[:qualityNames][key] || key.to_s.capitalize\n end\n end",
"def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end",
"def full_preload(docs, inclusions, polymorphic_inclusions, nested_inclusions)\n preload(inclusions, docs)\n\n polymorphic_inclusions.each do |metadata|\n preload_polymorphic(metadata, docs)\n end\n\n preload_nested(nested_inclusions, docs)\n end",
"def load_scenario_with_caching(name)\n EOL::ScenarioLoader.load_with_caching(name)\n end",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def before_load(o={}, &block) \n end",
"def load_objects\n @objects = scope.all\n instance_variable_set \"@#{object_name.pluralize}\", @objects\n end"
] |
[
"0.56630254",
"0.55869997",
"0.55869997",
"0.55869997",
"0.5576264",
"0.5533455",
"0.5526879",
"0.5526879",
"0.5526879",
"0.5526879",
"0.5438506",
"0.53440136",
"0.53169787",
"0.53122896",
"0.5303988",
"0.52137566",
"0.52052563",
"0.52052563",
"0.52052563",
"0.51941466",
"0.5155547",
"0.5153123",
"0.5138087",
"0.51115453",
"0.50879395",
"0.5073259",
"0.5070827",
"0.5065816",
"0.505254",
"0.5046701",
"0.5043795",
"0.50275725",
"0.50218207",
"0.5020733",
"0.5014742",
"0.5014301",
"0.50140154",
"0.50106627",
"0.5008433",
"0.49972093",
"0.49814063",
"0.49814063",
"0.49814063",
"0.49762258",
"0.49757248",
"0.49726337",
"0.49665093",
"0.49616387",
"0.4953425",
"0.49491653",
"0.49469206",
"0.49453416",
"0.49425057",
"0.4939717",
"0.49303967",
"0.4924213",
"0.49237955",
"0.49230444",
"0.49224448",
"0.49203616",
"0.49048465",
"0.49039778",
"0.4901159",
"0.4894012",
"0.48886096",
"0.488423",
"0.48818108",
"0.48573124",
"0.48573124",
"0.48573124",
"0.48573124",
"0.48558608",
"0.48549065",
"0.48462647",
"0.48396575",
"0.48388296",
"0.4835283",
"0.4834146",
"0.4818199",
"0.481443",
"0.4811574",
"0.48102835",
"0.48061758",
"0.4803657",
"0.4785697",
"0.47779435",
"0.47768483",
"0.47708827",
"0.47644883",
"0.476362",
"0.47594833",
"0.47592306",
"0.4749929",
"0.47456723",
"0.47411007",
"0.47411007",
"0.47411007",
"0.47411007",
"0.47387737",
"0.47381705"
] |
0.79650456
|
0
|
(boolean) can_modify_scrap_topic? : Return true if current user can modify the scrap
|
def can_modify_scrap_topic?
return (admin? or @scrap_topic.scraps.length == 0 or (logged_in? and @scrap_topic.user_id == current_user.id))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorized_to_modify_task?\n current_user.site_admin? || can_view_all_manuscript_managers_for_journal? || can_view_manuscript_manager_for_paper? ||\n allowed_manuscript_information_task? || metadata_task_collaborator? || allowed_reviewer_task? || task_participant?\n end",
"def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end",
"def has_access_to(cp)\n if can_review(cp) || can_edit(cp) || is_admin\n true\n end\n\n end",
"def update?\n @current_user.permission('Bid', :clerk)\n end",
"def can_moderate_topics?\n can?(:move_topics) || \n can?(:lock_topics) ||\n can?(:merge_topics) ||\n can?(:split_topics) ||\n can?(:sticky_topics)\n end",
"def update?\n @current_user.permission('Ration', :clerk)\n end",
"def can_edit?\n allows_current_user_access_to? :edit\n end",
"def update?\n @current_user.permission('Donor', :clerk)\n end",
"def update?\n @current_user.permission('Fdp', :clerk)\n end",
"def permitted_to_publish?\n @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_subject.current_step.acting_group_index )\n end",
"def edit_scrap_topic\n if can_modify_scrap_topic?\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'edit_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n else\n render_401 and return\n end\n end",
"def check_edit_rights(current_user, sample)\n true if current_user.id == sample.author_id && Time.now - sample.created_at < 3600 && current_user.baned == false\n end",
"def update_scrap_topic\n # Not allowed for now\n render_401 and return\n end",
"def check_permission\n # Check if user is signed in\n signed_in_user\n \n if (params[:topic_id]).nil?\n topic = Post.find(params[:id]).topic\n else\n topic = Topic.find(params[:topic_id])\n end\n\n # Admins have unlimited power\n if !current_user_is_admin?\n # Moderators have unlimited power in their boards\n if !current_user_is_moderator?(topic.board)\n\n # Check that user has the required rank to post in the board\n if !topic.board.required_rank.nil?\n req_rank = Rank.find(topic.board.required_rank)\n unless current_user.rank >= req_rank\n flash[:alert] = \"You do not have the required rank for that board.\" \n redirect_to topic\n return\n end\n end\n\n # Check if the board is unlocked\n if topic.board.locked?\n flash[:alert] = \"That board is currently locked.\"\n redirect_to topic\n return\n end\n\n # Check if the topic is unlocked\n if topic.locked?\n flash[:alert] = \"That topic is currently locked.\" \n redirect_to topic\n return\n end\n end\n end\n end",
"def can_edit_study?(user)\n if self.study.queued_for_deletion?\n return false\n else\n return self.study.can_edit?(user)\n end\n end",
"def action_allowed?\n if %w[edit update list_submissions].include? params[:action]\n current_user_has_admin_privileges? || current_user_teaching_staff_of_assignment?(params[:id])\n else\n current_user_has_ta_privileges?\n end\n end",
"def permitted?\n Article.can_edit?(@user)\n end",
"def can_mod?(user)\n return false if user.nil? # unregistered anonymous folk not allowed to mod a topic\n return true if user.is_admin? # admins are always allowed to mod\n return true if user.is_mod_of? self.forum_id # mods of this forum are allowed to mod\n return false # otherwise, no\n end",
"def can_read_content?(user)\n released_for_student?(user) || can_edit?(user)\n end",
"def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end",
"def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end",
"def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end",
"def can_modify_subject_status?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def can_edit?\n return false unless @document\n can?(:edit, @document.resource)\n end",
"def can_edit?\n return false unless @document\n can?(:edit, @document.resource)\n end",
"def current_user_can_write_to_collection?\n session[:group_id] && current_group.user_has_permission?(current_uid, 'write')\n end",
"def modifiable?(user)\n RetroCM[:ticketing][:author_modifiable][:tickets] == true && self.user == user\n end",
"def permitted?(user)\n Article.can_edit?(user)\n end",
"def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end",
"def custom_permissions_read(_notebook, _user, _use_admin=false)\n true\n end",
"def approve?\n user && user.able_to?(:moderate_any_forum, record.forum)\n end",
"def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end",
"def moderator?\n permissions == 'moderator'\n end",
"def user_can_write(user)\n if (self.writing? or self.rejected?) and (self.user == user or self.book.project.owner == user or user.id == 1) then\n return true\n else\n return false\n end\n end",
"def has_story_edit_privileges?(story)\n has_role_or_above?(:host) || (!story.edit_lock && (is_trusted_member? || [self, Member.nt_bot, Member.nt_anonymous].include?(story.submitted_by_member)))\n end",
"def reseller_allow_read(permission)\n return reseller_right(permission) > 0\n end",
"def check_permissions\n unless can_edit? @post\n flash[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end",
"def can_modify_shops?\n return self.admin_user? || self.vendor_user?\n end",
"def check_permissions\n unless can_edit? @post\n flash.now[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end",
"def can_edit?(user)\n\n end",
"def can_review?\n reviewer? || moderator? || administrator?\n end",
"def can_modify_templates?\n perms.include? Perm.modify_templates\n end",
"def can_edit?\n can_write? && (account_is_owner? || account_is_collaborator?)\n end",
"def can_publish?\n !user.discourse_username.empty?\n end",
"def update?\n @current_user.permission('Department', :clerk)\n end",
"def can_edit_document?(doc = nil)\r\n if self.current_user == self.effective_user\r\n return true\r\n end\r\n\r\n if current_proxy_roles and current_proxy_roles.any?{ |i| [Sys::UserRelation::REL_CANCELARIA, Sys::UserRelation::REL_JUSTICE].include?(i) }\r\n return true\r\n end\r\n\r\n return false\r\n end",
"def can_edit?\n head(:forbidden) unless current_user.review_space_admin? || @space.editable_by?(current_user)\n end",
"def can_modify_templates?\n self.perms.include? Perm.modify_templates\n end",
"def edit_user_permission?(permission)\n edit_user_permission = session.dig(:edit_user, 'permissions')\n return if edit_user_permission.nil?\n\n edit_user_permission.include?(permission)\n end",
"def can_edit?(user)\n Article.can_edit?(user)\n end",
"def check_description_edit_permission!\n okay = true\n\n # Fail completely if they don't even have write permission.\n unless in_admin_mode? || @description.writer?(@user)\n flash_error(:runtime_edit_description_denied.t)\n if in_admin_mode? || @description.is_reader?(@user)\n redirect_to(object_path(@description))\n else\n redirect_to(object_path(@description.parent))\n end\n\n okay = false\n end\n\n filter_illegal_changes\n\n okay\n end",
"def update?\n @current_user.permission('FdpContact', :clerk)\n end",
"def own_topic?(topic)\n topic.read_attribute(:user_id) == self.id\n end",
"def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end",
"def can_edit=(value)\n @can_edit = value\n end",
"def has_edit_permission?\n persisted?\n end",
"def action_allowed?\n case params[:action]\n when 'edit'\n @questionnaire = Questionnaire.find(params[:id])\n current_user_has_admin_privileges? ||\n (current_user_is_a?('Instructor') && current_user_id?(@questionnaire.try(:instructor_id))) ||\n (current_user_is_a?('Teaching Assistant') && session[:user].instructor_id == @questionnaire.try(:instructor_id))\n else\n current_user_has_student_privileges?\n end\n end",
"def check_update_permission\n return if owner? || @article.is_public_editable\n redirect_to articles_url\n end",
"def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end",
"def can_edit?(user)\n user == self.user\n end",
"def can_edit?(user)\n user == current_user\n end",
"def updatable_by?(user)\n user.admin_for?(resource.course)\n end",
"def user_can_edit?\n current_user == @list.user\n end",
"def can_edit?\n object.editable_by?(current_user)\n end",
"def action_allowed?\n current_user_has_student_privileges?\n end",
"def can_access?\n allows_current_user_access_to? :access\n end",
"def can_edit_admin_objects?\n in_role?('admin', 'super-user', 'releng') # pm?\n end",
"def can_edit?(user)\n course.can_edit? user\n end",
"def can_modify_user?(user_id)\n \trole == 'Admin' || id.to_s == user_id.to_s\n \tend",
"def admin_update?\n user.can_modify_templates? && (question.section.phase.template.org_id == user.org_id)\n end",
"def authorized_to_edit?(recipe)\n current_user == recipe.user\n end",
"def can_modify_user?(user_id)\n\t\trole == 'admin' || id.to_s == user_id.to_s\n\tend",
"def can_edit_admin?\n return false unless is_admin? && !is_last_admin?\n true\n end",
"def check_updated_permissions\n\t\tif self.permission_changed?\n\t\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\t\tend\n\tend",
"def mayEdit? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYEDIT ) )\n return true\n end\n end\n end\n return false\n end",
"def sharing?(permission_template:)\n # This short-circuit builds on a stated \"promise\" in the UI of\n # editing an admin set:\n #\n # > Managers of this administrative set can edit the set\n # > metadata, participants, and release and visibility\n # > settings. Managers can also edit work metadata, add to or\n # > remove files from a work, and add new works to the set.\n return true if @current_ability.can?(:manage, permission_template)\n\n # Otherwise, we check if the active workflow allows access grants\n !!permission_template.active_workflow&.allows_access_grant?\n end",
"def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end",
"def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end",
"def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end",
"def can_modify?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end",
"def update?\n @current_user.permission('Commodity', :clerk)\n end",
"def can_edit(user)\n unless user.nil?\n user.admin? || ((user.id == user_id) && (updated_at < 5.minutes.ago)) #TODO add to Configuration class\n else\n false\n end\n end",
"def can_reply_to?(topic) false end",
"def can_read=(value)\n if value\n set_privileges('r', value)\n else\n self.privileges = nil\n end\n end",
"def custom_read_check(user, use_admin=false)\n Revision.custom_permissions_read(self, user, use_admin)\n end",
"def authorized_to_edit?(post)\n post.user == current_user\n end",
"def authorized_to_edit?(post)\n post.user == current_user\n end",
"def can_edit_work?\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"false if single_use_link?=#{single_use_link?}\",\n \"true if current_ability.admin?=#{current_ability.admin?}\",\n \"true if editor?=#{editor?}\",\n \"and workflow_state != 'deposited'=#{workflow_state != 'deposited'}\",\n \"\" ] if WORKS_CONTROLLER_BEHAVIOR_DEBUG_VERBOSE\n return false if single_use_link?\n return true if current_ability.admin?\n return true if editor? && workflow_state != 'deposited'\n false\n end",
"def can_be_modified?\n @record = SavedReport.find_by_id( params[ :id ] )\n return appctrl_not_permitted() unless @record.can_be_modified_by?( @current_user )\n end",
"def can_read?(user)\n (self.user == user) || course.can_edit?(user)\n end",
"def editable_by?(usr)\n if wiki.project &&\n wiki.project.module_enabled?('wiki') &&\n wiki.project.module_enabled?('redmine_advanced_wiki_permissions')\n !protected? || usr.wiki_allowed_to?(self, :protect_wiki_pages)\n else\n !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project)\n end\n end",
"def can_change_read_property?(doc = nil)\r\n self.can_edit_document?(doc)\r\n end",
"def can_edit?(user)\n (self.user == user) || !!(user && user.admin?)\n end",
"def can_edit\n return @can_edit\n end",
"def can_edit?\n return !@energy_usage.approved? || current_user.manager? \n end",
"def can_edit?\n !published_at\n end",
"def can_edit?(user)\n self == user\n end",
"def can_edit?(user)\n self == user\n end",
"def can_edit?(user)\n self == user\n end"
] |
[
"0.686958",
"0.66173726",
"0.6583648",
"0.6569846",
"0.6475908",
"0.6414751",
"0.6406812",
"0.6400748",
"0.63820064",
"0.6372664",
"0.6336224",
"0.63320404",
"0.63004464",
"0.6294726",
"0.62846977",
"0.62694776",
"0.6267185",
"0.62453514",
"0.6241524",
"0.62254846",
"0.62254846",
"0.62188387",
"0.6199786",
"0.6191811",
"0.61911154",
"0.61911154",
"0.6175445",
"0.6166453",
"0.6162826",
"0.615846",
"0.6147842",
"0.61320674",
"0.6121118",
"0.6120711",
"0.61192083",
"0.6118071",
"0.6116979",
"0.61102927",
"0.6110088",
"0.6108924",
"0.61040246",
"0.61023545",
"0.6089474",
"0.60802007",
"0.60748607",
"0.6073792",
"0.6072837",
"0.60676354",
"0.6056307",
"0.60418236",
"0.60371953",
"0.60188305",
"0.6005135",
"0.59997284",
"0.5993643",
"0.599034",
"0.5986427",
"0.59836495",
"0.5978374",
"0.59709793",
"0.59696645",
"0.59693825",
"0.59690994",
"0.59658706",
"0.5958515",
"0.59530175",
"0.59515667",
"0.5950203",
"0.59312904",
"0.59264535",
"0.5921373",
"0.5920102",
"0.5915935",
"0.59096164",
"0.590024",
"0.5897683",
"0.5895199",
"0.5883024",
"0.5882392",
"0.5882392",
"0.5882135",
"0.5881133",
"0.5878164",
"0.587695",
"0.5876233",
"0.58716565",
"0.5866984",
"0.5866984",
"0.58648735",
"0.58469313",
"0.58442193",
"0.58363664",
"0.5836187",
"0.5835533",
"0.5834874",
"0.58336735",
"0.5832278",
"0.58306926",
"0.58306926",
"0.58306926"
] |
0.86594677
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.